@supabase/postgrest-js 2.100.0 → 2.100.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 +4 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -17
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PostgrestBuilder.ts +3 -10
- package/src/PostgrestClient.ts +1 -1
- package/src/PostgrestFilterBuilder.ts +20 -11
- package/src/PostgrestQueryBuilder.ts +1 -11
- package/src/PostgrestTransformBuilder.ts +2 -7
- package/src/select-query-parser/utils.ts +9 -7
- package/src/version.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,7 @@ var PostgrestBuilder = class {
|
|
|
47
47
|
*
|
|
48
48
|
* @category Database
|
|
49
49
|
*
|
|
50
|
-
* @example
|
|
50
|
+
* @example Creating a Postgrest query builder
|
|
51
51
|
* ```ts
|
|
52
52
|
* import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
|
|
53
53
|
*
|
|
@@ -126,7 +126,7 @@ var PostgrestBuilder = class {
|
|
|
126
126
|
const countHeader = (_this$headers$get2 = _this.headers.get("Prefer")) === null || _this$headers$get2 === void 0 ? void 0 : _this$headers$get2.match(/count=(exact|planned|estimated)/);
|
|
127
127
|
const contentRange = (_res$headers$get = res$1.headers.get("content-range")) === null || _res$headers$get === void 0 ? void 0 : _res$headers$get.split("/");
|
|
128
128
|
if (countHeader && contentRange && contentRange.length > 1) count = parseInt(contentRange[1]);
|
|
129
|
-
if (_this.isMaybeSingle &&
|
|
129
|
+
if (_this.isMaybeSingle && Array.isArray(data)) if (data.length > 1) {
|
|
130
130
|
error = {
|
|
131
131
|
code: "PGRST116",
|
|
132
132
|
details: `Results contain ${data.length} rows, application/vnd.pgrst.object+json requires 1 row`,
|
|
@@ -140,7 +140,6 @@ var PostgrestBuilder = class {
|
|
|
140
140
|
} else if (data.length === 1) data = data[0];
|
|
141
141
|
else data = null;
|
|
142
142
|
} else {
|
|
143
|
-
var _error$details;
|
|
144
143
|
const body = await res$1.text();
|
|
145
144
|
try {
|
|
146
145
|
error = JSON.parse(body);
|
|
@@ -156,11 +155,6 @@ var PostgrestBuilder = class {
|
|
|
156
155
|
statusText = "No Content";
|
|
157
156
|
} else error = { message: body };
|
|
158
157
|
}
|
|
159
|
-
if (error && _this.isMaybeSingle && (error === null || error === void 0 || (_error$details = error.details) === null || _error$details === void 0 ? void 0 : _error$details.includes("0 rows"))) {
|
|
160
|
-
error = null;
|
|
161
|
-
status = 200;
|
|
162
|
-
statusText = "OK";
|
|
163
|
-
}
|
|
164
158
|
if (error && _this.shouldThrowOnError) throw new PostgrestError(error);
|
|
165
159
|
}
|
|
166
160
|
return {
|
|
@@ -894,8 +888,6 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
894
888
|
* ```
|
|
895
889
|
*/
|
|
896
890
|
maybeSingle() {
|
|
897
|
-
if (this.method === "GET") this.headers.set("Accept", "application/json");
|
|
898
|
-
else this.headers.set("Accept", "application/vnd.pgrst.object+json");
|
|
899
891
|
this.isMaybeSingle = true;
|
|
900
892
|
return this;
|
|
901
893
|
}
|
|
@@ -2897,19 +2889,9 @@ var PostgrestQueryBuilder = class {
|
|
|
2897
2889
|
/**
|
|
2898
2890
|
* Creates a query builder scoped to a Postgres table or view.
|
|
2899
2891
|
*
|
|
2900
|
-
* @example
|
|
2901
|
-
* ```ts
|
|
2902
|
-
* import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
|
|
2903
|
-
*
|
|
2904
|
-
* const query = new PostgrestQueryBuilder(
|
|
2905
|
-
* new URL('https://xyzcompany.supabase.co/rest/v1/users'),
|
|
2906
|
-
* { headers: { apikey: 'public-anon-key' } }
|
|
2907
|
-
* )
|
|
2908
|
-
* ```
|
|
2909
|
-
*
|
|
2910
2892
|
* @category Database
|
|
2911
2893
|
*
|
|
2912
|
-
* @example
|
|
2894
|
+
* @example Creating a Postgrest query builder
|
|
2913
2895
|
* ```ts
|
|
2914
2896
|
* import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
|
|
2915
2897
|
*
|
|
@@ -4496,7 +4478,7 @@ var PostgrestClient = class PostgrestClient {
|
|
|
4496
4478
|
* - A `timeout` option (in milliseconds) can be set to automatically abort requests that take too long.
|
|
4497
4479
|
* - A `urlLengthLimit` option (default: 8000) can be set to control when URL length warnings are included in error messages for aborted requests.
|
|
4498
4480
|
*
|
|
4499
|
-
* @example
|
|
4481
|
+
* @example Creating a Postgrest client
|
|
4500
4482
|
* ```ts
|
|
4501
4483
|
* import { PostgrestClient } from '@supabase/postgrest-js'
|
|
4502
4484
|
*
|