@xata.io/client 0.0.0-alpha.vf28813b → 0.0.0-alpha.vf2ed8b7

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
@@ -1,3 +1,8 @@
1
+ declare type AttributeDictionary = Record<string, string | number | boolean | undefined>;
2
+ declare type TraceFunction = <T>(name: string, fn: (options: {
3
+ setAttributes: (attrs: AttributeDictionary) => void;
4
+ }) => T, options?: AttributeDictionary) => Promise<T>;
5
+
1
6
  declare type FetchImpl = (url: string, init?: {
2
7
  body?: string;
3
8
  headers?: Record<string, string>;
@@ -5,6 +10,7 @@ declare type FetchImpl = (url: string, init?: {
5
10
  }) => Promise<{
6
11
  ok: boolean;
7
12
  status: number;
13
+ url: string;
8
14
  json(): Promise<any>;
9
15
  headers?: {
10
16
  get(name: string): string | null;
@@ -16,6 +22,7 @@ declare type FetcherExtraProps = {
16
22
  workspacesApiUrl: string | WorkspaceApiUrlBuilder;
17
23
  fetchImpl: FetchImpl;
18
24
  apiKey: string;
25
+ trace: TraceFunction;
19
26
  };
20
27
  declare type ErrorWrapper<TError> = TError | {
21
28
  status: 'unknown';
@@ -52,6 +59,7 @@ declare abstract class XataPlugin {
52
59
  declare type XataPluginOptions = {
53
60
  getFetchProps: () => Promise<FetcherExtraProps>;
54
61
  cache: CacheImpl;
62
+ trace?: TraceFunction;
55
63
  };
56
64
 
57
65
  /**
@@ -2840,6 +2848,7 @@ declare const operationsByTag: {
2840
2848
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2841
2849
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2842
2850
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
2851
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2843
2852
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2844
2853
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2845
2854
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2847,7 +2856,6 @@ declare const operationsByTag: {
2847
2856
  };
2848
2857
  branch: {
2849
2858
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2850
- getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2851
2859
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2852
2860
  createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2853
2861
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
@@ -2895,10 +2903,8 @@ interface XataApiClientOptions {
2895
2903
  fetch?: FetchImpl;
2896
2904
  apiKey?: string;
2897
2905
  host?: HostProvider;
2906
+ trace?: TraceFunction;
2898
2907
  }
2899
- /**
2900
- * @deprecated Use XataApiPlugin instead
2901
- */
2902
2908
  declare class XataApiClient {
2903
2909
  #private;
2904
2910
  constructor(options?: XataApiClientOptions);
@@ -2942,6 +2948,7 @@ declare class DatabaseApi {
2942
2948
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2943
2949
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2944
2950
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
2951
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
2945
2952
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2946
2953
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2947
2954
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
@@ -3057,12 +3064,12 @@ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> e
3057
3064
  /**
3058
3065
  * Retrieves a refreshed copy of the current record from the database.
3059
3066
  * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3060
- * @returns The persisted record with the selected columns.
3067
+ * @returns The persisted record with the selected columns, null if not found.
3061
3068
  */
3062
3069
  read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3063
3070
  /**
3064
3071
  * Retrieves a refreshed copy of the current record from the database.
3065
- * @returns The persisted record with all first level properties.
3072
+ * @returns The persisted record with all first level properties, null if not found.
3066
3073
  */
3067
3074
  read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
3068
3075
  /**
@@ -3070,22 +3077,28 @@ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> e
3070
3077
  * returned and the current object is not mutated.
3071
3078
  * @param partialUpdate The columns and their values that have to be updated.
3072
3079
  * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3073
- * @returns The persisted record with the selected columns.
3080
+ * @returns The persisted record with the selected columns, null if not found.
3074
3081
  */
3075
- update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>>>;
3082
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3076
3083
  /**
3077
3084
  * Performs a partial update of the current record. On success a new object is
3078
3085
  * returned and the current object is not mutated.
3079
3086
  * @param partialUpdate The columns and their values that have to be updated.
3080
- * @returns The persisted record with all first level properties.
3087
+ * @returns The persisted record with all first level properties, null if not found.
3081
3088
  */
3082
- update(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>>>;
3089
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
3083
3090
  /**
3084
3091
  * Performs a deletion of the current record in the database.
3085
- *
3086
- * @throws If the record was already deleted or if an error happened while performing the deletion.
3092
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3093
+ * @returns The deleted record, null if not found.
3087
3094
  */
3088
- delete(): Promise<void>;
3095
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3096
+ /**
3097
+ * Performs a deletion of the current record in the database.
3098
+ * @returns The deleted record, null if not found.
3099
+
3100
+ */
3101
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
3089
3102
  }
3090
3103
  declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
3091
3104
  /**
@@ -3098,7 +3111,7 @@ declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update
3098
3111
  * @param partialUpdate The columns and their values that have to be updated.
3099
3112
  * @returns A new record containing the latest values for all the columns of the current record.
3100
3113
  */
3101
- update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3114
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Record>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3102
3115
  /**
3103
3116
  * Performs a deletion of the current record in the database.
3104
3117
  *
@@ -3115,13 +3128,13 @@ declare type XataRecordMetadata = {
3115
3128
  };
3116
3129
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
3117
3130
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
3118
- declare type EditableData<O extends BaseData> = {
3131
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
3119
3132
  [K in keyof O]: O[K] extends XataRecord ? {
3120
3133
  id: string;
3121
3134
  } | string : NonNullable<O[K]> extends XataRecord ? {
3122
3135
  id: string;
3123
3136
  } | string | null | undefined : O[K];
3124
- };
3137
+ }, keyof XataRecord>;
3125
3138
 
3126
3139
  /**
3127
3140
  * PropertyMatchFilter
@@ -3215,7 +3228,7 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
3215
3228
  declare type NestedApiFilter<T> = {
3216
3229
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3217
3230
  };
3218
- declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3231
+ declare type Filter<T> = T extends Record<string, any> ? T extends (infer ArrayType)[] ? ArrayType | ArrayType[] | ArrayFilter<ArrayType> | ArrayFilter<ArrayType[]> : T extends Date ? PropertyFilter<T> : BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3219
3232
 
3220
3233
  declare type DateBooster = {
3221
3234
  origin?: string;
@@ -3272,7 +3285,7 @@ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3272
3285
  [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3273
3286
  }>;
3274
3287
  };
3275
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3288
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3276
3289
  #private;
3277
3290
  private db;
3278
3291
  constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
@@ -3330,7 +3343,10 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3330
3343
  #private;
3331
3344
  readonly meta: PaginationQueryMeta;
3332
3345
  readonly records: RecordArray<Result>;
3333
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
3346
+ constructor(repository: Repository<Record> | null, table: {
3347
+ name: string;
3348
+ schema?: Table;
3349
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
3334
3350
  getQueryOptions(): QueryOptions<Record>;
3335
3351
  key(): string;
3336
3352
  /**
@@ -3369,7 +3385,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3369
3385
  * @param value The value to filter.
3370
3386
  * @returns A new Query object.
3371
3387
  */
3372
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3388
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3373
3389
  /**
3374
3390
  * Builds a new query object adding one or more constraints. Examples:
3375
3391
  *
@@ -3383,14 +3399,17 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3383
3399
  * @param filters A filter object
3384
3400
  * @returns A new Query object.
3385
3401
  */
3386
- filter(filters: Filter<Record>): Query<Record, Result>;
3402
+ filter(filters?: Filter<Record>): Query<Record, Result>;
3403
+ defaultFilter<T>(column: string, value: T): T | {
3404
+ $includes: (T & string) | (T & string[]);
3405
+ };
3387
3406
  /**
3388
3407
  * Builds a new query with a new sort option.
3389
3408
  * @param column The column name.
3390
3409
  * @param direction The direction. Either ascending or descending.
3391
3410
  * @returns A new Query object.
3392
3411
  */
3393
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3412
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
3394
3413
  /**
3395
3414
  * Builds a new query specifying the set of columns to be returned in the query response.
3396
3415
  * @param columns Array of column names to be returned by the query.
@@ -3662,9 +3681,9 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3662
3681
  /**
3663
3682
  * Common interface for performing operations on a table.
3664
3683
  */
3665
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3666
- abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3667
- abstract create(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3684
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3685
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3686
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3668
3687
  /**
3669
3688
  * Creates a single record in the table with a unique id.
3670
3689
  * @param id The unique id.
@@ -3672,27 +3691,27 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3672
3691
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3673
3692
  * @returns The full persisted record.
3674
3693
  */
3675
- abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3694
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3676
3695
  /**
3677
3696
  * Creates a single record in the table with a unique id.
3678
3697
  * @param id The unique id.
3679
3698
  * @param object Object containing the column names with their values to be stored in the table.
3680
3699
  * @returns The full persisted record.
3681
3700
  */
3682
- abstract create(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3701
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3683
3702
  /**
3684
3703
  * Creates multiple records in the table.
3685
3704
  * @param objects Array of objects with the column names and the values to be stored in the table.
3686
3705
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3687
3706
  * @returns Array of the persisted records in order.
3688
3707
  */
3689
- abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3708
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3690
3709
  /**
3691
3710
  * Creates multiple records in the table.
3692
3711
  * @param objects Array of objects with the column names and the values to be stored in the table.
3693
3712
  * @returns Array of the persisted records in order.
3694
3713
  */
3695
- abstract create(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3714
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3696
3715
  /**
3697
3716
  * Queries a single record from the table given its unique id.
3698
3717
  * @param id The unique id.
@@ -3749,43 +3768,43 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3749
3768
  * Partially update a single record.
3750
3769
  * @param object An object with its id and the columns to be updated.
3751
3770
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3752
- * @returns The full persisted record.
3771
+ * @returns The full persisted record, null if the record could not be found.
3753
3772
  */
3754
- abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3773
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3755
3774
  /**
3756
3775
  * Partially update a single record.
3757
3776
  * @param object An object with its id and the columns to be updated.
3758
- * @returns The full persisted record.
3777
+ * @returns The full persisted record, null if the record could not be found.
3759
3778
  */
3760
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3779
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3761
3780
  /**
3762
3781
  * Partially update a single record given its unique id.
3763
3782
  * @param id The unique id.
3764
3783
  * @param object The column names and their values that have to be updated.
3765
3784
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3766
- * @returns The full persisted record.
3785
+ * @returns The full persisted record, null if the record could not be found.
3767
3786
  */
3768
- abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3787
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3769
3788
  /**
3770
3789
  * Partially update a single record given its unique id.
3771
3790
  * @param id The unique id.
3772
3791
  * @param object The column names and their values that have to be updated.
3773
- * @returns The full persisted record.
3792
+ * @returns The full persisted record, null if the record could not be found.
3774
3793
  */
3775
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3794
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3776
3795
  /**
3777
3796
  * Partially updates multiple records.
3778
3797
  * @param objects An array of objects with their ids and columns to be updated.
3779
3798
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3780
- * @returns Array of the persisted records in order.
3799
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
3781
3800
  */
3782
- abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3801
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3783
3802
  /**
3784
3803
  * Partially updates multiple records.
3785
3804
  * @param objects An array of objects with their ids and columns to be updated.
3786
- * @returns Array of the persisted records in order.
3805
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
3787
3806
  */
3788
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3807
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3789
3808
  /**
3790
3809
  * Creates or updates a single record. If a record exists with the given id,
3791
3810
  * it will be update, otherwise a new record will be created.
@@ -3793,14 +3812,14 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3793
3812
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3794
3813
  * @returns The full persisted record.
3795
3814
  */
3796
- abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3815
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3797
3816
  /**
3798
3817
  * Creates or updates a single record. If a record exists with the given id,
3799
3818
  * it will be update, otherwise a new record will be created.
3800
3819
  * @param object Object containing the column names with their values to be persisted in the table.
3801
3820
  * @returns The full persisted record.
3802
3821
  */
3803
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3822
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3804
3823
  /**
3805
3824
  * Creates or updates a single record. If a record exists with the given id,
3806
3825
  * it will be update, otherwise a new record will be created.
@@ -3809,7 +3828,7 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3809
3828
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3810
3829
  * @returns The full persisted record.
3811
3830
  */
3812
- abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3831
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3813
3832
  /**
3814
3833
  * Creates or updates a single record. If a record exists with the given id,
3815
3834
  * it will be update, otherwise a new record will be created.
@@ -3817,7 +3836,7 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3817
3836
  * @param object The column names and the values to be persisted.
3818
3837
  * @returns The full persisted record.
3819
3838
  */
3820
- abstract createOrUpdate(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3839
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3821
3840
  /**
3822
3841
  * Creates or updates a single record. If a record exists with the given id,
3823
3842
  * it will be update, otherwise a new record will be created.
@@ -3825,38 +3844,66 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3825
3844
  * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3826
3845
  * @returns Array of the persisted records.
3827
3846
  */
3828
- abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Data> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3847
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3829
3848
  /**
3830
3849
  * Creates or updates a single record. If a record exists with the given id,
3831
3850
  * it will be update, otherwise a new record will be created.
3832
3851
  * @param objects Array of objects with the column names and the values to be stored in the table.
3833
3852
  * @returns Array of the persisted records.
3834
3853
  */
3835
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3854
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3836
3855
  /**
3837
3856
  * Deletes a record given its unique id.
3838
- * @param id The unique id.
3839
- * @throws If the record could not be found or there was an error while performing the deletion.
3857
+ * @param object An object with a unique id.
3858
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3859
+ * @returns The deleted record, null if the record could not be found.
3840
3860
  */
3841
- abstract delete(id: string): Promise<void>;
3861
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3842
3862
  /**
3843
3863
  * Deletes a record given its unique id.
3844
- * @param id An object with a unique id.
3845
- * @throws If the record could not be found or there was an error while performing the deletion.
3864
+ * @param object An object with a unique id.
3865
+ * @returns The deleted record, null if the record could not be found.
3866
+ */
3867
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3868
+ /**
3869
+ * Deletes a record given a unique id.
3870
+ * @param id The unique id.
3871
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3872
+ * @returns The deleted record, null if the record could not be found.
3873
+ */
3874
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3875
+ /**
3876
+ * Deletes a record given a unique id.
3877
+ * @param id The unique id.
3878
+ * @returns The deleted record, null if the record could not be found.
3846
3879
  */
3847
- abstract delete(id: Identifiable): Promise<void>;
3880
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3848
3881
  /**
3849
- * Deletes a record given a list of unique ids.
3850
- * @param ids The array of unique ids.
3851
- * @throws If the record could not be found or there was an error while performing the deletion.
3882
+ * Deletes multiple records given an array of objects with ids.
3883
+ * @param objects An array of objects with unique ids.
3884
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3885
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3852
3886
  */
3853
- abstract delete(ids: string[]): Promise<void>;
3887
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3854
3888
  /**
3855
- * Deletes a record given a list of unique ids.
3856
- * @param ids An array of objects with unique ids.
3857
- * @throws If the record could not be found or there was an error while performing the deletion.
3889
+ * Deletes multiple records given an array of objects with ids.
3890
+ * @param objects An array of objects with unique ids.
3891
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3858
3892
  */
3859
- abstract delete(ids: Identifiable[]): Promise<void>;
3893
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3894
+ /**
3895
+ * Deletes multiple records given an array of unique ids.
3896
+ * @param objects An array of ids.
3897
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3898
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3899
+ */
3900
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3901
+ /**
3902
+ * Deletes multiple records given an array of unique ids.
3903
+ * @param objects An array of ids.
3904
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3905
+ */
3906
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3860
3907
  /**
3861
3908
  * Search for records in the table.
3862
3909
  * @param query The query to search for.
@@ -3872,42 +3919,48 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3872
3919
  }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3873
3920
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3874
3921
  }
3875
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
3922
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3876
3923
  #private;
3877
- db: SchemaPluginResult<any>;
3878
3924
  constructor(options: {
3879
3925
  table: string;
3880
3926
  db: SchemaPluginResult<any>;
3881
3927
  pluginOptions: XataPluginOptions;
3882
3928
  schemaTables?: Table[];
3883
3929
  });
3884
- create(object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3885
- create(recordId: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3886
- create(objects: EditableData<Data>[]): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3887
- create<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3888
- create<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3889
- create<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3890
- read(recordId: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3891
- read(recordIds: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3892
- read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3893
- read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3894
- read<K extends SelectableColumn<Record>>(recordId: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3895
- read<K extends SelectableColumn<Record>>(recordIds: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3896
- read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3897
- read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3898
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3899
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3900
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3901
- update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3902
- update<K extends SelectableColumn<Record>>(recordId: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3903
- update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3904
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3905
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3906
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3907
- createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3908
- createOrUpdate<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3909
- createOrUpdate<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3910
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
3930
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3931
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3932
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3933
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3934
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3935
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3936
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3937
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3938
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3939
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3940
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3941
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3942
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3943
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3944
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3945
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3946
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3947
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3948
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3949
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3950
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3951
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3952
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3953
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3954
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3955
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3956
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3957
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3958
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3959
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3960
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3961
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3962
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3963
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3911
3964
  search(query: string, options?: {
3912
3965
  fuzziness?: FuzzinessExpression;
3913
3966
  prefix?: PrefixExpression;
@@ -3971,6 +4024,10 @@ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
3971
4024
  [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
3972
4025
  } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
3973
4026
 
4027
+ /**
4028
+ * Operator to restrict results to only values that are greater than the given value.
4029
+ */
4030
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3974
4031
  /**
3975
4032
  * Operator to restrict results to only values that are greater than the given value.
3976
4033
  */
@@ -3978,15 +4035,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3978
4035
  /**
3979
4036
  * Operator to restrict results to only values that are greater than or equal to the given value.
3980
4037
  */
3981
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4038
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4039
+ /**
4040
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4041
+ */
4042
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3982
4043
  /**
3983
4044
  * Operator to restrict results to only values that are greater than or equal to the given value.
3984
4045
  */
3985
4046
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4047
+ /**
4048
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4049
+ */
4050
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4051
+ /**
4052
+ * Operator to restrict results to only values that are lower than the given value.
4053
+ */
4054
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3986
4055
  /**
3987
4056
  * Operator to restrict results to only values that are lower than the given value.
3988
4057
  */
3989
4058
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4059
+ /**
4060
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4061
+ */
4062
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4063
+ /**
4064
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4065
+ */
4066
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3990
4067
  /**
3991
4068
  * Operator to restrict results to only values that are lower than or equal to the given value.
3992
4069
  */
@@ -4019,6 +4096,10 @@ declare const pattern: (value: string) => StringTypeFilter;
4019
4096
  * Operator to restrict results to only values that are equal to the given value.
4020
4097
  */
4021
4098
  declare const is: <T>(value: T) => PropertyFilter<T>;
4099
+ /**
4100
+ * Operator to restrict results to only values that are equal to the given value.
4101
+ */
4102
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
4022
4103
  /**
4023
4104
  * Operator to restrict results to only values that are not equal to the given value.
4024
4105
  */
@@ -4047,12 +4128,10 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
4047
4128
  declare type SchemaDefinition = {
4048
4129
  table: string;
4049
4130
  };
4050
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4131
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
4051
4132
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
4052
- } & {
4053
- [key: string]: Repository<XataRecord$1>;
4054
4133
  };
4055
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4134
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
4056
4135
  #private;
4057
4136
  constructor(schemaTables?: Schemas.Table[]);
4058
4137
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
@@ -4069,20 +4148,35 @@ declare type BaseClientOptions = {
4069
4148
  databaseURL?: string;
4070
4149
  branch?: BranchStrategyOption;
4071
4150
  cache?: CacheImpl;
4151
+ trace?: TraceFunction;
4072
4152
  };
4073
4153
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
4074
4154
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
4075
- new <T extends readonly BaseSchema[]>(options?: Partial<BaseClientOptions>, schemaTables?: T): Omit<{
4076
- db: Awaited<ReturnType<SchemaPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
4077
- search: Awaited<ReturnType<SearchPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
4155
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
4156
+ db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
4157
+ search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
4078
4158
  }, keyof Plugins> & {
4079
4159
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4160
+ } & {
4161
+ getConfig(): Promise<{
4162
+ databaseURL: string;
4163
+ branch: string;
4164
+ }>;
4080
4165
  };
4081
4166
  }
4082
4167
  declare const BaseClient_base: ClientConstructor<{}>;
4083
- declare class BaseClient extends BaseClient_base<[]> {
4168
+ declare class BaseClient extends BaseClient_base<Record<string, any>> {
4084
4169
  }
4085
4170
 
4171
+ declare class Serializer {
4172
+ classes: Record<string, any>;
4173
+ add(clazz: any): void;
4174
+ toJSON<T>(data: T): string;
4175
+ fromJSON<T>(json: string): T;
4176
+ }
4177
+ declare const serialize: <T>(data: T) => string;
4178
+ declare const deserialize: <T>(json: string) => T;
4179
+
4086
4180
  declare type BranchResolutionOptions = {
4087
4181
  databaseURL?: string;
4088
4182
  apiKey?: string;
@@ -4094,9 +4188,89 @@ declare function getDatabaseURL(): string | undefined;
4094
4188
 
4095
4189
  declare function getAPIKey(): string | undefined;
4096
4190
 
4191
+ interface Body {
4192
+ arrayBuffer(): Promise<ArrayBuffer>;
4193
+ blob(): Promise<Blob>;
4194
+ formData(): Promise<FormData>;
4195
+ json(): Promise<any>;
4196
+ text(): Promise<string>;
4197
+ }
4198
+ interface Blob {
4199
+ readonly size: number;
4200
+ readonly type: string;
4201
+ arrayBuffer(): Promise<ArrayBuffer>;
4202
+ slice(start?: number, end?: number, contentType?: string): Blob;
4203
+ text(): Promise<string>;
4204
+ }
4205
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4206
+ interface File extends Blob {
4207
+ readonly lastModified: number;
4208
+ readonly name: string;
4209
+ readonly webkitRelativePath: string;
4210
+ }
4211
+ declare type FormDataEntryValue = File | string;
4212
+ /** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
4213
+ interface FormData {
4214
+ append(name: string, value: string | Blob, fileName?: string): void;
4215
+ delete(name: string): void;
4216
+ get(name: string): FormDataEntryValue | null;
4217
+ getAll(name: string): FormDataEntryValue[];
4218
+ has(name: string): boolean;
4219
+ set(name: string, value: string | Blob, fileName?: string): void;
4220
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4221
+ }
4222
+ /** This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
4223
+ interface Headers {
4224
+ append(name: string, value: string): void;
4225
+ delete(name: string): void;
4226
+ get(name: string): string | null;
4227
+ has(name: string): boolean;
4228
+ set(name: string, value: string): void;
4229
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4230
+ }
4231
+ interface Request extends Body {
4232
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4233
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4234
+ /** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. */
4235
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4236
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4237
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4238
+ /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */
4239
+ readonly headers: Headers;
4240
+ /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
4241
+ readonly integrity: string;
4242
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4243
+ readonly keepalive: boolean;
4244
+ /** Returns request's HTTP method, which is "GET" by default. */
4245
+ readonly method: string;
4246
+ /** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs. */
4247
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4248
+ /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */
4249
+ readonly redirect: 'error' | 'follow' | 'manual';
4250
+ /** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made. */
4251
+ readonly referrer: string;
4252
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4253
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4254
+ /** Returns the URL of request as a string. */
4255
+ readonly url: string;
4256
+ clone(): Request;
4257
+ }
4258
+
4259
+ declare type XataWorkerContext<XataClient> = {
4260
+ xata: XataClient;
4261
+ request: Request;
4262
+ env: Record<string, string | undefined>;
4263
+ };
4264
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4265
+ declare type WorkerRunnerConfig = {
4266
+ workspace: string;
4267
+ worker: string;
4268
+ };
4269
+ declare function buildWorkerRunner<XataClient>(config: WorkerRunnerConfig): <WorkerFunction extends (ctx: XataWorkerContext<XataClient>, ...args: any[]) => any>(name: string, _worker: WorkerFunction) => (...args: RemoveFirst<Parameters<WorkerFunction>>) => Promise<Awaited<ReturnType<WorkerFunction>>>;
4270
+
4097
4271
  declare class XataError extends Error {
4098
4272
  readonly status: number;
4099
4273
  constructor(message: string, status: number);
4100
4274
  }
4101
4275
 
4102
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsQueryParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchResponse, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableResponse, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordQueryParams, 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, GetDatabaseMetadataError, GetDatabaseMetadataPathParams, GetDatabaseMetadataVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordQueryParams, 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, InsertRecordQueryParams, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, Link, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RecordArray, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaInference, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, SearchXataRecord, 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, UpdateWorkspaceMemberInviteError, UpdateWorkspaceMemberInvitePathParams, UpdateWorkspaceMemberInviteRequestBody, UpdateWorkspaceMemberInviteVariables, 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, getDatabaseMetadata, 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, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
4276
+ export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsQueryParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchResponse, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableResponse, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordQueryParams, 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, GetDatabaseMetadataError, GetDatabaseMetadataPathParams, GetDatabaseMetadataVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordQueryParams, 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, InsertRecordQueryParams, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, Link, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RecordArray, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaInference, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, SearchXataRecord, SelectableColumn, SelectedPick, Serializer, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberInviteError, UpdateWorkspaceMemberInvitePathParams, UpdateWorkspaceMemberInviteRequestBody, UpdateWorkspaceMemberInviteVariables, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };