From bfd96010a54cd00e5ae84a1436f815161447059f Mon Sep 17 00:00:00 2001 From: Martin Broerse Date: Fri, 26 Jan 2018 14:40:00 +0100 Subject: [PATCH] Bump to v3.0.1 --- bower.json | 2 +- dist/pouchdb.relational-pouch.min.js | 2 +- package.json | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 41a7be8..a14a46e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "relational-pouch", - "version": "3.0.0", + "version": "3.0.1", "description": "PouchDB, relational-style", "homepage": "https://github.com/pouchdb-community/relational-pouch", "authors": [ diff --git a/dist/pouchdb.relational-pouch.min.js b/dist/pouchdb.relational-pouch.min.js index 38b3b29..a939d45 100644 --- a/dist/pouchdb.relational-pouch.min.js +++ b/dist/pouchdb.relational-pouch.min.js @@ -1 +1 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).RelationalPouch=e()}}(function(){return function e(t,n,r){function o(u,c){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!c&&s)return s(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){var n=t[u][1][e];return o(n||e)},f,f.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u=0;e--){var n=h[e];t.has(u)&&t.get(u).has(JSON.stringify(n))&&delete h[e]}if((h=h.filter(function(e){return void 0!==e})).length)return{relatedType:u,relatedIds:h}}))}}),i.all(a)});return i.all(r)}).then(function(e){var n={};return e.forEach(function(e){e.forEach(function(e){e&&(n[e.relatedType]=(n[e.relatedType]||[]).concat(e.relatedIds))})}),r.series(Object.keys(n).map(function(e){var r=s(n[e]);return function(){return l(e,r,t)}})).then(function(){var e={};return t.forEach(function(t,n){var r=f(n),o=e[r.plural]=[];t.forEach(function(e){o.push(e)})}),e})})}function p(e,n,r,o){var i={_id:{$gt:y({type:e}),$lt:y({type:e,id:{}})}};return i["data."+n]=r,t.find({selector:i}).then(function(t){return h(e,o,t.docs)})}function y(e){var t=e.type,r=n.get(t);return r&&(t=r.documentType),d(t,e.id)}e.forEach(function(e){n.set(e.singular,e),n.set(e.plural,e)}),e.forEach(function(e){e.documentType=e.documentType||e.singular}),e.forEach(function(e){if(e.relations){if(!Object.keys(e.relations).length)throw new Error("Invalid relations for: "+e);Object.keys(e.relations).forEach(function(t){var r=e.relations[t];if(1!==Object.keys(r).length)throw new Error("Invalid relationship definition for: "+t);var o=Object.keys(r)[0],i=r[o];if("string"!=typeof i&&(i=i.type),!n.get(i))throw new Error("Unknown entity type: "+i);if("belongsTo"!==o&&"hasMany"!==o)throw new Error("Invalid relationship type for "+t+": "+o)})}}),t.rel={save:function(e,n){return i.resolve().then(function(){return r=n,c=f(e),i.resolve().then(function(){return u=a(c,r),t.put(u)}).then(function(e){var t={};return t[c.plural]=[o(!0,r,{id:v(e.id),rev:e.rev})],t});var r,u,c})},find:function(e,t){return i.resolve().then(function(){return l(f(e).singular,t,new u.Map)})},findHasMany:function(e,t,n){return p(e,t,n,new u.Map)},del:function(e,n){return i.resolve().then(function(){return r=n,u=f(e),i.resolve().then(function(){return o={_id:(o=a(u,r))._id,_rev:o._rev,_deleted:!0},t.put(o)}).then(function(){return{deleted:!0}});var r,o,u})},getAttachment:function(e,n,r,o){return o=o||{},i.resolve().then(function(){return t.getAttachment(d(e,n),r,o)})},putAttachment:function(e,n,r,u,c){var s=d(e,n.id),a=f(e);return i.resolve().then(function(){return t.putAttachment(s,r,n.rev,u,c)}).then(function(e){var t={};return t[a.plural]=[o(!0,n,{id:v(e.id),rev:e.rev})],t})},removeAttachment:function(e,n,r){var u=d(e,n.id),c=f(e);return i.resolve().then(function(){return t.removeAttachment(u,r,n.rev)}).then(function(e){var t={};return t[c.plural]=[o(!0,n,{id:v(e.id),rev:e.rev})],t})},parseDocID:function(t){var r=t.indexOf("_"),o=t.substring(0,r),i=v(t);if(!n.get(o)){var u=e.filter(function(e){return e.documentType===o});u.length>0&&(o=u[0].singular)}return{type:o,id:i}},makeDocID:y,parseRelDocs:function(e,t){return h(e,new u.Map,t)},isDeleted:function(e,n){var r=f(e);return t.get(d(r.documentType,n)).then(function(e){return!!e._deleted}).catch(function(e){return"deleted"===e.reason||null})}}},"undefined"!=typeof window&&window.PouchDB&&window.PouchDB.plugin(n)},{"./collections":1,"./pouch-utils":3,"./uuid":4,uniq:11}],3:[function(e,t,n){(function(t){"use strict";var r=e("pouchdb-promise");n.once=function(e){var t=!1;return n.getArguments(function(n){if(t)throw console.trace(),new Error("once called more than once");t=!0,e.apply(this,n)})},n.getArguments=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=-1;++r1)for(var n=1;n=0;e--){var n=h[e];t.has(u)&&t.get(u).has(JSON.stringify(n))&&delete h[e]}if((h=h.filter(function(e){return void 0!==e})).length)return{relatedType:u,relatedIds:h}}))}}),i.all(a)});return i.all(r)}).then(function(e){var n={};return e.forEach(function(e){e.forEach(function(e){e&&(n[e.relatedType]=(n[e.relatedType]||[]).concat(e.relatedIds))})}),r.series(Object.keys(n).map(function(e){var r=s(n[e]);return function(){return l(e,r,t)}})).then(function(){var e={};return t.forEach(function(t,n){var r=f(n),o=e[r.plural]=[];t.forEach(function(e){o.push(e)})}),e})})}function p(e,n,r,o){var i={_id:{$gt:y({type:e}),$lt:y({type:e,id:{}})}};return i["data."+n]=r,t.find({selector:i}).then(function(t){return h(e,o,t.docs)})}function y(e){var t=e.type,r=n.get(t);return r&&(t=r.documentType),d(t,e.id)}e.forEach(function(e){n.set(e.singular,e),n.set(e.plural,e)}),e.forEach(function(e){e.documentType=e.documentType||e.singular}),e.forEach(function(e){if(e.relations){if(!Object.keys(e.relations).length)throw new Error("Invalid relations for: "+e);Object.keys(e.relations).forEach(function(t){var r=e.relations[t];if(1!==Object.keys(r).length)throw new Error("Invalid relationship definition for: "+t);var o=Object.keys(r)[0],i=r[o];if("string"!=typeof i&&(i=i.type),!n.get(i))throw new Error("Unknown entity type: "+i);if("belongsTo"!==o&&"hasMany"!==o)throw new Error("Invalid relationship type for "+t+": "+o)})}}),t.rel={save:function(e,n){return i.resolve().then(function(){return r=n,c=f(e),i.resolve().then(function(){return u=a(c,r),t.put(u)}).then(function(e){var t={};return t[c.plural]=[o(!0,r,{id:v(e.id),rev:e.rev})],t});var r,u,c})},find:function(e,t){return i.resolve().then(function(){return l(f(e).singular,t,new u.Map)})},findHasMany:function(e,t,n){return p(e,t,n,new u.Map)},del:function(e,n){return i.resolve().then(function(){return r=n,u=f(e),i.resolve().then(function(){return o={_id:(o=a(u,r))._id,_rev:o._rev,_deleted:!0},t.put(o)}).then(function(){return{deleted:!0}});var r,o,u})},getAttachment:function(e,n,r,o){return o=o||{},i.resolve().then(function(){return t.getAttachment(d(e,n),r,o)})},putAttachment:function(e,n,r,u,c){var s=d(e,n.id),a=f(e);return i.resolve().then(function(){return t.putAttachment(s,r,n.rev,u,c)}).then(function(e){var t={};return t[a.plural]=[o(!0,n,{id:v(e.id),rev:e.rev})],t})},removeAttachment:function(e,n,r){var u=d(e,n.id),c=f(e);return i.resolve().then(function(){return t.removeAttachment(u,r,n.rev)}).then(function(e){var t={};return t[c.plural]=[o(!0,n,{id:v(e.id),rev:e.rev})],t})},parseDocID:function(t){var r=t.indexOf("_"),o=t.substring(0,r),i=v(t);if(!n.get(o)){var u=e.filter(function(e){return e.documentType===o});u.length>0&&(o=u[0].singular)}return{type:o,id:i}},makeDocID:y,parseRelDocs:function(e,t){return h(e,new u.Map,t)},isDeleted:function(e,n){var r=f(e);return t.get(d(r.documentType,n)).then(function(e){return!!e._deleted}).catch(function(e){return"deleted"===e.reason||null})}}},"undefined"!=typeof window&&window.PouchDB&&window.PouchDB.plugin(n)},{"./collections":1,"./pouch-utils":3,"./uuid":4,uniq:11}],3:[function(e,t,n){(function(t){"use strict";var r=e("pouchdb-promise");n.once=function(e){var t=!1;return n.getArguments(function(n){if(t)throw console.trace(),new Error("once called more than once");t=!0,e.apply(this,n)})},n.getArguments=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=-1;++r1)for(var n=1;n