postgresdk 0.18.3 → 0.18.5
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/cli.js +244 -30
- package/dist/index.js +244 -30
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3765,15 +3765,29 @@ export class ${Type}Client extends BaseClient {
|
|
|
3765
3765
|
private readonly resource = "/v1/${table.name}";
|
|
3766
3766
|
|
|
3767
3767
|
${hasJsonbColumns ? ` /**
|
|
3768
|
+
* Create a new ${table.name} record with field selection
|
|
3769
|
+
* @param data - The data to insert
|
|
3770
|
+
* @param options - Select specific fields to return
|
|
3771
|
+
* @returns The created record with only selected fields
|
|
3772
|
+
*/
|
|
3773
|
+
async create<TJsonb extends Partial<Select${Type}> = {}>(data: NoInfer<Insert${Type}<TJsonb>>, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>>>;
|
|
3774
|
+
/**
|
|
3775
|
+
* Create a new ${table.name} record with field exclusion
|
|
3776
|
+
* @param data - The data to insert
|
|
3777
|
+
* @param options - Exclude specific fields from return
|
|
3778
|
+
* @returns The created record without excluded fields
|
|
3779
|
+
*/
|
|
3780
|
+
async create<TJsonb extends Partial<Select${Type}> = {}>(data: NoInfer<Insert${Type}<TJsonb>>, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>>>;
|
|
3781
|
+
/**
|
|
3768
3782
|
* Create a new ${table.name} record
|
|
3769
3783
|
* @param data - The data to insert
|
|
3770
|
-
* @
|
|
3771
|
-
* @returns The created record
|
|
3784
|
+
* @returns The created record with all fields
|
|
3772
3785
|
* @example
|
|
3773
3786
|
* // With JSONB type override:
|
|
3774
3787
|
* type Metadata = { tags: string[]; prefs: { theme: 'light' | 'dark' } };
|
|
3775
3788
|
* const user = await client.create<{ metadata: Metadata }>({ name: 'Alice', metadata: { tags: [], prefs: { theme: 'light' } } });
|
|
3776
3789
|
*/
|
|
3790
|
+
async create<TJsonb extends Partial<Select${Type}> = {}>(data: NoInfer<Insert${Type}<TJsonb>>, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb>>;
|
|
3777
3791
|
async create<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3778
3792
|
data: NoInfer<Insert${Type}<TJsonb>>,
|
|
3779
3793
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -3785,11 +3799,25 @@ ${hasJsonbColumns ? ` /**
|
|
|
3785
3799
|
const url = query ? \`\${this.resource}?\${query}\` : this.resource;
|
|
3786
3800
|
return this.post<Select${Type}<TJsonb>>(url, data);
|
|
3787
3801
|
}` : ` /**
|
|
3802
|
+
* Create a new ${table.name} record with field selection
|
|
3803
|
+
* @param data - The data to insert
|
|
3804
|
+
* @param options - Select specific fields to return
|
|
3805
|
+
* @returns The created record with only selected fields
|
|
3806
|
+
*/
|
|
3807
|
+
async create(data: Insert${Type}, options: { select: string[] }): Promise<Partial<Select${Type}>>;
|
|
3808
|
+
/**
|
|
3809
|
+
* Create a new ${table.name} record with field exclusion
|
|
3810
|
+
* @param data - The data to insert
|
|
3811
|
+
* @param options - Exclude specific fields from return
|
|
3812
|
+
* @returns The created record without excluded fields
|
|
3813
|
+
*/
|
|
3814
|
+
async create(data: Insert${Type}, options: { exclude: string[] }): Promise<Partial<Select${Type}>>;
|
|
3815
|
+
/**
|
|
3788
3816
|
* Create a new ${table.name} record
|
|
3789
3817
|
* @param data - The data to insert
|
|
3790
|
-
* @
|
|
3791
|
-
* @returns The created record
|
|
3818
|
+
* @returns The created record with all fields
|
|
3792
3819
|
*/
|
|
3820
|
+
async create(data: Insert${Type}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}>;
|
|
3793
3821
|
async create(
|
|
3794
3822
|
data: Insert${Type},
|
|
3795
3823
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -3803,14 +3831,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
3803
3831
|
}`}
|
|
3804
3832
|
|
|
3805
3833
|
${hasJsonbColumns ? ` /**
|
|
3834
|
+
* Get a ${table.name} record by primary key with field selection
|
|
3835
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3836
|
+
* @param options - Select specific fields to return
|
|
3837
|
+
* @returns The record with only selected fields if found, null otherwise
|
|
3838
|
+
*/
|
|
3839
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
3840
|
+
/**
|
|
3841
|
+
* Get a ${table.name} record by primary key with field exclusion
|
|
3842
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3843
|
+
* @param options - Exclude specific fields from return
|
|
3844
|
+
* @returns The record without excluded fields if found, null otherwise
|
|
3845
|
+
*/
|
|
3846
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
3847
|
+
/**
|
|
3806
3848
|
* Get a ${table.name} record by primary key
|
|
3807
3849
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3808
|
-
* @
|
|
3809
|
-
* @returns The record if found, null otherwise
|
|
3850
|
+
* @returns The record with all fields if found, null otherwise
|
|
3810
3851
|
* @example
|
|
3811
3852
|
* // With JSONB type override:
|
|
3812
3853
|
* const user = await client.getByPk<{ metadata: Metadata }>('user-id');
|
|
3813
3854
|
*/
|
|
3855
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
3814
3856
|
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3815
3857
|
pk: ${pkType},
|
|
3816
3858
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -3823,11 +3865,25 @@ ${hasJsonbColumns ? ` /**
|
|
|
3823
3865
|
const url = query ? \`\${this.resource}/\${path}?\${query}\` : \`\${this.resource}/\${path}\`;
|
|
3824
3866
|
return this.get<Select${Type}<TJsonb> | null>(url);
|
|
3825
3867
|
}` : ` /**
|
|
3868
|
+
* Get a ${table.name} record by primary key with field selection
|
|
3869
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3870
|
+
* @param options - Select specific fields to return
|
|
3871
|
+
* @returns The record with only selected fields if found, null otherwise
|
|
3872
|
+
*/
|
|
3873
|
+
async getByPk(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
3874
|
+
/**
|
|
3875
|
+
* Get a ${table.name} record by primary key with field exclusion
|
|
3876
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3877
|
+
* @param options - Exclude specific fields from return
|
|
3878
|
+
* @returns The record without excluded fields if found, null otherwise
|
|
3879
|
+
*/
|
|
3880
|
+
async getByPk(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
3881
|
+
/**
|
|
3826
3882
|
* Get a ${table.name} record by primary key
|
|
3827
3883
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3828
|
-
* @
|
|
3829
|
-
* @returns The record if found, null otherwise
|
|
3884
|
+
* @returns The record with all fields if found, null otherwise
|
|
3830
3885
|
*/
|
|
3886
|
+
async getByPk(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type} | null>;
|
|
3831
3887
|
async getByPk(
|
|
3832
3888
|
pk: ${pkType},
|
|
3833
3889
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -3842,24 +3898,73 @@ ${hasJsonbColumns ? ` /**
|
|
|
3842
3898
|
}`}
|
|
3843
3899
|
|
|
3844
3900
|
${hasJsonbColumns ? ` /**
|
|
3901
|
+
* List ${table.name} records with field selection
|
|
3902
|
+
* @param params - Query parameters with select
|
|
3903
|
+
* @returns Paginated results with only selected fields
|
|
3904
|
+
*/
|
|
3905
|
+
async list<TJsonb extends Partial<Select${Type}> = {}>(params: {
|
|
3906
|
+
select: string[];
|
|
3907
|
+
include?: any;
|
|
3908
|
+
limit?: number;
|
|
3909
|
+
offset?: number;
|
|
3910
|
+
where?: Where<Select${Type}<TJsonb>>;${hasVectorColumns ? `
|
|
3911
|
+
vector?: {
|
|
3912
|
+
field: string;
|
|
3913
|
+
query: number[];
|
|
3914
|
+
metric?: "cosine" | "l2" | "inner";
|
|
3915
|
+
maxDistance?: number;
|
|
3916
|
+
};` : ""}
|
|
3917
|
+
orderBy?: string | string[];
|
|
3918
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3919
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}<TJsonb>>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
3920
|
+
/**
|
|
3921
|
+
* List ${table.name} records with field exclusion
|
|
3922
|
+
* @param params - Query parameters with exclude
|
|
3923
|
+
* @returns Paginated results without excluded fields
|
|
3924
|
+
*/
|
|
3925
|
+
async list<TJsonb extends Partial<Select${Type}> = {}>(params: {
|
|
3926
|
+
exclude: string[];
|
|
3927
|
+
include?: any;
|
|
3928
|
+
limit?: number;
|
|
3929
|
+
offset?: number;
|
|
3930
|
+
where?: Where<Select${Type}<TJsonb>>;${hasVectorColumns ? `
|
|
3931
|
+
vector?: {
|
|
3932
|
+
field: string;
|
|
3933
|
+
query: number[];
|
|
3934
|
+
metric?: "cosine" | "l2" | "inner";
|
|
3935
|
+
maxDistance?: number;
|
|
3936
|
+
};` : ""}
|
|
3937
|
+
orderBy?: string | string[];
|
|
3938
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3939
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}<TJsonb>>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
3940
|
+
/**
|
|
3845
3941
|
* List ${table.name} records with pagination and filtering
|
|
3846
3942
|
* @param params - Query parameters
|
|
3847
3943
|
* @param params.where - Filter conditions using operators like $eq, $gt, $in, $like, etc.
|
|
3848
|
-
* @param params.select - Array of field names to include in response
|
|
3849
|
-
* @param params.exclude - Array of field names to exclude from response (mutually exclusive with select)
|
|
3850
3944
|
* @param params.orderBy - Column(s) to sort by
|
|
3851
3945
|
* @param params.order - Sort direction(s): "asc" or "desc"
|
|
3852
3946
|
* @param params.limit - Maximum number of records to return (default: 50, max: 1000)
|
|
3853
3947
|
* @param params.offset - Number of records to skip for pagination
|
|
3854
3948
|
* @param params.include - Related records to include (see listWith* methods for typed includes)
|
|
3855
|
-
* @returns Paginated results with
|
|
3949
|
+
* @returns Paginated results with all fields
|
|
3856
3950
|
* @example
|
|
3857
3951
|
* // With JSONB type override:
|
|
3858
3952
|
* const users = await client.list<{ metadata: Metadata }>({ where: { status: 'active' } });
|
|
3859
|
-
* @example
|
|
3860
|
-
* // With select:
|
|
3861
|
-
* const users = await client.list({ select: ['id', 'email'] });
|
|
3862
3953
|
*/
|
|
3954
|
+
async list<TJsonb extends Partial<Select${Type}> = {}>(params?: {
|
|
3955
|
+
include?: any;
|
|
3956
|
+
limit?: number;
|
|
3957
|
+
offset?: number;
|
|
3958
|
+
where?: Where<Select${Type}<TJsonb>>;${hasVectorColumns ? `
|
|
3959
|
+
vector?: {
|
|
3960
|
+
field: string;
|
|
3961
|
+
query: number[];
|
|
3962
|
+
metric?: "cosine" | "l2" | "inner";
|
|
3963
|
+
maxDistance?: number;
|
|
3964
|
+
};` : ""}
|
|
3965
|
+
orderBy?: string | string[];
|
|
3966
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3967
|
+
}): Promise<PaginatedResponse<Select${Type}<TJsonb>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
3863
3968
|
async list<TJsonb extends Partial<Select${Type}> = {}>(params?: {
|
|
3864
3969
|
include?: any;
|
|
3865
3970
|
select?: string[];
|
|
@@ -3875,24 +3980,73 @@ ${hasJsonbColumns ? ` /**
|
|
|
3875
3980
|
};` : ""}
|
|
3876
3981
|
orderBy?: string | string[];
|
|
3877
3982
|
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3878
|
-
}): Promise<PaginatedResponse<
|
|
3983
|
+
}): Promise<PaginatedResponse<Select${Type}<TJsonb> | Partial<Select${Type}<TJsonb>>>> {
|
|
3879
3984
|
return this.post<PaginatedResponse<Select${Type}<TJsonb>${hasVectorColumns ? " & { _distance?: number }" : ""}>>(\`\${this.resource}/list\`, params ?? {});
|
|
3880
3985
|
}` : ` /**
|
|
3986
|
+
* List ${table.name} records with field selection
|
|
3987
|
+
* @param params - Query parameters with select
|
|
3988
|
+
* @returns Paginated results with only selected fields
|
|
3989
|
+
*/
|
|
3990
|
+
async list(params: {
|
|
3991
|
+
select: string[];
|
|
3992
|
+
include?: any;
|
|
3993
|
+
limit?: number;
|
|
3994
|
+
offset?: number;
|
|
3995
|
+
where?: Where<Select${Type}>;${hasVectorColumns ? `
|
|
3996
|
+
vector?: {
|
|
3997
|
+
field: string;
|
|
3998
|
+
query: number[];
|
|
3999
|
+
metric?: "cosine" | "l2" | "inner";
|
|
4000
|
+
maxDistance?: number;
|
|
4001
|
+
};` : ""}
|
|
4002
|
+
orderBy?: string | string[];
|
|
4003
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
4004
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
4005
|
+
/**
|
|
4006
|
+
* List ${table.name} records with field exclusion
|
|
4007
|
+
* @param params - Query parameters with exclude
|
|
4008
|
+
* @returns Paginated results without excluded fields
|
|
4009
|
+
*/
|
|
4010
|
+
async list(params: {
|
|
4011
|
+
exclude: string[];
|
|
4012
|
+
include?: any;
|
|
4013
|
+
limit?: number;
|
|
4014
|
+
offset?: number;
|
|
4015
|
+
where?: Where<Select${Type}>;${hasVectorColumns ? `
|
|
4016
|
+
vector?: {
|
|
4017
|
+
field: string;
|
|
4018
|
+
query: number[];
|
|
4019
|
+
metric?: "cosine" | "l2" | "inner";
|
|
4020
|
+
maxDistance?: number;
|
|
4021
|
+
};` : ""}
|
|
4022
|
+
orderBy?: string | string[];
|
|
4023
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
4024
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
4025
|
+
/**
|
|
3881
4026
|
* List ${table.name} records with pagination and filtering
|
|
3882
4027
|
* @param params - Query parameters
|
|
3883
4028
|
* @param params.where - Filter conditions using operators like $eq, $gt, $in, $like, etc.
|
|
3884
|
-
* @param params.select - Array of field names to include in response
|
|
3885
|
-
* @param params.exclude - Array of field names to exclude from response (mutually exclusive with select)
|
|
3886
4029
|
* @param params.orderBy - Column(s) to sort by
|
|
3887
4030
|
* @param params.order - Sort direction(s): "asc" or "desc"
|
|
3888
4031
|
* @param params.limit - Maximum number of records to return (default: 50, max: 1000)
|
|
3889
4032
|
* @param params.offset - Number of records to skip for pagination
|
|
3890
4033
|
* @param params.include - Related records to include (see listWith* methods for typed includes)
|
|
3891
|
-
* @returns Paginated results with
|
|
3892
|
-
* @example
|
|
3893
|
-
* // With select:
|
|
3894
|
-
* const users = await client.list({ select: ['id', 'email'] });
|
|
4034
|
+
* @returns Paginated results with all fields
|
|
3895
4035
|
*/
|
|
4036
|
+
async list(params?: {
|
|
4037
|
+
include?: any;
|
|
4038
|
+
limit?: number;
|
|
4039
|
+
offset?: number;
|
|
4040
|
+
where?: Where<Select${Type}>;${hasVectorColumns ? `
|
|
4041
|
+
vector?: {
|
|
4042
|
+
field: string;
|
|
4043
|
+
query: number[];
|
|
4044
|
+
metric?: "cosine" | "l2" | "inner";
|
|
4045
|
+
maxDistance?: number;
|
|
4046
|
+
};` : ""}
|
|
4047
|
+
orderBy?: string | string[];
|
|
4048
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
4049
|
+
}): Promise<PaginatedResponse<Select${Type}${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
3896
4050
|
async list(params?: {
|
|
3897
4051
|
include?: any;
|
|
3898
4052
|
select?: string[];
|
|
@@ -3908,20 +4062,36 @@ ${hasJsonbColumns ? ` /**
|
|
|
3908
4062
|
};` : ""}
|
|
3909
4063
|
orderBy?: string | string[];
|
|
3910
4064
|
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3911
|
-
}): Promise<PaginatedResponse<
|
|
4065
|
+
}): Promise<PaginatedResponse<Select${Type} | Partial<Select${Type}>>> {
|
|
3912
4066
|
return this.post<PaginatedResponse<Select${Type}${hasVectorColumns ? " & { _distance?: number }" : ""}>>(\`\${this.resource}/list\`, params ?? {});
|
|
3913
4067
|
}`}
|
|
3914
4068
|
|
|
3915
4069
|
${hasJsonbColumns ? ` /**
|
|
4070
|
+
* Update a ${table.name} record by primary key with field selection
|
|
4071
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4072
|
+
* @param patch - Partial data to update
|
|
4073
|
+
* @param options - Select specific fields to return
|
|
4074
|
+
* @returns The updated record with only selected fields if found, null otherwise
|
|
4075
|
+
*/
|
|
4076
|
+
async update<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, patch: NoInfer<Update${Type}<TJsonb>>, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
4077
|
+
/**
|
|
4078
|
+
* Update a ${table.name} record by primary key with field exclusion
|
|
4079
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4080
|
+
* @param patch - Partial data to update
|
|
4081
|
+
* @param options - Exclude specific fields from return
|
|
4082
|
+
* @returns The updated record without excluded fields if found, null otherwise
|
|
4083
|
+
*/
|
|
4084
|
+
async update<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, patch: NoInfer<Update${Type}<TJsonb>>, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
4085
|
+
/**
|
|
3916
4086
|
* Update a ${table.name} record by primary key
|
|
3917
4087
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3918
4088
|
* @param patch - Partial data to update
|
|
3919
|
-
* @
|
|
3920
|
-
* @returns The updated record if found, null otherwise
|
|
4089
|
+
* @returns The updated record with all fields if found, null otherwise
|
|
3921
4090
|
* @example
|
|
3922
4091
|
* // With JSONB type override:
|
|
3923
4092
|
* const user = await client.update<{ metadata: Metadata }>('user-id', { metadata: { tags: ['new'] } });
|
|
3924
4093
|
*/
|
|
4094
|
+
async update<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, patch: NoInfer<Update${Type}<TJsonb>>, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
3925
4095
|
async update<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3926
4096
|
pk: ${pkType},
|
|
3927
4097
|
patch: NoInfer<Update${Type}<TJsonb>>,
|
|
@@ -3935,12 +4105,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
3935
4105
|
const url = query ? \`\${this.resource}/\${path}?\${query}\` : \`\${this.resource}/\${path}\`;
|
|
3936
4106
|
return this.patch<Select${Type}<TJsonb> | null>(url, patch);
|
|
3937
4107
|
}` : ` /**
|
|
4108
|
+
* Update a ${table.name} record by primary key with field selection
|
|
4109
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4110
|
+
* @param patch - Partial data to update
|
|
4111
|
+
* @param options - Select specific fields to return
|
|
4112
|
+
* @returns The updated record with only selected fields if found, null otherwise
|
|
4113
|
+
*/
|
|
4114
|
+
async update(pk: ${pkType}, patch: Update${Type}, options: { select: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
4115
|
+
/**
|
|
4116
|
+
* Update a ${table.name} record by primary key with field exclusion
|
|
4117
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4118
|
+
* @param patch - Partial data to update
|
|
4119
|
+
* @param options - Exclude specific fields from return
|
|
4120
|
+
* @returns The updated record without excluded fields if found, null otherwise
|
|
4121
|
+
*/
|
|
4122
|
+
async update(pk: ${pkType}, patch: Update${Type}, options: { exclude: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
4123
|
+
/**
|
|
3938
4124
|
* Update a ${table.name} record by primary key
|
|
3939
4125
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3940
4126
|
* @param patch - Partial data to update
|
|
3941
|
-
* @
|
|
3942
|
-
* @returns The updated record if found, null otherwise
|
|
4127
|
+
* @returns The updated record with all fields if found, null otherwise
|
|
3943
4128
|
*/
|
|
4129
|
+
async update(pk: ${pkType}, patch: Update${Type}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type} | null>;
|
|
3944
4130
|
async update(
|
|
3945
4131
|
pk: ${pkType},
|
|
3946
4132
|
patch: Update${Type},
|
|
@@ -3956,14 +4142,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
3956
4142
|
}`}
|
|
3957
4143
|
|
|
3958
4144
|
${hasJsonbColumns ? ` /**
|
|
4145
|
+
* Delete a ${table.name} record by primary key with field selection
|
|
4146
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4147
|
+
* @param options - Select specific fields to return
|
|
4148
|
+
* @returns The deleted record with only selected fields if found, null otherwise
|
|
4149
|
+
*/
|
|
4150
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
4151
|
+
/**
|
|
4152
|
+
* Delete a ${table.name} record by primary key with field exclusion
|
|
4153
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4154
|
+
* @param options - Exclude specific fields from return
|
|
4155
|
+
* @returns The deleted record without excluded fields if found, null otherwise
|
|
4156
|
+
*/
|
|
4157
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
4158
|
+
/**
|
|
3959
4159
|
* Delete a ${table.name} record by primary key
|
|
3960
4160
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3961
|
-
* @
|
|
3962
|
-
* @returns The deleted record if found, null otherwise
|
|
4161
|
+
* @returns The deleted record with all fields if found, null otherwise
|
|
3963
4162
|
* @example
|
|
3964
4163
|
* // With JSONB type override:
|
|
3965
4164
|
* const user = await client.delete<{ metadata: Metadata }>('user-id');
|
|
3966
4165
|
*/
|
|
4166
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
3967
4167
|
async delete<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3968
4168
|
pk: ${pkType},
|
|
3969
4169
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -3976,11 +4176,25 @@ ${hasJsonbColumns ? ` /**
|
|
|
3976
4176
|
const url = query ? \`\${this.resource}/\${path}?\${query}\` : \`\${this.resource}/\${path}\`;
|
|
3977
4177
|
return this.del<Select${Type}<TJsonb> | null>(url);
|
|
3978
4178
|
}` : ` /**
|
|
4179
|
+
* Delete a ${table.name} record by primary key with field selection
|
|
4180
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4181
|
+
* @param options - Select specific fields to return
|
|
4182
|
+
* @returns The deleted record with only selected fields if found, null otherwise
|
|
4183
|
+
*/
|
|
4184
|
+
async delete(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
4185
|
+
/**
|
|
4186
|
+
* Delete a ${table.name} record by primary key with field exclusion
|
|
4187
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4188
|
+
* @param options - Exclude specific fields from return
|
|
4189
|
+
* @returns The deleted record without excluded fields if found, null otherwise
|
|
4190
|
+
*/
|
|
4191
|
+
async delete(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
4192
|
+
/**
|
|
3979
4193
|
* Delete a ${table.name} record by primary key
|
|
3980
4194
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3981
|
-
* @
|
|
3982
|
-
* @returns The deleted record if found, null otherwise
|
|
4195
|
+
* @returns The deleted record with all fields if found, null otherwise
|
|
3983
4196
|
*/
|
|
4197
|
+
async delete(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type} | null>;
|
|
3984
4198
|
async delete(
|
|
3985
4199
|
pk: ${pkType},
|
|
3986
4200
|
options?: { select?: string[]; exclude?: string[] }
|
package/dist/index.js
CHANGED
|
@@ -2786,15 +2786,29 @@ export class ${Type}Client extends BaseClient {
|
|
|
2786
2786
|
private readonly resource = "/v1/${table.name}";
|
|
2787
2787
|
|
|
2788
2788
|
${hasJsonbColumns ? ` /**
|
|
2789
|
+
* Create a new ${table.name} record with field selection
|
|
2790
|
+
* @param data - The data to insert
|
|
2791
|
+
* @param options - Select specific fields to return
|
|
2792
|
+
* @returns The created record with only selected fields
|
|
2793
|
+
*/
|
|
2794
|
+
async create<TJsonb extends Partial<Select${Type}> = {}>(data: NoInfer<Insert${Type}<TJsonb>>, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>>>;
|
|
2795
|
+
/**
|
|
2796
|
+
* Create a new ${table.name} record with field exclusion
|
|
2797
|
+
* @param data - The data to insert
|
|
2798
|
+
* @param options - Exclude specific fields from return
|
|
2799
|
+
* @returns The created record without excluded fields
|
|
2800
|
+
*/
|
|
2801
|
+
async create<TJsonb extends Partial<Select${Type}> = {}>(data: NoInfer<Insert${Type}<TJsonb>>, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>>>;
|
|
2802
|
+
/**
|
|
2789
2803
|
* Create a new ${table.name} record
|
|
2790
2804
|
* @param data - The data to insert
|
|
2791
|
-
* @
|
|
2792
|
-
* @returns The created record
|
|
2805
|
+
* @returns The created record with all fields
|
|
2793
2806
|
* @example
|
|
2794
2807
|
* // With JSONB type override:
|
|
2795
2808
|
* type Metadata = { tags: string[]; prefs: { theme: 'light' | 'dark' } };
|
|
2796
2809
|
* const user = await client.create<{ metadata: Metadata }>({ name: 'Alice', metadata: { tags: [], prefs: { theme: 'light' } } });
|
|
2797
2810
|
*/
|
|
2811
|
+
async create<TJsonb extends Partial<Select${Type}> = {}>(data: NoInfer<Insert${Type}<TJsonb>>, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb>>;
|
|
2798
2812
|
async create<TJsonb extends Partial<Select${Type}> = {}>(
|
|
2799
2813
|
data: NoInfer<Insert${Type}<TJsonb>>,
|
|
2800
2814
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -2806,11 +2820,25 @@ ${hasJsonbColumns ? ` /**
|
|
|
2806
2820
|
const url = query ? \`\${this.resource}?\${query}\` : this.resource;
|
|
2807
2821
|
return this.post<Select${Type}<TJsonb>>(url, data);
|
|
2808
2822
|
}` : ` /**
|
|
2823
|
+
* Create a new ${table.name} record with field selection
|
|
2824
|
+
* @param data - The data to insert
|
|
2825
|
+
* @param options - Select specific fields to return
|
|
2826
|
+
* @returns The created record with only selected fields
|
|
2827
|
+
*/
|
|
2828
|
+
async create(data: Insert${Type}, options: { select: string[] }): Promise<Partial<Select${Type}>>;
|
|
2829
|
+
/**
|
|
2830
|
+
* Create a new ${table.name} record with field exclusion
|
|
2831
|
+
* @param data - The data to insert
|
|
2832
|
+
* @param options - Exclude specific fields from return
|
|
2833
|
+
* @returns The created record without excluded fields
|
|
2834
|
+
*/
|
|
2835
|
+
async create(data: Insert${Type}, options: { exclude: string[] }): Promise<Partial<Select${Type}>>;
|
|
2836
|
+
/**
|
|
2809
2837
|
* Create a new ${table.name} record
|
|
2810
2838
|
* @param data - The data to insert
|
|
2811
|
-
* @
|
|
2812
|
-
* @returns The created record
|
|
2839
|
+
* @returns The created record with all fields
|
|
2813
2840
|
*/
|
|
2841
|
+
async create(data: Insert${Type}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}>;
|
|
2814
2842
|
async create(
|
|
2815
2843
|
data: Insert${Type},
|
|
2816
2844
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -2824,14 +2852,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
2824
2852
|
}`}
|
|
2825
2853
|
|
|
2826
2854
|
${hasJsonbColumns ? ` /**
|
|
2855
|
+
* Get a ${table.name} record by primary key with field selection
|
|
2856
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2857
|
+
* @param options - Select specific fields to return
|
|
2858
|
+
* @returns The record with only selected fields if found, null otherwise
|
|
2859
|
+
*/
|
|
2860
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
2861
|
+
/**
|
|
2862
|
+
* Get a ${table.name} record by primary key with field exclusion
|
|
2863
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2864
|
+
* @param options - Exclude specific fields from return
|
|
2865
|
+
* @returns The record without excluded fields if found, null otherwise
|
|
2866
|
+
*/
|
|
2867
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
2868
|
+
/**
|
|
2827
2869
|
* Get a ${table.name} record by primary key
|
|
2828
2870
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2829
|
-
* @
|
|
2830
|
-
* @returns The record if found, null otherwise
|
|
2871
|
+
* @returns The record with all fields if found, null otherwise
|
|
2831
2872
|
* @example
|
|
2832
2873
|
* // With JSONB type override:
|
|
2833
2874
|
* const user = await client.getByPk<{ metadata: Metadata }>('user-id');
|
|
2834
2875
|
*/
|
|
2876
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
2835
2877
|
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(
|
|
2836
2878
|
pk: ${pkType},
|
|
2837
2879
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -2844,11 +2886,25 @@ ${hasJsonbColumns ? ` /**
|
|
|
2844
2886
|
const url = query ? \`\${this.resource}/\${path}?\${query}\` : \`\${this.resource}/\${path}\`;
|
|
2845
2887
|
return this.get<Select${Type}<TJsonb> | null>(url);
|
|
2846
2888
|
}` : ` /**
|
|
2889
|
+
* Get a ${table.name} record by primary key with field selection
|
|
2890
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2891
|
+
* @param options - Select specific fields to return
|
|
2892
|
+
* @returns The record with only selected fields if found, null otherwise
|
|
2893
|
+
*/
|
|
2894
|
+
async getByPk(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
2895
|
+
/**
|
|
2896
|
+
* Get a ${table.name} record by primary key with field exclusion
|
|
2897
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2898
|
+
* @param options - Exclude specific fields from return
|
|
2899
|
+
* @returns The record without excluded fields if found, null otherwise
|
|
2900
|
+
*/
|
|
2901
|
+
async getByPk(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
2902
|
+
/**
|
|
2847
2903
|
* Get a ${table.name} record by primary key
|
|
2848
2904
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2849
|
-
* @
|
|
2850
|
-
* @returns The record if found, null otherwise
|
|
2905
|
+
* @returns The record with all fields if found, null otherwise
|
|
2851
2906
|
*/
|
|
2907
|
+
async getByPk(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type} | null>;
|
|
2852
2908
|
async getByPk(
|
|
2853
2909
|
pk: ${pkType},
|
|
2854
2910
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -2863,24 +2919,73 @@ ${hasJsonbColumns ? ` /**
|
|
|
2863
2919
|
}`}
|
|
2864
2920
|
|
|
2865
2921
|
${hasJsonbColumns ? ` /**
|
|
2922
|
+
* List ${table.name} records with field selection
|
|
2923
|
+
* @param params - Query parameters with select
|
|
2924
|
+
* @returns Paginated results with only selected fields
|
|
2925
|
+
*/
|
|
2926
|
+
async list<TJsonb extends Partial<Select${Type}> = {}>(params: {
|
|
2927
|
+
select: string[];
|
|
2928
|
+
include?: any;
|
|
2929
|
+
limit?: number;
|
|
2930
|
+
offset?: number;
|
|
2931
|
+
where?: Where<Select${Type}<TJsonb>>;${hasVectorColumns ? `
|
|
2932
|
+
vector?: {
|
|
2933
|
+
field: string;
|
|
2934
|
+
query: number[];
|
|
2935
|
+
metric?: "cosine" | "l2" | "inner";
|
|
2936
|
+
maxDistance?: number;
|
|
2937
|
+
};` : ""}
|
|
2938
|
+
orderBy?: string | string[];
|
|
2939
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
2940
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}<TJsonb>>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
2941
|
+
/**
|
|
2942
|
+
* List ${table.name} records with field exclusion
|
|
2943
|
+
* @param params - Query parameters with exclude
|
|
2944
|
+
* @returns Paginated results without excluded fields
|
|
2945
|
+
*/
|
|
2946
|
+
async list<TJsonb extends Partial<Select${Type}> = {}>(params: {
|
|
2947
|
+
exclude: string[];
|
|
2948
|
+
include?: any;
|
|
2949
|
+
limit?: number;
|
|
2950
|
+
offset?: number;
|
|
2951
|
+
where?: Where<Select${Type}<TJsonb>>;${hasVectorColumns ? `
|
|
2952
|
+
vector?: {
|
|
2953
|
+
field: string;
|
|
2954
|
+
query: number[];
|
|
2955
|
+
metric?: "cosine" | "l2" | "inner";
|
|
2956
|
+
maxDistance?: number;
|
|
2957
|
+
};` : ""}
|
|
2958
|
+
orderBy?: string | string[];
|
|
2959
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
2960
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}<TJsonb>>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
2961
|
+
/**
|
|
2866
2962
|
* List ${table.name} records with pagination and filtering
|
|
2867
2963
|
* @param params - Query parameters
|
|
2868
2964
|
* @param params.where - Filter conditions using operators like $eq, $gt, $in, $like, etc.
|
|
2869
|
-
* @param params.select - Array of field names to include in response
|
|
2870
|
-
* @param params.exclude - Array of field names to exclude from response (mutually exclusive with select)
|
|
2871
2965
|
* @param params.orderBy - Column(s) to sort by
|
|
2872
2966
|
* @param params.order - Sort direction(s): "asc" or "desc"
|
|
2873
2967
|
* @param params.limit - Maximum number of records to return (default: 50, max: 1000)
|
|
2874
2968
|
* @param params.offset - Number of records to skip for pagination
|
|
2875
2969
|
* @param params.include - Related records to include (see listWith* methods for typed includes)
|
|
2876
|
-
* @returns Paginated results with
|
|
2970
|
+
* @returns Paginated results with all fields
|
|
2877
2971
|
* @example
|
|
2878
2972
|
* // With JSONB type override:
|
|
2879
2973
|
* const users = await client.list<{ metadata: Metadata }>({ where: { status: 'active' } });
|
|
2880
|
-
* @example
|
|
2881
|
-
* // With select:
|
|
2882
|
-
* const users = await client.list({ select: ['id', 'email'] });
|
|
2883
2974
|
*/
|
|
2975
|
+
async list<TJsonb extends Partial<Select${Type}> = {}>(params?: {
|
|
2976
|
+
include?: any;
|
|
2977
|
+
limit?: number;
|
|
2978
|
+
offset?: number;
|
|
2979
|
+
where?: Where<Select${Type}<TJsonb>>;${hasVectorColumns ? `
|
|
2980
|
+
vector?: {
|
|
2981
|
+
field: string;
|
|
2982
|
+
query: number[];
|
|
2983
|
+
metric?: "cosine" | "l2" | "inner";
|
|
2984
|
+
maxDistance?: number;
|
|
2985
|
+
};` : ""}
|
|
2986
|
+
orderBy?: string | string[];
|
|
2987
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
2988
|
+
}): Promise<PaginatedResponse<Select${Type}<TJsonb>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
2884
2989
|
async list<TJsonb extends Partial<Select${Type}> = {}>(params?: {
|
|
2885
2990
|
include?: any;
|
|
2886
2991
|
select?: string[];
|
|
@@ -2896,24 +3001,73 @@ ${hasJsonbColumns ? ` /**
|
|
|
2896
3001
|
};` : ""}
|
|
2897
3002
|
orderBy?: string | string[];
|
|
2898
3003
|
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
2899
|
-
}): Promise<PaginatedResponse<
|
|
3004
|
+
}): Promise<PaginatedResponse<Select${Type}<TJsonb> | Partial<Select${Type}<TJsonb>>>> {
|
|
2900
3005
|
return this.post<PaginatedResponse<Select${Type}<TJsonb>${hasVectorColumns ? " & { _distance?: number }" : ""}>>(\`\${this.resource}/list\`, params ?? {});
|
|
2901
3006
|
}` : ` /**
|
|
3007
|
+
* List ${table.name} records with field selection
|
|
3008
|
+
* @param params - Query parameters with select
|
|
3009
|
+
* @returns Paginated results with only selected fields
|
|
3010
|
+
*/
|
|
3011
|
+
async list(params: {
|
|
3012
|
+
select: string[];
|
|
3013
|
+
include?: any;
|
|
3014
|
+
limit?: number;
|
|
3015
|
+
offset?: number;
|
|
3016
|
+
where?: Where<Select${Type}>;${hasVectorColumns ? `
|
|
3017
|
+
vector?: {
|
|
3018
|
+
field: string;
|
|
3019
|
+
query: number[];
|
|
3020
|
+
metric?: "cosine" | "l2" | "inner";
|
|
3021
|
+
maxDistance?: number;
|
|
3022
|
+
};` : ""}
|
|
3023
|
+
orderBy?: string | string[];
|
|
3024
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3025
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
3026
|
+
/**
|
|
3027
|
+
* List ${table.name} records with field exclusion
|
|
3028
|
+
* @param params - Query parameters with exclude
|
|
3029
|
+
* @returns Paginated results without excluded fields
|
|
3030
|
+
*/
|
|
3031
|
+
async list(params: {
|
|
3032
|
+
exclude: string[];
|
|
3033
|
+
include?: any;
|
|
3034
|
+
limit?: number;
|
|
3035
|
+
offset?: number;
|
|
3036
|
+
where?: Where<Select${Type}>;${hasVectorColumns ? `
|
|
3037
|
+
vector?: {
|
|
3038
|
+
field: string;
|
|
3039
|
+
query: number[];
|
|
3040
|
+
metric?: "cosine" | "l2" | "inner";
|
|
3041
|
+
maxDistance?: number;
|
|
3042
|
+
};` : ""}
|
|
3043
|
+
orderBy?: string | string[];
|
|
3044
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3045
|
+
}): Promise<PaginatedResponse<Partial<Select${Type}>${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
3046
|
+
/**
|
|
2902
3047
|
* List ${table.name} records with pagination and filtering
|
|
2903
3048
|
* @param params - Query parameters
|
|
2904
3049
|
* @param params.where - Filter conditions using operators like $eq, $gt, $in, $like, etc.
|
|
2905
|
-
* @param params.select - Array of field names to include in response
|
|
2906
|
-
* @param params.exclude - Array of field names to exclude from response (mutually exclusive with select)
|
|
2907
3050
|
* @param params.orderBy - Column(s) to sort by
|
|
2908
3051
|
* @param params.order - Sort direction(s): "asc" or "desc"
|
|
2909
3052
|
* @param params.limit - Maximum number of records to return (default: 50, max: 1000)
|
|
2910
3053
|
* @param params.offset - Number of records to skip for pagination
|
|
2911
3054
|
* @param params.include - Related records to include (see listWith* methods for typed includes)
|
|
2912
|
-
* @returns Paginated results with
|
|
2913
|
-
* @example
|
|
2914
|
-
* // With select:
|
|
2915
|
-
* const users = await client.list({ select: ['id', 'email'] });
|
|
3055
|
+
* @returns Paginated results with all fields
|
|
2916
3056
|
*/
|
|
3057
|
+
async list(params?: {
|
|
3058
|
+
include?: any;
|
|
3059
|
+
limit?: number;
|
|
3060
|
+
offset?: number;
|
|
3061
|
+
where?: Where<Select${Type}>;${hasVectorColumns ? `
|
|
3062
|
+
vector?: {
|
|
3063
|
+
field: string;
|
|
3064
|
+
query: number[];
|
|
3065
|
+
metric?: "cosine" | "l2" | "inner";
|
|
3066
|
+
maxDistance?: number;
|
|
3067
|
+
};` : ""}
|
|
3068
|
+
orderBy?: string | string[];
|
|
3069
|
+
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3070
|
+
}): Promise<PaginatedResponse<Select${Type}${hasVectorColumns ? " & { _distance?: number }" : ""}>>;
|
|
2917
3071
|
async list(params?: {
|
|
2918
3072
|
include?: any;
|
|
2919
3073
|
select?: string[];
|
|
@@ -2929,20 +3083,36 @@ ${hasJsonbColumns ? ` /**
|
|
|
2929
3083
|
};` : ""}
|
|
2930
3084
|
orderBy?: string | string[];
|
|
2931
3085
|
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
2932
|
-
}): Promise<PaginatedResponse<
|
|
3086
|
+
}): Promise<PaginatedResponse<Select${Type} | Partial<Select${Type}>>> {
|
|
2933
3087
|
return this.post<PaginatedResponse<Select${Type}${hasVectorColumns ? " & { _distance?: number }" : ""}>>(\`\${this.resource}/list\`, params ?? {});
|
|
2934
3088
|
}`}
|
|
2935
3089
|
|
|
2936
3090
|
${hasJsonbColumns ? ` /**
|
|
3091
|
+
* Update a ${table.name} record by primary key with field selection
|
|
3092
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3093
|
+
* @param patch - Partial data to update
|
|
3094
|
+
* @param options - Select specific fields to return
|
|
3095
|
+
* @returns The updated record with only selected fields if found, null otherwise
|
|
3096
|
+
*/
|
|
3097
|
+
async update<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, patch: NoInfer<Update${Type}<TJsonb>>, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
3098
|
+
/**
|
|
3099
|
+
* Update a ${table.name} record by primary key with field exclusion
|
|
3100
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3101
|
+
* @param patch - Partial data to update
|
|
3102
|
+
* @param options - Exclude specific fields from return
|
|
3103
|
+
* @returns The updated record without excluded fields if found, null otherwise
|
|
3104
|
+
*/
|
|
3105
|
+
async update<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, patch: NoInfer<Update${Type}<TJsonb>>, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
3106
|
+
/**
|
|
2937
3107
|
* Update a ${table.name} record by primary key
|
|
2938
3108
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2939
3109
|
* @param patch - Partial data to update
|
|
2940
|
-
* @
|
|
2941
|
-
* @returns The updated record if found, null otherwise
|
|
3110
|
+
* @returns The updated record with all fields if found, null otherwise
|
|
2942
3111
|
* @example
|
|
2943
3112
|
* // With JSONB type override:
|
|
2944
3113
|
* const user = await client.update<{ metadata: Metadata }>('user-id', { metadata: { tags: ['new'] } });
|
|
2945
3114
|
*/
|
|
3115
|
+
async update<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, patch: NoInfer<Update${Type}<TJsonb>>, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
2946
3116
|
async update<TJsonb extends Partial<Select${Type}> = {}>(
|
|
2947
3117
|
pk: ${pkType},
|
|
2948
3118
|
patch: NoInfer<Update${Type}<TJsonb>>,
|
|
@@ -2956,12 +3126,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
2956
3126
|
const url = query ? \`\${this.resource}/\${path}?\${query}\` : \`\${this.resource}/\${path}\`;
|
|
2957
3127
|
return this.patch<Select${Type}<TJsonb> | null>(url, patch);
|
|
2958
3128
|
}` : ` /**
|
|
3129
|
+
* Update a ${table.name} record by primary key with field selection
|
|
3130
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3131
|
+
* @param patch - Partial data to update
|
|
3132
|
+
* @param options - Select specific fields to return
|
|
3133
|
+
* @returns The updated record with only selected fields if found, null otherwise
|
|
3134
|
+
*/
|
|
3135
|
+
async update(pk: ${pkType}, patch: Update${Type}, options: { select: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
3136
|
+
/**
|
|
3137
|
+
* Update a ${table.name} record by primary key with field exclusion
|
|
3138
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3139
|
+
* @param patch - Partial data to update
|
|
3140
|
+
* @param options - Exclude specific fields from return
|
|
3141
|
+
* @returns The updated record without excluded fields if found, null otherwise
|
|
3142
|
+
*/
|
|
3143
|
+
async update(pk: ${pkType}, patch: Update${Type}, options: { exclude: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
3144
|
+
/**
|
|
2959
3145
|
* Update a ${table.name} record by primary key
|
|
2960
3146
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2961
3147
|
* @param patch - Partial data to update
|
|
2962
|
-
* @
|
|
2963
|
-
* @returns The updated record if found, null otherwise
|
|
3148
|
+
* @returns The updated record with all fields if found, null otherwise
|
|
2964
3149
|
*/
|
|
3150
|
+
async update(pk: ${pkType}, patch: Update${Type}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type} | null>;
|
|
2965
3151
|
async update(
|
|
2966
3152
|
pk: ${pkType},
|
|
2967
3153
|
patch: Update${Type},
|
|
@@ -2977,14 +3163,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
2977
3163
|
}`}
|
|
2978
3164
|
|
|
2979
3165
|
${hasJsonbColumns ? ` /**
|
|
3166
|
+
* Delete a ${table.name} record by primary key with field selection
|
|
3167
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3168
|
+
* @param options - Select specific fields to return
|
|
3169
|
+
* @returns The deleted record with only selected fields if found, null otherwise
|
|
3170
|
+
*/
|
|
3171
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
3172
|
+
/**
|
|
3173
|
+
* Delete a ${table.name} record by primary key with field exclusion
|
|
3174
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3175
|
+
* @param options - Exclude specific fields from return
|
|
3176
|
+
* @returns The deleted record without excluded fields if found, null otherwise
|
|
3177
|
+
*/
|
|
3178
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}<TJsonb>> | null>;
|
|
3179
|
+
/**
|
|
2980
3180
|
* Delete a ${table.name} record by primary key
|
|
2981
3181
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2982
|
-
* @
|
|
2983
|
-
* @returns The deleted record if found, null otherwise
|
|
3182
|
+
* @returns The deleted record with all fields if found, null otherwise
|
|
2984
3183
|
* @example
|
|
2985
3184
|
* // With JSONB type override:
|
|
2986
3185
|
* const user = await client.delete<{ metadata: Metadata }>('user-id');
|
|
2987
3186
|
*/
|
|
3187
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
2988
3188
|
async delete<TJsonb extends Partial<Select${Type}> = {}>(
|
|
2989
3189
|
pk: ${pkType},
|
|
2990
3190
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -2997,11 +3197,25 @@ ${hasJsonbColumns ? ` /**
|
|
|
2997
3197
|
const url = query ? \`\${this.resource}/\${path}?\${query}\` : \`\${this.resource}/\${path}\`;
|
|
2998
3198
|
return this.del<Select${Type}<TJsonb> | null>(url);
|
|
2999
3199
|
}` : ` /**
|
|
3200
|
+
* Delete a ${table.name} record by primary key with field selection
|
|
3201
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3202
|
+
* @param options - Select specific fields to return
|
|
3203
|
+
* @returns The deleted record with only selected fields if found, null otherwise
|
|
3204
|
+
*/
|
|
3205
|
+
async delete(pk: ${pkType}, options: { select: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
3206
|
+
/**
|
|
3207
|
+
* Delete a ${table.name} record by primary key with field exclusion
|
|
3208
|
+
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3209
|
+
* @param options - Exclude specific fields from return
|
|
3210
|
+
* @returns The deleted record without excluded fields if found, null otherwise
|
|
3211
|
+
*/
|
|
3212
|
+
async delete(pk: ${pkType}, options: { exclude: string[] }): Promise<Partial<Select${Type}> | null>;
|
|
3213
|
+
/**
|
|
3000
3214
|
* Delete a ${table.name} record by primary key
|
|
3001
3215
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3002
|
-
* @
|
|
3003
|
-
* @returns The deleted record if found, null otherwise
|
|
3216
|
+
* @returns The deleted record with all fields if found, null otherwise
|
|
3004
3217
|
*/
|
|
3218
|
+
async delete(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type} | null>;
|
|
3005
3219
|
async delete(
|
|
3006
3220
|
pk: ${pkType},
|
|
3007
3221
|
options?: { select?: string[]; exclude?: string[] }
|