@xata.io/client 0.9.0 → 0.9.1

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/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;
@@ -1294,9 +1458,8 @@ declare type UpdateTableVariables = {
1294
1458
  *
1295
1459
  * In the example below, we rename a table from “users” to “people”:
1296
1460
  *
1297
- * ```json
1298
- * // PATCH /db/test:main/tables/users
1299
- *
1461
+ * ```jsx
1462
+ * PATCH /db/test:main/tables/users
1300
1463
  * {
1301
1464
  * "name": "people"
1302
1465
  * }
@@ -1704,7 +1867,7 @@ declare type QueryTableVariables = {
1704
1867
  * {
1705
1868
  * "columns": [...],
1706
1869
  * "filter": {
1707
- * "$all": [...],
1870
+ * "$all": [...]
1708
1871
  * "$any": [...]
1709
1872
  * ...
1710
1873
  * },
@@ -1750,7 +1913,11 @@ declare type QueryTableVariables = {
1750
1913
  * "link": {
1751
1914
  * "table": "users"
1752
1915
  * }
1753
- * }
1916
+ * },
1917
+ * {
1918
+ * "name": "foundedDate",
1919
+ * "type": "datetime"
1920
+ * },
1754
1921
  * ]
1755
1922
  * },
1756
1923
  * {
@@ -1838,7 +2005,7 @@ declare type QueryTableVariables = {
1838
2005
  * {
1839
2006
  * "name": "Kilian",
1840
2007
  * "address": {
1841
- * "street": "New street"
2008
+ * "street": "New street",
1842
2009
  * }
1843
2010
  * }
1844
2011
  * ```
@@ -1847,7 +2014,10 @@ declare type QueryTableVariables = {
1847
2014
  *
1848
2015
  * ```json
1849
2016
  * {
1850
- * "columns": ["*", "team.name"]
2017
+ * "columns": [
2018
+ * "*",
2019
+ * "team.name"
2020
+ * ]
1851
2021
  * }
1852
2022
  * ```
1853
2023
  *
@@ -1865,7 +2035,7 @@ declare type QueryTableVariables = {
1865
2035
  * "team": {
1866
2036
  * "id": "XX",
1867
2037
  * "xata": {
1868
- * "version": 0
2038
+ * "version": 0,
1869
2039
  * },
1870
2040
  * "name": "first team"
1871
2041
  * }
@@ -1876,7 +2046,10 @@ declare type QueryTableVariables = {
1876
2046
  *
1877
2047
  * ```json
1878
2048
  * {
1879
- * "columns": ["*", "team.*"]
2049
+ * "columns": [
2050
+ * "*",
2051
+ * "team.*"
2052
+ * ]
1880
2053
  * }
1881
2054
  * ```
1882
2055
  *
@@ -1894,10 +2067,11 @@ declare type QueryTableVariables = {
1894
2067
  * "team": {
1895
2068
  * "id": "XX",
1896
2069
  * "xata": {
1897
- * "version": 0
2070
+ * "version": 0,
1898
2071
  * },
1899
2072
  * "name": "first team",
1900
- * "code": "A1"
2073
+ * "code": "A1",
2074
+ * "foundedDate": "2020-03-04T10:43:54.32Z"
1901
2075
  * }
1902
2076
  * }
1903
2077
  * ```
@@ -1912,7 +2086,7 @@ declare type QueryTableVariables = {
1912
2086
  * `$none`, etc.
1913
2087
  *
1914
2088
  * All operators start with an `$` to differentiate them from column names
1915
- * (which are not allowed to start with an dollar sign).
2089
+ * (which are not allowed to start with a dollar sign).
1916
2090
  *
1917
2091
  * #### Exact matching and control operators
1918
2092
  *
@@ -1943,7 +2117,7 @@ declare type QueryTableVariables = {
1943
2117
  * ```json
1944
2118
  * {
1945
2119
  * "filter": {
1946
- * "name": "r2"
2120
+ * "name": "r2",
1947
2121
  * }
1948
2122
  * }
1949
2123
  * ```
@@ -1965,7 +2139,7 @@ declare type QueryTableVariables = {
1965
2139
  * ```json
1966
2140
  * {
1967
2141
  * "filter": {
1968
- * "settings.plan": "free"
2142
+ * "settings.plan": "free",
1969
2143
  * }
1970
2144
  * }
1971
2145
  * ```
@@ -1975,8 +2149,8 @@ declare type QueryTableVariables = {
1975
2149
  * "filter": {
1976
2150
  * "settings": {
1977
2151
  * "plan": "free"
1978
- * }
1979
- * }
2152
+ * },
2153
+ * },
1980
2154
  * }
1981
2155
  * ```
1982
2156
  *
@@ -1985,8 +2159,8 @@ declare type QueryTableVariables = {
1985
2159
  * ```json
1986
2160
  * {
1987
2161
  * "filter": {
1988
- * "settings.plan": { "$any": ["free", "paid"] }
1989
- * }
2162
+ * "settings.plan": {"$any": ["free", "paid"]}
2163
+ * },
1990
2164
  * }
1991
2165
  * ```
1992
2166
  *
@@ -1995,9 +2169,9 @@ declare type QueryTableVariables = {
1995
2169
  * ```json
1996
2170
  * {
1997
2171
  * "filter": {
1998
- * "settings.dark": true,
1999
- * "settings.plan": "free"
2000
- * }
2172
+ * "settings.dark": true,
2173
+ * "settings.plan": "free",
2174
+ * },
2001
2175
  * }
2002
2176
  * ```
2003
2177
  *
@@ -2008,11 +2182,11 @@ declare type QueryTableVariables = {
2008
2182
  * ```json
2009
2183
  * {
2010
2184
  * "filter": {
2011
- * "$any": {
2012
- * "settings.dark": true,
2013
- * "settings.plan": "free"
2014
- * }
2015
- * }
2185
+ * "$any": {
2186
+ * "settings.dark": true,
2187
+ * "settings.plan": "free"
2188
+ * }
2189
+ * },
2016
2190
  * }
