Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@supabase/postgrest-js

Package Overview
Dependencies
Maintainers
3
Versions
135
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.4.1 to 0.5.0

2

lib/Builder.js

@@ -1,1 +0,1 @@

"use strict";var _Request=_interopRequireDefault(require("./Request"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var Builder=function(){function a(b){_classCallCheck(this,a),this.url=b,this.queryFilters=[]}return _createClass(a,[{key:"request",value:function request(a){return new _Request["default"](a,this.url)}},{key:"addFilters",value:function addFilters(a,b){0!=Object.keys(b).length&&Object.keys(b).forEach(function(c){var d=b[c];a.set(c,d)}),this.queryFilters.forEach(function(b){switch(b.filter){case"filter":a.filter(b.columnName,b.operator,b.criteria);break;case"match":a.match(b.query);break;case"order":a.order(b.property,b.ascending,b.nullsFirst);break;case"range":a.range(b.from,b.to);break;case"single":a.single();break;default:}})}},{key:"filter",value:function filter(a,b,c){return this.queryFilters.push({filter:"filter",columnName:a,operator:b,criteria:c}),this}},{key:"match",value:function match(a){return this.queryFilters.push({filter:"match",query:a}),this}},{key:"order",value:function order(a){var b=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],c=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return this.queryFilters.push({filter:"order",property:a,ascending:b,nullsFirst:c}),this}},{key:"range",value:function range(a,b){return this.queryFilters.push({filter:"range",from:a,to:b}),this}},{key:"single",value:function single(){return this.queryFilters.push({filter:"single"}),this}},{key:"select",value:function select(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"*",b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=this.request("GET");return c.select(a),this.addFilters(c,b),c}},{key:"insert",value:function insert(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=this.request("POST"),d=Array.isArray(a)?a:[a];return d.forEach(function(a){c.send(a)}),this.addFilters(c,b),c}},{key:"update",value:function update(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=this.request("PATCH");return c.send(a),this.addFilters(c,b),c}},{key:"delete",value:function _delete(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=this.request("DELETE");return this.addFilters(b,a),b}}]),a}(),advancedFilters=["eq","gt","lt","gte","lte","like","ilike","is","in","not"];advancedFilters.forEach(function(a){return Builder.prototype[a]=function(b,c){return this.filter(b,a,c),this}});var _default=Builder;exports["default"]=_default;
"use strict";var _Request=_interopRequireDefault(require("./Request"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var Builder=function(){function a(b){_classCallCheck(this,a),this.url=b,this.queryFilters=[]}return _createClass(a,[{key:"request",value:function request(a){return new _Request["default"](a,this.url)}},{key:"addFilters",value:function addFilters(a,b){0!=Object.keys(b).length&&Object.keys(b).forEach(function(c){var d=b[c];a.set(c,d)}),this.queryFilters.forEach(function(b){switch(b.filter){case"filter":a.filter(b.columnName,b.operator,b.criteria);break;case"match":a.match(b.query);break;case"order":a.order(b.property,b.ascending,b.nullsFirst);break;case"range":a.range(b.from,b.to);break;case"single":a.single();break;default:}})}},{key:"filter",value:function filter(a,b,c){return this.queryFilters.push({filter:"filter",columnName:a,operator:b,criteria:c}),this}},{key:"match",value:function match(a){return this.queryFilters.push({filter:"match",query:a}),this}},{key:"order",value:function order(a){var b=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],c=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return this.queryFilters.push({filter:"order",property:a,ascending:b,nullsFirst:c}),this}},{key:"range",value:function range(a,b){return this.queryFilters.push({filter:"range",from:a,to:b}),this}},{key:"single",value:function single(){return this.queryFilters.push({filter:"single"}),this}},{key:"select",value:function select(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"*",b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=this.request("GET");return c.select(a),this.addFilters(c,b),c}},{key:"insert",value:function insert(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=this.request("POST");c.set("Prefer","return=representation");var d=Array.isArray(a)?a:[a];return d.forEach(function(a){c.send(a)}),this.addFilters(c,b),c}},{key:"update",value:function update(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=this.request("PATCH");return c.set("Prefer","return=representation"),c.send(a),this.addFilters(c,b),c}},{key:"delete",value:function _delete(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=this.request("DELETE");return this.addFilters(b,a),b}}]),a}(),advancedFilters=["eq","gt","lt","gte","lte","like","ilike","is","in","not"];advancedFilters.forEach(function(a){return Builder.prototype[a]=function(b,c){return this.filter(b,a,c),this}});var _default=Builder;exports["default"]=_default;
{
"name": "@supabase/postgrest-js",
"version": "0.4.1",
"version": "0.5.0",
"description": "PostgREST JS client",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

import Request from './Request'
/**
* Allows the user to stack the filter functions before they call any of
*
* Allows the user to stack the filter functions before they call any of
*
* select() - "get"
*
*
* insert() - "post"
*
*
* update() - "patch"
*
*
* delete() - "delete"
*
*
* Once any of these are called the filters are passed down to the Request

@@ -133,2 +133,4 @@ *

let request = this.request(method)
request.set('Prefer', 'return=representation')
let dataList = !Array.isArray(data) ? [data] : data

@@ -145,3 +147,2 @@

/**

@@ -153,2 +154,3 @@ * Start a "PATCH" request

let request = this.request(method)
request.set('Prefer', 'return=representation')

@@ -161,3 +163,2 @@ request.send(data)

/**

@@ -164,0 +165,0 @@ * Start a "DELETE" request

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