@supabase/postgrest-js
Advanced tools
Comparing version 0.16.1 to 0.17.0
@@ -16,3 +16,3 @@ "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}/** | ||
* @param {string} url The full URL | ||
*/var Builder=/*#__PURE__*/function(){function a(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},d=2<arguments.length?arguments[2]:void 0;_classCallCheck(this,a),this.url=b,this.queryFilters=[],this.headers=c,this.schema=d}return _createClass(a,[{key:"request",value:function request(a){return this.schema&&("GET"==a?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),new _Request["default"](a,this.url,this.headers)}},{key:"addFilters",value:function addFilters(a){this.queryFilters.forEach(function(b){switch(b.filter){case"filter":a.filter(b.columnName,b.operator,b.criteria);break;case"not":a.not(b.columnName,b.operator,b.criteria);break;case"match":a.match(b.query);break;case"order":a.order(b.columnName,b.ascending,b.nullsFirst);break;case"limit":a.limit(b.criteria,b.columnName);break;case"offset":a.offset(b.criteria,b.columnName);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:"not",value:function not(a,b,c){return this.queryFilters.push({filter:"not",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",columnName:a,ascending:b,nullsFirst:c}),this}},{key:"limit",value:function limit(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.queryFilters.push({filter:"limit",criteria:a,columnName:b}),this}},{key:"offset",value:function offset(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.queryFilters.push({filter:"offset",columnName:b,criteria:a}),this}},{key:"range",value:function range(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.queryFilters.push({filter:"range",from:a,to:b}),this}},{key:"single",value:function single(){return this.queryFilters.push({filter:"single"}),this}/** | ||
*/var Builder=/*#__PURE__*/function(){function a(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},d=2<arguments.length?arguments[2]:void 0;_classCallCheck(this,a),this.url=b,this.queryFilters=[],this.headers=c,this.schema=d}return _createClass(a,[{key:"request",value:function request(a){return this.schema&&("GET"==a?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),new _Request["default"](a,this.url,this.headers)}},{key:"addFilters",value:function addFilters(a){this.queryFilters.forEach(function(b){switch(b.filter){case"filter":a.filter(b.columnName,b.operator,b.criteria);break;case"not":a.not(b.columnName,b.operator,b.criteria);break;case"or":a.or(b.filters);break;case"match":a.match(b.query);break;case"order":a.order(b.columnName,b.ascending,b.nullsFirst);break;case"limit":a.limit(b.criteria,b.columnName);break;case"offset":a.offset(b.criteria,b.columnName);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:"not",value:function not(a,b,c){return this.queryFilters.push({filter:"not",columnName:a,operator:b,criteria:c}),this}},{key:"or",value:function or(a){return this.queryFilters.push({filter:"or",filters:a}),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",columnName:a,ascending:b,nullsFirst:c}),this}},{key:"limit",value:function limit(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.queryFilters.push({filter:"limit",criteria:a,columnName:b}),this}},{key:"offset",value:function offset(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.queryFilters.push({filter:"offset",columnName:b,criteria:a}),this}},{key:"range",value:function range(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.queryFilters.push({filter:"range",from:a,to:b}),this}},{key:"single",value:function single(){return this.queryFilters.push({filter:"single"}),this}/** | ||
* Start a "GET" request | ||
@@ -19,0 +19,0 @@ */},{key:"select",value:function select(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"*",b=this.request("GET");return b.select(a),this.addFilters(b),b}/** |
@@ -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=/*#__PURE__*/function(){function a(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,a),this.restUrl=b,this.headers={},this.queryString=null,this.schema=null,c.headers&&(this.headers=c.headers),c.queryParams&&(this.queryString=Helpers.objectToQueryString(c.queryParams)),c.schema&&(this.schema=c.schema)}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,this.schema)}},{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),d=this.headers;this.queryString&&(c+="?".concat(this.queryString)),this.schema&&(d["Content-Profile"]=this.schema,d["Accept-Profile"]=this.schema);var e=new _Request["default"]("post",c,d);return null!=b&&e.send(b),e}}]),a}();exports.PostgrestClient=PostgrestClient; | ||
"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=/*#__PURE__*/function(){function a(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,a),this.restUrl=b,this.headers={},this.queryString=null,this.schema=null,c.headers&&(this.headers=c.headers),c.queryParams&&(this.queryString=Helpers.objectToQueryString(c.queryParams)),c.schema&&(this.schema=c.schema)}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,this.schema)}},{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),d=this.headers;this.queryString&&(c+="?".concat(this.queryString)),this.schema&&(d["Content-Profile"]=this.schema);var e=new _Request["default"]("post",c,d);return null!=b&&e.send(b),e}}]),a}();exports.PostgrestClient=PostgrestClient; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _superagent=require("superagent"),Filters=_interopRequireWildcard(require("./utils/Filters")),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 _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 _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 _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)}function _createSuper(a){return function(){var b,c=_getPrototypeOf(a);if(_isNativeReflectConstruct()){var d=_getPrototypeOf(this).constructor;b=Reflect.construct(c,arguments,d)}else b=c.apply(this,arguments);return _possibleConstructorReturn(this,b)}}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 _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}var contentRangeStructure=/^(\d+)-(\d+)\/(\d+)$/,Request=/*#__PURE__*/function(a){function b(a,d){var e,f=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,b),e=c.call(this,a,d),e.set("Accept","application/json"),{}!=f)for(var g in f)e.set(g,f[g]);// Fix for superagent disconnect on client & server. | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _superagent=require("superagent"),Filters=_interopRequireWildcard(require("./utils/Filters")),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 _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 _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 _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)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}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 _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}var contentRangeStructure=/^(\d+)-(\d+)\/(\d+)$/,Request=/*#__PURE__*/function(a){function b(a,d){var e,f=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(_classCallCheck(this,b),e=c.call(this,a,d),e.set("Accept","application/json"),{}!=f)for(var g in f)e.set(g,f[g]);// Fix for superagent disconnect on client & server. | ||
return e.get||(e.get=e.getHeader),e}/** | ||
@@ -79,2 +79,2 @@ * Set auth using special formats. If only one string parameter is passed, it | ||
* @returns {Promise} Resolves when there is an error. | ||
*/},{key:"catch",value:function _catch(a){return this.end()["catch"](a)}}]),b}(_superagent.Request),filters=["eq","neq","gt","lt","gte","lte","like","ilike","is","in","fts","plfts","phfts","wfts","cs","cd","ova","ovr","sl","sr","nxr","nxl","adj"];filters.forEach(function(a){return Request.prototype[a]=function(b,c){return this.filter(b,a,c)}});var _default=Request;exports["default"]=_default; | ||
*/},{key:"catch",value:function _catch(a){return this.end()["catch"](a)}}]),b}(_superagent.Request),filters=["eq","neq","gt","lt","gte","lte","like","ilike","is","in","fts","plfts","phfts","wfts","cs","cd","ova","ovr","sl","sr","nxr","nxl","adj","or"];filters.forEach(function(a){return Request.prototype[a]=function(b,c){return this.filter(b,a,c)}});var _default=Request;exports["default"]=_default; |
@@ -1,2 +0,2 @@ | ||
"use strict";var Helpers=_interopRequireWildcard(require("./Helpers"));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._eq=_eq,exports._gt=_gt,exports._lt=_lt,exports._gte=_gte,exports._lte=_lte,exports._like=_like,exports._ilike=_ilike,exports._is=_is,exports._in=_in,exports._neq=_neq,exports._fts=_fts,exports._plfts=_plfts,exports._phfts=_phfts,exports._wfts=_wfts,exports._cs=_cs,exports._cd=_cd,exports._ova=_ova,exports._ovr=_ovr,exports._sl=_sl,exports._sr=_sr,exports._nxl=_nxl,exports._nxr=_nxr,exports._adj=_adj;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}/** @module Filters **/ /** | ||
"use strict";var Helpers=_interopRequireWildcard(require("./Helpers"));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._eq=_eq,exports._gt=_gt,exports._lt=_lt,exports._gte=_gte,exports._lte=_lte,exports._like=_like,exports._ilike=_ilike,exports._is=_is,exports._in=_in,exports._neq=_neq,exports._fts=_fts,exports._plfts=_plfts,exports._phfts=_phfts,exports._wfts=_wfts,exports._cs=_cs,exports._cd=_cd,exports._ova=_ova,exports._ovr=_ovr,exports._sl=_sl,exports._sr=_sr,exports._nxl=_nxl,exports._nxr=_nxr,exports._adj=_adj,exports._or=_or;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}/** @module Filters **/ /** | ||
* All exports are prefixed with an underscore to avoid collisions with reserved keywords (eg: "in") | ||
@@ -345,2 +345,13 @@ */ /** | ||
* 'population_range=adj.(100,500)' | ||
*/function _adj(a,b){return"".concat(a,"=adj.(").concat(b.join(","),")")} | ||
*/function _adj(a,b){return"".concat(a,"=adj.(").concat(b.join(","),")")}/** | ||
* Finds all rows that satisfy at least one of the specified `filters`. | ||
* @param {string} filters Filters to satisfy | ||
* @name or | ||
* @function | ||
* @returns {string} | ||
* | ||
* @example | ||
* _or('id.gt.20,and(name.eq.New Zealand,name.eq.France)') | ||
* //=> | ||
* 'or=(id.gt.20,and(name.eq.New Zealand,name.eq.France))' | ||
*/function _or(a){return"or=(".concat(a,")")} |
{ | ||
"name": "@supabase/postgrest-js", | ||
"version": "0.16.1", | ||
"version": "0.17.0", | ||
"description": "PostgREST JS client", | ||
@@ -47,3 +47,3 @@ "main": "./lib/index.js", | ||
"jsdoc": "^3.6.3", | ||
"mocha": "^7.1.0", | ||
"mocha": "^8.0.1", | ||
"nyc": "^15.0.0", | ||
@@ -50,0 +50,0 @@ "prettier": "^2.0.1", |
@@ -28,10 +28,2 @@ # Postgrest JS | ||
**Release Notes** | ||
``` | ||
gren release --override | ||
``` | ||
This will create the changelog and the [release](https://github.com/supabase/postgrest-js/releases). | ||
## License | ||
@@ -38,0 +30,0 @@ |
@@ -48,2 +48,6 @@ import Request from './Request' | ||
case 'or': | ||
request.or(queryFilter.filters) | ||
break | ||
case 'match': | ||
@@ -101,2 +105,11 @@ request.match(queryFilter.query) | ||
or(filters) { | ||
this.queryFilters.push({ | ||
filter: 'or', | ||
filters, | ||
}) | ||
return this | ||
} | ||
match(query) { | ||
@@ -103,0 +116,0 @@ this.queryFilters.push({ |
@@ -37,7 +37,3 @@ /** | ||
if (this.schema) { | ||
// although POST requests should be 'Content-Profile', | ||
// this is only somehow working when the header set is 'Accept-Profile' | ||
// will revisit this when postgREST updates their documentation for multischema rpc | ||
headers['Content-Profile'] = this.schema | ||
headers['Accept-Profile'] = this.schema | ||
} | ||
@@ -44,0 +40,0 @@ let request = new Request('post', url, headers) |
@@ -335,2 +335,3 @@ /** | ||
'adj', | ||
'or', | ||
] | ||
@@ -337,0 +338,0 @@ filters.forEach( |
@@ -484,1 +484,17 @@ import * as Helpers from './Helpers' | ||
} | ||
/** | ||
* Finds all rows that satisfy at least one of the specified `filters`. | ||
* @param {string} filters Filters to satisfy | ||
* @name or | ||
* @function | ||
* @returns {string} | ||
* | ||
* @example | ||
* _or('id.gt.20,and(name.eq.New Zealand,name.eq.France)') | ||
* //=> | ||
* 'or=(id.gt.20,and(name.eq.New Zealand,name.eq.France))' | ||
*/ | ||
export function _or(filters) { | ||
return `or=(${filters})` | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
68070
1563
13
36