@xata.io/client 0.9.1 → 0.10.2

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
@@ -268,6 +268,17 @@ declare type SortExpression = string[] | {
268
268
  [key: string]: SortOrder;
269
269
  }[];
270
270
  declare type SortOrder = 'asc' | 'desc';
271
+ /**
272
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
273
+ * distance is the number of one charcter changes needed to make two strings equal. The default is 1, meaning that single
274
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
275
+ * to allow two typos in a word.
276
+ *
277
+ * @default 1
278
+ * @maximum 2
279
+ * @minimum 0
280
+ */
281
+ declare type FuzzinessExpression = number;
271
282
  /**
272
283
  * @minProperties 1
273
284
  */
@@ -409,6 +420,7 @@ type schemas_TableMigration = TableMigration;
409
420
  type schemas_ColumnMigration = ColumnMigration;
410
421
  type schemas_SortExpression = SortExpression;
411
422
  type schemas_SortOrder = SortOrder;
423
+ type schemas_FuzzinessExpression = FuzzinessExpression;
412
424
  type schemas_FilterExpression = FilterExpression;
413
425
  type schemas_FilterList = FilterList;
414
426
  type schemas_FilterColumn = FilterColumn;
@@ -462,6 +474,7 @@ declare namespace schemas {
462
474
  schemas_ColumnMigration as ColumnMigration,
463
475
  schemas_SortExpression as SortExpression,
464
476
  schemas_SortOrder as SortOrder,
477
+ schemas_FuzzinessExpression as FuzzinessExpression,
465
478
  schemas_FilterExpression as FilterExpression,
466
479
  schemas_FilterList as FilterList,
467
480
  schemas_FilterColumn as FilterColumn,
@@ -1151,14 +1164,15 @@ declare type ResolveBranchVariables = {
1151
1164
  } & FetcherExtraProps;
1152
1165
  /**
1153
1166
  * 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
1167
+ * * if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned
1155
1168
  * * 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)
1169
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1170
+ * * else, return the default branch of the DB (`main` or the first branch)
1157
1171
  *
1158
1172
  * Example call:
1159
1173
  *
1160
1174
  * ```json
1161
- * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test?fallbackBranch=tsg
1175
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1162
1176
  * ```
1163
1177
  *
1164
1178
  * Example response:
@@ -1458,8 +1472,9 @@ declare type UpdateTableVariables = {
1458
1472
  *
1459
1473
  * In the example below, we rename a table from “users” to “people”:
1460
1474
  *
1461
- * ```jsx
1462
- * PATCH /db/test:main/tables/users
1475
+ * ```json
1476
+ * // PATCH /db/test:main/tables/users
1477
+ *
1463
1478
  * {
1464
1479
  * "name": "people"
1465
1480
  * }
@@ -1867,7 +1882,7 @@ declare type QueryTableVariables = {
1867
1882
  * {
1868
1883
  * "columns": [...],
1869
1884
  * "filter": {
1870
- * "$all": [...]
1885
+ * "$all": [...],
1871
1886
  * "$any": [...]
1872
1887
  * ...
1873
1888
  * },
@@ -2005,7 +2020,7 @@ declare type QueryTableVariables = {
2005
2020
  * {
2006
2021
  * "name": "Kilian",
2007
2022
  * "address": {
2008
- * "street": "New street",
2023
+ * "street": "New street"
2009
2024
  * }
2010
2025
  * }
2011
2026
  * ```
@@ -2014,10 +2029,7 @@ declare type QueryTableVariables = {
2014
2029
  *
2015
2030
  * ```json
2016
2031
  * {
2017
- * "columns": [
2018
- * "*",
2019
- * "team.name"
2020
- * ]
2032
+ * "columns": ["*", "team.name"]
2021
2033
  * }
2022
2034
  * ```
2023
2035
  *
@@ -2035,7 +2047,7 @@ declare type QueryTableVariables = {
2035
2047
  * "team": {
2036
2048
  * "id": "XX",
2037
2049
  * "xata": {
2038
- * "version": 0,
2050
+ * "version": 0
2039
2051
  * },
2040
2052
  * "name": "first team"
2041
2053
  * }
@@ -2046,10 +2058,7 @@ declare type QueryTableVariables = {
2046
2058
  *
2047
2059
  * ```json
2048
2060
  * {
2049
- * "columns": [
2050
- * "*",
2051
- * "team.*"
2052
- * ]
2061
+ * "columns": ["*", "team.*"]
2053
2062
  * }
2054
2063
  * ```
2055
2064
  *
@@ -2067,7 +2076,7 @@ declare type QueryTableVariables = {
2067
2076
  * "team": {
2068
2077
  * "id": "XX",
2069
2078
  * "xata": {
2070
- * "version": 0,
2079
+ * "version": 0
2071
2080
  * },
2072
2081
  * "name": "first team",
2073
2082
  * "code": "A1",
@@ -2117,7 +2126,7 @@ declare type QueryTableVariables = {
2117
2126
  * ```json
2118
2127
  * {
2119
2128
  * "filter": {
2120
- * "name": "r2",
2129
+ * "name": "r2"
2121
2130
  * }
2122
2131
  * }
2123
2132
  * ```
@@ -2139,7 +2148,7 @@ declare type QueryTableVariables = {
2139
2148
  * ```json
2140
2149
  * {
2141
2150
  * "filter": {
2142
- * "settings.plan": "free",
2151
+ * "settings.plan": "free"
2143
2152
  * }
2144
2153
  * }
2145
2154
  * ```
@@ -2149,8 +2158,8 @@ declare type QueryTableVariables = {
2149
2158
  * "filter": {
2150
2159
  * "settings": {
2151
2160
  * "plan": "free"
2152
- * },
2153
- * },
2161
+ * }
2162
+ * }
2154
2163
  * }
2155
2164
  * ```
2156
2165
  *
@@ -2159,8 +2168,8 @@ declare type QueryTableVariables = {
2159
2168
  * ```json
2160
2169
  * {
2161
2170
  * "filter": {
2162
- * "settings.plan": {"$any": ["free", "paid"]}
2163
- * },
2171
+ * "settings.plan": { "$any": ["free", "paid"] }
2172
+ * }
2164
2173
  * }
2165
2174
  * ```
2166
2175
  *
@@ -2169,9 +2178,9 @@ declare type QueryTableVariables = {
2169
2178
  * ```json
2170
2179
  * {
2171
2180
  * "filter": {
2172
- * "settings.dark": true,
2173
- * "settings.plan": "free",
2174
- * },
2181
+ * "settings.dark": true,
2182
+ * "settings.plan": "free"
2183
+ * }
2175
2184
  * }
2176
2185
  * ```
2177
2186
  *
@@ -2182,11 +2191,11 @@ declare type QueryTableVariables = {
2182
2191
  * ```json
2183
2192
  * {
2184
2193
  * "filter": {
2185
- * "$any": {
2186
- * "settings.dark": true,
2187
- * "settings.plan": "free"
2188
- * }
2189
- * },
2194
+ * "$any": {
2195
+ * "settings.dark": true,
2196
+ * "settings.plan": "free"
2197
+ * }
2198
+ * }
2190
2199
  * }
2191
2200
  * ```
2192
2201
  *
@@ -2197,10 +2206,10 @@ declare type QueryTableVariables = {
2197
2206
  * "filter": {
2198
2207
  * "$any": [
2199
2208
  * {
2200
- * "name": "r1",
2209
+ * "name": "r1"
2201
2210
  * },
2202
2211
  * {
2203
- * "name": "r2",
2212
+ * "name": "r2"
2204
2213
  * }
2205
2214
  * ]
2206
2215
  * }
@@ -2212,7 +2221,7 @@ declare type QueryTableVariables = {
2212
2221
  * ```json
2213
2222
  * {
2214
2223
  * "filter": {
2215
- * "$exists": "settings",
2224
+ * "$exists": "settings"
2216
2225
  * }
2217
2226
  * }
2218
2227
  * ```
@@ -2224,10 +2233,10 @@ declare type QueryTableVariables = {
2224
2233
  * "filter": {
2225
2234
  * "$all": [
2226
2235
  * {
2227
- * "$exists": "settings",
2236
+ * "$exists": "settings"
2228
2237
  * },
2229
2238
  * {
2230
- * "$exists": "name",
2239
+ * "$exists": "name"
2231
2240
  * }
2232
2241
  * ]
2233
2242
  * }
@@ -2239,7 +2248,7 @@ declare type QueryTableVariables = {
2239
2248
  * ```json
2240
2249
  * {
2241
2250
  * "filter": {
2242
- * "$notExists": "settings",
2251
+ * "$notExists": "settings"
2243
2252
  * }
2244
2253
  * }
2245
2254
  * ```
@@ -2266,22 +2275,28 @@ declare type QueryTableVariables = {
2266
2275
  * {
2267
2276
  * "filter": {
2268
2277
  * "<column_name>": {
2269
- * "$pattern": "v*alue*"
2278
+ * "$pattern": "v*alu?"
2270
2279
  * }
2271
2280
  * }
2272
2281
  * }
2273
2282
  * ```
2274
2283
  *
2284
+ * The `$pattern` operator accepts two wildcard characters:
2285
+ * * `*` matches zero or more characters
2286
+ * * `?` matches exactly one character
2287
+ *
2288
+ * If you want to match a string that contains a wildcard character, you can escape them using a backslash (`\`). You can escape a backslash by usign another backslash.
2289
+ *
2275
2290
  * We could also have `$endsWith` and `$startsWith` operators:
2276
2291
  *
2277
2292
  * ```json
2278
2293
  * {
2279
2294
  * "filter": {
2280
2295
  * "<column_name>": {
2281
- * "$endsWith": ".gz"
2296
+ * "$endsWith": ".gz"
2282
2297
  * },
2283
2298
  * "<column_name>": {
2284
- * "$startsWith": "tmp-"
2299
+ * "$startsWith": "tmp-"
2285
2300
  * }
2286
2301
  * }
2287
2302
  * }
@@ -2292,10 +2307,10 @@ declare type QueryTableVariables = {
2292
2307
  * ```json
2293
2308
  * {
2294
2309
  * "filter": {
2295
- * "<column_name>": {
2296
- * "$ge": 0,
2297
- * "$lt": 100
2298
- * }
2310
+ * "<column_name>": {
2311
+ * "$ge": 0,
2312
+ * "$lt": 100
2313
+ * }
2299
2314
  * }
2300
2315
  * }
2301
2316
  * ```
@@ -2313,7 +2328,6 @@ declare type QueryTableVariables = {
2313
2328
  * ```
2314
2329
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2315
2330
  *
2316
- *
2317
2331
  * #### Negations
2318
2332
  *
2319
2333
  * A general `$not` operator can inverse any operation.
@@ -2338,15 +2352,21 @@ declare type QueryTableVariables = {
2338
2352
  * {
2339
2353
  * "filter": {
2340
2354
  * "$not": {
2341
- * "$any": [{
2342
- * "<column_name1>": "value1"
2343
- * }, {
2344
- * "$all": [{
2345
- * "<column_name2>": "value2"
2346
- * }, {
2347
- * "<column_name3>": "value3"
2348
- * }]
2349
- * }]
2355
+ * "$any": [
2356
+ * {
2357
+ * "<column_name1>": "value1"
2358
+ * },
2359
+ * {
2360
+ * "$all": [
2361
+ * {
2362
+ * "<column_name2>": "value2"
2363
+ * },
2364
+ * {
2365
+ * "<column_name3>": "value3"
2366
+ * }
2367
+ * ]
2368
+ * }
2369
+ * ]
2350
2370
  * }
2351
2371
  * }
2352
2372
  * }
@@ -2401,8 +2421,8 @@ declare type QueryTableVariables = {
2401
2421
  * "<array name>": {
2402
2422
  * "$includes": {
2403
2423
  * "$all": [
2404
- * {"$contains": "label"},
2405
- * {"$not": {"$endsWith": "-debug"}}
2424
+ * { "$contains": "label" },
2425
+ * { "$not": { "$endsWith": "-debug" } }
2406
2426
  * ]
2407
2427
  * }
2408
2428
  * }
@@ -2422,9 +2442,7 @@ declare type QueryTableVariables = {
2422
2442
  * {
2423
2443
  * "filter": {
2424
2444
  * "settings.labels": {
2425
- * "$includesAll": [
2426
- * {"$contains": "label"},
2427
- * ]
2445
+ * "$includesAll": [{ "$contains": "label" }]
2428
2446
  * }
2429
2447
  * }
2430
2448
  * }
@@ -2472,7 +2490,6 @@ declare type QueryTableVariables = {
2472
2490
  * }
2473
2491
  * ```
2474
2492
  *
2475
- *
2476
2493
  * ### Pagination
2477
2494
  *
2478
2495
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2538,8 +2555,8 @@ declare type QueryTableVariables = {
2538
2555
  * can be queried by update `page.after` to the returned cursor while keeping the
2539
2556
  * `page.before` cursor from the first range query.
2540
2557
  *
2541
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2542
- * encoded with the cursor. The pagination request will be invalid if
2558
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2559
+ * encoded with the cursor. The pagination request will be invalid if
2543
2560
  * `filter` or `sort` is set. The columns returned and page size can be changed
2544
2561
  * anytime by passing the `columns` or `page.size` settings to the next query.
2545
2562
  *
@@ -2576,6 +2593,38 @@ declare type QueryTableVariables = {
2576
2593
  * ```
2577
2594
  */
2578
2595
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2596
+ declare type SearchTablePathParams = {
2597
+ dbBranchName: DBBranchName;
2598
+ tableName: TableName;
2599
+ workspace: string;
2600
+ };
2601
+ declare type SearchTableError = ErrorWrapper<{
2602
+ status: 400;
2603
+ payload: BadRequestError;
2604
+ } | {
2605
+ status: 401;
2606
+ payload: AuthError;
2607
+ } | {
2608
+ status: 404;
2609
+ payload: SimpleError;
2610
+ }>;
2611
+ declare type SearchTableRequestBody = {
2612
+ query: string;
2613
+ fuzziness?: FuzzinessExpression;
2614
+ filter?: FilterExpression;
2615
+ };
2616
+ declare type SearchTableVariables = {
2617
+ body: SearchTableRequestBody;
2618
+ pathParams: SearchTablePathParams;
2619
+ } & FetcherExtraProps;
2620
+ /**
2621
+ * Run a free text search operation in a particular table.
2622
+ *
2623
+ * The endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:
2624
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
2625
+ * * filtering on columns of type `multiple` is currently unsupported
2626
+ */
2627
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2579
2628
  declare type SearchBranchPathParams = {
2580
2629
  dbBranchName: DBBranchName;
2581
2630
  workspace: string;
@@ -2593,7 +2642,7 @@ declare type SearchBranchError = ErrorWrapper<{
2593
2642
  declare type SearchBranchRequestBody = {
2594
2643
  tables?: string[];
2595
2644
  query: string;
2596
- fuzziness?: number;
2645
+ fuzziness?: FuzzinessExpression;
2597
2646
  };
2598
2647
  declare type SearchBranchVariables = {
2599
2648
  body: SearchBranchRequestBody;
@@ -2668,6 +2717,7 @@ declare const operationsByTag: {
2668
2717
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2669
2718
  bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2670
2719
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2720
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2671
2721
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2672
2722
  };
2673
2723
  };
@@ -2773,6 +2823,7 @@ declare class RecordsApi {
2773
2823
  getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2774
2824
  bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
2775
2825
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
2826
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2776
2827
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2777
2828
  }
2778
2829
 
@@ -2794,7 +2845,7 @@ declare type RequiredBy<T, K extends keyof T> = T & {
2794
2845
  };
2795
2846
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2796
2847
  declare type SingleOrArray<T> = T | T[];
2797
- declare type Dictionary<T> = Record<string, T>;
2848
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
2798
2849
 
2799
2850
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2800
2851
  declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
@@ -2989,13 +3040,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2989
3040
  [Key in StringKeys<T>]: SortDirection;
2990
3041
  };
2991
3042
 
2992
- declare type QueryOptions<T extends XataRecord> = {
2993
- page?: PaginationOptions;
3043
+ declare type BaseOptions<T extends XataRecord> = {
2994
3044
  columns?: NonEmptyArray<SelectableColumn<T>>;
3045
+ cache?: number;
3046
+ };
3047
+ declare type CursorQueryOptions = {
3048
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3049
+ filter?: never;
3050
+ sort?: never;
3051
+ };
3052
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3053
+ pagination?: OffsetNavigationOptions;
2995
3054
  filter?: FilterExpression;
2996
3055
  sort?: SortFilter<T> | SortFilter<T>[];
2997
- cache?: number;
2998
3056
  };
3057
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2999
3058
  /**
3000
3059
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
3001
3060
  *
@@ -3064,19 +3123,23 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3064
3123
  */
3065
3124
  select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3066
3125
  getPaginated(): Promise<Page<Record, Result>>;
3067
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3126
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3068
3127
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
3069
3128
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
3070
- getIterator(chunk: number): AsyncGenerator<Result[]>;
3071
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
3072
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3129
+ getIterator(): AsyncGenerator<Result[]>;
3130
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3131
+ batchSize?: number;
3132
+ }): AsyncGenerator<Result[]>;
3133
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3134
+ batchSize?: number;
3135
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3073
3136
  /**
3074
3137
  * Performs the query in the database and returns a set of results.
3075
3138
  * @param options Additional options to be used when performing the query.
3076
3139
  * @returns An array of records from the database.
3077
3140
  */
