@xata.io/client 0.0.0-alpha.vf89b33e → 0.0.0-alpha.vfb4a018
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 +357 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +258 -20
- package/dist/index.mjs +353 -151
- 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;
|
@@ -2775,6 +2994,7 @@ declare type QueryOptions<T extends XataRecord> = {
|
|
2775
2994
|
columns?: NonEmptyArray<SelectableColumn<T>>;
|
2776
2995
|
filter?: FilterExpression;
|
2777
2996
|
sort?: SortFilter<T> | SortFilter<T>[];
|
2997
|
+
cache?: number;
|
2778
2998
|
};
|
2779
2999
|
/**
|
2780
3000
|
* Query objects contain the information of all filters, sorting, etc. to be included in the database query.
|
@@ -2788,6 +3008,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2788
3008
|
readonly records: Result[];
|
2789
3009
|
constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
|
2790
3010
|
getQueryOptions(): QueryOptions<Record>;
|
3011
|
+
key(): string;
|
2791
3012
|
/**
|
2792
3013
|
* Builds a new query object representing a logical OR between the given subqueries.
|
2793
3014
|
* @param queries An array of subqueries.
|
@@ -2846,9 +3067,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2846
3067
|
getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
|
2847
3068
|
getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
|
2848
3069
|
[Symbol.asyncIterator](): AsyncIterableIterator<Result>;
|
2849
|
-
getIterator(
|
2850
|
-
getIterator(
|
2851
|
-
|
3070
|
+
getIterator(): AsyncGenerator<Result[]>;
|
3071
|
+
getIterator(options: Omit<QueryOptions<Record>, 'columns' | 'page'> & {
|
3072
|
+
batchSize?: number;
|
3073
|
+
}): AsyncGenerator<Result[]>;
|
3074
|
+
getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'> & {
|
3075
|
+
batchSize?: number;
|
3076
|
+
}>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
|
2852
3077
|
/**
|
2853
3078
|
* Performs the query in the database and returns a set of results.
|
2854
3079
|
* @param options Additional options to be used when performing the query.
|
@@ -2863,17 +3088,27 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
2863
3088
|
* @param options Additional options to be used when performing the query.
|
2864
3089
|
* @returns An array of records from the database.
|
2865
3090
|
*/
|
2866
|
-
getAll(
|
2867
|
-
getAll(
|
2868
|
-
|
3091
|
+
getAll(): Promise<Result[]>;
|
3092
|
+
getAll(options: Omit<QueryOptions<Record>, 'columns' | 'page'> & {
|
3093
|
+
batchSize?: number;
|
3094
|
+
}): Promise<Result[]>;
|
3095
|
+
getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'> & {
|
3096
|
+
batchSize?: number;
|
3097
|
+
}>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
|
2869
3098
|
/**
|
2870
3099
|
* Performs the query in the database and returns the first result.
|
2871
3100
|
* @param options Additional options to be used when performing the query.
|
2872
3101
|
* @returns The first record that matches the query, or null if no record matched the query.
|
2873
3102
|
*/
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
3103
|
+
getFirst(): Promise<Result | null>;
|
3104
|
+
getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
|
3105
|
+
getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
|
3106
|
+
/**
|
3107
|
+
* Builds a new query object adding a cache TTL in milliseconds.
|
3108
|
+
* @param ttl The cache TTL in milliseconds.
|
3109
|
+
* @returns A new Query object.
|
3110
|
+
*/
|
3111
|
+
cache(ttl: number): Query<Record, Result>;
|
2877
3112
|
nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
2878
3113
|
previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
2879
3114
|
firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
|
@@ -3071,8 +3306,8 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
|
|
3071
3306
|
constructor(options: {
|
3072
3307
|
table: string;
|
3073
3308
|
links?: LinkDictionary;
|
3074
|
-
getFetchProps: () => Promise<FetcherExtraProps>;
|
3075
3309
|
db: SchemaPluginResult<any>;
|
3310
|
+
pluginOptions: XataPluginOptions;
|
3076
3311
|
});
|
3077
3312
|
create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3078
3313
|
create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
@@ -3084,7 +3319,7 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
|
|
3084
3319
|
createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3085
3320
|
createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3086
3321
|
createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
|
3087
|
-
delete(
|
3322
|
+
delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
|
3088
3323
|
search(query: string, options?: {
|
3089
3324
|
fuzziness?: number;
|
3090
3325
|
}): Promise<SelectedPick<Record, ['*']>[]>;
|
@@ -3170,13 +3405,15 @@ declare type SchemaDefinition = {
|
|
3170
3405
|
};
|
3171
3406
|
declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
|
3172
3407
|
[Key in keyof Schemas]: Repository<Schemas[Key]>;
|
3408
|
+
} & {
|
3409
|
+
[key: string]: Repository<XataRecord$1>;
|
3173
3410
|
};
|
3174
3411
|
declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
3175
3412
|
#private;
|
3176
3413
|
private links?;
|
3177
3414
|
private tableNames?;
|
3178
3415
|
constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
|
3179
|
-
build(
|
3416
|
+
build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
|
3180
3417
|
}
|
3181
3418
|
|
3182
3419
|
declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
|
@@ -3217,10 +3454,11 @@ declare type BaseClientOptions = {
|
|
3217
3454
|
apiKey?: string;
|
3218
3455
|
databaseURL?: string;
|
3219
3456
|
branch?: BranchStrategyOption;
|
3457
|
+
cache?: CacheImpl;
|
3220
3458
|
};
|
3221
3459
|
declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
|
3222
3460
|
interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
|
3223
|
-
new <Schemas extends Record<string, BaseData
|
3461
|
+
new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
|
3224
3462
|
db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
|
3225
3463
|
search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
|
3226
3464
|
}, keyof Plugins> & {
|
@@ -3247,4 +3485,4 @@ declare class XataError extends Error {
|
|
3247
3485
|
constructor(message: string, status: number);
|
3248
3486
|
}
|
3249
3487
|
|
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, LinkDictionary, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeWorkspaceMember, resendWorkspaceMemberInvite, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
|
3488
|
+
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, LinkDictionary, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, 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 };
|