New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@supabase/postgrest-js

Package Overview
Dependencies
Maintainers
3
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supabase/postgrest-js - npm Package Compare versions

Comparing version 0.24.3 to 0.24.4

dist/main/lib/PostgrestRpcBuilder.d.ts

13

dist/main/lib/PostgrestQueryBuilder.js

@@ -8,3 +8,2 @@ "use strict";

const PostgrestFilterBuilder_1 = __importDefault(require("./PostgrestFilterBuilder"));
const PostgrestTransformBuilder_1 = __importDefault(require("./PostgrestTransformBuilder"));
class PostgrestQueryBuilder extends types_1.PostgrestBuilder {

@@ -104,16 +103,4 @@ constructor(url, { headers = {}, schema } = {}) {

}
/** @internal */
rpc(params, { head = false, count = null, } = {}) {
this.method = 'POST';
this.body = params;
if (count) {
this.headers['Prefer'] = `count=${count}`;
}
if (head) {
this.method = 'HEAD';
}
return new PostgrestTransformBuilder_1.default(this);
}
}
exports.default = PostgrestQueryBuilder;
//# sourceMappingURL=PostgrestQueryBuilder.js.map

32

dist/main/lib/types.js

@@ -42,30 +42,20 @@ "use strict";

var _a, _b, _c;
let error, data, count;
let error = null;
let data = null;
let count = null;
if (res.ok) {
error = null;
if (this.method !== 'HEAD') {
const isReturnMinimal = (_a = this.headers['Prefer']) === null || _a === void 0 ? void 0 : _a.split(',').includes('return=minimal');
data = isReturnMinimal ? null : yield res.json();
const isReturnMinimal = (_a = this.headers['Prefer']) === null || _a === void 0 ? void 0 : _a.split(',').includes('return=minimal');
if (this.method !== 'HEAD' && !isReturnMinimal) {
const text = yield res.text();
if (text && text !== '')
data = JSON.parse(text);
}
else {
data = null;
}
const countHeader = (_b = this.headers['Prefer']) === null || _b === void 0 ? void 0 : _b.match(/count=(exact|planned|estimated)/);
if (countHeader) {
const contentRange = (_c = res.headers.get('content-range')) === null || _c === void 0 ? void 0 : _c.split('/');
if (contentRange && contentRange.length > 1) {
count = parseInt(contentRange[1]);
}
else {
count = null;
}
const contentRange = (_c = res.headers.get('content-range')) === null || _c === void 0 ? void 0 : _c.split('/');
if (countHeader && contentRange && contentRange.length > 1) {
count = parseInt(contentRange[1]);
}
else {
count = null;
}
}
else {
error = yield res.json();
data = null;
count = null;
}

@@ -72,0 +62,0 @@ const postgrestResponse = {

@@ -39,5 +39,8 @@ import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder';

* @param params The parameters to pass to the function call.
* @param count Count algorithm to use to count rows in a table.
*/
rpc<T = any>(fn: string, params?: object): PostgrestTransformBuilder<T>;
rpc<T = any>(fn: string, params?: object, { count, }?: {
count?: null | 'exact' | 'planned' | 'estimated';
}): PostgrestTransformBuilder<T>;
}
//# sourceMappingURL=PostgrestClient.d.ts.map

@@ -7,2 +7,3 @@ "use strict";

const PostgrestQueryBuilder_1 = __importDefault(require("./lib/PostgrestQueryBuilder"));
const PostgrestRpcBuilder_1 = __importDefault(require("./lib/PostgrestRpcBuilder"));
class PostgrestClient {

@@ -44,6 +45,10 @@ /**

* @param params The parameters to pass to the function call.
* @param count Count algorithm to use to count rows in a table.
*/
rpc(fn, params) {
rpc(fn, params, { count = null, } = {}) {
const url = `${this.url}/rpc/${fn}`;
return new PostgrestQueryBuilder_1.default(url, { headers: this.headers, schema: this.schema }).rpc(params);
return new PostgrestRpcBuilder_1.default(url, {
headers: this.headers,
schema: this.schema,
}).rpc(params, { count });
}

@@ -50,0 +55,0 @@ }

import { PostgrestBuilder } from './types';
import PostgrestFilterBuilder from './PostgrestFilterBuilder';
import PostgrestTransformBuilder from './PostgrestTransformBuilder';
export default class PostgrestQueryBuilder extends PostgrestBuilder {

@@ -98,15 +97,3 @@ constructor(url, { headers = {}, schema } = {}) {

}
/** @internal */
rpc(params, { head = false, count = null, } = {}) {
this.method = 'POST';
this.body = params;
if (count) {
this.headers['Prefer'] = `count=${count}`;
}
if (head) {
this.method = 'HEAD';
}
return new PostgrestTransformBuilder(this);
}
}
//# sourceMappingURL=PostgrestQueryBuilder.js.map

@@ -36,30 +36,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

var _a, _b, _c;
let error, data, count;
let error = null;
let data = null;
let count = null;
if (res.ok) {
error = null;
if (this.method !== 'HEAD') {
const isReturnMinimal = (_a = this.headers['Prefer']) === null || _a === void 0 ? void 0 : _a.split(',').includes('return=minimal');
data = isReturnMinimal ? null : yield res.json();
const isReturnMinimal = (_a = this.headers['Prefer']) === null || _a === void 0 ? void 0 : _a.split(',').includes('return=minimal');
if (this.method !== 'HEAD' && !isReturnMinimal) {
const text = yield res.text();
if (text && text !== '')
data = JSON.parse(text);
}
else {
data = null;
}
const countHeader = (_b = this.headers['Prefer']) === null || _b === void 0 ? void 0 : _b.match(/count=(exact|planned|estimated)/);
if (countHeader) {
const contentRange = (_c = res.headers.get('content-range')) === null || _c === void 0 ? void 0 : _c.split('/');
if (contentRange && contentRange.length > 1) {
count = parseInt(contentRange[1]);
}
else {
count = null;
}
const contentRange = (_c = res.headers.get('content-range')) === null || _c === void 0 ? void 0 : _c.split('/');
if (countHeader && contentRange && contentRange.length > 1) {
count = parseInt(contentRange[1]);
}
else {
count = null;
}
}
else {
error = yield res.json();
data = null;
count = null;
}

@@ -66,0 +56,0 @@ const postgrestResponse = {

@@ -39,5 +39,8 @@ import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder';

* @param params The parameters to pass to the function call.
* @param count Count algorithm to use to count rows in a table.
*/
rpc<T = any>(fn: string, params?: object): PostgrestTransformBuilder<T>;
rpc<T = any>(fn: string, params?: object, { count, }?: {
count?: null | 'exact' | 'planned' | 'estimated';
}): PostgrestTransformBuilder<T>;
}
//# sourceMappingURL=PostgrestClient.d.ts.map
import PostgrestQueryBuilder from './lib/PostgrestQueryBuilder';
import PostgrestRpcBuilder from './lib/PostgrestRpcBuilder';
export default class PostgrestClient {

@@ -38,8 +39,12 @@ /**

* @param params The parameters to pass to the function call.
* @param count Count algorithm to use to count rows in a table.
*/
rpc(fn, params) {
rpc(fn, params, { count = null, } = {}) {
const url = `${this.url}/rpc/${fn}`;
return new PostgrestQueryBuilder(url, { headers: this.headers, schema: this.schema }).rpc(params);
return new PostgrestRpcBuilder(url, {
headers: this.headers,
schema: this.schema,
}).rpc(params, { count });
}
}
//# sourceMappingURL=PostgrestClient.js.map
{
"name": "@supabase/postgrest-js",
"version": "0.24.3",
"version": "0.24.4",
"description": "Isomorphic PostgREST client",

@@ -5,0 +5,0 @@ "keywords": [

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc