@xata.io/client 0.0.0-alpha.vf9d4e41 → 0.0.0-alpha.vfb4479d

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
  */
@@ -281,6 +292,10 @@ declare type FilterExpression = {
281
292
  } & {
282
293
  [key: string]: FilterColumn;
283
294
  };
295
+ declare type HighlightExpression = {
296
+ enabled?: boolean;
297
+ encodeHTML?: boolean;
298
+ };
284
299
  declare type FilterList = FilterExpression | FilterExpression[];
285
300
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
286
301
  /**
@@ -366,6 +381,11 @@ declare type XataRecord$1 = {
366
381
  xata: {
367
382
  version: number;
368
383
  table?: string;
384
+ highlight?: {
385
+ [key: string]: string[] | {
386
+ [key: string]: any;
387
+ };
388
+ };
369
389
  warnings?: string[];
370
390
  };
371
391
  } & {
@@ -409,7 +429,9 @@ type schemas_TableMigration = TableMigration;
409
429
  type schemas_ColumnMigration = ColumnMigration;
410
430
  type schemas_SortExpression = SortExpression;
411
431
  type schemas_SortOrder = SortOrder;
432
+ type schemas_FuzzinessExpression = FuzzinessExpression;
412
433
  type schemas_FilterExpression = FilterExpression;
434
+ type schemas_HighlightExpression = HighlightExpression;
413
435
  type schemas_FilterList = FilterList;
414
436
  type schemas_FilterColumn = FilterColumn;
415
437
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -462,7 +484,9 @@ declare namespace schemas {
462
484
  schemas_ColumnMigration as ColumnMigration,
463
485
  schemas_SortExpression as SortExpression,
464
486
  schemas_SortOrder as SortOrder,
487
+ schemas_FuzzinessExpression as FuzzinessExpression,
465
488
  schemas_FilterExpression as FilterExpression,
489
+ schemas_HighlightExpression as HighlightExpression,
466
490
  schemas_FilterList as FilterList,
467
491
  schemas_FilterColumn as FilterColumn,
468
492
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -2262,12 +2286,18 @@ declare type QueryTableVariables = {
2262
2286
  * {
2263
2287
  * "filter": {
2264
2288
  * "<column_name>": {
2265
- * "$pattern": "v*alue*"
2289
+ * "$pattern": "v*alu?"
2266
2290
  * }
2267
2291
  * }
2268
2292
  * }
2269
2293
  * ```
2270
2294
  *
2295
+ * The `$pattern` operator accepts two wildcard characters:
2296
+ * * `*` matches zero or more characters
2297
+ * * `?` matches exactly one character
2298
+ *
2299
+ * 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.
2300
+ *
2271
2301
  * We could also have `$endsWith` and `$startsWith` operators:
2272
2302
  *
2273
2303
  * ```json
@@ -2574,6 +2604,39 @@ declare type QueryTableVariables = {
2574
2604
  * ```
2575
2605
  */
