@xata.io/client 0.0.0-alpha.vf2043e7 → 0.0.0-alpha.vf350c0a
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 +16 -0
- package/dist/index.cjs +428 -163
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +247 -24
- package/dist/index.mjs +424 -164
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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
|
};
|
@@ -354,6 +388,7 @@ type schemas_WorkspaceMembers = WorkspaceMembers;
|
|
354
388
|
type schemas_InviteKey = InviteKey;
|
355
389
|
type schemas_ListDatabasesResponse = ListDatabasesResponse;
|
356
390
|
type schemas_ListBranchesResponse = ListBranchesResponse;
|
391
|
+
type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
|
357
392
|
type schemas_Branch = Branch;
|
358
393
|
type schemas_BranchMetadata = BranchMetadata;
|
359
394
|
type schemas_DBBranch = DBBranch;
|
@@ -406,6 +441,7 @@ declare namespace schemas {
|
|
406
441
|
schemas_InviteKey as InviteKey,
|
407
442
|
schemas_ListDatabasesResponse as ListDatabasesResponse,
|
408
443
|
schemas_ListBranchesResponse as ListBranchesResponse,
|
444
|
+
schemas_ListGitBranchesResponse as ListGitBranchesResponse,
|
409
445
|
schemas_Branch as Branch,
|
410
446
|
schemas_BranchMetadata as BranchMetadata,
|
411
447
|
schemas_DBBranch as DBBranch,
|
@@ -982,6 +1018,162 @@ declare type DeleteDatabaseVariables = {
|
|
982
1018
|
* Delete a database and all of its branches and tables permanently.
|
983
1019
|
*/
|
984
1020
|
declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
|
1021
|
+
declare type GetGitBranchesMappingPathParams = {
|
1022
|
+
dbName: DBName;
|
1023
|
+
workspace: string;
|
1024
|
+
};
|
1025
|
+
declare type GetGitBranchesMappingError = ErrorWrapper<{
|
1026
|
+
status: 400;
|
1027
|
+
payload: BadRequestError;
|
1028
|
+
} | {
|
1029
|
+
status: 401;
|
1030
|
+
payload: AuthError;
|
1031
|
+
}>;
|
1032
|
+
declare type GetGitBranchesMappingVariables = {
|
1033
|
+
pathParams: GetGitBranchesMappingPathParams;
|
1034
|
+
} & FetcherExtraProps;
|
1035
|
+
/**
|
1036
|
+
* Lists all the git branches in the mapping, and their associated Xata branches.
|
1037
|
+
*
|
1038
|
+
* Example response:
|
1039
|
+
*
|
1040
|
+
* ```json
|
1041
|
+
* {
|
1042
|
+
* "mappings": [
|
1043
|
+
* {
|
1044
|
+
* "gitBranch": "main",
|
1045
|
+
* "xataBranch": "main"
|
1046
|
+
* },
|
1047
|
+
* {
|
1048
|
+
* "gitBranch": "gitBranch1",
|
1049
|
+
* "xataBranch": "xataBranch1"
|
1050
|
+
* }
|
1051
|
+
* {
|
1052
|
+
* "gitBranch": "xataBranch2",
|
1053
|
+
* "xataBranch": "xataBranch2"
|
1054
|
+
* }
|
1055
|
+
* ]
|
1056
|
+
* }
|
1057
|
+
* ```
|
1058
|
+
*/
|
1059
|
+
declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
|
1060
|
+
declare type AddGitBranchesEntryPathParams = {
|
1061
|
+
dbName: DBName;
|
1062
|
+
workspace: string;
|
1063
|
+
};
|
1064
|
+
declare type AddGitBranchesEntryError = ErrorWrapper<{
|
1065
|
+
status: 400;
|
1066
|
+
payload: BadRequestError;
|
1067
|
+
} | {
|
1068
|
+
status: 401;
|
1069
|
+
payload: AuthError;
|
1070
|
+
}>;
|
1071
|
+
declare type AddGitBranchesEntryResponse = {
|
1072
|
+
warning?: string;
|
1073
|
+
};
|
1074
|
+
declare type AddGitBranchesEntryRequestBody = {
|
1075
|
+
gitBranch: string;
|
1076
|
+
xataBranch: BranchName;
|
1077
|
+
};
|
1078
|
+
declare type AddGitBranchesEntryVariables = {
|
1079
|
+
body: AddGitBranchesEntryRequestBody;
|
1080
|
+
pathParams: AddGitBranchesEntryPathParams;
|
1081
|
+
} & FetcherExtraProps;
|
1082
|
+
/**
|
1083
|
+
* 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.
|
1084
|
+
*
|
1085
|
+
* 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.
|
1086
|
+
*
|
1087
|
+
* Example request:
|
1088
|
+
*
|
1089
|
+
* ```json
|
1090
|
+
* // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
|
1091
|
+
* {
|
1092
|
+
* "gitBranch": "fix/bug123",
|
1093
|
+
* "xataBranch": "fix_bug"
|
1094
|
+
* }
|
1095
|
+
* ```
|
1096
|
+
*/
|
1097
|
+
declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
|
1098
|
+
declare type RemoveGitBranchesEntryPathParams = {
|
1099
|
+
dbName: DBName;
|
1100
|
+
workspace: string;
|
1101
|
+
};
|
1102
|
+
declare type RemoveGitBranchesEntryQueryParams = {
|
1103
|
+
gitBranch: string;
|
1104
|
+
};
|
1105
|
+
declare type RemoveGitBranchesEntryError = ErrorWrapper<{
|
1106
|
+
status: 400;
|
1107
|
+
payload: BadRequestError;
|
1108
|
+
} | {
|
1109
|
+
status: 401;
|
1110
|
+
payload: AuthError;
|
1111
|
+
}>;
|
1112
|
+
declare type RemoveGitBranchesEntryVariables = {
|
1113
|
+
pathParams: RemoveGitBranchesEntryPathParams;
|
1114
|
+
queryParams: RemoveGitBranchesEntryQueryParams;
|
1115
|
+
} & FetcherExtraProps;
|
1116
|
+
/**
|
1117
|
+
* 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.
|
1118
|
+
*
|
1119
|
+
* Example request:
|
1120
|
+
*
|
1121
|
+
* ```json
|
1122
|
+
* // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
|
1123
|
+
* ```
|
1124
|
+
*/
|
1125
|
+
declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
|
1126
|
+
declare type ResolveBranchPathParams = {
|
1127
|
+
dbName: DBName;
|
1128
|
+
workspace: string;
|
1129
|
+
};
|
1130
|
+
declare type ResolveBranchQueryParams = {
|
1131
|
+
gitBranch?: string;
|
1132
|
+
fallbackBranch?: string;
|
1133
|
+
};
|
1134
|
+
declare type ResolveBranchError = ErrorWrapper<{
|
1135
|
+
status: 400;
|
1136
|
+
payload: BadRequestError;
|
1137
|
+
} | {
|
1138
|
+
status: 401;
|
1139
|
+
payload: AuthError;
|
1140
|
+
}>;
|
1141
|
+
declare type ResolveBranchResponse = {
|
1142
|
+
branch: string;
|
1143
|
+
reason: {
|
1144
|
+
code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
|
1145
|
+
message: string;
|
1146
|
+
};
|
1147
|
+
};
|
1148
|
+
declare type ResolveBranchVariables = {
|
1149
|
+
pathParams: ResolveBranchPathParams;
|
1150
|
+
queryParams?: ResolveBranchQueryParams;
|
1151
|
+
} & FetcherExtraProps;
|
1152
|
+
/**
|
1153
|
+
* In order to resolve the database branch, the following algorithm is used:
|
1154
|
+
* * if the `gitBranch` is found in the [git branches mapping](), the associated Xata branch is returned
|
1155
|
+
* * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
|
1156
|
+
* * else, return the default branch of the DB (currently `main` or the first branch)
|
1157
|
+
*
|
1158
|
+
* Example call:
|
1159
|
+
*
|
1160
|
+
* ```json
|
1161
|
+
* // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test?fallbackBranch=tsg
|
1162
|
+
* ```
|
1163
|
+
*
|
1164
|
+
* Example response:
|
1165
|
+
*
|
1166
|
+
* ```json
|
1167
|
+
* {
|
1168
|
+
* "branch": "main",
|
1169
|
+
* "reason": {
|
1170
|
+
* "code": "DEFAULT_BRANCH",
|
1171
|
+
* "message": "Default branch for this database (main)"
|
1172
|
+
* }
|
1173
|
+
* }
|
1174
|
+
* ```
|
1175
|
+
*/
|
1176
|
+
declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
|
985
1177
|
declare type GetBranchDetailsPathParams = {
|
986
1178
|
dbBranchName: DBBranchName;
|
987
1179
|
workspace: string;
|
@@ -1721,7 +1913,11 @@ declare type QueryTableVariables = {
|
|
1721
1913
|
* "link": {
|
1722
1914
|
* "table": "users"
|
1723
1915
|
* }
|
1724
|
-
* }
|
1916
|
+
* },
|
1917
|
+
* {
|
1918
|
+
* "name": "foundedDate",
|
1919
|
+
* "type": "datetime"
|
1920
|
+
* },
|
1725
1921
|
* ]
|
1726
1922
|
* },
|
1727
1923
|
* {
|
@@ -1874,7 +2070,8 @@ declare type QueryTableVariables = {
|
|
1874
2070
|
* "version": 0,
|
1875
2071
|
* },
|
1876
2072
|
* "name": "first team",
|
1877
|
-
* "code": "A1"
|
2073
|
+
* "code": "A1",
|
2074
|
+
* "foundedDate": "2020-03-04T10:43:54.32Z"
|
1878
2075
|
* }
|
1879
2076
|
* }
|
1880
2077
|
* ```
|
@@ -1889,7 +2086,7 @@ declare type QueryTableVariables = {
|
|
1889
2086
|
* `$none`, etc.
|
1890
2087
|
*
|
1891
2088
|
* All operators start with an `$` to differentiate them from column names
|
1892
|
-
* (which are not allowed to start with
|
2089
|
+
* (which are not allowed to start with a dollar sign).
|
1893
2090
|
*
|
1894
2091
|
* #### Exact matching and control operators
|
1895
2092
|
*
|
@@ -2090,7 +2287,7 @@ declare type QueryTableVariables = {
|
|
2090
2287
|
* }
|
2091
2288
|
* ```
|
2092
2289
|
*
|
2093
|
-
* #### Numeric ranges
|
2290
|
+
* #### Numeric or datetime ranges
|
2094
2291
|
*
|
2095
2292
|
* ```json
|
2096
2293
|
* {
|
@@ -2102,7 +2299,18 @@ declare type QueryTableVariables = {
|
|
2102
2299
|
* }
|
2103
2300
|
* }
|
2104
2301
|
* ```
|
2105
|
-
*
|
2302
|
+
* Date ranges support the same operators, with the date using the format defined in
|
2303
|
+
* [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
|
2304
|
+
* ```json
|
2305
|
+
* {
|
2306
|
+
* "filter": {
|
2307
|
+
* "<column_name>": {
|
2308
|
+
* "$gt": "2019-10-12T07:20:50.52Z",
|
2309
|
+
* "$lt": "2021-10-12T07:20:50.52Z"
|
2310
|
+
* }
|
2311
|
+
* }
|
2312
|
+
* }
|
2313
|
+
* ```
|
2106
2314
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
2107
2315
|
*
|
2108
2316
|
*
|
@@ -2422,6 +2630,10 @@ declare const operationsByTag: {
|
|
2422
2630
|
getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
|
2423
2631
|
createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
|
2424
2632
|
deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
|
2633
|
+
getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
|
2634
|
+
addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
|
2635
|
+
removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
|
2636
|
+
resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
|
2425
2637
|
};
|
2426
2638
|
branch: {
|
2427
2639
|
getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
|
@@ -2472,6 +2684,9 @@ interface XataApiClientOptions {
|
|
2472
2684
|
apiKey?: string;
|
2473
2685
|
host?: HostProvider;
|
2474
2686
|
}
|
2687
|
+
/**
|
2688
|
+
* @deprecated Use XataApiPlugin instead
|
2689
|
+
*/
|
2475
2690
|
declare class XataApiClient {
|
2476
2691
|
#private;
|
2477
2692
|
constructor(options?: XataApiClientOptions);
|
@@ -2514,6 +2729,10 @@ declare class DatabaseApi {
|
|
2514
2729
|
getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
|
2515
2730
|
createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
|
2516
2731
|
deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
|
2732
|
+
getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
|
2733
|
+
addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
|
2734
|
+
removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
|
2735
|
+
resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<ResolveBranchResponse>;
|
2517
2736
|
}
|
2518
2737
|
declare class BranchApi {
|
2519
2738
|
private extraProps;
|
@@ -2575,7 +2794,6 @@ declare type RequiredBy<T, K extends keyof T> = T & {
|
|
2575
2794
|
};
|
2576
2795
|
declare type GetArrayInnerType<T extends readonly any[]> = T[number];
|
2577
2796
|
declare type SingleOrArray<T> = T | T[];
|
2578
|
-
declare type Dictionary<T> = Record<string, T>;
|
2579
2797
|
|
2580
2798
|
declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
|
2581
2799
|
declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
|
@@ -2775,6 +2993,7 @@ declare type QueryOptions<T extends XataRecord> = {
|
|
2775
2993
|
columns?: NonEmptyArray<SelectableColumn<T>>;
|
2776
2994
|
filter?: FilterExpression;
|
2777
2995
|
sort?: SortFilter<T> | SortFilter<T>[];
|
2996
|
+
cache?: number;
|
2778
2997
|
};
|
2779
2998
|
/**
|
2780
2999
|
* Query objects contain the information of all filters, sorting, etc. to be included in the database query.
|
@@ -2788,6 +3007,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2788
3007
|
readonly records: Result[];
|
2789
3008
|
constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
|
2790
3009
|
getQueryOptions(): QueryOptions<Record>;
|
3010
|
+
key(): string;
|
2791
3011
|
/**
|
2792
3012
|
* Builds a new query object representing a logical OR between the given subqueries.
|
2793
3013
|
* @param queries An array of subqueries.
|
@@ -2871,9 +3091,15 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2871
3091
|
* @param options Additional options to be used when performing the query.
|
2872
3092
|
* @returns The first record that matches the query, or null if no record matched the query.
|
2873
3093
|
*/
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
3094
|
+
getFirst(): Promise<Result | null>;
|
3095
|
+
getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
|
3096
|
+
getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
|
3097
|
+
/**
|
3098
|
+
* Builds a new query object adding a cache TTL in milliseconds.
|
3099
|
+
* @param ttl The cache TTL in milliseconds.
|
3100
|
+
* @returns A new Query object.
|
3101
|
+
*/
|
3102
|
+
cache(ttl: number): Query<Record, Result>;
|
2877
3103
|
nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
2878
3104
|
previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
2879
3105
|
firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
@@ -2963,8 +3189,6 @@ declare const PAGINATION_DEFAULT_SIZE = 200;
|
|
2963
3189
|
declare const PAGINATION_MAX_OFFSET = 800;
|
2964
3190
|
declare const PAGINATION_DEFAULT_OFFSET = 0;
|
2965
3191
|
|
2966
|
-
declare type TableLink = string[];
|
2967
|
-
declare type LinkDictionary = Dictionary<TableLink[]>;
|
2968
3192
|
/**
|
2969
3193
|
* Common interface for performing operations on a table.
|
2970
3194
|
*/
|
@@ -3070,9 +3294,8 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
|
|
3070
3294
|
db: SchemaPluginResult<any>;
|
3071
3295
|
constructor(options: {
|
3072
3296
|
table: string;
|
3073
|
-
links?: LinkDictionary;
|
3074
|
-
getFetchProps: () => Promise<FetcherExtraProps>;
|
3075
3297
|
db: SchemaPluginResult<any>;
|
3298
|
+
pluginOptions: XataPluginOptions;
|
3076
3299
|
});
|
3077
3300
|
create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3078
3301
|
create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
@@ -3084,7 +3307,7 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
|
|
3084
3307
|
createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3085
3308
|
createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3086
3309
|
createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
|
3087
|
-
delete(
|
3310
|
+
delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
|
3088
3311
|
search(query: string, options?: {
|
3089
3312
|
fuzziness?: number;
|
3090
3313
|
}): Promise<SelectedPick<Record, ['*']>[]>;
|
@@ -3166,17 +3389,17 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
|
|
3166
3389
|
|
3167
3390
|
declare type SchemaDefinition = {
|
3168
3391
|
table: string;
|
3169
|
-
links?: LinkDictionary;
|
3170
3392
|
};
|
3171
3393
|
declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
|
3172
3394
|
[Key in keyof Schemas]: Repository<Schemas[Key]>;
|
3395
|
+
} & {
|
3396
|
+
[key: string]: Repository<XataRecord$1>;
|
3173
3397
|
};
|
3174
3398
|
declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
3175
3399
|
#private;
|
3176
|
-
private links?;
|
3177
3400
|
private tableNames?;
|
3178
|
-
constructor(
|
3179
|
-
build(
|
3401
|
+
constructor(tableNames?: string[] | undefined);
|
3402
|
+
build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
|
3180
3403
|
}
|
3181
3404
|
|
3182
3405
|
declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
|
@@ -3197,8 +3420,7 @@ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
|
|
3197
3420
|
declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
3198
3421
|
#private;
|
3199
3422
|
private db;
|
3200
|
-
|
3201
|
-
constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
|
3423
|
+
constructor(db: SchemaPluginResult<Schemas>);
|
3202
3424
|
build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
|
3203
3425
|
}
|
3204
3426
|
declare type SearchXataRecord = XataRecord & {
|
@@ -3217,10 +3439,11 @@ declare type BaseClientOptions = {
|
|
3217
3439
|
apiKey?: string;
|
3218
3440
|
databaseURL?: string;
|
3219
3441
|
branch?: BranchStrategyOption;
|
3442
|
+
cache?: CacheImpl;
|
3220
3443
|
};
|
3221
3444
|
declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
|
3222
3445
|
interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
|
3223
|
-
new <Schemas extends Record<string, BaseData
|
3446
|
+
new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
|
3224
3447
|
db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
|
3225
3448
|
search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
|
3226
3449
|
}, keyof Plugins> & {
|
@@ -3236,7 +3459,7 @@ declare type BranchResolutionOptions = {
|
|
3236
3459
|
apiKey?: string;
|
3237
3460
|
fetchImpl?: FetchImpl;
|
3238
3461
|
};
|
3239
|
-
declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string
|
3462
|
+
declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string>;
|
3240
3463
|
declare function getCurrentBranchDetails(options?: BranchResolutionOptions): Promise<DBBranch | null>;
|
3241
3464
|
declare function getDatabaseURL(): string | undefined;
|
3242
3465
|
|
@@ -3247,4 +3470,4 @@ declare class XataError extends Error {
|
|
3247
3470
|
constructor(message: string, status: number);
|
3248
3471
|
}
|
3249
3472
|
|
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,
|
3473
|
+
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, PaginationOptions, 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, 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, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
|