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.9.0 to 0.10.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");return c.set("Prefer","return=representation"),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 Array.isArray(a)?{body:null,status:400,statusCode:400,statusText:"Data type should be an object."}:(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;
"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){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,a),this.url=b,this.queryFilters=[],this.headers=c}return _createClass(a,[{key:"request",value:function request(a){return new _Request["default"](a,this.url,this.headers)}},{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");return c.set("Prefer","return=representation"),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 Array.isArray(a)?{body:null,status:400,statusCode:400,statusText:"Data type should be an object."}:(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;

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

"use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.PostgrestClient=void 0;var _Builder=_interopRequireDefault(require("./Builder")),_Request=_interopRequireDefault(require("./Request")),Helpers=_interopRequireWildcard(require("./utils/Helpers"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return _getRequireWildcardCache=function(){return a},a}function _interopRequireWildcard(a){if(a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var b=_getRequireWildcardCache();if(b&&b.has(a))return b.get(a);var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a)if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;f&&(f.get||f.set)?Object.defineProperty(c,e,f):c[e]=a[e]}return c["default"]=a,b&&b.set(a,c),c}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 PostgrestClient=function(){function a(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,a),this.restUrl=b,this.queryString=null,c.queryParams&&(this.queryString=Helpers.objectToQueryString(c.queryParams))}return _createClass(a,[{key:"from",value:function from(a){var b="".concat(this.restUrl,"/").concat(a);return this.queryString&&(b+="?".concat(this.queryString)),new _Builder["default"](b)}},{key:"rpc",value:function rpc(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,c="".concat(this.restUrl,"/rpc/").concat(a);this.queryString&&(c+="?".concat(this.queryString));var d=new _Request["default"]("post",c);return null!=b&&d.send(b),d}}]),a}();exports.PostgrestClient=PostgrestClient;
"use strict";function _typeof(a){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.PostgrestClient=void 0;var _Builder=_interopRequireDefault(require("./Builder")),_Request=_interopRequireDefault(require("./Request")),Helpers=_interopRequireWildcard(require("./utils/Helpers"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return _getRequireWildcardCache=function(){return a},a}function _interopRequireWildcard(a){if(a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var b=_getRequireWildcardCache();if(b&&b.has(a))return b.get(a);var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a)if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;f&&(f.get||f.set)?Object.defineProperty(c,e,f):c[e]=a[e]}return c["default"]=a,b&&b.set(a,c),c}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 PostgrestClient=function(){function a(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,a),this.restUrl=b,this.queryString=null,this.headers={},c.headers&&(this.headers=c.headers),c.queryParams&&(this.queryString=Helpers.objectToQueryString(c.queryParams))}return _createClass(a,[{key:"from",value:function from(a){var b="".concat(this.restUrl,"/").concat(a);return this.queryString&&(b+="?".concat(this.queryString)),new _Builder["default"](b,this.headers)}},{key:"rpc",value:function rpc(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,c="".concat(this.restUrl,"/rpc/").concat(a);this.queryString&&(c+="?".concat(this.queryString));var d=new _Request["default"]("post",c,this.headers);return null!=b&&d.send(b),d}}]),a}();exports.PostgrestClient=PostgrestClient;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _superagent=require("superagent"),Filters=_interopRequireWildcard(require("./utils/Filters"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return _getRequireWildcardCache=function(){return a},a}function _interopRequireWildcard(a){if(a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var b=_getRequireWildcardCache();if(b&&b.has(a))return b.get(a);var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a)if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;f&&(f.get||f.set)?Object.defineProperty(c,e,f):c[e]=a[e]}return c["default"]=a,b&&b.set(a,c),c}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(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}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _get(a,b,c){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(a,b,c){var d=_superPropBase(a,b);if(d){var e=Object.getOwnPropertyDescriptor(d,b);return e.get?e.get.call(c):e.value}},_get(a,b,c||a)}function _superPropBase(a,b){for(;!Object.prototype.hasOwnProperty.call(a,b)&&(a=_getPrototypeOf(a),null!==a););return a}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}var contentRangeStructure=/^(\d+)-(\d+)\/(\d+)$/,Request=function(a){function b(a,c){var d;return _classCallCheck(this,b),d=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a,c)),d.set("Accept","application/json"),d.get||(d.get=d.getHeader),d}return _inherits(b,a),_createClass(b,[{key:"auth",value:function auth(a,c){return"string"==typeof a&&null==c?(this.set("Authorization","Bearer ".concat(a)),this):("object"===_typeof(a)&&null==c&&(c=a.pass,a=a.user),_get(_getPrototypeOf(b.prototype),"auth",this).call(this,a,c))}},{key:"filter",value:function filter(a,b,c){var d=Filters["_".concat(b.toLowerCase())](a,c);return this.query(d)}},{key:"match",value:function match(a){var b=this;return Object.keys(a).forEach(function(c){b.query("".concat(c,"=eq.").concat(a[c]))}),this}},{key:"select",value:function select(a){return a&&this.query({select:a.replace(/\s/g,"")}),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.query("order=".concat(a,".").concat(b?"asc":"desc",".").concat(c?"nullsfirst":"nullslast")),this}},{key:"range",value:function range(a,b){var c=0==b?0:b||"";return this.set("Range-Unit","items"),this.set("Range","".concat(a||0,"-").concat(c)),this}},{key:"single",value:function single(){return this.set("Accept","application/vnd.pgrst.object+json"),this.set("Prefer","return=representation"),this}},{key:"end",value:function end(){var a=this;return new Promise(function(c,d){if(["DELETE","PATCH"].includes(a.method)&&0==a._query.length){var e="DELETE"===a.method?".delete()":".update()";return c({body:null,status:400,statusCode:400,statusText:"".concat(e," cannot be invoked without any filters.")})}_get(_getPrototypeOf(b.prototype),"end",a).call(a,function(a,b){if(a)return d(a);var e=b.body,f=b.headers,g=b.status,h=b.statusCode,i=b.statusText,j=f["content-range"];Array.isArray(e)&&j&&contentRangeStructure.test(j)&&(e.fullLength=parseInt(contentRangeStructure.exec(j)[3],10));return c({body:e,status:g,statusCode:h,statusText:i})})})}},{key:"then",value:function then(a,b){return this.end().then(a,b)}},{key:"catch",value:function _catch(a){return this.end()["catch"](a)}}]),b}(_superagent.Request),filters=["eq","gt","lt","gte","lte","like","ilike","is","in","not"];filters.forEach(function(a){return Request.prototype[a]=function(b,c){return this.filter(b,a,c)}});var _default=Request;exports["default"]=_default;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _superagent=require("superagent"),Filters=_interopRequireWildcard(require("./utils/Filters"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return _getRequireWildcardCache=function(){return a},a}function _interopRequireWildcard(a){if(a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var b=_getRequireWildcardCache();if(b&&b.has(a))return b.get(a);var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a)if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;f&&(f.get||f.set)?Object.defineProperty(c,e,f):c[e]=a[e]}return c["default"]=a,b&&b.set(a,c),c}function _typeof(a){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(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}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _get(a,b,c){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(a,b,c){var d=_superPropBase(a,b);if(d){var e=Object.getOwnPropertyDescriptor(d,b);return e.get?e.get.call(c):e.value}},_get(a,b,c||a)}function _superPropBase(a,b){for(;!Object.prototype.hasOwnProperty.call(a,b)&&(a=_getPrototypeOf(a),null!==a););return a}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}var contentRangeStructure=/^(\d+)-(\d+)\/(\d+)$/,Request=function(a){function b(a,c){var d,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,b),d=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a,c)),d.set("Accept","application/json"),{}!=e)for(var f in e)d.set(f,e[f]);return d.get||(d.get=d.getHeader),d}return _inherits(b,a),_createClass(b,[{key:"auth",value:function auth(a,c){return"string"==typeof a&&null==c?(this.set("Authorization","Bearer ".concat(a)),this):("object"===_typeof(a)&&null==c&&(c=a.pass,a=a.user),_get(_getPrototypeOf(b.prototype),"auth",this).call(this,a,c))}},{key:"filter",value:function filter(a,b,c){var d=Filters["_".concat(b.toLowerCase())](a,c);return this.query(d)}},{key:"match",value:function match(a){var b=this;return Object.keys(a).forEach(function(c){b.query("".concat(c,"=eq.").concat(a[c]))}),this}},{key:"select",value:function select(a){return a&&this.query({select:a.replace(/\s/g,"")}),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.query("order=".concat(a,".").concat(b?"asc":"desc",".").concat(c?"nullsfirst":"nullslast")),this}},{key:"range",value:function range(a,b){var c=0==b?0:b||"";return this.set("Range-Unit","items"),this.set("Range","".concat(a||0,"-").concat(c)),this}},{key:"single",value:function single(){return this.set("Accept","application/vnd.pgrst.object+json"),this.set("Prefer","return=representation"),this}},{key:"end",value:function end(){var a=this;return new Promise(function(c,d){if(["DELETE","PATCH"].includes(a.method)&&0==a._query.length){var e="DELETE"===a.method?".delete()":".update()";return c({body:null,status:400,statusCode:400,statusText:"".concat(e," cannot be invoked without any filters.")})}_get(_getPrototypeOf(b.prototype),"end",a).call(a,function(a,b){if(a)return d(a);var e=b.body,f=b.headers,g=b.status,h=b.statusCode,i=b.statusText,j=f["content-range"];Array.isArray(e)&&j&&contentRangeStructure.test(j)&&(e.fullLength=parseInt(contentRangeStructure.exec(j)[3],10));return c({body:e,status:g,statusCode:h,statusText:i})})})}},{key:"then",value:function then(a,b){return this.end().then(a,b)}},{key:"catch",value:function _catch(a){return this.end()["catch"](a)}}]),b}(_superagent.Request),filters=["eq","gt","lt","gte","lte","like","ilike","is","in","not"];filters.forEach(function(a){return Request.prototype[a]=function(b,c){return this.filter(b,a,c)}});var _default=Request;exports["default"]=_default;
{
"name": "@supabase/postgrest-js",
"version": "0.9.0",
"version": "0.10.0",
"description": "PostgREST JS client",
"main": "./lib/index.js",
"scripts": {
"build": "cross-env BABEL_ENV=production babel src --out-dir lib",
"build": "BABEL_ENV=production babel src --out-dir lib",
"clean": "rimraf lib",

@@ -16,3 +16,3 @@ "cover": "nyc --check-coverage npm run test",

"test": "mocha -r @babel/register -r babel-polyfill test/unit/**/*.js",
"test:prod": "cross-env BABEL_ENV=production npm run test",
"test:prod": "BABEL_ENV=production npm run test",
"test:watch": "npm test -- --watch"

@@ -40,14 +40,13 @@ },

"@babel/register": "^7.8.3",
"@supabase/doctest-js": "0.0.10",
"@supabase/jsdoc-template": "^0.1.0",
"@supabase/doctest-js": "0.1.0",
"@supabase/jsdoc-template": "^0.2.0",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-polyfill": "^6.26.0",
"babel-preset-minify": "^0.3.0",
"babel-preset-minify": "^0.5.1",
"chai": "^4.2.0",
"cross-env": "^5.2.1",
"jsdoc": "^3.6.3",
"mocha": "^6.2.2",
"nyc": "^13.3.0",
"mocha": "^7.1.0",
"nyc": "^15.0.0",
"prettier": "^1.19.1",
"rimraf": "^2.6.2"
"rimraf": "^3.0.2"
},

