@xata.io/client 0.0.0-alpha.ved00a04 → 0.0.0-alpha.vef05610
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 +52 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +201 -69
- package/dist/index.mjs +49 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,12 @@ declare type ListBranchesResponse = {
|
|
|
138
138
|
displayName: string;
|
|
139
139
|
branches: Branch[];
|
|
140
140
|
};
|
|
141
|
+
declare type ListGitBranchesResponse = {
|
|
142
|
+
mapping: {
|
|
143
|
+
gitBranch: string;
|
|
144
|
+
xataBranch: string;
|
|
145
|
+
}[];
|
|
146
|
+
};
|
|
141
147
|
declare type Branch = {
|
|
142
148
|
name: string;
|
|
143
149
|
createdAt: DateTime;
|
|
@@ -186,7 +192,7 @@ declare type Table = {
|
|
|
186
192
|
*/
|
|
187
193
|
declare type Column = {
|
|
188
194
|
name: string;
|
|
189
|
-
type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
|
|
195
|
+
type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
|
|
190
196
|
link?: {
|
|
191
197
|
table: string;
|
|
192
198
|
};
|
|
@@ -382,6 +388,7 @@ type schemas_WorkspaceMembers = WorkspaceMembers;
|
|
|
382
388
|
type schemas_InviteKey = InviteKey;
|
|
383
389
|
type schemas_ListDatabasesResponse = ListDatabasesResponse;
|
|
384
390
|
type schemas_ListBranchesResponse = ListBranchesResponse;
|
|
391
|
+
type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
|
|
385
392
|
type schemas_Branch = Branch;
|
|
386
393
|
type schemas_BranchMetadata = BranchMetadata;
|
|
387
394
|
type schemas_DBBranch = DBBranch;
|
|
@@ -434,6 +441,7 @@ declare namespace schemas {
|
|
|
434
441
|
schemas_InviteKey as InviteKey,
|
|
435
442
|
schemas_ListDatabasesResponse as ListDatabasesResponse,
|
|
436
443
|
schemas_ListBranchesResponse as ListBranchesResponse,
|
|
444
|
+
schemas_ListGitBranchesResponse as ListGitBranchesResponse,
|
|
437
445
|
schemas_Branch as Branch,
|
|
438
446
|
schemas_BranchMetadata as BranchMetadata,
|
|
439
447
|
schemas_DBBranch as DBBranch,
|
|
@@ -1010,6 +1018,162 @@ declare type DeleteDatabaseVariables = {
|
|
|
1010
1018
|
* Delete a database and all of its branches and tables permanently.
|
|
1011
1019
|
*/
|
|
1012
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>;
|
|
1013
1177
|
declare type GetBranchDetailsPathParams = {
|
|
1014
1178
|
dbBranchName: DBBranchName;
|
|
1015
1179
|
workspace: string;
|
|
@@ -1191,64 +1355,6 @@ declare type GetBranchMigrationPlanVariables = {
|
|
|
1191
1355
|
* Compute a migration plan from a target schema the branch should be migrated too.
|
|
1192
1356
|
*/
|
|
1193
1357
|
declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
|
|
1194
|
-
declare type CompareBranchSchemaPathParams = {
|
|
1195
|
-
dbBranchName: DBBranchName;
|
|
1196
|
-
branchName: BranchName;
|
|
1197
|
-
workspace: string;
|
|
1198
|
-
};
|
|
1199
|
-
declare type CompareBranchSchemaError = ErrorWrapper<{
|
|
1200
|
-
status: 400;
|
|
1201
|
-
payload: BadRequestError;
|
|
1202
|
-
} | {
|
|
1203
|
-
status: 401;
|
|
1204
|
-
payload: AuthError;
|
|
1205
|
-
} | {
|
|
1206
|
-
status: 404;
|
|
1207
|
-
payload: SimpleError;
|
|
1208
|
-
}>;
|
|
1209
|
-
declare type CompareBranchSchemaVariables = {
|
|
1210
|
-
body?: Record<string, any>;
|
|
1211
|
-
pathParams: CompareBranchSchemaPathParams;
|
|
1212
|
-
} & FetcherExtraProps;
|
|
1213
|
-
declare const compareBranchSchema: (variables: CompareBranchSchemaVariables) => Promise<Record<string, any>>;
|
|
1214
|
-
declare type UpdateBranchSchemaPathParams = {
|
|
1215
|
-
dbBranchName: DBBranchName;
|
|
1216
|
-
workspace: string;
|
|
1217
|
-
};
|
|
1218
|
-
declare type UpdateBranchSchemaError = ErrorWrapper<{
|
|
1219
|
-
status: 400;
|
|
1220
|
-
payload: BadRequestError;
|
|
1221
|
-
} | {
|
|
1222
|
-
status: 401;
|
|
1223
|
-
payload: AuthError;
|
|
1224
|
-
} | {
|
|
1225
|
-
status: 404;
|
|
1226
|
-
payload: SimpleError;
|
|
1227
|
-
}>;
|
|
1228
|
-
declare type UpdateBranchSchemaVariables = {
|
|
1229
|
-
body?: Record<string, any>;
|
|
1230
|
-
pathParams: UpdateBranchSchemaPathParams;
|
|
1231
|
-
} & FetcherExtraProps;
|
|
1232
|
-
declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<Record<string, any>>;
|
|
1233
|
-
declare type GetBranchSchemaHistoryPathParams = {
|
|
1234
|
-
dbBranchName: DBBranchName;
|
|
1235
|
-
workspace: string;
|
|
1236
|
-
};
|
|
1237
|
-
declare type GetBranchSchemaHistoryError = ErrorWrapper<{
|
|
1238
|
-
status: 400;
|
|
1239
|
-
payload: BadRequestError;
|
|
1240
|
-
} | {
|
|
1241
|
-
status: 401;
|
|
1242
|
-
payload: AuthError;
|
|
1243
|
-
} | {
|
|
1244
|
-
status: 404;
|
|
1245
|
-
payload: SimpleError;
|
|
1246
|
-
}>;
|
|
1247
|
-
declare type GetBranchSchemaHistoryVariables = {
|
|
1248
|
-
body?: Record<string, any>;
|
|
1249
|
-
pathParams: GetBranchSchemaHistoryPathParams;
|
|
1250
|
-
} & FetcherExtraProps;
|
|
1251
|
-
declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<Record<string, any>>;
|
|
1252
1358
|
declare type GetBranchStatsPathParams = {
|
|
1253
1359
|
dbBranchName: DBBranchName;
|
|
1254
1360
|
workspace: string;
|
|
@@ -1807,7 +1913,11 @@ declare type QueryTableVariables = {
|
|
|
1807
1913
|
* "link": {
|
|
1808
1914
|
* "table": "users"
|
|
1809
1915
|
* }
|
|
1810
|
-
* }
|
|
1916
|
+
* },
|
|
1917
|
+
* {
|
|
1918
|
+
* "name": "foundedDate",
|
|
1919
|
+
* "type": "datetime"
|
|
1920
|
+
* },
|
|
1811
1921
|
* ]
|
|
1812
1922
|
* },
|
|
1813
1923
|
* {
|
|
@@ -1960,7 +2070,8 @@ declare type QueryTableVariables = {
|
|
|
1960
2070
|
* "version": 0,
|
|
1961
2071
|
* },
|
|
1962
2072
|
* "name": "first team",
|
|
1963
|
-
* "code": "A1"
|
|
2073
|
+
* "code": "A1",
|
|
2074
|
+
* "foundedDate": "2020-03-04T10:43:54.32Z"
|
|
1964
2075
|
* }
|
|
1965
2076
|
* }
|
|
1966
2077
|
* ```
|
|
@@ -1975,7 +2086,7 @@ declare type QueryTableVariables = {
|
|
|
1975
2086
|
* `$none`, etc.
|
|
1976
2087
|
*
|
|
1977
2088
|
* All operators start with an `$` to differentiate them from column names
|
|
1978
|
-
* (which are not allowed to start with
|
|
2089
|
+
* (which are not allowed to start with a dollar sign).
|
|
1979
2090
|
*
|
|
1980
2091
|
* #### Exact matching and control operators
|
|
1981
2092
|
*
|
|
@@ -2176,7 +2287,7 @@ declare type QueryTableVariables = {
|
|
|
2176
2287
|
* }
|
|
2177
2288
|
* ```
|
|
2178
2289
|
*
|
|
2179
|
-
* #### Numeric ranges
|
|
2290
|
+
* #### Numeric or datetime ranges
|
|
2180
2291
|
*
|
|
2181
2292
|
* ```json
|
|
2182
2293
|
* {
|
|
@@ -2188,7 +2299,18 @@ declare type QueryTableVariables = {
|
|
|
2188
2299
|
* }
|
|
2189
2300
|
* }
|
|
2190
2301
|
* ```
|
|
2191
|
-
*
|
|
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
|
+
* ```
|
|
2192
2314
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
|
2193
2315
|
*
|
|
2194
2316
|
*
|
|
@@ -2508,6 +2630,10 @@ declare const operationsByTag: {
|
|
|
2508
2630
|
getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
|
|
2509
2631
|
createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
|
|
2510
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>;
|
|
2511
2637
|
};
|
|
2512
2638
|
branch: {
|
|
2513
2639
|
getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
|
|
@@ -2519,9 +2645,6 @@ declare const operationsByTag: {
|
|
|
2519
2645
|
getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
|
|
2520
2646
|
executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
|
|
2521
2647
|
getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
|
|
2522
|
-
compareBranchSchema: (variables: CompareBranchSchemaVariables) => Promise<Record<string, any>>;
|
|
2523
|
-
updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<Record<string, any>>;
|
|
2524
|
-
getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<Record<string, any>>;
|
|
2525
2648
|
getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
|
|
2526
2649
|
};
|
|
2527
2650
|
table: {
|
|
@@ -2561,6 +2684,9 @@ interface XataApiClientOptions {
|
|
|
2561
2684
|
apiKey?: string;
|
|
2562
2685
|
host?: HostProvider;
|
|
2563
2686
|
}
|
|
2687
|
+
/**
|
|
2688
|
+
* @deprecated Use XataApiPlugin instead
|
|
2689
|
+
*/
|
|
2564
2690
|
declare class XataApiClient {
|
|
2565
2691
|
#private;
|
|
2566
2692
|
constructor(options?: XataApiClientOptions);
|
|
@@ -2603,6 +2729,10 @@ declare class DatabaseApi {
|
|
|
2603
2729
|
getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
|
|
2604
2730
|
createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
|
|
2605
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>;
|
|
2606
2736
|
}
|
|
2607
2737
|
declare class BranchApi {
|
|
2608
2738
|
private extraProps;
|
|
@@ -3267,6 +3397,8 @@ declare type SchemaDefinition = {
|
|
|
3267
3397
|
};
|
|
3268
3398
|
declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
|
|
3269
3399
|
[Key in keyof Schemas]: Repository<Schemas[Key]>;
|
|
3400
|
+
} & {
|
|
3401
|
+
[key: string]: Repository<XataRecord$1>;
|
|
3270
3402
|
};
|
|
3271
3403
|
declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
|
3272
3404
|
#private;
|
|
@@ -3318,7 +3450,7 @@ declare type BaseClientOptions = {
|
|
|
3318
3450
|
};
|
|
3319
3451
|
declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
|
|
3320
3452
|
interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
|
|
3321
|
-
new <Schemas extends Record<string, BaseData
|
|
3453
|
+
new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
|
|
3322
3454
|
db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
|
|
3323
3455
|
search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
|
|
3324
3456
|
}, keyof Plugins> & {
|
|
@@ -3345,4 +3477,4 @@ declare class XataError extends Error {
|
|
|
3345
3477
|
constructor(message: string, status: number);
|
|
3346
3478
|
}
|
|
3347
3479
|
|
|
3348
|
-
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor,
|
|
3480
|
+
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -34,7 +34,10 @@ function getEnvVariable(name) {
|
|
|
34
34
|
}
|
|
35
35
|
async function getGitBranch() {
|
|
36
36
|
try {
|
|
37
|
-
|
|
37
|
+
if (typeof require === "function") {
|
|
38
|
+
const req = require;
|
|
39
|
+
return req("child_process").execSync("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
40
|
+
}
|
|
38
41
|
} catch (err) {
|
|
39
42
|
}
|
|
40
43
|
try {
|
|
@@ -248,6 +251,14 @@ const deleteDatabase = (variables) => fetch$1({
|
|
|
248
251
|
method: "delete",
|
|
249
252
|
...variables
|
|
250
253
|
});
|
|
254
|
+
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
|
255
|
+
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
|
256
|
+
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
|
257
|
+
const resolveBranch = (variables) => fetch$1({
|
|
258
|
+
url: "/dbs/{dbName}/resolveBranch",
|
|
259
|
+
method: "get",
|
|
260
|
+
...variables
|
|
261
|
+
});
|
|
251
262
|
const getBranchDetails = (variables) => fetch$1({
|
|
252
263
|
url: "/db/{dbBranchName}",
|
|
253
264
|
method: "get",
|
|
@@ -276,17 +287,6 @@ const getBranchMetadata = (variables) => fetch$1({
|
|
|
276
287
|
const getBranchMigrationHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables });
|
|
277
288
|
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
|
278
289
|
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
|
279
|
-
const compareBranchSchema = (variables) => fetch$1({
|
|
280
|
-
url: "/db/{dbBranchName}/schema/compare/{branchName}",
|
|
281
|
-
method: "post",
|
|
282
|
-
...variables
|
|
283
|
-
});
|
|
284
|
-
const updateBranchSchema = (variables) => fetch$1({
|
|
285
|
-
url: "/db/{dbBranchName}/schema/update",
|
|
286
|
-
method: "post",
|
|
287
|
-
...variables
|
|
288
|
-
});
|
|
289
|
-
const getBranchSchemaHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables });
|
|
290
290
|
const getBranchStats = (variables) => fetch$1({
|
|
291
291
|
url: "/db/{dbBranchName}/stats",
|
|
292
292
|
method: "get",
|
|
@@ -387,7 +387,15 @@ const operationsByTag = {
|
|
|
387
387
|
resendWorkspaceMemberInvite,
|
|
388
388
|
acceptWorkspaceMemberInvite
|
|
389
389
|
},
|
|
390
|
-
database: {
|
|
390
|
+
database: {
|
|
391
|
+
getDatabaseList,
|
|
392
|
+
createDatabase,
|
|
393
|
+
deleteDatabase,
|
|
394
|
+
getGitBranchesMapping,
|
|
395
|
+
addGitBranchesEntry,
|
|
396
|
+
removeGitBranchesEntry,
|
|
397
|
+
resolveBranch
|
|
398
|
+
},
|
|
391
399
|
branch: {
|
|
392
400
|
getBranchList,
|
|
393
401
|
getBranchDetails,
|
|
@@ -398,9 +406,6 @@ const operationsByTag = {
|
|
|
398
406
|
getBranchMigrationHistory,
|
|
399
407
|
executeBranchMigrationPlan,
|
|
400
408
|
getBranchMigrationPlan,
|
|
401
|
-
compareBranchSchema,
|
|
402
|
-
updateBranchSchema,
|
|
403
|
-
getBranchSchemaHistory,
|
|
404
409
|
getBranchStats
|
|
405
410
|
},
|
|
406
411
|
table: {
|
|
@@ -650,6 +655,33 @@ class DatabaseApi {
|
|
|
650
655
|
...this.extraProps
|
|
651
656
|
});
|
|
652
657
|
}
|
|
658
|
+
getGitBranchesMapping(workspace, dbName) {
|
|
659
|
+
return operationsByTag.database.getGitBranchesMapping({
|
|
660
|
+
pathParams: { workspace, dbName },
|
|
661
|
+
...this.extraProps
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
addGitBranchesEntry(workspace, dbName, body) {
|
|
665
|
+
return operationsByTag.database.addGitBranchesEntry({
|
|
666
|
+
pathParams: { workspace, dbName },
|
|
667
|
+
body,
|
|
668
|
+
...this.extraProps
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
removeGitBranchesEntry(workspace, dbName, gitBranch) {
|
|
672
|
+
return operationsByTag.database.removeGitBranchesEntry({
|
|
673
|
+
pathParams: { workspace, dbName },
|
|
674
|
+
queryParams: { gitBranch },
|
|
675
|
+
...this.extraProps
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
resolveBranch(workspace, dbName, gitBranch) {
|
|
679
|
+
return operationsByTag.database.resolveBranch({
|
|
680
|
+
pathParams: { workspace, dbName },
|
|
681
|
+
queryParams: { gitBranch },
|
|
682
|
+
...this.extraProps
|
|
683
|
+
});
|
|
684
|
+
}
|
|
653
685
|
}
|
|
654
686
|
class BranchApi {
|
|
655
687
|
constructor(extraProps) {
|
|
@@ -1817,5 +1849,5 @@ class XataError extends Error {
|
|
|
1817
1849
|
}
|
|
1818
1850
|
}
|
|
1819
1851
|
|
|
1820
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, Repository, RestRepository, SchemaPlugin, SearchPlugin, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite,
|
|
1852
|
+
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, Repository, RestRepository, SchemaPlugin, SearchPlugin, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, 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 };
|
|
1821
1853
|
//# sourceMappingURL=index.mjs.map
|