postgresdk 0.18.4 → 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 +122 -15
- package/dist/index.js +122 -15
- 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[] }
|
|
@@ -3817,14 +3831,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
3817
3831
|
}`}
|
|
3818
3832
|
|
|
3819
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
|
+
/**
|
|
3820
3848
|
* Get a ${table.name} record by primary key
|
|
3821
3849
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3822
|
-
* @
|
|
3823
|
-
* @returns The record if found, null otherwise
|
|
3850
|
+
* @returns The record with all fields if found, null otherwise
|
|
3824
3851
|
* @example
|
|
3825
3852
|
* // With JSONB type override:
|
|
3826
3853
|
* const user = await client.getByPk<{ metadata: Metadata }>('user-id');
|
|
3827
3854
|
*/
|
|
3855
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
3828
3856
|
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3829
3857
|
pk: ${pkType},
|
|
3830
3858
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -3870,24 +3898,73 @@ ${hasJsonbColumns ? ` /**
|
|
|
3870
3898
|
}`}
|
|
3871
3899
|
|
|
3872
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
|
+
/**
|
|
3873
3941
|
* List ${table.name} records with pagination and filtering
|
|
3874
3942
|
* @param params - Query parameters
|
|
3875
3943
|
* @param params.where - Filter conditions using operators like $eq, $gt, $in, $like, etc.
|
|
3876
|
-
* @param params.select - Array of field names to include in response
|
|
3877
|
-
* @param params.exclude - Array of field names to exclude from response (mutually exclusive with select)
|
|
3878
3944
|
* @param params.orderBy - Column(s) to sort by
|
|
3879
3945
|
* @param params.order - Sort direction(s): "asc" or "desc"
|
|
3880
3946
|
* @param params.limit - Maximum number of records to return (default: 50, max: 1000)
|
|
3881
3947
|
* @param params.offset - Number of records to skip for pagination
|
|
3882
3948
|
* @param params.include - Related records to include (see listWith* methods for typed includes)
|
|
3883
|
-
* @returns Paginated results with
|
|
3949
|
+
* @returns Paginated results with all fields
|
|
3884
3950
|
* @example
|
|
3885
3951
|
* // With JSONB type override:
|
|
3886
3952
|
* const users = await client.list<{ metadata: Metadata }>({ where: { status: 'active' } });
|
|
3887
|
-
* @example
|
|
3888
|
-
* // With select:
|
|
3889
|
-
* const users = await client.list({ select: ['id', 'email'] });
|
|
3890
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 }" : ""}>>;
|
|
3891
3968
|
async list<TJsonb extends Partial<Select${Type}> = {}>(params?: {
|
|
3892
3969
|
include?: any;
|
|
3893
3970
|
select?: string[];
|
|
@@ -3903,7 +3980,7 @@ ${hasJsonbColumns ? ` /**
|
|
|
3903
3980
|
};` : ""}
|
|
3904
3981
|
orderBy?: string | string[];
|
|
3905
3982
|
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
3906
|
-
}): Promise<PaginatedResponse<
|
|
3983
|
+
}): Promise<PaginatedResponse<Select${Type}<TJsonb> | Partial<Select${Type}<TJsonb>>>> {
|
|
3907
3984
|
return this.post<PaginatedResponse<Select${Type}<TJsonb>${hasVectorColumns ? " & { _distance?: number }" : ""}>>(\`\${this.resource}/list\`, params ?? {});
|
|
3908
3985
|
}` : ` /**
|
|
3909
3986
|
* List ${table.name} records with field selection
|
|
@@ -3990,15 +4067,31 @@ ${hasJsonbColumns ? ` /**
|
|
|
3990
4067
|
}`}
|
|
3991
4068
|
|
|
3992
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
|
+
/**
|
|
3993
4086
|
* Update a ${table.name} record by primary key
|
|
3994
4087
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3995
4088
|
* @param patch - Partial data to update
|
|
3996
|
-
* @
|
|
3997
|
-
* @returns The updated record if found, null otherwise
|
|
4089
|
+
* @returns The updated record with all fields if found, null otherwise
|
|
3998
4090
|
* @example
|
|
3999
4091
|
* // With JSONB type override:
|
|
4000
4092
|
* const user = await client.update<{ metadata: Metadata }>('user-id', { metadata: { tags: ['new'] } });
|
|
4001
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>;
|
|
4002
4095
|
async update<TJsonb extends Partial<Select${Type}> = {}>(
|
|
4003
4096
|
pk: ${pkType},
|
|
4004
4097
|
patch: NoInfer<Update${Type}<TJsonb>>,
|
|
@@ -4049,14 +4142,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
4049
4142
|
}`}
|
|
4050
4143
|
|
|
4051
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
|
+
/**
|
|
4052
4159
|
* Delete a ${table.name} record by primary key
|
|
4053
4160
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
4054
|
-
* @
|
|
4055
|
-
* @returns The deleted record if found, null otherwise
|
|
4161
|
+
* @returns The deleted record with all fields if found, null otherwise
|
|
4056
4162
|
* @example
|
|
4057
4163
|
* // With JSONB type override:
|
|
4058
4164
|
* const user = await client.delete<{ metadata: Metadata }>('user-id');
|
|
4059
4165
|
*/
|
|
4166
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
4060
4167
|
async delete<TJsonb extends Partial<Select${Type}> = {}>(
|
|
4061
4168
|
pk: ${pkType},
|
|
4062
4169
|
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[] }
|
|
@@ -2838,14 +2852,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
2838
2852
|
}`}
|
|
2839
2853
|
|
|
2840
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
|
+
/**
|
|
2841
2869
|
* Get a ${table.name} record by primary key
|
|
2842
2870
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
2843
|
-
* @
|
|
2844
|
-
* @returns The record if found, null otherwise
|
|
2871
|
+
* @returns The record with all fields if found, null otherwise
|
|
2845
2872
|
* @example
|
|
2846
2873
|
* // With JSONB type override:
|
|
2847
2874
|
* const user = await client.getByPk<{ metadata: Metadata }>('user-id');
|
|
2848
2875
|
*/
|
|
2876
|
+
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
2849
2877
|
async getByPk<TJsonb extends Partial<Select${Type}> = {}>(
|
|
2850
2878
|
pk: ${pkType},
|
|
2851
2879
|
options?: { select?: string[]; exclude?: string[] }
|
|
@@ -2891,24 +2919,73 @@ ${hasJsonbColumns ? ` /**
|
|
|
2891
2919
|
}`}
|
|
2892
2920
|
|
|
2893
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
|
+
/**
|
|
2894
2962
|
* List ${table.name} records with pagination and filtering
|
|
2895
2963
|
* @param params - Query parameters
|
|
2896
2964
|
* @param params.where - Filter conditions using operators like $eq, $gt, $in, $like, etc.
|
|
2897
|
-
* @param params.select - Array of field names to include in response
|
|
2898
|
-
* @param params.exclude - Array of field names to exclude from response (mutually exclusive with select)
|
|
2899
2965
|
* @param params.orderBy - Column(s) to sort by
|
|
2900
2966
|
* @param params.order - Sort direction(s): "asc" or "desc"
|
|
2901
2967
|
* @param params.limit - Maximum number of records to return (default: 50, max: 1000)
|
|
2902
2968
|
* @param params.offset - Number of records to skip for pagination
|
|
2903
2969
|
* @param params.include - Related records to include (see listWith* methods for typed includes)
|
|
2904
|
-
* @returns Paginated results with
|
|
2970
|
+
* @returns Paginated results with all fields
|
|
2905
2971
|
* @example
|
|
2906
2972
|
* // With JSONB type override:
|
|
2907
2973
|
* const users = await client.list<{ metadata: Metadata }>({ where: { status: 'active' } });
|
|
2908
|
-
* @example
|
|
2909
|
-
* // With select:
|
|
2910
|
-
* const users = await client.list({ select: ['id', 'email'] });
|
|
2911
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 }" : ""}>>;
|
|
2912
2989
|
async list<TJsonb extends Partial<Select${Type}> = {}>(params?: {
|
|
2913
2990
|
include?: any;
|
|
2914
2991
|
select?: string[];
|
|
@@ -2924,7 +3001,7 @@ ${hasJsonbColumns ? ` /**
|
|
|
2924
3001
|
};` : ""}
|
|
2925
3002
|
orderBy?: string | string[];
|
|
2926
3003
|
order?: "asc" | "desc" | ("asc" | "desc")[];
|
|
2927
|
-
}): Promise<PaginatedResponse<
|
|
3004
|
+
}): Promise<PaginatedResponse<Select${Type}<TJsonb> | Partial<Select${Type}<TJsonb>>>> {
|
|
2928
3005
|
return this.post<PaginatedResponse<Select${Type}<TJsonb>${hasVectorColumns ? " & { _distance?: number }" : ""}>>(\`\${this.resource}/list\`, params ?? {});
|
|
2929
3006
|
}` : ` /**
|
|
2930
3007
|
* List ${table.name} records with field selection
|
|
@@ -3011,15 +3088,31 @@ ${hasJsonbColumns ? ` /**
|
|
|
3011
3088
|
}`}
|
|
3012
3089
|
|
|
3013
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
|
+
/**
|
|
3014
3107
|
* Update a ${table.name} record by primary key
|
|
3015
3108
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3016
3109
|
* @param patch - Partial data to update
|
|
3017
|
-
* @
|
|
3018
|
-
* @returns The updated record if found, null otherwise
|
|
3110
|
+
* @returns The updated record with all fields if found, null otherwise
|
|
3019
3111
|
* @example
|
|
3020
3112
|
* // With JSONB type override:
|
|
3021
3113
|
* const user = await client.update<{ metadata: Metadata }>('user-id', { metadata: { tags: ['new'] } });
|
|
3022
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>;
|
|
3023
3116
|
async update<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3024
3117
|
pk: ${pkType},
|
|
3025
3118
|
patch: NoInfer<Update${Type}<TJsonb>>,
|
|
@@ -3070,14 +3163,28 @@ ${hasJsonbColumns ? ` /**
|
|
|
3070
3163
|
}`}
|
|
3071
3164
|
|
|
3072
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
|
+
/**
|
|
3073
3180
|
* Delete a ${table.name} record by primary key
|
|
3074
3181
|
* @param pk - The primary key value${hasCompositePk ? "s" : ""}
|
|
3075
|
-
* @
|
|
3076
|
-
* @returns The deleted record if found, null otherwise
|
|
3182
|
+
* @returns The deleted record with all fields if found, null otherwise
|
|
3077
3183
|
* @example
|
|
3078
3184
|
* // With JSONB type override:
|
|
3079
3185
|
* const user = await client.delete<{ metadata: Metadata }>('user-id');
|
|
3080
3186
|
*/
|
|
3187
|
+
async delete<TJsonb extends Partial<Select${Type}> = {}>(pk: ${pkType}, options?: Omit<{ select?: string[]; exclude?: string[] }, 'select' | 'exclude'>): Promise<Select${Type}<TJsonb> | null>;
|
|
3081
3188
|
async delete<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3082
3189
|
pk: ${pkType},
|
|
3083
3190
|
options?: { select?: string[]; exclude?: string[] }
|