3078
3141
  getMany(): Promise<Result[]>;
3079
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3142
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3080
3143
  getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3081
3144
  /**
3082
3145
  * Performs the query in the database and returns all the results.
@@ -3084,17 +3147,21 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3084
3147
  * @param options Additional options to be used when performing the query.
3085
3148
  * @returns An array of records from the database.
3086
3149
  */
3087
- getAll(chunk?: number): Promise<Result[]>;
3088
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
3089
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3150
+ getAll(): Promise<Result[]>;
3151
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3152
+ batchSize?: number;
3153
+ }): Promise<Result[]>;
3154
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3155
+ batchSize?: number;
3156
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3090
3157
  /**
3091
3158
  * Performs the query in the database and returns the first result.
3092
3159
  * @param options Additional options to be used when performing the query.
3093
3160
  * @returns The first record that matches the query, or null if no record matched the query.
3094
3161
  */
3095
3162
  getFirst(): Promise<Result | null>;
3096
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
3097
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3163
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3164
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3098
3165
  /**
3099
3166
  * Builds a new query object adding a cache TTL in milliseconds.
3100
3167
  * @param ttl The cache TTL in milliseconds.
@@ -3184,14 +3251,11 @@ declare type OffsetNavigationOptions = {
3184
3251
  size?: number;
3185
3252
  offset?: number;
3186
3253
  };
3187
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
3188
3254
  declare const PAGINATION_MAX_SIZE = 200;
3189
3255
  declare const PAGINATION_DEFAULT_SIZE = 200;
3190
3256
  declare const PAGINATION_MAX_OFFSET = 800;
3191
3257
  declare const PAGINATION_DEFAULT_OFFSET = 0;
3192
3258
 
3193
- declare type TableLink = string[];
3194
- declare type LinkDictionary = Dictionary<TableLink[]>;
3195
3259
  /**
3196
3260
  * Common interface for performing operations on a table.
3197
3261
  */