@@ -54,0 +53,0 @@ "dependencies": {

@@ -21,9 +21,10 @@ import Request from './Request'

class Builder {
constructor(url) {
constructor(url, headers = {}) {
this.url = url
this.queryFilters = []
this.headers = headers
}
request(method) {
return new Request(method, this.url)
return new Request(method, this.url, this.headers)
}

@@ -134,3 +135,3 @@

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

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

request.send(data)
this.addFilters(request, options)

@@ -166,0 +167,0 @@

@@ -18,3 +18,5 @@ /**

this.queryString = null
this.headers = {}
if (options.headers) this.headers = options.headers
if (options.queryParams) this.queryString = Helpers.objectToQueryString(options.queryParams)

@@ -26,3 +28,3 @@ }

if (this.queryString) url += `?${this.queryString}`
return new Builder(url)
return new Builder(url, this.headers)
}

@@ -33,3 +35,3 @@

if (this.queryString) url += `?${this.queryString}`
let request = new Request('post', url)
let request = new Request('post', url, this.headers)
if (functionParameters != null) request.send(functionParameters)

@@ -36,0 +38,0 @@ return request

@@ -19,6 +19,12 @@ /**

class Request extends SuperAgent {
constructor(method, url) {
constructor(method, url, headers = {}) {
super(method, url)
this.set('Accept', 'application/json')
if (headers != {}) {
for (var k in headers) {
this.set(k, headers[k])
}
}
// Fix for superagent disconnect on client & server.

@@ -25,0 +31,0 @@ if (!this.get) {

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