2576
2606
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2607
+ declare type SearchTablePathParams = {
2608
+ dbBranchName: DBBranchName;
2609
+ tableName: TableName;
2610
+ workspace: string;
2611
+ };
2612
+ declare type SearchTableError = ErrorWrapper<{
2613
+ status: 400;
2614
+ payload: BadRequestError;
2615
+ } | {
2616
+ status: 401;
2617
+ payload: AuthError;
2618
+ } | {
2619
+ status: 404;
2620
+ payload: SimpleError;
2621
+ }>;
2622
+ declare type SearchTableRequestBody = {
2623
+ query: string;
2624
+ fuzziness?: FuzzinessExpression;
2625
+ filter?: FilterExpression;
2626
+ highlight?: HighlightExpression;
2627
+ };
2628
+ declare type SearchTableVariables = {
2629
+ body: SearchTableRequestBody;
2630
+ pathParams: SearchTablePathParams;
2631
+ } & FetcherExtraProps;
2632
+ /**
2633
+ * Run a free text search operation in a particular table.
2634
+ *
2635
+ * 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:
2636
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
2637
+ * * filtering on columns of type `multiple` is currently unsupported
2638
+ */
2639
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2577
2640
  declare type SearchBranchPathParams = {
2578
2641
  dbBranchName: DBBranchName;
2579
2642
  workspace: string;
@@ -2589,9 +2652,13 @@ declare type SearchBranchError = ErrorWrapper<{
2589
2652
  payload: SimpleError;
2590
2653
  }>;
2591
2654
  declare type SearchBranchRequestBody = {
2592
- tables?: string[];
2655
+ tables?: (string | {
2656
+ table: string;
2657
+ filter?: FilterExpression;
2658
+ })[];
2593
2659
  query: string;
2594
- fuzziness?: number;
2660
+ fuzziness?: FuzzinessExpression;
2661
+ highlight?: HighlightExpression;
2595
2662
  };
2596
2663
  declare type SearchBranchVariables = {
2597
2664
  body: SearchBranchRequestBody;
@@ -2666,6 +2733,7 @@ declare const operationsByTag: {
2666
2733
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2667
2734
  bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2668
2735
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2736
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2669
2737
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2670
2738
  };
2671
2739
  };
@@ -2771,6 +2839,7 @@ declare class RecordsApi {
2771
2839
  getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2772
2840
  bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
2773
2841
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
2842
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2774
2843
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2775
2844
  }
2776
2845
 
@@ -2798,24 +2867,25 @@ declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id'
2798
2867
  declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2799
2868
  [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
2800
2869
  }>>;
2801
- declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<O[K] extends XataRecord ? (V extends SelectableColumn<O[K]> ? {
2802
- V: ValueAtColumn<O[K], V>;
2803
- } : never) : O[K]> : never : never;
2870
+ declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<RemoveNullable<O[K]> extends Record<string, any> ? V extends SelectableColumn<RemoveNullable<O[K]>> ? {
2871
+ V: ValueAtColumn<RemoveNullable<O[K]>, V>;
2872
+ } : never : O[K]> : never : never;
2804
2873
  declare type MAX_RECURSION = 5;
2805
2874
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2806
- [K in DataProps<O>]: If<IsArray<NonNullable<O[K]>>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
2807
- If<IsObject<NonNullable<O[K]>>, NonNullable<O[K]> extends XataRecord ? SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]> extends string ? K | `${K}.${SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]>}` : never : `${K}.${StringKeys<NonNullable<O[K]>> | '*'}`, // This allows usage of objects that are not links
2875
+ [K in DataProps<O>]: If<IsArray<RemoveNullable<O[K]>>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
2876
+ If<IsObject<RemoveNullable<O[K]>>, RemoveNullable<O[K]> extends XataRecord ? SelectableColumn<RemoveNullable<O[K]>, [...RecursivePath, O[K]]> extends string ? K | `${K}.${SelectableColumn<RemoveNullable<O[K]>, [...RecursivePath, O[K]]>}` : never : `${K}.${StringKeys<RemoveNullable<O[K]>> | '*'}`, // This allows usage of objects that are not links
2808
2877
  K>>;
2809
2878
  }>, never>;
2810
2879
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2811
2880
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
2812
- [K in N]: M extends SelectableColumn<NonNullable<O[K]>> ? NonNullable<O[K]> extends XataRecord ? ForwardNullable<O[K], NestedValueAtColumn<NonNullable<O[K]>, M> & XataRecord> : ForwardNullable<O[K], NestedValueAtColumn<NonNullable<O[K]>, M>> : unknown;
2881
+ [K in N]: M extends SelectableColumn<RemoveNullable<O[K]>> ? RemoveNullable<O[K]> extends XataRecord ? ForwardNullable<O[K], NestedValueAtColumn<RemoveNullable<O[K]>, M> & XataRecord> : ForwardNullable<O[K], NestedValueAtColumn<RemoveNullable<O[K]>, M>> : unknown;
2813
2882
  } : unknown : Key extends DataProps<O> ? {
2814
- [K in Key]: NonNullable<O[K]> extends XataRecord ? ForwardNullable<O[K], SelectedPick<NonNullable<O[K]>, ['*']>> : O[K];
2883
+ [K in Key]: RemoveNullable<O[K]> extends XataRecord ? ForwardNullable<O[K], SelectedPick<RemoveNullable<O[K]>, ['*']>> : O[K];
2815
2884
  } : Key extends '*' ? {
2816
- [K in StringKeys<O>]: NonNullable<O[K]> extends XataRecord ? ForwardNullable<O[K], Link<NonNullable<O[K]>>> : O[K];
2885
+ [K in StringKeys<O>]: RemoveNullable<O[K]> extends XataRecord ? ForwardNullable<O[K], Link<RemoveNullable<O[K]>>> : O[K];
2817
2886
  } : unknown;
