@xata.io/client 0.0.0-alpha.vf7b5320 → 0.0.0-alpha.vf9819fa
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 +18 -0
- package/dist/index.cjs +12 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +88 -75
- package/dist/index.mjs +12 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -1158,7 +1158,7 @@ declare type ResolveBranchVariables = {
|
|
1158
1158
|
* Example call:
|
1159
1159
|
*
|
1160
1160
|
* ```json
|
1161
|
-
* // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test
|
1161
|
+
* // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
|
1162
1162
|
* ```
|
1163
1163
|
*
|
1164
1164
|
* Example response:
|
@@ -1458,8 +1458,9 @@ declare type UpdateTableVariables = {
|
|
1458
1458
|
*
|
1459
1459
|
* In the example below, we rename a table from “users” to “people”:
|
1460
1460
|
*
|
1461
|
-
* ```
|
1462
|
-
* PATCH /db/test:main/tables/users
|
1461
|
+
* ```json
|
1462
|
+
* // PATCH /db/test:main/tables/users
|
1463
|
+
*
|
1463
1464
|
* {
|
1464
1465
|
* "name": "people"
|
1465
1466
|
* }
|
@@ -1867,7 +1868,7 @@ declare type QueryTableVariables = {
|
|
1867
1868
|
* {
|
1868
1869
|
* "columns": [...],
|
1869
1870
|
* "filter": {
|
1870
|
-
* "$all": [...]
|
1871
|
+
* "$all": [...],
|
1871
1872
|
* "$any": [...]
|
1872
1873
|
* ...
|
1873
1874
|
* },
|
@@ -2005,7 +2006,7 @@ declare type QueryTableVariables = {
|
|
2005
2006
|
* {
|
2006
2007
|
* "name": "Kilian",
|
2007
2008
|
* "address": {
|
2008
|
-
* "street": "New street"
|
2009
|
+
* "street": "New street"
|
2009
2010
|
* }
|
2010
2011
|
* }
|
2011
2012
|
* ```
|
@@ -2014,10 +2015,7 @@ declare type QueryTableVariables = {
|
|
2014
2015
|
*
|
2015
2016
|
* ```json
|
2016
2017
|
* {
|
2017
|
-
* "columns": [
|
2018
|
-
* "*",
|
2019
|
-
* "team.name"
|
2020
|
-
* ]
|
2018
|
+
* "columns": ["*", "team.name"]
|
2021
2019
|
* }
|
2022
2020
|
* ```
|
2023
2021
|
*
|
@@ -2035,7 +2033,7 @@ declare type QueryTableVariables = {
|
|
2035
2033
|
* "team": {
|
2036
2034
|
* "id": "XX",
|
2037
2035
|
* "xata": {
|
2038
|
-
* "version": 0
|
2036
|
+
* "version": 0
|
2039
2037
|
* },
|
2040
2038
|
* "name": "first team"
|
2041
2039
|
* }
|
@@ -2046,10 +2044,7 @@ declare type QueryTableVariables = {
|
|
2046
2044
|
*
|
2047
2045
|
* ```json
|
2048
2046
|
* {
|
2049
|
-
* "columns": [
|
2050
|
-
* "*",
|
2051
|
-
* "team.*"
|
2052
|
-
* ]
|
2047
|
+
* "columns": ["*", "team.*"]
|
2053
2048
|
* }
|
2054
2049
|
* ```
|
2055
2050
|
*
|
@@ -2067,7 +2062,7 @@ declare type QueryTableVariables = {
|
|
2067
2062
|
* "team": {
|
2068
2063
|
* "id": "XX",
|
2069
2064
|
* "xata": {
|
2070
|
-
* "version": 0
|
2065
|
+
* "version": 0
|
2071
2066
|
* },
|
2072
2067
|
* "name": "first team",
|
2073
2068
|
* "code": "A1",
|
@@ -2117,7 +2112,7 @@ declare type QueryTableVariables = {
|
|
2117
2112
|
* ```json
|
2118
2113
|
* {
|
2119
2114
|
* "filter": {
|
2120
|
-
*
|
2115
|
+
* "name": "r2"
|
2121
2116
|
* }
|
2122
2117
|
* }
|
2123
2118
|
* ```
|
@@ -2139,7 +2134,7 @@ declare type QueryTableVariables = {
|
|
2139
2134
|
* ```json
|
2140
2135
|
* {
|
2141
2136
|
* "filter": {
|
2142
|
-
*
|
2137
|
+
* "settings.plan": "free"
|
2143
2138
|
* }
|
2144
2139
|
* }
|
2145
2140
|
* ```
|
@@ -2149,8 +2144,8 @@ declare type QueryTableVariables = {
|
|
2149
2144
|
* "filter": {
|
2150
2145
|
* "settings": {
|
2151
2146
|
* "plan": "free"
|
2152
|
-
* }
|
2153
|
-
* }
|
2147
|
+
* }
|
2148
|
+
* }
|
2154
2149
|
* }
|
2155
2150
|
* ```
|
2156
2151
|
*
|
@@ -2159,8 +2154,8 @@ declare type QueryTableVariables = {
|
|
2159
2154
|
* ```json
|
2160
2155
|
* {
|
2161
2156
|
* "filter": {
|
2162
|
-
* "settings.plan": {"$any": ["free", "paid"]}
|
2163
|
-
* }
|
2157
|
+
* "settings.plan": { "$any": ["free", "paid"] }
|
2158
|
+
* }
|
2164
2159
|
* }
|
2165
2160
|
* ```
|
2166
2161
|
*
|
@@ -2169,9 +2164,9 @@ declare type QueryTableVariables = {
|
|
2169
2164
|
* ```json
|
2170
2165
|
* {
|
2171
2166
|
* "filter": {
|
2172
|
-
*
|
2173
|
-
*
|
2174
|
-
* }
|
2167
|
+
* "settings.dark": true,
|
2168
|
+
* "settings.plan": "free"
|
2169
|
+
* }
|
2175
2170
|
* }
|
2176
2171
|
* ```
|
2177
2172
|
*
|
@@ -2182,11 +2177,11 @@ declare type QueryTableVariables = {
|
|
2182
2177
|
* ```json
|
2183
2178
|
* {
|
2184
2179
|
* "filter": {
|
2185
|
-
*
|
2186
|
-
*
|
2187
|
-
*
|
2188
|
-
*
|
2189
|
-
* }
|
2180
|
+
* "$any": {
|
2181
|
+
* "settings.dark": true,
|
2182
|
+
* "settings.plan": "free"
|
2183
|
+
* }
|
2184
|
+
* }
|
2190
2185
|
* }
|
2191
2186
|
* ```
|
2192
2187
|
*
|
@@ -2197,10 +2192,10 @@ declare type QueryTableVariables = {
|
|
2197
2192
|
* "filter": {
|
2198
2193
|
* "$any": [
|
2199
2194
|
* {
|
2200
|
-
* "name": "r1"
|
2195
|
+
* "name": "r1"
|
2201
2196
|
* },
|
2202
2197
|
* {
|
2203
|
-
* "name": "r2"
|
2198
|
+
* "name": "r2"
|
2204
2199
|
* }
|
2205
2200
|
* ]
|
2206
2201
|
* }
|
@@ -2212,7 +2207,7 @@ declare type QueryTableVariables = {
|
|
2212
2207
|
* ```json
|
2213
2208
|
* {
|
2214
2209
|
* "filter": {
|
2215
|
-
* "$exists": "settings"
|
2210
|
+
* "$exists": "settings"
|
2216
2211
|
* }
|
2217
2212
|
* }
|
2218
2213
|
* ```
|
@@ -2224,10 +2219,10 @@ declare type QueryTableVariables = {
|
|
2224
2219
|
* "filter": {
|
2225
2220
|
* "$all": [
|
2226
2221
|
* {
|
2227
|
-
* "$exists": "settings"
|
2222
|
+
* "$exists": "settings"
|
2228
2223
|
* },
|
2229
2224
|
* {
|
2230
|
-
* "$exists": "name"
|
2225
|
+
* "$exists": "name"
|
2231
2226
|
* }
|
2232
2227
|
* ]
|
2233
2228
|
* }
|
@@ -2239,7 +2234,7 @@ declare type QueryTableVariables = {
|
|
2239
2234
|
* ```json
|
2240
2235
|
* {
|
2241
2236
|
* "filter": {
|
2242
|
-
* "$notExists": "settings"
|
2237
|
+
* "$notExists": "settings"
|
2243
2238
|
* }
|
2244
2239
|
* }
|
2245
2240
|
* ```
|
@@ -2266,7 +2261,7 @@ declare type QueryTableVariables = {
|
|
2266
2261
|
* {
|
2267
2262
|
* "filter": {
|
2268
2263
|
* "<column_name>": {
|
2269
|
-
*
|
2264
|
+
* "$pattern": "v*alue*"
|
2270
2265
|
* }
|
2271
2266
|
* }
|
2272
2267
|
* }
|
@@ -2278,10 +2273,10 @@ declare type QueryTableVariables = {
|
|
2278
2273
|
* {
|
2279
2274
|
* "filter": {
|
2280
2275
|
* "<column_name>": {
|
2281
|
-
*
|
2276
|
+
* "$endsWith": ".gz"
|
2282
2277
|
* },
|
2283
2278
|
* "<column_name>": {
|
2284
|
-
*
|
2279
|
+
* "$startsWith": "tmp-"
|
2285
2280
|
* }
|
2286
2281
|
* }
|
2287
2282
|
* }
|
@@ -2292,10 +2287,10 @@ declare type QueryTableVariables = {
|
|
2292
2287
|
* ```json
|
2293
2288
|
* {
|
2294
2289
|
* "filter": {
|
2295
|
-
*
|
2296
|
-
*
|
2297
|
-
*
|
2298
|
-
*
|
2290
|
+
* "<column_name>": {
|
2291
|
+
* "$ge": 0,
|
2292
|
+
* "$lt": 100
|
2293
|
+
* }
|
2299
2294
|
* }
|
2300
2295
|
* }
|
2301
2296
|
* ```
|
@@ -2313,7 +2308,6 @@ declare type QueryTableVariables = {
|
|
2313
2308
|
* ```
|
2314
2309
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
2315
2310
|
*
|
2316
|
-
*
|
2317
2311
|
* #### Negations
|
2318
2312
|
*
|
2319
2313
|
* A general `$not` operator can inverse any operation.
|
@@ -2338,15 +2332,21 @@ declare type QueryTableVariables = {
|
|
2338
2332
|
* {
|
2339
2333
|
* "filter": {
|
2340
2334
|
* "$not": {
|
2341
|
-
* "$any": [
|
2342
|
-
*
|
2343
|
-
*
|
2344
|
-
*
|
2345
|
-
*
|
2346
|
-
*
|
2347
|
-
*
|
2348
|
-
*
|
2349
|
-
*
|
2335
|
+
* "$any": [
|
2336
|
+
* {
|
2337
|
+
* "<column_name1>": "value1"
|
2338
|
+
* },
|
2339
|
+
* {
|
2340
|
+
* "$all": [
|
2341
|
+
* {
|
2342
|
+
* "<column_name2>": "value2"
|
2343
|
+
* },
|
2344
|
+
* {
|
2345
|
+
* "<column_name3>": "value3"
|
2346
|
+
* }
|
2347
|
+
* ]
|
2348
|
+
* }
|
2349
|
+
* ]
|
2350
2350
|
* }
|
2351
2351
|
* }
|
2352
2352
|
* }
|
@@ -2401,8 +2401,8 @@ declare type QueryTableVariables = {
|
|
2401
2401
|
* "<array name>": {
|
2402
2402
|
* "$includes": {
|
2403
2403
|
* "$all": [
|
2404
|
-
* {"$contains": "label"},
|
2405
|
-
* {"$not": {"$endsWith": "-debug"}}
|
2404
|
+
* { "$contains": "label" },
|
2405
|
+
* { "$not": { "$endsWith": "-debug" } }
|
2406
2406
|
* ]
|
2407
2407
|
* }
|
2408
2408
|
* }
|
@@ -2422,9 +2422,7 @@ declare type QueryTableVariables = {
|
|
2422
2422
|
* {
|
2423
2423
|
* "filter": {
|
2424
2424
|
* "settings.labels": {
|
2425
|
-
* "$includesAll": [
|
2426
|
-
* {"$contains": "label"},
|
2427
|
-
* ]
|
2425
|
+
* "$includesAll": [{ "$contains": "label" }]
|
2428
2426
|
* }
|
2429
2427
|
* }
|
2430
2428
|
* }
|
@@ -2472,7 +2470,6 @@ declare type QueryTableVariables = {
|
|
2472
2470
|
* }
|
2473
2471
|
* ```
|
2474
2472
|
*
|
2475
|
-
*
|
2476
2473
|
* ### Pagination
|
2477
2474
|
*
|
2478
2475
|
* We offer cursor pagination and offset pagination. The offset pagination is limited
|
@@ -2538,8 +2535,8 @@ declare type QueryTableVariables = {
|
|
2538
2535
|
* can be queried by update `page.after` to the returned cursor while keeping the
|
2539
2536
|
* `page.before` cursor from the first range query.
|
2540
2537
|
*
|
2541
|
-
* The `filter` , `columns`,
|
2542
|
-
* encoded with the cursor.
|
2538
|
+
* The `filter` , `columns`, `sort` , and `page.size` configuration will be
|
2539
|
+
* encoded with the cursor. The pagination request will be invalid if
|
2543
2540
|
* `filter` or `sort` is set. The columns returned and page size can be changed
|
2544
2541
|
* anytime by passing the `columns` or `page.size` settings to the next query.
|
2545
2542
|
*
|
@@ -2794,6 +2791,7 @@ declare type RequiredBy<T, K extends keyof T> = T & {
|
|
2794
2791
|
};
|
2795
2792
|
declare type GetArrayInnerType<T extends readonly any[]> = T[number];
|
2796
2793
|
declare type SingleOrArray<T> = T | T[];
|
2794
|
+
declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
|
2797
2795
|
|
2798
2796
|
declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
|
2799
2797
|
declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
|
@@ -2988,13 +2986,21 @@ declare type SortFilterBase<T extends XataRecord> = {
|
|
2988
2986
|
[Key in StringKeys<T>]: SortDirection;
|
2989
2987
|
};
|
2990
2988
|
|
2991
|
-
declare type
|
2992
|
-
pagination?: PaginationOptions;
|
2989
|
+
declare type BaseOptions<T extends XataRecord> = {
|
2993
2990
|
columns?: NonEmptyArray<SelectableColumn<T>>;
|
2991
|
+
cache?: number;
|
2992
|
+
};
|
2993
|
+
declare type CursorQueryOptions = {
|
2994
|
+
pagination?: CursorNavigationOptions & OffsetNavigationOptions;
|
2995
|
+
filter?: never;
|
2996
|
+
sort?: never;
|
2997
|
+
};
|
2998
|
+
declare type OffsetQueryOptions<T extends XataRecord> = {
|
2999
|
+
pagination?: OffsetNavigationOptions;
|
2994
3000
|
filter?: FilterExpression;
|
2995
3001
|
sort?: SortFilter<T> | SortFilter<T>[];
|
2996
|
-
cache?: number;
|
2997
3002
|
};
|
3003
|
+
declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
|
2998
3004
|
/**
|
2999
3005
|
* Query objects contain the information of all filters, sorting, etc. to be included in the database query.
|
3000
3006
|
*
|
@@ -3063,19 +3069,23 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
3063
3069
|
*/
|
3064
3070
|
select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
|
3065
3071
|
getPaginated(): Promise<Page<Record, Result>>;
|
3066
|
-
getPaginated(options:
|
3072
|
+
getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
|
3067
3073
|
getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
|
3068
3074
|
[Symbol.asyncIterator](): AsyncIterableIterator<Result>;
|
3069
|
-
getIterator(
|
3070
|
-
getIterator(
|
3071
|
-
|
3075
|
+
getIterator(): AsyncGenerator<Result[]>;
|
3076
|
+
getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
|
3077
|
+
batchSize?: number;
|
3078
|
+
}): AsyncGenerator<Result[]>;
|
3079
|
+
getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
|
3080
|
+
batchSize?: number;
|
3081
|
+
}>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
|
3072
3082
|
/**
|
3073
3083
|
* Performs the query in the database and returns a set of results.
|
3074
3084
|
* @param options Additional options to be used when performing the query.
|
3075
3085
|
* @returns An array of records from the database.
|
3076
3086
|
*/
|
3077
3087
|
getMany(): Promise<Result[]>;
|
3078
|
-
getMany(options:
|
3088
|
+
getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
|
3079
3089
|
getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
|
3080
3090
|
/**
|
3081
3091
|
* Performs the query in the database and returns all the results.
|
@@ -3083,17 +3093,21 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
3083
3093
|
* @param options Additional options to be used when performing the query.
|
3084
3094
|
* @returns An array of records from the database.
|
3085
3095
|
*/
|
3086
|
-
getAll(
|
3087
|
-
getAll(
|
3088
|
-
|
3096
|
+
getAll(): Promise<Result[]>;
|
3097
|
+
getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
|
3098
|
+
batchSize?: number;
|
3099
|
+
}): Promise<Result[]>;
|
3100
|
+
getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
|
3101
|
+
batchSize?: number;
|
3102
|
+
}>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
|
3089
3103
|
/**
|
3090
3104
|
* Performs the query in the database and returns the first result.
|
3091
3105
|
* @param options Additional options to be used when performing the query.
|
3092
3106
|
* @returns The first record that matches the query, or null if no record matched the query.
|
3093
3107
|
*/
|
3094
3108
|
getFirst(): Promise<Result | null>;
|
3095
|
-
getFirst(options:
|
3096
|
-
getFirst<Options extends RequiredBy<
|
3109
|
+
getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
|
3110
|
+
getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
|
3097
3111
|
/**
|
3098
3112
|
* Builds a new query object adding a cache TTL in milliseconds.
|
3099
3113
|
* @param ttl The cache TTL in milliseconds.
|
@@ -3183,7 +3197,6 @@ declare type OffsetNavigationOptions = {
|
|
3183
3197
|
size?: number;
|
3184
3198
|
offset?: number;
|
3185
3199
|
};
|
3186
|
-
declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
|
3187
3200
|
declare const PAGINATION_MAX_SIZE = 200;
|
3188
3201
|
declare const PAGINATION_DEFAULT_SIZE = 200;
|
3189
3202
|
declare const PAGINATION_MAX_OFFSET = 800;
|
@@ -3470,4 +3483,4 @@ declare class XataError extends Error {
|
|
3470
3483
|
constructor(message: string, status: number);
|
3471
3484
|
}
|
3472
3485
|
|
3473
|
-
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable,
|
3486
|
+
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, 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
@@ -699,10 +699,10 @@ class BranchApi {
|
|
699
699
|
...this.extraProps
|
700
700
|
});
|
701
701
|
}
|
702
|
-
createBranch(workspace, database, branch, from
|
702
|
+
createBranch(workspace, database, branch, from, options = {}) {
|
703
703
|
return operationsByTag.branch.createBranch({
|
704
704
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
705
|
-
queryParams: { from },
|
705
|
+
queryParams: isString(from) ? { from } : void 0,
|
706
706
|
body: options,
|
707
707
|
...this.extraProps
|
708
708
|
});
|
@@ -1048,17 +1048,18 @@ const _Query = class {
|
|
1048
1048
|
return __privateGet$5(this, _repository).query(query);
|
1049
1049
|
}
|
1050
1050
|
async *[Symbol.asyncIterator]() {
|
1051
|
-
for await (const [record] of this.getIterator(1)) {
|
1051
|
+
for await (const [record] of this.getIterator({ batchSize: 1 })) {
|
1052
1052
|
yield record;
|
1053
1053
|
}
|
1054
1054
|
}
|
1055
|
-
async *getIterator(
|
1055
|
+
async *getIterator(options = {}) {
|
1056
|
+
const { batchSize = 1 } = options;
|
1056
1057
|
let offset = 0;
|
1057
1058
|
let end = false;
|
1058
1059
|
while (!end) {
|
1059
|
-
const { records, meta } = await this.getPaginated({ ...options, pagination: { size:
|
1060
|
+
const { records, meta } = await this.getPaginated({ ...options, pagination: { size: batchSize, offset } });
|
1060
1061
|
yield records;
|
1061
|
-
offset +=
|
1062
|
+
offset += batchSize;
|
1062
1063
|
end = !meta.page.more;
|
1063
1064
|
}
|
1064
1065
|
}
|
@@ -1066,9 +1067,10 @@ const _Query = class {
|
|
1066
1067
|
const { records } = await this.getPaginated(options);
|
1067
1068
|
return records;
|
1068
1069
|
}
|
1069
|
-
async getAll(
|
1070
|
+
async getAll(options = {}) {
|
1071
|
+
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
1070
1072
|
const results = [];
|
1071
|
-
for await (const page of this.getIterator(
|
1073
|
+
for await (const page of this.getIterator({ ...rest, batchSize })) {
|
1072
1074
|
results.push(...page);
|
1073
1075
|
}
|
1074
1076
|
return results;
|
@@ -1449,8 +1451,8 @@ getCacheQuery_fn = async function(query) {
|
|
1449
1451
|
if (!result)
|
1450
1452
|
return null;
|
1451
1453
|
const { cache: ttl = __privateGet$4(this, _cache).defaultQueryTTL } = query.getQueryOptions();
|
1452
|
-
if (
|
1453
|
-
return
|
1454
|
+
if (ttl < 0)
|
1455
|
+
return null;
|
1454
1456
|
const hasExpired = result.date.getTime() + ttl < Date.now();
|
1455
1457
|
return hasExpired ? null : result;
|
1456
1458
|
};
|