2017
2191
  * ```
2018
2192
  *
@@ -2023,10 +2197,10 @@ declare type QueryTableVariables = {
2023
2197
  * "filter": {
2024
2198
  * "$any": [
2025
2199
  * {
2026
- * "name": "r1"
2200
+ * "name": "r1",
2027
2201
  * },
2028
2202
  * {
2029
- * "name": "r2"
2203
+ * "name": "r2",
2030
2204
  * }
2031
2205
  * ]
2032
2206
  * }
@@ -2038,7 +2212,7 @@ declare type QueryTableVariables = {
2038
2212
  * ```json
2039
2213
  * {
2040
2214
  * "filter": {
2041
- * "$exists": "settings"
2215
+ * "$exists": "settings",
2042
2216
  * }
2043
2217
  * }
2044
2218
  * ```
@@ -2050,10 +2224,10 @@ declare type QueryTableVariables = {
2050
2224
  * "filter": {
2051
2225
  * "$all": [
2052
2226
  * {
2053
- * "$exists": "settings"
2227
+ * "$exists": "settings",
2054
2228
  * },
2055
2229
  * {
2056
- * "$exists": "name"
2230
+ * "$exists": "name",
2057
2231
  * }
2058
2232
  * ]
2059
2233
  * }
@@ -2065,7 +2239,7 @@ declare type QueryTableVariables = {
2065
2239
  * ```json
2066
2240
  * {
2067
2241
  * "filter": {
2068
- * "$notExists": "settings"
2242
+ * "$notExists": "settings",
2069
2243
  * }
2070
2244
  * }
2071
2245
  * ```
@@ -2092,7 +2266,7 @@ declare type QueryTableVariables = {
2092
2266
  * {
2093
2267
  * "filter": {
2094
2268
  * "<column_name>": {
2095
- * "$pattern": "v*alue*"
2269
+ * "$pattern": "v*alue*"
2096
2270
  * }
2097
2271
  * }
2098
2272
  * }
@@ -2104,30 +2278,42 @@ declare type QueryTableVariables = {
2104
2278
  * {
2105
2279
  * "filter": {
2106
2280
  * "<column_name>": {
2107
- * "$endsWith": ".gz"
2281
+ * "$endsWith": ".gz"
2108
2282
  * },
2109
2283
  * "<column_name>": {
2110
- * "$startsWith": "tmp-"
2284
+ * "$startsWith": "tmp-"
2111
2285
  * }
2112
2286
  * }
2113
2287
  * }
2114
2288
  * ```
2115
2289
  *
2116
- * #### Numeric ranges
2290
+ * #### Numeric or datetime ranges
2117
2291
  *
2118
2292
  * ```json
2119
2293
  * {
2120
2294
  * "filter": {
2295
+ * "<column_name>": {
2296
+ * "$ge": 0,
2297
+ * "$lt": 100
2298
+ * }
2299
+ * }
2300
+ * }
2301
+ * ```
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": {
2121
2307
  * "<column_name>": {
2122
- * "$ge": 0,
2123
- * "$lt": 100
2308
+ * "$gt": "2019-10-12T07:20:50.52Z",
2309
+ * "$lt": "2021-10-12T07:20:50.52Z"
2124
2310
  * }
2125
2311
  * }
2126
2312
  * }
