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.21.2 to 0.22.0

17

dist/main/lib/PostgrestQueryBuilder.d.ts

@@ -24,7 +24,9 @@ import { PostgrestBuilder } from './types';

* @param upsert If `true`, performs an UPSERT.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param returning By default the new record is returned. Set this to 'minimal' if you don't need this value.
*/
insert(values: Partial<T> | Partial<T>[], { upsert, onConflict }?: {
insert(values: Partial<T> | Partial<T>[], { upsert, onConflict, returning, }?: {
upsert?: boolean;
onConflict?: string;
returning?: 'minimal' | 'representation';
}): PostgrestFilterBuilder<T>;

@@ -35,9 +37,16 @@ /**

* @param values The values to update.
* @param returning By default the updated record is returned. Set this to 'minimal' if you don't need this value.
*/
update(values: Partial<T>): PostgrestFilterBuilder<T>;
update(values: Partial<T>, { returning }?: {
returning?: 'minimal' | 'representation';
}): PostgrestFilterBuilder<T>;
/**
* Performs a DELETE on the table.
*
* @param returning If `true`, return the deleted row(s) in the response.
*/
delete(): PostgrestFilterBuilder<T>;
delete({ returning, }?: {
returning?: 'minimal' | 'representation';
}): PostgrestFilterBuilder<T>;
}
//# sourceMappingURL=PostgrestQueryBuilder.d.ts.map

@@ -47,9 +47,12 @@ "use strict";

* @param upsert If `true`, performs an UPSERT.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param returning By default the new record is returned. Set this to 'minimal' if you don't need this value.
*/
insert(values, { upsert = false, onConflict } = {}) {
insert(values, { upsert = false, onConflict, returning = 'representation', } = {}) {
this.method = 'POST';
this.headers['Prefer'] = upsert
? 'return=representation,resolution=merge-duplicates'
: 'return=representation';
let prefersHeaders = [];
prefersHeaders.push(`return=${returning}`);
if (upsert)
prefersHeaders.push('resolution=merge-duplicates');
this.headers['Prefer'] = prefersHeaders.join(',');
if (upsert && onConflict !== undefined)

@@ -64,6 +67,7 @@ this.url.searchParams.set('on_conflict', onConflict);

* @param values The values to update.
* @param returning By default the updated record is returned. Set this to 'minimal' if you don't need this value.
*/
update(values) {
update(values, { returning = 'representation' } = {}) {
this.method = 'PATCH';
this.headers['Prefer'] = 'return=representation';
this.headers['Prefer'] = `return=${returning}`;
this.body = values;

@@ -74,6 +78,8 @@ return new PostgrestFilterBuilder_1.default(this);

* Performs a DELETE on the table.
*
* @param returning If `true`, return the deleted row(s) in the response.
*/
delete() {
delete({ returning = 'representation', } = {}) {
this.method = 'DELETE';
this.headers['Prefer'] = 'return=representation';
this.headers['Prefer'] = `return=${returning}`;
return new PostgrestFilterBuilder_1.default(this);

@@ -80,0 +86,0 @@ }

@@ -17,16 +17,22 @@ /**

*/
interface PostgrestResponse<T> {
error: PostgrestError | null;
data: T[] | null;
interface PostgrestResponseBase {
status: number;
statusText: string;
body: T[] | null;
}
export interface PostgrestSingleResponse<T> {
error: PostgrestError | null;
data: T | null;
status: number;
statusText: string;
body: T | null;
interface PostgrestResponseSuccess<T> extends PostgrestResponseBase {
error: null;
data: T[];
body: T[];
}
interface PostgrestResponseFailure extends PostgrestResponseBase {
error: PostgrestError;
data: null;
body: null;
}
export declare type PostgrestResponse<T> = PostgrestResponseSuccess<T> | PostgrestResponseFailure;
interface PostgrestSingleResponseSuccess<T> extends PostgrestResponseBase {
data: T;
body: T;
}
export declare type PostgrestSingleResponse<T> = PostgrestSingleResponseSuccess<T> | PostgrestResponseFailure;
export declare abstract class PostgrestBuilder<T> implements PromiseLike<PostgrestResponse<T>> {

@@ -33,0 +39,0 @@ protected method: 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE';

@@ -41,6 +41,8 @@ "use strict";

.then((res) => __awaiter(this, void 0, void 0, function* () {
var _a;
let error, data;
if (res.ok) {
error = null;
data = yield res.json();
const isReturnMinimal = (_a = this.headers['Prefer']) === null || _a === void 0 ? void 0 : _a.split(',').includes('return=minimal');
data = isReturnMinimal ? null : yield res.json();
}

@@ -47,0 +49,0 @@ else {

@@ -24,7 +24,9 @@ import { PostgrestBuilder } from './types';

* @param upsert If `true`, performs an UPSERT.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param returning By default the new record is returned. Set this to 'minimal' if you don't need this value.
*/
insert(values: Partial<T> | Partial<T>[], { upsert, onConflict }?: {
insert(values: Partial<T> | Partial<T>[], { upsert, onConflict, returning, }?: {
upsert?: boolean;
onConflict?: string;
returning?: 'minimal' | 'representation';
}): PostgrestFilterBuilder<T>;

@@ -35,9 +37,16 @@ /**

* @param values The values to update.
* @param returning By default the updated record is returned. Set this to 'minimal' if you don't need this value.
*/
update(values: Partial<T>): PostgrestFilterBuilder<T>;
update(values: Partial<T>, { returning }?: {
returning?: 'minimal' | 'representation';
}): PostgrestFilterBuilder<T>;
/**
* Performs a DELETE on the table.
*
* @param returning If `true`, return the deleted row(s) in the response.
*/
delete(): PostgrestFilterBuilder<T>;
delete({ returning, }?: {
returning?: 'minimal' | 'representation';
}): PostgrestFilterBuilder<T>;
}
//# sourceMappingURL=PostgrestQueryBuilder.d.ts.map

@@ -42,9 +42,12 @@ import { PostgrestBuilder } from './types';

* @param upsert If `true`, performs an UPSERT.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param onConflict By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.
* @param returning By default the new record is returned. Set this to 'minimal' if you don't need this value.
*/
insert(values, { upsert = false, onConflict } = {}) {
insert(values, { upsert = false, onConflict, returning = 'representation', } = {}) {
this.method = 'POST';
this.headers['Prefer'] = upsert
? 'return=representation,resolution=merge-duplicates'
: 'return=representation';
let prefersHeaders = [];
prefersHeaders.push(`return=${returning}`);
if (upsert)
prefersHeaders.push('resolution=merge-duplicates');
this.headers['Prefer'] = prefersHeaders.join(',');
if (upsert && onConflict !== undefined)

@@ -59,6 +62,7 @@ this.url.searchParams.set('on_conflict', onConflict);

* @param values The values to update.
* @param returning By default the updated record is returned. Set this to 'minimal' if you don't need this value.
*/
update(values) {
update(values, { returning = 'representation' } = {}) {
this.method = 'PATCH';
this.headers['Prefer'] = 'return=representation';
this.headers['Prefer'] = `return=${returning}`;
this.body = values;

@@ -69,6 +73,8 @@ return new PostgrestFilterBuilder(this);

* Performs a DELETE on the table.
*
* @param returning If `true`, return the deleted row(s) in the response.
*/
delete() {
delete({ returning = 'representation', } = {}) {
this.method = 'DELETE';
this.headers['Prefer'] = 'return=representation';
this.headers['Prefer'] = `return=${returning}`;
return new PostgrestFilterBuilder(this);

@@ -75,0 +81,0 @@ }

@@ -17,16 +17,22 @@ /**

*/
interface PostgrestResponse<T> {
error: PostgrestError | null;
data: T[] | null;
interface PostgrestResponseBase {
status: number;
statusText: string;
body: T[] | null;
}
export interface PostgrestSingleResponse<T> {
error: PostgrestError | null;
data: T | null;
status: number;
statusText: string;
body: T | null;
interface PostgrestResponseSuccess<T> extends PostgrestResponseBase {
error: null;
data: T[];
body: T[];
}
interface PostgrestResponseFailure extends PostgrestResponseBase {
error: PostgrestError;
data: null;
body: null;
}
export declare type PostgrestResponse<T> = PostgrestResponseSuccess<T> | PostgrestResponseFailure;
interface PostgrestSingleResponseSuccess<T> extends PostgrestResponseBase {
data: T;
body: T;
}
export declare type PostgrestSingleResponse<T> = PostgrestSingleResponseSuccess<T> | PostgrestResponseFailure;
export declare abstract class PostgrestBuilder<T> implements PromiseLike<PostgrestResponse<T>> {

@@ -33,0 +39,0 @@ protected method: 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE';

@@ -35,6 +35,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

.then((res) => __awaiter(this, void 0, void 0, function* () {
var _a;
let error, data;
if (res.ok) {
error = null;
data = yield res.json();
const isReturnMinimal = (_a = this.headers['Prefer']) === null || _a === void 0 ? void 0 : _a.split(',').includes('return=minimal');
data = isReturnMinimal ? null : yield res.json();
}

@@ -41,0 +43,0 @@ else {

{
"name": "@supabase/postgrest-js",
"version": "0.21.2",
"version": "0.22.0",
"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

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