@@ -3289,6 +3353,7 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3289
3353
  */
3290
3354
  abstract search(query: string, options?: {
3291
3355
  fuzziness?: number;
3356
+ filter?: Filter<Record>;
3292
3357
  }): Promise<SelectedPick<Record, ['*']>[]>;
3293
3358
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3294
3359
  }
@@ -3297,7 +3362,6 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
3297
3362
  db: SchemaPluginResult<any>;
3298
3363
  constructor(options: {
3299
3364
  table: string;
3300
- links?: LinkDictionary;
3301
3365
  db: SchemaPluginResult<any>;
3302
3366
  pluginOptions: XataPluginOptions;
3303
3367
  });
@@ -3314,6 +3378,7 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
3314
3378
  delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
3315
3379
  search(query: string, options?: {
3316
3380
  fuzziness?: number;
3381
+ filter?: Filter<Record>;
3317
3382
  }): Promise<SelectedPick<Record, ['*']>[]>;
3318
3383
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3319
3384
  }
@@ -3393,7 +3458,6 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3393
3458
 
3394
3459
  declare type SchemaDefinition = {
3395
3460
  table: string;
3396
- links?: LinkDictionary;
3397
3461
  };
3398
3462
  declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
3399
3463
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
@@ -3402,9 +3466,8 @@ declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
3402
3466
  };
3403
3467
  declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3404
3468
  #private;
3405
- private links?;
3406
3469
  private tableNames?;
3407
- constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
3470
+ constructor(tableNames?: string[] | undefined);
3408
3471
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3409
3472
  }
3410
3473
 
@@ -3426,8 +3489,7 @@ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3426
3489
  declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3427
3490
  #private;
3428
3491
  private db;
3429
- private links;
3430
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3492
+ constructor(db: SchemaPluginResult<Schemas>);
3431
3493
  build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3432
3494
  }
3433
3495
  declare type SearchXataRecord = XataRecord & {
@@ -3450,7 +3512,7 @@ declare type BaseClientOptions = {
3450
3512
  };
3451
3513
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3452
3514
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3453
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
3515
+ new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
3454
3516
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3455
3517
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3456
3518
  }, keyof Plugins> & {
@@ -3477,4 +3539,4 @@ declare class XataError extends Error {
3477
3539
  constructor(message: string, status: number);
3478
3540
  }
3479
3541
 
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 };
3542
+ 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, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, 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, searchTable, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };