postgresdk 0.16.13 → 0.16.14
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 +8 -8
- package/dist/index.js +8 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3539,7 +3539,7 @@ ${hasJsonbColumns ? ` /**
|
|
|
3539
3539
|
* const user = await client.create<{ metadata: Metadata }>({ name: 'Alice', metadata: { tags: [], prefs: { theme: 'light' } } });
|
|
3540
3540
|
*/
|
|
3541
3541
|
async create<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3542
|
-
data: Insert${Type}<TJsonb
|
|
3542
|
+
data: NoInfer<Insert${Type}<TJsonb>>
|
|
3543
3543
|
): Promise<Select${Type}<TJsonb>> {
|
|
3544
3544
|
return this.post<Select${Type}<TJsonb>>(this.resource, data);
|
|
3545
3545
|
}` : ` /**
|
|
@@ -3642,7 +3642,7 @@ ${hasJsonbColumns ? ` /**
|
|
|
3642
3642
|
*/
|
|
3643
3643
|
async update<TJsonb extends Partial<Select${Type}> = {}>(
|
|
3644
3644
|
pk: ${pkType},
|
|
3645
|
-
patch: Update${Type}<TJsonb
|
|
3645
|
+
patch: NoInfer<Update${Type}<TJsonb>>
|
|
3646
3646
|
): Promise<Select${Type}<TJsonb> | null> {
|
|
3647
3647
|
const path = ${pkPathExpr};
|
|
3648
3648
|
return this.patch<Select${Type}<TJsonb> | null>(\`\${this.resource}/\${path}\`, patch);
|
|
@@ -3854,18 +3854,18 @@ export abstract class BaseClient {
|
|
|
3854
3854
|
/**
|
|
3855
3855
|
* Make a POST request
|
|
3856
3856
|
*/
|
|
3857
|
-
protected async post<T>(path: string, body?:
|
|
3857
|
+
protected async post<T>(path: string, body?: unknown): Promise<T> {
|
|
3858
3858
|
const res = await this.fetchFn(\`\${this.baseUrl}\${path}\`, {
|
|
3859
3859
|
method: "POST",
|
|
3860
3860
|
headers: await this.headers(true),
|
|
3861
3861
|
body: JSON.stringify(body),
|
|
3862
3862
|
});
|
|
3863
|
-
|
|
3863
|
+
|
|
3864
3864
|
// Handle 404 specially for operations that might return null
|
|
3865
3865
|
if (res.status === 404) {
|
|
3866
3866
|
return null as T;
|
|
3867
3867
|
}
|
|
3868
|
-
|
|
3868
|
+
|
|
3869
3869
|
await this.okOrThrow(res, "POST", path);
|
|
3870
3870
|
return (await res.json()) as T;
|
|
3871
3871
|
}
|
|
@@ -3889,17 +3889,17 @@ export abstract class BaseClient {
|
|
|
3889
3889
|
/**
|
|
3890
3890
|
* Make a PATCH request
|
|
3891
3891
|
*/
|
|
3892
|
-
protected async patch<T>(path: string, body?:
|
|
3892
|
+
protected async patch<T>(path: string, body?: unknown): Promise<T> {
|
|
3893
3893
|
const res = await this.fetchFn(\`\${this.baseUrl}\${path}\`, {
|
|
3894
3894
|
method: "PATCH",
|
|
3895
3895
|
headers: await this.headers(true),
|
|
3896
3896
|
body: JSON.stringify(body),
|
|
3897
3897
|
});
|
|
3898
|
-
|
|
3898
|
+
|
|
3899
3899
|
if (res.status === 404) {
|
|
3900
3900
|
return null as T;
|
|
3901
3901
|
}
|
|
3902
|
-
|
|
3902
|
+
|
|
3903
3903
|
await this.okOrThrow(res, "PATCH", path);
|
|
3904
3904
|
return (await res.json()) as T;
|
|
3905
3905
|
}
|
package/dist/index.js
CHANGED
|
@@ -2606,7 +2606,7 @@ ${hasJsonbColumns ? ` /**
|
|
|
2606
2606
|
* const user = await client.create<{ metadata: Metadata }>({ name: 'Alice', metadata: { tags: [], prefs: { theme: 'light' } } });
|
|
2607
2607
|
*/
|
|
2608
2608
|
async create<TJsonb extends Partial<Select${Type}> = {}>(
|
|
2609
|
-
data: Insert${Type}<TJsonb
|
|
2609
|
+
data: NoInfer<Insert${Type}<TJsonb>>
|
|
2610
2610
|
): Promise<Select${Type}<TJsonb>> {
|
|
2611
2611
|
return this.post<Select${Type}<TJsonb>>(this.resource, data);
|
|
2612
2612
|
}` : ` /**
|
|
@@ -2709,7 +2709,7 @@ ${hasJsonbColumns ? ` /**
|
|
|
2709
2709
|
*/
|
|
2710
2710
|
async update<TJsonb extends Partial<Select${Type}> = {}>(
|
|
2711
2711
|
pk: ${pkType},
|
|
2712
|
-
patch: Update${Type}<TJsonb
|
|
2712
|
+
patch: NoInfer<Update${Type}<TJsonb>>
|
|
2713
2713
|
): Promise<Select${Type}<TJsonb> | null> {
|
|
2714
2714
|
const path = ${pkPathExpr};
|
|
2715
2715
|
return this.patch<Select${Type}<TJsonb> | null>(\`\${this.resource}/\${path}\`, patch);
|
|
@@ -2921,18 +2921,18 @@ export abstract class BaseClient {
|
|
|
2921
2921
|
/**
|
|
2922
2922
|
* Make a POST request
|
|
2923
2923
|
*/
|
|
2924
|
-
protected async post<T>(path: string, body?:
|
|
2924
|
+
protected async post<T>(path: string, body?: unknown): Promise<T> {
|
|
2925
2925
|
const res = await this.fetchFn(\`\${this.baseUrl}\${path}\`, {
|
|
2926
2926
|
method: "POST",
|
|
2927
2927
|
headers: await this.headers(true),
|
|
2928
2928
|
body: JSON.stringify(body),
|
|
2929
2929
|
});
|
|
2930
|
-
|
|
2930
|
+
|
|
2931
2931
|
// Handle 404 specially for operations that might return null
|
|
2932
2932
|
if (res.status === 404) {
|
|
2933
2933
|
return null as T;
|
|
2934
2934
|
}
|
|
2935
|
-
|
|
2935
|
+
|
|
2936
2936
|
await this.okOrThrow(res, "POST", path);
|
|
2937
2937
|
return (await res.json()) as T;
|
|
2938
2938
|
}
|
|
@@ -2956,17 +2956,17 @@ export abstract class BaseClient {
|
|
|
2956
2956
|
/**
|
|
2957
2957
|
* Make a PATCH request
|
|
2958
2958
|
*/
|
|
2959
|
-
protected async patch<T>(path: string, body?:
|
|
2959
|
+
protected async patch<T>(path: string, body?: unknown): Promise<T> {
|
|
2960
2960
|
const res = await this.fetchFn(\`\${this.baseUrl}\${path}\`, {
|
|
2961
2961
|
method: "PATCH",
|
|
2962
2962
|
headers: await this.headers(true),
|
|
2963
2963
|
body: JSON.stringify(body),
|
|
2964
2964
|
});
|
|
2965
|
-
|
|
2965
|
+
|
|
2966
2966
|
if (res.status === 404) {
|
|
2967
2967
|
return null as T;
|
|
2968
2968
|
}
|
|
2969
|
-
|
|
2969
|
+
|
|
2970
2970
|
await this.okOrThrow(res, "PATCH", path);
|
|
2971
2971
|
return (await res.json()) as T;
|
|
2972
2972
|
}
|