@supabase/postgrest-js
Advanced tools
Comparing version 0.31.1 to 0.31.2
@@ -58,4 +58,4 @@ import { PostgrestBuilder, PostgrestMaybeSingleResponse, PostgrestSingleResponse } from './types'; | ||
*/ | ||
csv(): this; | ||
csv(): PromiseLike<PostgrestSingleResponse<string>>; | ||
} | ||
//# sourceMappingURL=PostgrestTransformBuilder.d.ts.map |
@@ -59,4 +59,11 @@ "use strict"; | ||
const text = yield res.text(); | ||
if (text && text !== '' && this.headers['Accept'] !== 'text/csv') | ||
if (!text) { | ||
// discard `text` | ||
} | ||
else if (this.headers['Accept'] === 'text/csv') { | ||
data = text; | ||
} | ||
else { | ||
data = JSON.parse(text); | ||
} | ||
} | ||
@@ -63,0 +70,0 @@ const countHeader = (_b = this.headers['Prefer']) === null || _b === void 0 ? void 0 : _b.match(/count=(exact|planned|estimated)/); |
@@ -58,4 +58,4 @@ import { PostgrestBuilder, PostgrestMaybeSingleResponse, PostgrestSingleResponse } from './types'; | ||
*/ | ||
csv(): this; | ||
csv(): PromiseLike<PostgrestSingleResponse<string>>; | ||
} | ||
//# sourceMappingURL=PostgrestTransformBuilder.d.ts.map |
@@ -53,4 +53,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const text = yield res.text(); | ||
if (text && text !== '' && this.headers['Accept'] !== 'text/csv') | ||
if (!text) { | ||
// discard `text` | ||
} | ||
else if (this.headers['Accept'] === 'text/csv') { | ||
data = text; | ||
} | ||
else { | ||
data = JSON.parse(text); | ||
} | ||
} | ||
@@ -57,0 +64,0 @@ const countHeader = (_b = this.headers['Prefer']) === null || _b === void 0 ? void 0 : _b.match(/count=(exact|planned|estimated)/); |
{ | ||
"name": "@supabase/postgrest-js", | ||
"version": "0.31.1", | ||
"version": "0.31.2", | ||
"description": "Isomorphic PostgREST client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -126,6 +126,6 @@ import { PostgrestBuilder, PostgrestMaybeSingleResponse, PostgrestSingleResponse } from './types' | ||
*/ | ||
csv(): this { | ||
csv(): PromiseLike<PostgrestSingleResponse<string>> { | ||
this.headers['Accept'] = 'text/csv' | ||
return this | ||
return this as PromiseLike<PostgrestSingleResponse<string>> | ||
} | ||
} |
@@ -107,4 +107,9 @@ import fetch from 'cross-fetch' | ||
const text = await res.text() | ||
if (text && text !== '' && this.headers['Accept'] !== 'text/csv') | ||
if (!text) { | ||
// discard `text` | ||
} else if (this.headers['Accept'] === 'text/csv') { | ||
data = text | ||
} else { | ||
data = JSON.parse(text) | ||
} | ||
} | ||
@@ -111,0 +116,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
193306
3590