@xata.io/client 0.0.0-alpha.vf2043e7 → 0.0.0-alpha.vf221157
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/.eslintrc.cjs +1 -2
- package/CHANGELOG.md +56 -0
- package/dist/index.cjs +493 -203
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +387 -95
- package/dist/index.mjs +488 -204
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/tsconfig.json +1 -0
package/dist/index.d.ts
CHANGED
@@ -19,11 +19,39 @@ declare type ErrorWrapper<TError> = TError | {
|
|
19
19
|
payload: string;
|
20
20
|
};
|
21
21
|
|
22
|
+
interface CacheImpl {
|
23
|
+
cacheRecords: boolean;
|
24
|
+
defaultQueryTTL: number;
|
25
|
+
getAll(): Promise<Record<string, unknown>>;
|
26
|
+
get: <T>(key: string) => Promise<T | null>;
|
27
|
+
set: <T>(key: string, value: T) => Promise<void>;
|
28
|
+
delete: (key: string) => Promise<void>;
|
29
|
+
clear: () => Promise<void>;
|
30
|
+
}
|
31
|
+
interface SimpleCacheOptions {
|
32
|
+
max?: number;
|
33
|
+
cacheRecords?: boolean;
|
34
|
+
defaultQueryTTL?: number;
|
35
|
+
}
|
36
|
+
declare class SimpleCache implements CacheImpl {
|
37
|
+
#private;
|
38
|
+
capacity: number;
|
39
|
+
cacheRecords: boolean;
|
40
|
+
defaultQueryTTL: number;
|
41
|
+
constructor(options?: SimpleCacheOptions);
|
42
|
+
getAll(): Promise<Record<string, unknown>>;
|
43
|
+
get<T>(key: string): Promise<T | null>;
|
44
|
+
set<T>(key: string, value: T): Promise<void>;
|
45
|
+
delete(key: string): Promise<void>;
|
46
|
+
clear(): Promise<void>;
|
47
|
+
}
|
48
|
+
|
22
49
|
declare abstract class XataPlugin {
|
23
50
|
abstract build(options: XataPluginOptions): unknown | Promise<unknown>;
|
24
51
|
}
|
25
52
|
declare type XataPluginOptions = {
|
26
53
|
getFetchProps: () => Promise<FetcherExtraProps>;
|
54
|
+
cache: CacheImpl;
|
27
55
|
};
|
28
56
|
|
29
57
|
/**
|
@@ -110,6 +138,12 @@ declare type ListBranchesResponse = {
|
|
110
138
|
displayName: string;
|
111
139
|
branches: Branch[];
|
112
140
|
};
|
141
|
+
declare type ListGitBranchesResponse = {
|
142
|
+
mapping: {
|
143
|
+
gitBranch: string;
|
144
|
+
xataBranch: string;
|
145
|
+
}[];
|
146
|
+
};
|
113
147
|
declare type Branch = {
|
114
148
|
name: string;
|
115
149
|
createdAt: DateTime;
|
@@ -158,7 +192,7 @@ declare type Table = {
|
|
158
192
|
*/
|
159
193
|
declare type Column = {
|
160
194
|
name: string;
|
161
|
-
type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
|
195
|
+
type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
|
162
196
|
link?: {
|
163
197
|
table: string;
|
164
198
|
};
|
@@ -234,6 +268,17 @@ declare type SortExpression = string[] | {
|
|
234
268
|
[key: string]: SortOrder;
|
235
269
|
}[];
|
236
270
|
declare type SortOrder = 'asc' | 'desc';
|
271
|
+
/**
|
272
|
+
* Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
|
273
|
+
* distance is the number of one charcter changes needed to make two strings equal. The default is 1, meaning that single
|
274
|
+
* character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
|
275
|
+
* to allow two typos in a word.
|
276
|
+
*
|
277
|
+
* @default 1
|
278
|
+
* @maximum 2
|
279
|
+
* @minimum 0
|
280
|
+
*/
|
281
|
+
declare type FuzzinessExpression = number;
|
237
282
|
/**
|
238
283
|
* @minProperties 1
|
239
284
|
*/
|
@@ -354,6 +399,7 @@ type schemas_WorkspaceMembers = WorkspaceMembers;
|
|
354
399
|
type schemas_InviteKey = InviteKey;
|
355
400
|
type schemas_ListDatabasesResponse = ListDatabasesResponse;
|
356
401
|
type schemas_ListBranchesResponse = ListBranchesResponse;
|
402
|
+
type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
|
357
403
|
type schemas_Branch = Branch;
|
358
404
|
type schemas_BranchMetadata = BranchMetadata;
|
359
405
|
type schemas_DBBranch = DBBranch;
|
@@ -374,6 +420,7 @@ type schemas_TableMigration = TableMigration;
|
|
374
420
|
type schemas_ColumnMigration = ColumnMigration;
|
375
421
|
type schemas_SortExpression = SortExpression;
|
376
422
|
type schemas_SortOrder = SortOrder;
|
423
|
+
type schemas_FuzzinessExpression = FuzzinessExpression;
|
377
424
|
type schemas_FilterExpression = FilterExpression;
|
378
425
|
type schemas_FilterList = FilterList;
|
379
426
|
type schemas_FilterColumn = FilterColumn;
|
@@ -406,6 +453,7 @@ declare namespace schemas {
|
|
406
453
|
schemas_InviteKey as InviteKey,
|
407
454
|
schemas_ListDatabasesResponse as ListDatabasesResponse,
|
408
455
|
schemas_ListBranchesResponse as ListBranchesResponse,
|
456
|
+
schemas_ListGitBranchesResponse as ListGitBranchesResponse,
|
409
457
|
schemas_Branch as Branch,
|
410
458
|
schemas_BranchMetadata as BranchMetadata,
|
411
459
|
schemas_DBBranch as DBBranch,
|
@@ -426,6 +474,7 @@ declare namespace schemas {
|
|
426
474
|
schemas_ColumnMigration as ColumnMigration,
|
427
475
|
schemas_SortExpression as SortExpression,
|
428
476
|
schemas_SortOrder as SortOrder,
|
477
|
+
schemas_FuzzinessExpression as FuzzinessExpression,
|
429
478
|
schemas_FilterExpression as FilterExpression,
|
430
479
|
schemas_FilterList as FilterList,
|
431
480
|
schemas_FilterColumn as FilterColumn,
|
@@ -982,6 +1031,163 @@ declare type DeleteDatabaseVariables = {
|
|
982
1031
|
* Delete a database and all of its branches and tables permanently.
|
983
1032
|
*/
|
984
1033
|
declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
|
1034
|
+
declare type GetGitBranchesMappingPathParams = {
|
1035
|
+
dbName: DBName;
|
1036
|
+
workspace: string;
|
1037
|
+
};
|
1038
|
+
declare type GetGitBranchesMappingError = ErrorWrapper<{
|
1039
|
+
status: 400;
|
1040
|
+
payload: BadRequestError;
|
1041
|
+
} | {
|
1042
|
+
status: 401;
|
1043
|
+
payload: AuthError;
|
1044
|
+
}>;
|
1045
|
+
declare type GetGitBranchesMappingVariables = {
|
1046
|
+
pathParams: GetGitBranchesMappingPathParams;
|
1047
|
+
} & FetcherExtraProps;
|
1048
|
+
/**
|
1049
|
+
* Lists all the git branches in the mapping, and their associated Xata branches.
|
1050
|
+
*
|
1051
|
+
* Example response:
|
1052
|
+
*
|
1053
|
+
* ```json
|
1054
|
+
* {
|
1055
|
+
* "mappings": [
|
1056
|
+
* {
|
1057
|
+
* "gitBranch": "main",
|
1058
|
+
* "xataBranch": "main"
|
1059
|
+
* },
|
1060
|
+
* {
|
1061
|
+
* "gitBranch": "gitBranch1",
|
1062
|
+
* "xataBranch": "xataBranch1"
|
1063
|
+
* }
|
1064
|
+
* {
|
1065
|
+
* "gitBranch": "xataBranch2",
|
1066
|
+
* "xataBranch": "xataBranch2"
|
1067
|
+
* }
|
1068
|
+
* ]
|
1069
|
+
* }
|
1070
|
+
* ```
|
1071
|
+
*/
|
1072
|
+
declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
|
1073
|
+
declare type AddGitBranchesEntryPathParams = {
|
1074
|
+
dbName: DBName;
|
1075
|
+
workspace: string;
|
1076
|
+
};
|
1077
|
+
declare type AddGitBranchesEntryError = ErrorWrapper<{
|
1078
|
+
status: 400;
|
1079
|
+
payload: BadRequestError;
|
1080
|
+
} | {
|
1081
|
+
status: 401;
|
1082
|
+
payload: AuthError;
|
1083
|
+
}>;
|
1084
|
+
declare type AddGitBranchesEntryResponse = {
|
1085
|
+
warning?: string;
|
1086
|
+
};
|
1087
|
+
declare type AddGitBranchesEntryRequestBody = {
|
1088
|
+
gitBranch: string;
|
1089
|
+
xataBranch: BranchName;
|
1090
|
+
};
|
1091
|
+
declare type AddGitBranchesEntryVariables = {
|
1092
|
+
body: AddGitBranchesEntryRequestBody;
|
1093
|
+
pathParams: AddGitBranchesEntryPathParams;
|
1094
|
+
} & FetcherExtraProps;
|
1095
|
+
/**
|
1096
|
+
* Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.
|
1097
|
+
*
|
1098
|
+
* If the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.
|
1099
|
+
*
|
1100
|
+
* Example request:
|
1101
|
+
*
|
1102
|
+
* ```json
|
1103
|
+
* // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
|
1104
|
+
* {
|
1105
|
+
* "gitBranch": "fix/bug123",
|
1106
|
+
* "xataBranch": "fix_bug"
|
1107
|
+
* }
|
1108
|
+
* ```
|
1109
|
+
*/
|
1110
|
+
declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
|
1111
|
+
declare type RemoveGitBranchesEntryPathParams = {
|
1112
|
+
dbName: DBName;
|
1113
|
+
workspace: string;
|
1114
|
+
};
|
1115
|
+
declare type RemoveGitBranchesEntryQueryParams = {
|
1116
|
+
gitBranch: string;
|
1117
|
+
};
|
1118
|
+
declare type RemoveGitBranchesEntryError = ErrorWrapper<{
|
1119
|
+
status: 400;
|
1120
|
+
payload: BadRequestError;
|
1121
|
+
} | {
|
1122
|
+
status: 401;
|
1123
|
+
payload: AuthError;
|
1124
|
+
}>;
|
1125
|
+
declare type RemoveGitBranchesEntryVariables = {
|
1126
|
+
pathParams: RemoveGitBranchesEntryPathParams;
|
1127
|
+
queryParams: RemoveGitBranchesEntryQueryParams;
|
1128
|
+
} & FetcherExtraProps;
|
1129
|
+
/**
|
1130
|
+
* Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.
|
1131
|
+
*
|
1132
|
+
* Example request:
|
1133
|
+
*
|
1134
|
+
* ```json
|
1135
|
+
* // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
|
1136
|
+
* ```
|
1137
|
+
*/
|
1138
|
+
declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
|
1139
|
+
declare type ResolveBranchPathParams = {
|
1140
|
+
dbName: DBName;
|
1141
|
+
workspace: string;
|
1142
|
+
};
|
1143
|
+
declare type ResolveBranchQueryParams = {
|
1144
|
+
gitBranch?: string;
|
1145
|
+
fallbackBranch?: string;
|
1146
|
+
};
|
1147
|
+
declare type ResolveBranchError = ErrorWrapper<{
|
1148
|
+
status: 400;
|
1149
|
+
payload: BadRequestError;
|
1150
|
+
} | {
|
1151
|
+
status: 401;
|
1152
|
+
payload: AuthError;
|
1153
|
+
}>;
|
1154
|
+
declare type ResolveBranchResponse = {
|
1155
|
+
branch: string;
|
1156
|
+
reason: {
|
1157
|
+
code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
|
1158
|
+
message: string;
|
1159
|
+
};
|
1160
|
+
};
|
1161
|
+
declare type ResolveBranchVariables = {
|
1162
|
+
pathParams: ResolveBranchPathParams;
|
1163
|
+
queryParams?: ResolveBranchQueryParams;
|
1164
|
+
} & FetcherExtraProps;
|
1165
|
+
/**
|
1166
|
+
* In order to resolve the database branch, the following algorithm is used:
|
1167
|
+
* * if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned
|
1168
|
+
* * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
|
1169
|
+
* * else, if `fallbackBranch` is provided and a branch with that name exists, return it
|
1170
|
+
* * else, return the default branch of the DB (`main` or the first branch)
|
1171
|
+
*
|
1172
|
+
* Example call:
|
1173
|
+
*
|
1174
|
+
* ```json
|
1175
|
+
* // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
|
1176
|
+
* ```
|
1177
|
+
*
|
1178
|
+
* Example response:
|
1179
|
+
*
|
1180
|
+
* ```json
|
1181
|
+
* {
|
1182
|
+
* "branch": "main",
|
1183
|
+
* "reason": {
|
1184
|
+
* "code": "DEFAULT_BRANCH",
|
1185
|
+
* "message": "Default branch for this database (main)"
|
1186
|
+
* }
|
1187
|
+
* }
|
1188
|
+
* ```
|
1189
|
+
*/
|
1190
|
+
declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
|
985
1191
|
declare type GetBranchDetailsPathParams = {
|
986
1192
|
dbBranchName: DBBranchName;
|
987
1193
|
workspace: string;
|
@@ -1266,8 +1472,9 @@ declare type UpdateTableVariables = {
|
|
1266
1472
|
*
|
1267
1473
|
* In the example below, we rename a table from “users” to “people”:
|
1268
1474
|
*
|
1269
|
-
* ```
|
1270
|
-
* PATCH /db/test:main/tables/users
|
1475
|
+
* ```json
|
1476
|
+
* // PATCH /db/test:main/tables/users
|
1477
|
+
*
|
1271
1478
|
* {
|
1272
1479
|
* "name": "people"
|
1273
1480
|
* }
|
@@ -1675,7 +1882,7 @@ declare type QueryTableVariables = {
|
|
1675
1882
|
* {
|
1676
1883
|
* "columns": [...],
|
1677
1884
|
* "filter": {
|
1678
|
-
* "$all": [...]
|
1885
|
+
* "$all": [...],
|
1679
1886
|
* "$any": [...]
|
1680
1887
|
* ...
|
1681
1888
|
* },
|
@@ -1721,7 +1928,11 @@ declare type QueryTableVariables = {
|
|
1721
1928
|
* "link": {
|
1722
1929
|
* "table": "users"
|
1723
1930
|
* }
|
1724
|
-
* }
|
1931
|
+
* },
|
1932
|
+
* {
|
1933
|
+
* "name": "foundedDate",
|
1934
|
+
* "type": "datetime"
|
1935
|
+
* },
|
1725
1936
|
* ]
|
1726
1937
|
* },
|
1727
1938
|
* {
|
@@ -1809,7 +2020,7 @@ declare type QueryTableVariables = {
|
|
1809
2020
|
* {
|
1810
2021
|
* "name": "Kilian",
|
1811
2022
|
* "address": {
|
1812
|
-
* "street": "New street"
|
2023
|
+
* "street": "New street"
|
1813
2024
|
* }
|
1814
2025
|
* }
|
1815
2026
|
* ```
|
@@ -1818,10 +2029,7 @@ declare type QueryTableVariables = {
|
|
1818
2029
|
*
|
1819
2030
|
* ```json
|
1820
2031
|
* {
|
1821
|
-
* "columns": [
|
1822
|
-
* "*",
|
1823
|
-
* "team.name"
|
1824
|
-
* ]
|
2032
|
+
* "columns": ["*", "team.name"]
|
1825
2033
|
* }
|
1826
2034
|
* ```
|
1827
2035
|
*
|
@@ -1839,7 +2047,7 @@ declare type QueryTableVariables = {
|
|
1839
2047
|
* "team": {
|
1840
2048
|
* "id": "XX",
|
1841
2049
|
* "xata": {
|
1842
|
-
* "version": 0
|
2050
|
+
* "version": 0
|
1843
2051
|
* },
|
1844
2052
|
* "name": "first team"
|
1845
2053
|
* }
|
@@ -1850,10 +2058,7 @@ declare type QueryTableVariables = {
|
|
1850
2058
|
*
|
1851
2059
|
* ```json
|
1852
2060
|
* {
|
1853
|
-
* "columns": [
|
1854
|
-
* "*",
|
1855
|
-
* "team.*"
|
1856
|
-
* ]
|
2061
|
+
* "columns": ["*", "team.*"]
|
1857
2062
|
* }
|
1858
2063
|
* ```
|
1859
2064
|
*
|
@@ -1871,10 +2076,11 @@ declare type QueryTableVariables = {
|
|
1871
2076
|
* "team": {
|
1872
2077
|
* "id": "XX",
|
1873
2078
|
* "xata": {
|
1874
|
-
* "version": 0
|
2079
|
+
* "version": 0
|
1875
2080
|
* },
|
1876
2081
|
* "name": "first team",
|
1877
|
-
* "code": "A1"
|
2082
|
+
* "code": "A1",
|
2083
|
+
* "foundedDate": "2020-03-04T10:43:54.32Z"
|
1878
2084
|
* }
|
1879
2085
|
* }
|
1880
2086
|
* ```
|
@@ -1889,7 +2095,7 @@ declare type QueryTableVariables = {
|
|
1889
2095
|
* `$none`, etc.
|
1890
2096
|
*
|
1891
2097
|
* All operators start with an `$` to differentiate them from column names
|
1892
|
-
* (which are not allowed to start with
|
2098
|
+
* (which are not allowed to start with a dollar sign).
|
1893
2099
|
*
|
1894
2100
|
* #### Exact matching and control operators
|
1895
2101
|
*
|
@@ -1920,7 +2126,7 @@ declare type QueryTableVariables = {
|
|
1920
2126
|
* ```json
|
1921
2127
|
* {
|
1922
2128
|
* "filter": {
|
1923
|
-
*
|
2129
|
+
* "name": "r2"
|
1924
2130
|
* }
|
1925
2131
|
* }
|
1926
2132
|
* ```
|
@@ -1942,7 +2148,7 @@ declare type QueryTableVariables = {
|
|
1942
2148
|
* ```json
|
1943
2149
|
* {
|
1944
2150
|
* "filter": {
|
1945
|
-
*
|
2151
|
+
* "settings.plan": "free"
|
1946
2152
|
* }
|
1947
2153
|
* }
|
1948
2154
|
* ```
|
@@ -1952,8 +2158,8 @@ declare type QueryTableVariables = {
|
|
1952
2158
|
* "filter": {
|
1953
2159
|
* "settings": {
|
1954
2160
|
* "plan": "free"
|
1955
|
-
* }
|
1956
|
-
* }
|
2161
|
+
* }
|
2162
|
+
* }
|
1957
2163
|
* }
|
1958
2164
|
* ```
|
1959
2165
|
*
|
@@ -1962,8 +2168,8 @@ declare type QueryTableVariables = {
|
|
1962
2168
|
* ```json
|
1963
2169
|
* {
|
1964
2170
|
* "filter": {
|
1965
|
-
* "settings.plan": {"$any": ["free", "paid"]}
|
1966
|
-
* }
|
2171
|
+
* "settings.plan": { "$any": ["free", "paid"] }
|
2172
|
+
* }
|
1967
2173
|
* }
|
1968
2174
|
* ```
|
1969
2175
|
*
|
@@ -1972,9 +2178,9 @@ declare type QueryTableVariables = {
|
|
1972
2178
|
* ```json
|
1973
2179
|
* {
|
1974
2180
|
* "filter": {
|
1975
|
-
*
|
1976
|
-
*
|
1977
|
-
* }
|
2181
|
+
* "settings.dark": true,
|
2182
|
+
* "settings.plan": "free"
|
2183
|
+
* }
|
1978
2184
|
* }
|
1979
2185
|
* ```
|
1980
2186
|
*
|
@@ -1985,11 +2191,11 @@ declare type QueryTableVariables = {
|
|
1985
2191
|
* ```json
|
1986
2192
|
* {
|
1987
2193
|
* "filter": {
|
1988
|
-
*
|
1989
|
-
*
|
1990
|
-
*
|
1991
|
-
*
|
1992
|
-
* }
|
2194
|
+
* "$any": {
|
2195
|
+
* "settings.dark": true,
|
2196
|
+
* "settings.plan": "free"
|
2197
|
+
* }
|
2198
|
+
* }
|
1993
2199
|
* }
|
1994
2200
|
* ```
|
1995
2201
|
*
|
@@ -2000,10 +2206,10 @@ declare type QueryTableVariables = {
|
|
2000
2206
|
* "filter": {
|
2001
2207
|
* "$any": [
|
2002
2208
|
* {
|
2003
|
-
* "name": "r1"
|
2209
|
+
* "name": "r1"
|
2004
2210
|
* },
|
2005
2211
|
* {
|
2006
|
-
* "name": "r2"
|
2212
|
+
* "name": "r2"
|
2007
2213
|
* }
|
2008
2214
|
* ]
|
2009
2215
|
* }
|
@@ -2015,7 +2221,7 @@ declare type QueryTableVariables = {
|
|
2015
2221
|
* ```json
|
2016
2222
|
* {
|
2017
2223
|
* "filter": {
|
2018
|
-
* "$exists": "settings"
|
2224
|
+
* "$exists": "settings"
|
2019
2225
|
* }
|
2020
2226
|
* }
|
2021
2227
|
* ```
|
@@ -2027,10 +2233,10 @@ declare type QueryTableVariables = {
|
|
2027
2233
|
* "filter": {
|
2028
2234
|
* "$all": [
|
2029
2235
|
* {
|
2030
|
-
* "$exists": "settings"
|
2236
|
+
* "$exists": "settings"
|
2031
2237
|
* },
|
2032
2238
|
* {
|
2033
|
-
* "$exists": "name"
|
2239
|
+
* "$exists": "name"
|
2034
2240
|
* }
|
2035
2241
|
* ]
|
2036
2242
|
* }
|
@@ -2042,7 +2248,7 @@ declare type QueryTableVariables = {
|
|
2042
2248
|
* ```json
|
2043
2249
|
* {
|
2044
2250
|
* "filter": {
|
2045
|
-
* "$notExists": "settings"
|
2251
|
+
* "$notExists": "settings"
|
2046
2252
|
* }
|
2047
2253
|
* }
|
2048
2254
|
* ```
|
@@ -2069,43 +2275,59 @@ declare type QueryTableVariables = {
|
|
2069
2275
|
* {
|
2070
2276
|
* "filter": {
|
2071
2277
|
* "<column_name>": {
|
2072
|
-
*
|
2278
|
+
* "$pattern": "v*alu?"
|
2073
2279
|
* }
|
2074
2280
|
* }
|
2075
2281
|
* }
|
2076
2282
|
* ```
|
2077
2283
|
*
|
2284
|
+
* The `$pattern` operator accepts two wildcard characters:
|
2285
|
+
* * `*` matches zero or more characters
|
2286
|
+
* * `?` matches exactly one character
|
2287
|
+
*
|
2288
|
+
* If you want to match a string that contains a wildcard character, you can escape them using a backslash (`\`). You can escape a backslash by usign another backslash.
|
2289
|
+
*
|
2078
2290
|
* We could also have `$endsWith` and `$startsWith` operators:
|
2079
2291
|
*
|
2080
2292
|
* ```json
|
2081
2293
|
* {
|
2082
2294
|
* "filter": {
|
2083
2295
|
* "<column_name>": {
|
2084
|
-
*
|
2296
|
+
* "$endsWith": ".gz"
|
2085
2297
|
* },
|
2086
2298
|
* "<column_name>": {
|
2087
|
-
*
|
2299
|
+
* "$startsWith": "tmp-"
|
2088
2300
|
* }
|
2089
2301
|
* }
|
2090
2302
|
* }
|
2091
2303
|
* ```
|
2092
2304
|
*
|
2093
|
-
* #### Numeric ranges
|
2305
|
+
* #### Numeric or datetime ranges
|
2094
2306
|
*
|
2095
2307
|
* ```json
|
2096
2308
|
* {
|
2097
2309
|
* "filter": {
|
2098
|
-
*
|
2099
|
-
*
|
2100
|
-
*
|
2101
|
-
*
|
2310
|
+
* "<column_name>": {
|
2311
|
+
* "$ge": 0,
|
2312
|
+
* "$lt": 100
|
2313
|
+
* }
|
2314
|
+
* }
|
2315
|
+
* }
|
2316
|
+
* ```
|
2317
|
+
* Date ranges support the same operators, with the date using the format defined in
|
2318
|
+
* [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
|
2319
|
+
* ```json
|
2320
|
+
* {
|
2321
|
+
* "filter": {
|
2322
|
+
* "<column_name>": {
|
2323
|
+
* "$gt": "2019-10-12T07:20:50.52Z",
|
2324
|
+
* "$lt": "2021-10-12T07:20:50.52Z"
|
2325
|
+
* }
|
2102
2326
|
* }
|
2103
2327
|
* }
|
2104
2328
|
* ```
|
2105
|
-
*
|
2106
2329
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
2107
2330
|
*
|
2108
|
-
*
|
2109
2331
|
* #### Negations
|
2110
2332
|
*
|
2111
2333
|
* A general `$not` operator can inverse any operation.
|
@@ -2130,15 +2352,21 @@ declare type QueryTableVariables = {
|
|
2130
2352
|
* {
|
2131
2353
|
* "filter": {
|
2132
2354
|
* "$not": {
|
2133
|
-
* "$any": [
|
2134
|
-
*
|
2135
|
-
*
|
2136
|
-
*
|
2137
|
-
*
|
2138
|
-
*
|
2139
|
-
*
|
2140
|
-
*
|
2141
|
-
*
|
2355
|
+
* "$any": [
|
2356
|
+
* {
|
2357
|
+
* "<column_name1>": "value1"
|
2358
|
+
* },
|
2359
|
+
* {
|
2360
|
+
* "$all": [
|
2361
|
+
* {
|
2362
|
+
* "<column_name2>": "value2"
|
2363
|
+
* },
|
2364
|
+
* {
|
2365
|
+
* "<column_name3>": "value3"
|
2366
|
+
* }
|
2367
|
+
* ]
|
2368
|
+
* }
|
2369
|
+
* ]
|
2142
2370
|
* }
|
2143
2371
|
* }
|
2144
2372
|
* }
|
@@ -2193,8 +2421,8 @@ declare type QueryTableVariables = {
|
|
2193
2421
|
* "<array name>": {
|
2194
2422
|
* "$includes": {
|
2195
2423
|
* "$all": [
|
2196
|
-
* {"$contains": "label"},
|
2197
|
-
* {"$not": {"$endsWith": "-debug"}}
|
2424
|
+
* { "$contains": "label" },
|
2425
|
+
* { "$not": { "$endsWith": "-debug" } }
|
2198
2426
|
* ]
|
2199
2427
|
* }
|
2200
2428
|
* }
|
@@ -2214,9 +2442,7 @@ declare type QueryTableVariables = {
|
|
2214
2442
|
* {
|
2215
2443
|
* "filter": {
|
2216
2444
|
* "settings.labels": {
|
2217
|
-
* "$includesAll": [
|
2218
|
-
* {"$contains": "label"},
|
2219
|
-
* ]
|
2445
|
+
* "$includesAll": [{ "$contains": "label" }]
|
2220
2446
|
* }
|
2221
2447
|
* }
|
2222
2448
|
* }
|
@@ -2264,7 +2490,6 @@ declare type QueryTableVariables = {
|
|
2264
2490
|
* }
|
2265
2491
|
* ```
|
2266
2492
|
*
|
2267
|
-
*
|
2268
2493
|
* ### Pagination
|
2269
2494
|
*
|
2270
2495
|
* We offer cursor pagination and offset pagination. The offset pagination is limited
|
@@ -2330,8 +2555,8 @@ declare type QueryTableVariables = {
|
|
2330
2555
|
* can be queried by update `page.after` to the returned cursor while keeping the
|
2331
2556
|
* `page.before` cursor from the first range query.
|
2332
2557
|
*
|
2333
|
-
* The `filter` , `columns`,
|
2334
|
-
* encoded with the cursor.
|
2558
|
+
* The `filter` , `columns`, `sort` , and `page.size` configuration will be
|
2559
|
+
* encoded with the cursor. The pagination request will be invalid if
|
2335
2560
|
* `filter` or `sort` is set. The columns returned and page size can be changed
|
2336
2561
|
* anytime by passing the `columns` or `page.size` settings to the next query.
|
2337
2562
|
*
|
@@ -2368,6 +2593,38 @@ declare type QueryTableVariables = {
|
|
2368
2593
|
* ```
|
2369
2594
|
*/
|
2370
2595
|
declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
|
2596
|
+
declare type SearchTablePathParams = {
|
2597
|
+
dbBranchName: DBBranchName;
|
2598
|
+
tableName: TableName;
|
2599
|
+
workspace: string;
|
2600
|
+
};
|
2601
|
+
declare type SearchTableError = ErrorWrapper<{
|
2602
|
+
status: 400;
|
2603
|
+
payload: BadRequestError;
|
2604
|
+
} | {
|
2605
|
+
status: 401;
|
2606
|
+
payload: AuthError;
|
2607
|
+
} | {
|
2608
|
+
status: 404;
|
2609
|
+
payload: SimpleError;
|
2610
|
+
}>;
|
2611
|
+
declare type SearchTableRequestBody = {
|
2612
|
+
query: string;
|
2613
|
+
fuzziness?: FuzzinessExpression;
|
2614
|
+
filter?: FilterExpression;
|
2615
|
+
};
|
2616
|
+
declare type SearchTableVariables = {
|
2617
|
+
body: SearchTableRequestBody;
|
2618
|
+
pathParams: SearchTablePathParams;
|
2619
|
+
} & FetcherExtraProps;
|
2620
|
+
/**
|
2621
|
+
* Run a free text search operation in a particular table.
|
2622
|
+
*
|
2623
|
+
* The endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:
|
2624
|
+
* * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
|
2625
|
+
* * filtering on columns of type `multiple` is currently unsupported
|
2626
|
+
*/
|
2627
|
+
declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
|
2371
2628
|
declare type SearchBranchPathParams = {
|
2372
2629
|
dbBranchName: DBBranchName;
|
2373
2630
|
workspace: string;
|
@@ -2385,7 +2642,7 @@ declare type SearchBranchError = ErrorWrapper<{
|
|
2385
2642
|
declare type SearchBranchRequestBody = {
|
2386
2643
|
tables?: string[];
|
2387
2644
|
query: string;
|
2388
|
-
fuzziness?:
|
2645
|
+
fuzziness?: FuzzinessExpression;
|
2389
2646
|
};
|
2390
2647
|
declare type SearchBranchVariables = {
|
2391
2648
|
body: SearchBranchRequestBody;
|
@@ -2422,6 +2679,10 @@ declare const operationsByTag: {
|
|
2422
2679
|
getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
|
2423
2680
|
createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
|
2424
2681
|
deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
|
2682
|
+
getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
|
2683
|
+
addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
|
2684
|
+
removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
|
2685
|
+
resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
|
2425
2686
|
};
|
2426
2687
|
branch: {
|
2427
2688
|
getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
|
@@ -2456,6 +2717,7 @@ declare const operationsByTag: {
|
|
2456
2717
|
getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
|
2457
2718
|
bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
|
2458
2719
|
queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
|
2720
|
+
searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
|
2459
2721
|
searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
|
2460
2722
|
};
|
2461
2723
|
};
|
@@ -2472,6 +2734,9 @@ interface XataApiClientOptions {
|
|
2472
2734
|
apiKey?: string;
|
2473
2735
|
host?: HostProvider;
|
2474
2736
|
}
|
2737
|
+
/**
|
2738
|
+
* @deprecated Use XataApiPlugin instead
|
2739
|
+
*/
|
2475
2740
|
declare class XataApiClient {
|
2476
2741
|
#private;
|
2477
2742
|
constructor(options?: XataApiClientOptions);
|
@@ -2514,6 +2779,10 @@ declare class DatabaseApi {
|
|
2514
2779
|
getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
|
2515
2780
|
createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
|
2516
2781
|
deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
|
2782
|
+
getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
|
2783
|
+
addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
|
2784
|
+
removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
|
2785
|
+
resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<ResolveBranchResponse>;
|
2517
2786
|
}
|
2518
2787
|
declare class BranchApi {
|
2519
2788
|
private extraProps;
|
@@ -2554,6 +2823,7 @@ declare class RecordsApi {
|
|
2554
2823
|
getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
|
2555
2824
|
bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
|
2556
2825
|
queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
|
2826
|
+
searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
|
2557
2827
|
searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
|
2558
2828
|
}
|
2559
2829
|
|
@@ -2575,7 +2845,7 @@ declare type RequiredBy<T, K extends keyof T> = T & {
|
|
2575
2845
|
};
|
2576
2846
|
declare type GetArrayInnerType<T extends readonly any[]> = T[number];
|
2577
2847
|
declare type SingleOrArray<T> = T | T[];
|
2578
|
-
declare type
|
2848
|
+
declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
|
2579
2849
|
|
2580
2850
|
declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
|
2581
2851
|
declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
|
@@ -2770,12 +3040,21 @@ declare type SortFilterBase<T extends XataRecord> = {
|
|
2770
3040
|
[Key in StringKeys<T>]: SortDirection;
|
2771
3041
|
};
|
2772
3042
|
|
2773
|
-
declare type
|
2774
|
-
page?: PaginationOptions;
|
3043
|
+
declare type BaseOptions<T extends XataRecord> = {
|
2775
3044
|
columns?: NonEmptyArray<SelectableColumn<T>>;
|
3045
|
+
cache?: number;
|
3046
|
+
};
|
3047
|
+
declare type CursorQueryOptions = {
|
3048
|
+
pagination?: CursorNavigationOptions & OffsetNavigationOptions;
|
3049
|
+
filter?: never;
|
3050
|
+
sort?: never;
|
3051
|
+
};
|
3052
|
+
declare type OffsetQueryOptions<T extends XataRecord> = {
|
3053
|
+
pagination?: OffsetNavigationOptions;
|
2776
3054
|
filter?: FilterExpression;
|
2777
3055
|
sort?: SortFilter<T> | SortFilter<T>[];
|
2778
3056
|
};
|
3057
|
+
declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
|
2779
3058
|
/**
|
2780
3059
|
* Query objects contain the information of all filters, sorting, etc. to be included in the database query.
|
2781
3060
|
*
|
@@ -2788,6 +3067,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2788
3067
|
readonly records: Result[];
|
2789
3068
|
constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
|
2790
3069
|
getQueryOptions(): QueryOptions<Record>;
|
3070
|
+
key(): string;
|
2791
3071
|
/**
|
2792
3072
|
* Builds a new query object representing a logical OR between the given subqueries.
|
2793
3073
|
* @param queries An array of subqueries.
|
@@ -2843,19 +3123,23 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2843
3123
|
*/
|
2844
3124
|
select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
|
2845
3125
|
getPaginated(): Promise<Page<Record, Result>>;
|
2846
|
-
getPaginated(options:
|
3126
|
+
getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
|
2847
3127
|
getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
|
2848
3128
|
[Symbol.asyncIterator](): AsyncIterableIterator<Result>;
|
2849
|
-
getIterator(
|
2850
|
-
getIterator(
|
2851
|
-
|
3129
|
+
getIterator(): AsyncGenerator<Result[]>;
|
3130
|
+
getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
|
3131
|
+
batchSize?: number;
|
3132
|
+
}): AsyncGenerator<Result[]>;
|
3133
|
+
getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
|
3134
|
+
batchSize?: number;
|
3135
|
+
}>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
|
2852
3136
|
/**
|
2853
3137
|
* Performs the query in the database and returns a set of results.
|
2854
3138
|
* @param options Additional options to be used when performing the query.
|
2855
3139
|
* @returns An array of records from the database.
|
2856
3140
|
*/
|
2857
3141
|
getMany(): Promise<Result[]>;
|
2858
|
-
getMany(options:
|
3142
|
+
getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
|
2859
3143
|
getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
|
2860
3144
|
/**
|
2861
3145
|
* Performs the query in the database and returns all the results.
|
@@ -2863,17 +3147,27 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2863
3147
|
* @param options Additional options to be used when performing the query.
|
2864
3148
|
* @returns An array of records from the database.
|
2865
3149
|
*/
|
2866
|
-
getAll(
|
2867
|
-
getAll(
|
2868
|
-
|
3150
|
+
getAll(): Promise<Result[]>;
|
3151
|
+
getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
|
3152
|
+
batchSize?: number;
|
3153
|
+
}): Promise<Result[]>;
|
3154
|
+
getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
|
3155
|
+
batchSize?: number;
|
3156
|
+
}>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
|
2869
3157
|
/**
|
2870
3158
|
* Performs the query in the database and returns the first result.
|
2871
3159
|
* @param options Additional options to be used when performing the query.
|
2872
3160
|
* @returns The first record that matches the query, or null if no record matched the query.
|
2873
3161
|
*/
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
3162
|
+
getFirst(): Promise<Result | null>;
|
3163
|
+
getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
|
3164
|
+
getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
|
3165
|
+
/**
|
3166
|
+
* Builds a new query object adding a cache TTL in milliseconds.
|
3167
|
+
* @param ttl The cache TTL in milliseconds.
|
3168
|
+
* @returns A new Query object.
|
3169
|
+
*/
|
3170
|
+
cache(ttl: number): Query<Record, Result>;
|
2877
3171
|
nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
2878
3172
|
previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
2879
3173
|
firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
@@ -2957,14 +3251,11 @@ declare type OffsetNavigationOptions = {
|
|
2957
3251
|
size?: number;
|
2958
3252
|
offset?: number;
|
2959
3253
|
};
|
2960
|
-
declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
|
2961
3254
|
declare const PAGINATION_MAX_SIZE = 200;
|
2962
3255
|
declare const PAGINATION_DEFAULT_SIZE = 200;
|
2963
3256
|
declare const PAGINATION_MAX_OFFSET = 800;
|
2964
3257
|
declare const PAGINATION_DEFAULT_OFFSET = 0;
|
2965
3258
|
|
2966
|
-
declare type TableLink = string[];
|
2967
|
-
declare type LinkDictionary = Dictionary<TableLink[]>;
|
2968
3259
|
/**
|
2969
3260
|
* Common interface for performing operations on a table.
|
2970
3261
|
*/
|
@@ -3062,6 +3353,7 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3062
3353
|
*/
|
3063
3354
|
abstract search(query: string, options?: {
|
3064
3355
|
fuzziness?: number;
|
3356
|
+
filter?: Filter<Record>;
|
3065
3357
|
}): Promise<SelectedPick<Record, ['*']>[]>;
|
3066
3358
|
abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
|
3067
3359
|
}
|
@@ -3070,9 +3362,8 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
|
|
3070
3362
|
db: SchemaPluginResult<any>;
|
3071
3363
|
constructor(options: {
|
3072
3364
|
table: string;
|
3073
|
-
links?: LinkDictionary;
|
3074
|
-
getFetchProps: () => Promise<FetcherExtraProps>;
|
3075
3365
|
db: SchemaPluginResult<any>;
|
3366
|
+
pluginOptions: XataPluginOptions;
|
3076
3367
|
});
|
3077
3368
|
create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3078
3369
|
create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
@@ -3084,9 +3375,10 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
|
|
3084
3375
|
createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3085
3376
|
createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3086
3377
|
createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
|
3087
|
-
delete(
|
3378
|
+
delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
|
3088
3379
|
search(query: string, options?: {
|
3089
3380
|
fuzziness?: number;
|
3381
|
+
filter?: Filter<Record>;
|
3090
3382
|
}): Promise<SelectedPick<Record, ['*']>[]>;
|
3091
3383
|
query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
|
3092
3384
|
}
|
@@ -3166,17 +3458,17 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
|
|
3166
3458
|
|
3167
3459
|
declare type SchemaDefinition = {
|
3168
3460
|
table: string;
|
3169
|
-
links?: LinkDictionary;
|
3170
3461
|
};
|
3171
3462
|
declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
|
3172
3463
|
[Key in keyof Schemas]: Repository<Schemas[Key]>;
|
3464
|
+
} & {
|
3465
|
+
[key: string]: Repository<XataRecord$1>;
|
3173
3466
|
};
|
3174
3467
|
declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
3175
3468
|
#private;
|
3176
|
-
private links?;
|
3177
3469
|
private tableNames?;
|
3178
|
-
constructor(
|
3179
|
-
build(
|
3470
|
+
constructor(tableNames?: string[] | undefined);
|
3471
|
+
build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
|
3180
3472
|
}
|
3181
3473
|
|
3182
3474
|
declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
|
@@ -3197,8 +3489,7 @@ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
|
|
3197
3489
|
declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
3198
3490
|
#private;
|
3199
3491
|
private db;
|
3200
|
-
|
3201
|
-
constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
|
3492
|
+
constructor(db: SchemaPluginResult<Schemas>);
|
3202
3493
|
build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
|
3203
3494
|
}
|
3204
3495
|
declare type SearchXataRecord = XataRecord & {
|
@@ -3217,10 +3508,11 @@ declare type BaseClientOptions = {
|
|
3217
3508
|
apiKey?: string;
|
3218
3509
|
databaseURL?: string;
|
3219
3510
|
branch?: BranchStrategyOption;
|
3511
|
+
cache?: CacheImpl;
|
3220
3512
|
};
|
3221
3513
|
declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
|
3222
3514
|
interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
|
3223
|
-
new <Schemas extends Record<string, BaseData
|
3515
|
+
new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
|
3224
3516
|
db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
|
3225
3517
|
search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
|
3226
3518
|
}, keyof Plugins> & {
|
@@ -3236,7 +3528,7 @@ declare type BranchResolutionOptions = {
|
|
3236
3528
|
apiKey?: string;
|
3237
3529
|
fetchImpl?: FetchImpl;
|
3238
3530
|
};
|
3239
|
-
declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string
|
3531
|
+
declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string>;
|
3240
3532
|
declare function getCurrentBranchDetails(options?: BranchResolutionOptions): Promise<DBBranch | null>;
|
3241
3533
|
declare function getDatabaseURL(): string | undefined;
|
3242
3534
|
|
@@ -3247,4 +3539,4 @@ declare class XataError extends Error {
|
|
3247
3539
|
constructor(message: string, status: number);
|
3248
3540
|
}
|
3249
3541
|
|
3250
|
-
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables,
|
3542
|
+
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
|