@supabase/postgrest-js 2.108.0 → 2.108.1-canary.1
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.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -11
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +13 -11
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PostgrestBuilder.ts +2 -2
- package/src/PostgrestFilterBuilder.ts +37 -3
- package/src/PostgrestTransformBuilder.ts +47 -15
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/PostgrestBuilder.ts
CHANGED
|
@@ -152,9 +152,9 @@ export default abstract class PostgrestBuilder<
|
|
|
152
152
|
*
|
|
153
153
|
* @category Database
|
|
154
154
|
*/
|
|
155
|
-
throwOnError():
|
|
155
|
+
throwOnError(): PostgrestBuilder<ClientOptions, Result, true> {
|
|
156
156
|
this.shouldThrowOnError = true
|
|
157
|
-
return this as
|
|
157
|
+
return this as PostgrestBuilder<ClientOptions, Result, true>
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
@@ -100,6 +100,7 @@ export default class PostgrestFilterBuilder<
|
|
|
100
100
|
RelationName = unknown,
|
|
101
101
|
Relationships = unknown,
|
|
102
102
|
Method = unknown,
|
|
103
|
+
ThrowOnError extends boolean = false,
|
|
103
104
|
> extends PostgrestTransformBuilder<
|
|
104
105
|
ClientOptions,
|
|
105
106
|
Schema,
|
|
@@ -107,8 +108,31 @@ export default class PostgrestFilterBuilder<
|
|
|
107
108
|
Result,
|
|
108
109
|
RelationName,
|
|
109
110
|
Relationships,
|
|
110
|
-
Method
|
|
111
|
+
Method,
|
|
112
|
+
ThrowOnError
|
|
111
113
|
> {
|
|
114
|
+
throwOnError(): PostgrestFilterBuilder<
|
|
115
|
+
ClientOptions,
|
|
116
|
+
Schema,
|
|
117
|
+
Row,
|
|
118
|
+
Result,
|
|
119
|
+
RelationName,
|
|
120
|
+
Relationships,
|
|
121
|
+
Method,
|
|
122
|
+
true
|
|
123
|
+
> {
|
|
124
|
+
return super.throwOnError() as PostgrestFilterBuilder<
|
|
125
|
+
ClientOptions,
|
|
126
|
+
Schema,
|
|
127
|
+
Row,
|
|
128
|
+
Result,
|
|
129
|
+
RelationName,
|
|
130
|
+
Relationships,
|
|
131
|
+
Method,
|
|
132
|
+
true
|
|
133
|
+
>
|
|
134
|
+
}
|
|
135
|
+
|
|
112
136
|
/**
|
|
113
137
|
* Match only rows where `column` is equal to `value`.
|
|
114
138
|
*
|
|
@@ -1773,7 +1797,8 @@ export default class PostgrestFilterBuilder<
|
|
|
1773
1797
|
NarrowResultColumn<Result, ColumnName>,
|
|
1774
1798
|
RelationName,
|
|
1775
1799
|
Relationships,
|
|
1776
|
-
Method
|
|
1800
|
+
Method,
|
|
1801
|
+
ThrowOnError
|
|
1777
1802
|
> &
|
|
1778
1803
|
this
|
|
1779
1804
|
not<ColumnName extends string & keyof Row>(
|
|
@@ -1845,7 +1870,16 @@ export default class PostgrestFilterBuilder<
|
|
|
1845
1870
|
column: string,
|
|
1846
1871
|
operator: string,
|
|
1847
1872
|
value: unknown
|
|
1848
|
-
): PostgrestFilterBuilder<
|
|
1873
|
+
): PostgrestFilterBuilder<
|
|
1874
|
+
ClientOptions,
|
|
1875
|
+
Schema,
|
|
1876
|
+
any,
|
|
1877
|
+
any,
|
|
1878
|
+
RelationName,
|
|
1879
|
+
Relationships,
|
|
1880
|
+
Method,
|
|
1881
|
+
ThrowOnError
|
|
1882
|
+
> &
|
|
1849
1883
|
this {
|
|
1850
1884
|
this.url.searchParams.append(column, `not.${operator}.${value}`)
|
|
1851
1885
|
return this as any
|
|
@@ -13,7 +13,30 @@ export default class PostgrestTransformBuilder<
|
|
|
13
13
|
RelationName = unknown,
|
|
14
14
|
Relationships = unknown,
|
|
15
15
|
Method = unknown,
|
|
16
|
-
|
|
16
|
+
ThrowOnError extends boolean = false,
|
|
17
|
+
> extends PostgrestBuilder<ClientOptions, Result, ThrowOnError> {
|
|
18
|
+
throwOnError(): PostgrestTransformBuilder<
|
|
19
|
+
ClientOptions,
|
|
20
|
+
Schema,
|
|
21
|
+
Row,
|
|
22
|
+
Result,
|
|
23
|
+
RelationName,
|
|
24
|
+
Relationships,
|
|
25
|
+
Method,
|
|
26
|
+
true
|
|
27
|
+
> {
|
|
28
|
+
return super.throwOnError() as PostgrestTransformBuilder<
|
|
29
|
+
ClientOptions,
|
|
30
|
+
Schema,
|
|
31
|
+
Row,
|
|
32
|
+
Result,
|
|
33
|
+
RelationName,
|
|
34
|
+
Relationships,
|
|
35
|
+
Method,
|
|
36
|
+
true
|
|
37
|
+
>
|
|
38
|
+
}
|
|
39
|
+
|
|
17
40
|
/**
|
|
18
41
|
* Perform a SELECT on the query result.
|
|
19
42
|
*
|
|
@@ -75,7 +98,8 @@ export default class PostgrestTransformBuilder<
|
|
|
75
98
|
: NewResultOne[],
|
|
76
99
|
RelationName,
|
|
77
100
|
Relationships,
|
|
78
|
-
Method
|
|
101
|
+
Method,
|
|
102
|
+
ThrowOnError
|
|
79
103
|
> {
|
|
80
104
|
// Remove whitespaces except when quoted
|
|
81
105
|
let quoted = false
|
|
@@ -104,7 +128,8 @@ export default class PostgrestTransformBuilder<
|
|
|
104
128
|
: NewResultOne[],
|
|
105
129
|
RelationName,
|
|
106
130
|
Relationships,
|
|
107
|
-
Method
|
|
131
|
+
Method,
|
|
132
|
+
ThrowOnError
|
|
108
133
|
>
|
|
109
134
|
}
|
|
110
135
|
|
|
@@ -644,10 +669,11 @@ export default class PostgrestTransformBuilder<
|
|
|
644
669
|
*/
|
|
645
670
|
single<ResultOne = Result extends (infer ResultOne)[] ? ResultOne : never>(): PostgrestBuilder<
|
|
646
671
|
ClientOptions,
|
|
647
|
-
ResultOne
|
|
672
|
+
ResultOne,
|
|
673
|
+
ThrowOnError
|
|
648
674
|
> {
|
|
649
675
|
this.headers.set('Accept', 'application/vnd.pgrst.object+json')
|
|
650
|
-
return this as unknown as PostgrestBuilder<ClientOptions, ResultOne>
|
|
676
|
+
return this as unknown as PostgrestBuilder<ClientOptions, ResultOne, ThrowOnError>
|
|
651
677
|
}
|
|
652
678
|
|
|
653
679
|
/**
|
|
@@ -691,11 +717,11 @@ export default class PostgrestTransformBuilder<
|
|
|
691
717
|
*/
|
|
692
718
|
maybeSingle<
|
|
693
719
|
ResultOne = Result extends (infer ResultOne)[] ? ResultOne : never,
|
|
694
|
-
>(): PostgrestBuilder<ClientOptions, ResultOne | null> {
|
|
720
|
+
>(): PostgrestBuilder<ClientOptions, ResultOne | null, ThrowOnError> {
|
|
695
721
|
// No Accept header override — we fetch as a list and enforce cardinality client-side.
|
|
696
722
|
// Fixes https://github.com/supabase/postgrest-js/issues/361 for all request methods.
|
|
697
723
|
this.isMaybeSingle = true
|
|
698
|
-
return this as unknown as PostgrestBuilder<ClientOptions, ResultOne | null>
|
|
724
|
+
return this as unknown as PostgrestBuilder<ClientOptions, ResultOne | null, ThrowOnError>
|
|
699
725
|
}
|
|
700
726
|
|
|
701
727
|
/**
|
|
@@ -737,9 +763,9 @@ export default class PostgrestTransformBuilder<
|
|
|
737
763
|
* }
|
|
738
764
|
* ```
|
|
739
765
|
*/
|
|
740
|
-
csv(): PostgrestBuilder<ClientOptions, string> {
|
|
766
|
+
csv(): PostgrestBuilder<ClientOptions, string, ThrowOnError> {
|
|
741
767
|
this.headers.set('Accept', 'text/csv')
|
|
742
|
-
return this as unknown as PostgrestBuilder<ClientOptions, string>
|
|
768
|
+
return this as unknown as PostgrestBuilder<ClientOptions, string, ThrowOnError>
|
|
743
769
|
}
|
|
744
770
|
|
|
745
771
|
/**
|
|
@@ -747,9 +773,9 @@ export default class PostgrestTransformBuilder<
|
|
|
747
773
|
*
|
|
748
774
|
* @category Database
|
|
749
775
|
*/
|
|
750
|
-
geojson(): PostgrestBuilder<ClientOptions, Record<string, unknown
|
|
776
|
+
geojson(): PostgrestBuilder<ClientOptions, Record<string, unknown>, ThrowOnError> {
|
|
751
777
|
this.headers.set('Accept', 'application/geo+json')
|
|
752
|
-
return this as unknown as PostgrestBuilder<ClientOptions, Record<string, unknown
|
|
778
|
+
return this as unknown as PostgrestBuilder<ClientOptions, Record<string, unknown>, ThrowOnError>
|
|
753
779
|
}
|
|
754
780
|
|
|
755
781
|
/**
|
|
@@ -879,9 +905,13 @@ export default class PostgrestTransformBuilder<
|
|
|
879
905
|
`application/vnd.pgrst.plan+${format}; for="${forMediatype}"; options=${options};`
|
|
880
906
|
)
|
|
881
907
|
if (format === 'json') {
|
|
882
|
-
return this as unknown as PostgrestBuilder<
|
|
908
|
+
return this as unknown as PostgrestBuilder<
|
|
909
|
+
ClientOptions,
|
|
910
|
+
Record<string, unknown>[],
|
|
911
|
+
ThrowOnError
|
|
912
|
+
>
|
|
883
913
|
} else {
|
|
884
|
-
return this as unknown as PostgrestBuilder<ClientOptions, string>
|
|
914
|
+
return this as unknown as PostgrestBuilder<ClientOptions, string, ThrowOnError>
|
|
885
915
|
}
|
|
886
916
|
}
|
|
887
917
|
|
|
@@ -943,7 +973,8 @@ export default class PostgrestTransformBuilder<
|
|
|
943
973
|
CheckMatchingArrayTypes<Result, NewResult>,
|
|
944
974
|
RelationName,
|
|
945
975
|
Relationships,
|
|
946
|
-
Method
|
|
976
|
+
Method,
|
|
977
|
+
ThrowOnError
|
|
947
978
|
> {
|
|
948
979
|
return this as unknown as PostgrestTransformBuilder<
|
|
949
980
|
ClientOptions,
|
|
@@ -952,7 +983,8 @@ export default class PostgrestTransformBuilder<
|
|
|
952
983
|
CheckMatchingArrayTypes<Result, NewResult>,
|
|
953
984
|
RelationName,
|
|
954
985
|
Relationships,
|
|
955
|
-
Method
|
|
986
|
+
Method,
|
|
987
|
+
ThrowOnError
|
|
956
988
|
>
|
|
957
989
|
}
|
|
958
990
|
|
package/src/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.108.
|
|
7
|
+
export const version = '2.108.1-canary.1'
|