2818
- declare type ForwardNullable<T, R> = T extends NonNullable<T> ? R : R | null;
2887
+ declare type RemoveNullable<T> = T extends null | undefined ? never : T;
2888
+ declare type ForwardNullable<T, R> = T extends RemoveNullable<T> ? R : R | null;
2819
2889
 
2820
2890
  /**
2821
2891
  * Represents an identifiable record from the database.
@@ -2956,8 +3026,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2956
3026
  ],
2957
3027
  }
2958
3028
  */
2959
- declare type AggregatorFilter<Record> = {
2960
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3029
+ declare type AggregatorFilter<T> = {
3030
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2961
3031
  };
2962
3032
  /**
2963
3033
  * Existance filter
@@ -2972,10 +3042,10 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
2972
3042
  * Injects the Api filters on nested properties
2973
3043
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2974
3044
  */
2975
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
3045
+ declare type NestedApiFilter<T> = {
2976
3046
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2977
- } : PropertyFilter<T>;
2978
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3047
+ };
3048
+ declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
2979
3049
 
2980
3050
  declare type SortDirection = 'asc' | 'desc';
2981
3051
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -3012,7 +3082,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3012
3082
  #private;
3013
3083
  readonly meta: PaginationQueryMeta;
3014
3084
  readonly records: Result[];
3015
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3085
+ constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
3016
3086
  getQueryOptions(): QueryOptions<Record>;
3017
3087
  key(): string;
3018
3088
  /**
@@ -3044,18 +3114,28 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3044
3114
  *
3045
3115
  * ```
3046
3116
  * query.filter("columnName", columnValue)
3047
- * query.filter({
3048
- * "columnName": columnValue
3049
- * })
3117
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3118
+ * ```
3119
+ *
3120
+ * @param column The name of the column to filter.
3121
+ * @param value The value to filter.
3122
+ * @returns A new Query object.
3123
+ */
3124
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3125
+ /**
3126
+ * Builds a new query object adding one or more constraints. Examples:
3127
+ *
3128
+ * ```
3129
+ * query.filter({ "columnName": columnValue })
3050
3130
  * query.filter({
3051
3131
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
3052
3132
  * })
3053
3133
  * ```
3054
3134
  *
3135
+ * @param filters A filter object
3055
3136
  * @returns A new Query object.
3056
3137
  */
3057
3138
  filter(filters: Filter<Record>): Query<Record, Result>;
3058
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3059
3139
  /**
3060
3140
  * Builds a new query with a new sort option.
3061
3141
  * @param column The column name.
@@ -3069,45 +3149,114 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3069
3149
  * @returns A new Query object.
3070
3150
  */
3071
3151
  select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3152
+ /**
3153
+ * Get paginated results
3154
+ *
3155
+ * @returns A page of results
3156
+ */
3072
3157
  getPaginated(): Promise<Page<Record, Result>>;
3158
+ /**
3159
+ * Get paginated results
3160
+ *
3161
+ * @param options Pagination options
3162
+ * @returns A page of results
3163
+ */
3073
3164
  getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3165
+ /**
3166
+ * Get paginated results
3167
+ *
3168
+ * @param options Pagination options
3169
+ * @returns A page of results
3170
+ */
3074
3171
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
3172
+ /**
3173
+ * Get results in an iterator
3174
+ *
3175
+ * @async
3176
+ * @returns Async interable of results
3177
+ */
3075
3178
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
3179
+ /**
3180
+ * Build an iterator of results
3181
+ *
3182
+ * @returns Async generator of results array
3183
+ */
3076
3184
  getIterator(): AsyncGenerator<Result[]>;