2127
2313
  * ```
2128
- *
2129
2314
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2130
2315
  *
2316
+ *
2131
2317
  * #### Negations
2132
2318
  *
2133
2319
  * A general `$not` operator can inverse any operation.
@@ -2152,21 +2338,15 @@ declare type QueryTableVariables = {
2152
2338
  * {
2153
2339
  * "filter": {
2154
2340
  * "$not": {
2155
- * "$any": [
2156
- * {
2157
- * "<column_name1>": "value1"
2158
- * },
2159
- * {
2160
- * "$all": [
2161
- * {
2162
- * "<column_name2>": "value2"
2163
- * },
2164
- * {
2165
- * "<column_name3>": "value3"
2166
- * }
2167
- * ]
2168
- * }
2169
- * ]
2341
+ * "$any": [{
2342
+ * "<column_name1>": "value1"
2343
+ * }, {
2344
+ * "$all": [{
2345
+ * "<column_name2>": "value2"
2346
+ * }, {
2347
+ * "<column_name3>": "value3"
2348
+ * }]
2349
+ * }]
2170
2350
  * }
2171
2351
  * }
2172
2352
  * }
@@ -2221,8 +2401,8 @@ declare type QueryTableVariables = {
2221
2401
  * "<array name>": {
2222
2402
  * "$includes": {
2223
2403
  * "$all": [
2224
- * { "$contains": "label" },
2225
- * { "$not": { "$endsWith": "-debug" } }
2404
+ * {"$contains": "label"},
2405
+ * {"$not": {"$endsWith": "-debug"}}
2226
2406
  * ]
2227
2407
  * }
2228
2408
  * }
@@ -2242,7 +2422,9 @@ declare type QueryTableVariables = {
2242
2422
  * {
2243
2423
  * "filter": {
2244
2424
  * "settings.labels": {
2245
- * "$includesAll": [{ "$contains": "label" }]
2425
+ * "$includesAll": [
2426
+ * {"$contains": "label"},
2427
+ * ]
2246
2428
  * }
2247
2429
  * }
2248
2430
  * }
@@ -2290,6 +2472,7 @@ declare type QueryTableVariables = {
2290
2472
  * }
2291
2473
  * ```
2292
2474
  *
2475
+ *
2293
2476
  * ### Pagination
2294
2477
  *
2295
2478
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2355,8 +2538,8 @@ declare type QueryTableVariables = {
2355
2538
  * can be queried by update `page.after` to the returned cursor while keeping the
2356
2539
  * `page.before` cursor from the first range query.
2357
2540
  *
2358
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2359
- * encoded with the cursor. The pagination request will be invalid if
2541
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2542
+ * encoded with the cursor. The pagination request will be invalid if
2360
2543
  * `filter` or `sort` is set. The columns returned and page size can be changed
2361
2544
  * anytime by passing the `columns` or `page.size` settings to the next query.
2362
2545
  *
@@ -2447,6 +2630,10 @@ declare const operationsByTag: {
2447
2630
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2448
2631
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2449
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>;
2450
2637
  };
2451
2638
  branch: {
2452
2639
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
@@ -2542,6 +2729,10 @@ declare class DatabaseApi {
2542
2729
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2543
2730
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2544
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>;
2545
2736
  }
2546
2737
  declare class BranchApi {
2547
2738
  private extraProps;
@@ -3286,4 +3477,4 @@ declare class XataError extends Error {
3286
3477
  constructor(message: string, status: number);
3287
3478
  }
3288
3479
 
3289
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, 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, 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, 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, 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 };
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
- return require("child_process").execSync("git branch --show-current", { encoding: "utf-8" }).trim();
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",
@@ -376,7 +387,15 @@ const operationsByTag = {
376
387
  resendWorkspaceMemberInvite,
377
388
  acceptWorkspaceMemberInvite
378
389
  },
379
- database: { getDatabaseList, createDatabase, deleteDatabase },
390
+ database: {
391
+ getDatabaseList,
392
+ createDatabase,
393
+ deleteDatabase,
394
+ getGitBranchesMapping,
395
+ addGitBranchesEntry,
396
+ removeGitBranchesEntry,
397
+ resolveBranch
398
+ },
380
399
  branch: {
381
400
  getBranchList,
382
401
  getBranchDetails,
@@ -636,6 +655,33 @@ class DatabaseApi {
636
655
  ...this.extraProps
637
656
  });
638
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
+ }
639
685
  }
640
686
  class BranchApi {
641
687
  constructor(extraProps) {
@@ -1803,5 +1849,5 @@ class XataError extends Error {
1803
1849
  }
1804
1850
  }
1805
1851
 
1806
- 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, 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 };
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 };
1807
1853
  //# sourceMappingURL=index.mjs.map