3185
+ /**
3186
+ * Build an iterator of results
3187
+ *
3188
+ * @param options Pagination options with batchSize
3189
+ * @returns Async generator of results array
3190
+ */
3077
3191
  getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3078
3192
  batchSize?: number;
3079
3193
  }): AsyncGenerator<Result[]>;
3194
+ /**
3195
+ * Build an iterator of results
3196
+ *
3197
+ * @param options Pagination options with batchSize
3198
+ * @returns Async generator of results array
3199
+ */
3080
3200
  getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3081
3201
  batchSize?: number;
3082
3202
  }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3083
3203
  /**
3084
3204
  * Performs the query in the database and returns a set of results.
3085
- * @param options Additional options to be used when performing the query.
3086
3205
  * @returns An array of records from the database.
3087
3206
  */
3088
3207
  getMany(): Promise<Result[]>;
3208
+ /**
3209
+ * Performs the query in the database and returns a set of results.
3210
+ * @param options Additional options to be used when performing the query.
3211
+ * @returns An array of records from the database.
3212
+ */
3089
3213
  getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3214
+ /**
3215
+ * Performs the query in the database and returns a set of results.
3216
+ * @param options Additional options to be used when performing the query.
3217
+ * @returns An array of records from the database.
3218
+ */
3090
3219
  getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3091
3220
  /**
3092
3221
  * Performs the query in the database and returns all the results.
3093
3222
  * Warning: If there are a large number of results, this method can have performance implications.
3094
- * @param options Additional options to be used when performing the query.
3095
3223
  * @returns An array of records from the database.
3096
3224
  */
3097
3225
  getAll(): Promise<Result[]>;
3226
+ /**
3227
+ * Performs the query in the database and returns all the results.
3228
+ * Warning: If there are a large number of results, this method can have performance implications.
3229
+ * @param options Additional options to be used when performing the query.
3230
+ * @returns An array of records from the database.
3231
+ */
3098
3232
  getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3099
3233
  batchSize?: number;
3100
3234
  }): Promise<Result[]>;
3235
+ /**
3236
+ * Performs the query in the database and returns all the results.
3237
+ * Warning: If there are a large number of results, this method can have performance implications.
3238
+ * @param options Additional options to be used when performing the query.
3239
+ * @returns An array of records from the database.
3240
+ */
3101
3241
  getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3102
3242
  batchSize?: number;
3103
3243
  }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3104
3244
  /**
3105
3245
  * Performs the query in the database and returns the first result.
3106
- * @param options Additional options to be used when performing the query.
3107
3246
  * @returns The first record that matches the query, or null if no record matched the query.
3108
3247
  */
3109
3248
  getFirst(): Promise<Result | null>;
3249
+ /**
3250
+ * Performs the query in the database and returns the first result.
3251
+ * @param options Additional options to be used when performing the query.
3252
+ * @returns The first record that matches the query, or null if no record matched the query.
3253
+ */
3110
3254
  getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3255
+ /**
3256
+ * Performs the query in the database and returns the first result.
3257
+ * @param options Additional options to be used when performing the query.
3258
+ * @returns The first record that matches the query, or null if no record matched the query.
3259
+ */
3111
3260
  getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3112
3261
  /**
3113
3262
  * Builds a new query object adding a cache TTL in milliseconds.
@@ -3115,10 +3264,33 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3115
3264
  * @returns A new Query object.
3116
3265
  */
3117
3266
  cache(ttl: number): Query<Record, Result>;
3267
+ /**
3268
+ * Retrieve next page of records
3269
+ *
3270
+ * @returns A new page object.
3271
+ */
3118
3272
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3273
+ /**
3274
+ * Retrieve previous page of records
3275
+ *
3276
+ * @returns A new page object
3277
+ */
3119
3278
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3279
+ /**
3280
+ * Retrieve first page of records
3281
+ *
3282
+ * @returns A new page object
3283
+ */
3120
3284
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3285
+ /**
3286
+ * Retrieve last page of records
3287
+ *
3288
+ * @returns A new page object
3289
+ */
3121
3290
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3291
+ /**
3292
+ * @returns Boolean indicating if there is a next page
3293
+ */
3122
3294
  hasNextPage(): boolean;
3123
3295
  }
3124
3296
 
@@ -3202,6 +3374,7 @@ declare const PAGINATION_MAX_SIZE = 200;
3202
3374
  declare const PAGINATION_DEFAULT_SIZE = 200;
3203
3375
  declare const PAGINATION_MAX_OFFSET = 800;
3204
3376
  declare const PAGINATION_DEFAULT_OFFSET = 0;
3377
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
3205
3378
 
3206
3379
  /**
3207
3380
  * Common interface for performing operations on a table.
@@ -3227,6 +3400,12 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3227
3400
  * @returns The persisted record for the given id or null if the record could not be found.
3228
3401
  */
3229
3402
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3403
+ /**
3404
+ * Queries multiple records from the table given their unique id.
3405
+ * @param ids The unique ids array.
3406
+ * @returns The persisted records for the given ids (if a record could not be found it is not returned).
3407
+ */
3408
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3230
3409
  /**
3231
3410
  * Partially update a single record.
3232
3411
  * @param object An object with its id and the columns to be updated.
@@ -3299,7 +3478,9 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3299
3478
  * @returns The found records.
3300
3479
  */
3301
3480
  abstract search(query: string, options?: {
3302
- fuzziness?: number;
3481
+ fuzziness?: FuzzinessExpression;
3482
+ highlight?: HighlightExpression;
3483
+ filter?: Filter<Record>;
3303
3484
  }): Promise<SelectedPick<Record, ['*']>[]>;
3304
3485
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3305
3486
  }
@@ -3315,6 +3496,7 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
3315
3496
  create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3316
3497
  create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3317
3498
  read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3499
+ read(recordIds: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3318
3500
  update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3319
3501
  update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3320
3502
  update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
@@ -3323,7 +3505,9 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
3323
3505
  createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3324
3506
  delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
3325
3507
  search(query: string, options?: {
3326
- fuzziness?: number;
3508
+ fuzziness?: FuzzinessExpression;
3509
+ highlight?: HighlightExpression;
3510
+ filter?: Filter<Record>;
3327
3511
  }): Promise<SelectedPick<Record, ['*']>[]>;
3328
3512
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3329
3513
  }
@@ -3417,18 +3601,24 @@ declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends Xat
3417
3601
  }
3418
3602
 
3419
3603
  declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3420
- fuzziness?: number;
3421
- tables?: Tables[];
3604
+ fuzziness?: FuzzinessExpression;
3605
+ highlight?: HighlightExpression;
3606
+ tables?: Array<Tables | Values<{
3607
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3608
+ table: Model;
3609
+ filter?: Filter<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3610
+ };
3611
+ }>>;
3422
3612
  };
3423
3613
  declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3424
3614
  all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3425
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3615
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3426
3616
  table: Model;
3427
3617
  record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3428
3618
  };
3429
3619
  }>[]>;
3430
3620
  byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3431
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3621
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3432
3622
  }>;
3433
3623
  };
3434
3624
  declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
@@ -3439,9 +3629,18 @@ declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends Xat
3439
3629
  }
3440
3630
  declare type SearchXataRecord = XataRecord & {
3441
3631
  xata: {
3442
- table: string;
3632
+ table?: string;
3633
+ highlight?: {
3634
+ [key: string]: string[] | {
3635
+ [key: string]: any;
3636
+ };
3637
+ };
3443
3638
  };
3444
3639
  };
3640
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3641
+ declare type ExtractTables<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>, TableOptions extends GetArrayInnerType<NonNullable<NonNullable<SearchOptions<Schemas, Tables>>['tables']>>> = TableOptions extends `${infer Table}` ? ReturnTable<Table, Tables> : TableOptions extends {
3642
+ table: infer Table;
3643
+ } ? ReturnTable<Table, Tables> : never;
3445
3644
 
3446
3645
  declare type BranchStrategyValue = string | undefined | null;
3447
3646
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
@@ -3484,4 +3683,4 @@ declare class XataError extends Error {
3484
3683
  constructor(message: string, status: number);
3485
3684
  }
3486
3685
 
3487
- 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 };
3686
+ 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, isCursorPaginationOptions, 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 };