Socket
Socket
Sign inDemoInstall

druxt

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

druxt - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

10

dist/druxt.esm.js

@@ -1050,4 +1050,4 @@ import { resolve } from 'path';

if (!state.collections[type]) { state.collections[type] = {}; }
state.collections[type][hash] = collection;
if (!state.collections[type]) { Vue.set(state.collections, type, {}); }
Vue.set(state.collections[type], hash, collection);
},

@@ -1075,5 +1075,5 @@

if (!state.resources[type]) { state.resources[type] = {}; }
if (!state.resources[type][id]) { state.resources[type][id] = {}; }
state.resources[type][id][hash] = resource;
if (!state.resources[type]) { Vue.set(state.resources, type, {}); }
if (!state.resources[type][id]) { Vue.set(state.resources[type], id, {}); }
Vue.set(state.resources[type][id], hash, resource);
},

@@ -1080,0 +1080,0 @@ },

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

var Druxt=function(t,e,n,o,r,i,s){"use strict";function a(t,e,n,o,r,i,s,a,p,u){"boolean"!=typeof s&&(p=a,a=s,s=!1);var c,d="function"==typeof n?n.options:n;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,r&&(d.functional=!0)),o&&(d._scopeId=o),i?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,p(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},d._ssrRegister=c):e&&(c=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(d.functional){var l=d.render;d.render=function(t,e){return c.call(e),l(t,e)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,c):[c]}return n}n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i,s=s&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s;var p=a({},undefined,{name:"Druxt",props:{inner:{type:[Object,Boolean],default:function(){return{component:"div",propsData:{}}}},module:{type:String,required:!0},propsData:{type:Object,default:function(){return{}}},wrapper:{type:[Object,Boolean],default:function(){return{component:"div",propsData:{}}}}},data:function(){return{component:{is:void 0,propsData:{}}}},created:function(){this.setModuleComponent()},methods:{setModuleComponent:function(){var t="Druxt"+this.module.split("-").map((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})).join("");this.$options.components[t]&&(this.component.is=t,this.component.propsData=this.propsData)}},render:function(t){var e=t(this.component.is,{props:Object.assign({},{wrapper:this.inner},this.component.propsData,this.$attrs)});return(this.wrapper||{}).component?t(this.wrapper.component,{props:this.wrapper.propsData},[e]):e}},undefined,undefined,undefined,!1,void 0,void 0,void 0),u=a({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",[t._t("default")],2)},staticRenderFns:[]},undefined,{name:"DruxtWrapper"},undefined,false,undefined,!1,void 0,void 0,void 0),c=function(t){void 0===t&&(t={});var n=Object.assign({},t,(this.options||{}).druxt);this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt.js",options:n}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/store.js"),fileName:"store/druxt.js",options:n}),this.options.store=!0};c.meta=require("../package.json");var d=function(t,e){if(void 0===e&&(e={}),!t)throw new Error("The 'baseUrl' parameter is required.");var o={baseURL:t};"object"==typeof e.axios&&(o=Object.assign(o,e.axios),delete e.axios),this.axios=n.create(o),this.options=Object.assign({},{endpoint:"/jsonapi",jsonapiResourceConfig:"jsonapi_resource_config--jsonapi_resource_config"},e)};d.prototype.addHeaders=function(t){if(void 0===t)return!1;for(var e in t)this.axios.defaults.headers.common[e]=t[e]},d.prototype.buildQueryUrl=function(t,e){return e?"string"==typeof e?"?"===e.charAt(0)?t+e:[t,e].join("?"):"object"==typeof e&&"function"==typeof e.getQueryString?[t,e.getQueryString()].join("?"):"object"==typeof e&&Object.keys(e).length?[t,o.stringify(e)].join("?"):t:t},d.prototype.checkPermissions=function(t){if(t.data.meta&&t.data.meta.omitted){var e={};for(var n in delete t.data.meta.omitted.links.help,t.data.meta.omitted.links){var o=t.data.meta.omitted.links[n].meta.detail.match(/'(.*?)'/);o&&o[1]&&(e[o[1]]=!0)}if(Object.keys(e).length)throw new TypeError(t.data.meta.omitted.detail+"\n\n Required permissions: "+Object.keys(e).join(", ")+".")}},d.prototype.getCollection=async function(t,e){var n=(await this.getIndex(t)).href;if(!n)return!1;var o=this.buildQueryUrl(n,e),r=await this.axios.get(o);return this.checkPermissions(r),r.data},d.prototype.getCollectionAll=async function(t,e){var n=[],o=await this.getCollection(t,e);for(n.push(o);((o.links||{}).next||{}).href;)e=o.links.next.href.split("?")[1],o=await this.getCollection(t,e),n.push(o);return n},d.prototype.getIndex=async function(t){if(this.index&&!t)return this.index;if(this.index&&t)return!!this.index[t]&&this.index[t];var e=await this.axios.get(this.options.endpoint);if(this.index=e.data.links,this.index[this.options.jsonapiResourceConfig]){var n=await this.axios.get(this.index[this.options.jsonapiResourceConfig].href);for(var o in n.data.data){var r=n.data.data[o],i=r.attributes.drupal_internal__id.split("--"),s={resourceType:r.attributes.resourceType,entityType:i[0],bundle:i[1],resourceFields:r.attributes.resourceFields},a=[s.entityType,s.bundle].join("--");this.index[a]=Object.assign({},s,this.index[a])}}return t?!!this.index[t]&&this.index[t]:this.index},d.prototype.getResource=async function(t,e,n){if(!e||!t)return!1;var o=(await this.getIndex(t)).href;o||(o=this.options.endpoint+"/"+t.replace("--","/"));var r=this.buildQueryUrl(o+"/"+e,n);try{return(await this.axios.get(r)).data}catch(t){return!1}};var l=a({},undefined,{components:{DruxtWrapper:u},props:{wrapper:{type:Object,default:function(){return{component:"div",propsData:{}}}}},fetch:async function(){if(!(this.$options||{}).druxt)return!1;var t=this.getModuleComponents(),e={is:((t.filter((function(t){return t.global}))||[])[0]||{}).name||"DruxtWrapper",options:t.map((function(t){return t.name}))||[]},n=await this.getWrapperData(e.is);e.settings=n.druxt||{},e=Object.assign({},e,this.getModulePropsData(n.props)),this.component=e},data:function(){return{component:{$attrs:{},is:"DruxtWrapper",options:[],props:{},propsData:{},settings:{}}}},methods:{getModuleComponents:function(){var t=this;if(!(this.$options.druxt||{}).componentOptions)return[];var e=this.$options.druxt.componentOptions.call(this,this);if(!e||!e.length)return[];var n,o=[],i=function(){var e=[];o=o.concat(s.map((function(n){var o=e.length?[].concat(e[0].parts):[];o.push(r.pascalCase(r.splitByCase(n)));var i=r.pascalCase([t.$options.name].concat(o)),s=!!t.$options.components[i];return e.unshift({global:s,name:i,parts:o}),{global:s,name:i,parts:o}})))};for(var s of e.filter((function(t){return Array.isArray(t)})))i();return o.filter((n=new Set,function(t){return!n.has(t.name)&&n.add(t.name)})).sort((function(t,e){return e.parts.length-t.parts.length}))},getModulePropsData:function(t){if(void 0===t&&(t={}),!(this.$options.druxt||{}).propsData)return{};var e=this.$options.druxt.propsData.call(this,this),n={},o=Object.keys(t).filter((function(t){return Object.keys(e).includes(t)}));for(var r of o)n[r]=e[r];var i=Object.assign({},this.$attrs),s=Object.keys(e).filter((function(e){return!Object.keys(t).includes(e)}));for(var a of s)i[a]=e[a];return{$attrs:i,props:n,propsData:e}},getScopedSlots:function(){var t=this;return{default:function(){return t.$createElement("div",[JSON.stringify(t.component.propsData)])}}},getWrapperData:async function(t){var e={druxt:{},props:{}};if(!this.$options.components[t])return e;this.$options.components[t].options?e=this.$options.components[t].options:"function"==typeof this.$options.components[t]&&this._init&&(e=await this.$options.components[t].call(this)||{});var n=i.util.mergeOptions({},e);return{druxt:n.druxt||{},props:n.props||{}}}},render:function(t){var e={class:this.wrapper.class||void 0,style:this.wrapper.style||void 0,props:this.wrapper.propsData};return this.$fetchState.pending?t(this.wrapper.component,e):t(this.wrapper.component,e,[t(this.component.is,{attrs:this.component.$attrs,props:this.component.props,scopedSlots:this.getScopedSlots()})])}},undefined,undefined,undefined,!1,void 0,void 0,void 0),f=function(){};f.prototype.getComponents=function(t,e,n,o){void 0===n&&(n=!1);var r=[],i={};return e.filter((function(t){return Array.isArray(t)})).map((function(e){var n=[];e.map((function(e){var r=n.length?[].concat(n[0].parts):[];r.push(e);var i=[].concat(r);"string"==typeof o||!1===o&&void 0!==o||!((t||{}).$options||{}).name||(o=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),o&&i.unshift(o);var s=i.map((function(t){return t.toLowerCase().replace(/--|_/g,"-")})).join("-"),a=s.replace(/((\b|[^a-zA-Z0-9]+)[a-zA-Z0-9])/gi,(function(t,e,n){return t.toUpperCase().replace(n,"")})),p=!1;for(var u of[s,a])if(void 0!==(((t||{}).$options||{}).components||{})[u]){p=!0;break}n.unshift({global:p,kebab:s,parts:r,pascal:a,prefix:o})})),n.map((function(t){i[t.pascal]||(i[t.pascal]=!0,r.push(t))}))})),r.filter((function(t){return t.global||!!n})).sort((function(t,e){return e.parts.length-t.parts.length}))},f.prototype.getModuleData=async function(t){if("function"!=typeof((t||{}).$options||{}).druxt)return!1;var e=await t.$options.druxt({vm:t});return(t.$options||{}).name&&(e.name=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),e};var h={components:{DruxtWrapper:u},data:function(){return{component:{is:"DruxtWrapper",options:[],propsData:{}}}},props:{wrapper:{type:Object,default:function(){return{component:"div",propsData:{}}}}},fetch:async function(){console.warn("DruxtComponentMixin is deprecated in favour of DruxtModule.");var t=new f,e=await t.getModuleData(this);if(this.component.propsData=e.propsData||{},e.componentOptions){var n=t.getComponents(this,e.componentOptions,!0);this.component.options=n.map((function(t){return t.pascal}));var o=n.filter((function(t){return t.global}));o.length&&(this.component.is=o[0].pascal)}}};return t.Druxt=p,t.DruxtClass=f,t.DruxtClient=d,t.DruxtComponentMixin=h,t.DruxtModule=l,t.DruxtStore=function(t){var e=t.store;if(void 0===e)throw new TypeError("Vuex store not found.");var n="druxt",o={namespaced:!0,state:function(){return{collections:{},resources:{}}},mutations:{addCollection:function(t,e){var n=e.collection,o=e.type,r=e.hash;t.collections[o]||(t.collections[o]={}),t.collections[o][r]=n},addResource:function(t,e){var n=e.resource,o=e.hash,r=(n||{}).data||{},i=r.id,s=r.type;i&&s&&(t.resources[s]||(t.resources[s]={}),t.resources[s][i]||(t.resources[s][i]={}),t.resources[s][i][o]=n)}},actions:{getCollection:async function(t,e){var n=t.commit,o=t.state,r=e.type,i=e.query,a=i?s(this.$druxt.buildQueryUrl("",i)):"_default";if((o.collections[r]||{})[a])return o.collections[r][a];var p=await this.$druxt.getCollection(r,i);return n("addCollection",{collection:p,type:r,hash:a}),((p||{}).data||[]).map((function(t){n("addResource",{resource:{data:t},hash:a})})),p},getResource:async function(t,e){var n=t.commit,o=t.state,r=e.type,i=e.id,a=e.query,p=a?s(this.$druxt.buildQueryUrl("",a)):"_default";if(void 0!==((o.resources[r]||{})[i]||{})[p])return o.resources[r][i][p];var u=await this.$druxt.getResource(r,i,a);return n("addResource",{resource:u,hash:p}),u}}};e.registerModule(n,o,{preserveState:Boolean(e.state.druxt)})},t.DruxtWrapper=u,t.default=c,t}({},path,axios,querystring,scule,Vue,md5);
var Druxt=function(t,e,n,o,r,i,s){"use strict";function a(t,e,n,o,r,i,s,a,p,u){"boolean"!=typeof s&&(p=a,a=s,s=!1);var c,d="function"==typeof n?n.options:n;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,r&&(d.functional=!0)),o&&(d._scopeId=o),i?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,p(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},d._ssrRegister=c):e&&(c=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(d.functional){var l=d.render;d.render=function(t,e){return c.call(e),l(t,e)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,c):[c]}return n}n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i,s=s&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s;var p=a({},undefined,{name:"Druxt",props:{inner:{type:[Object,Boolean],default:function(){return{component:"div",propsData:{}}}},module:{type:String,required:!0},propsData:{type:Object,default:function(){return{}}},wrapper:{type:[Object,Boolean],default:function(){return{component:"div",propsData:{}}}}},data:function(){return{component:{is:void 0,propsData:{}}}},created:function(){this.setModuleComponent()},methods:{setModuleComponent:function(){var t="Druxt"+this.module.split("-").map((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})).join("");this.$options.components[t]&&(this.component.is=t,this.component.propsData=this.propsData)}},render:function(t){var e=t(this.component.is,{props:Object.assign({},{wrapper:this.inner},this.component.propsData,this.$attrs)});return(this.wrapper||{}).component?t(this.wrapper.component,{props:this.wrapper.propsData},[e]):e}},undefined,undefined,undefined,!1,void 0,void 0,void 0),u=a({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",[t._t("default")],2)},staticRenderFns:[]},undefined,{name:"DruxtWrapper"},undefined,false,undefined,!1,void 0,void 0,void 0),c=function(t){void 0===t&&(t={});var n=Object.assign({},t,(this.options||{}).druxt);this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt.js",options:n}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/store.js"),fileName:"store/druxt.js",options:n}),this.options.store=!0};c.meta=require("../package.json");var d=function(t,e){if(void 0===e&&(e={}),!t)throw new Error("The 'baseUrl' parameter is required.");var o={baseURL:t};"object"==typeof e.axios&&(o=Object.assign(o,e.axios),delete e.axios),this.axios=n.create(o),this.options=Object.assign({},{endpoint:"/jsonapi",jsonapiResourceConfig:"jsonapi_resource_config--jsonapi_resource_config"},e)};d.prototype.addHeaders=function(t){if(void 0===t)return!1;for(var e in t)this.axios.defaults.headers.common[e]=t[e]},d.prototype.buildQueryUrl=function(t,e){return e?"string"==typeof e?"?"===e.charAt(0)?t+e:[t,e].join("?"):"object"==typeof e&&"function"==typeof e.getQueryString?[t,e.getQueryString()].join("?"):"object"==typeof e&&Object.keys(e).length?[t,o.stringify(e)].join("?"):t:t},d.prototype.checkPermissions=function(t){if(t.data.meta&&t.data.meta.omitted){var e={};for(var n in delete t.data.meta.omitted.links.help,t.data.meta.omitted.links){var o=t.data.meta.omitted.links[n].meta.detail.match(/'(.*?)'/);o&&o[1]&&(e[o[1]]=!0)}if(Object.keys(e).length)throw new TypeError(t.data.meta.omitted.detail+"\n\n Required permissions: "+Object.keys(e).join(", ")+".")}},d.prototype.getCollection=async function(t,e){var n=(await this.getIndex(t)).href;if(!n)return!1;var o=this.buildQueryUrl(n,e),r=await this.axios.get(o);return this.checkPermissions(r),r.data},d.prototype.getCollectionAll=async function(t,e){var n=[],o=await this.getCollection(t,e);for(n.push(o);((o.links||{}).next||{}).href;)e=o.links.next.href.split("?")[1],o=await this.getCollection(t,e),n.push(o);return n},d.prototype.getIndex=async function(t){if(this.index&&!t)return this.index;if(this.index&&t)return!!this.index[t]&&this.index[t];var e=await this.axios.get(this.options.endpoint);if(this.index=e.data.links,this.index[this.options.jsonapiResourceConfig]){var n=await this.axios.get(this.index[this.options.jsonapiResourceConfig].href);for(var o in n.data.data){var r=n.data.data[o],i=r.attributes.drupal_internal__id.split("--"),s={resourceType:r.attributes.resourceType,entityType:i[0],bundle:i[1],resourceFields:r.attributes.resourceFields},a=[s.entityType,s.bundle].join("--");this.index[a]=Object.assign({},s,this.index[a])}}return t?!!this.index[t]&&this.index[t]:this.index},d.prototype.getResource=async function(t,e,n){if(!e||!t)return!1;var o=(await this.getIndex(t)).href;o||(o=this.options.endpoint+"/"+t.replace("--","/"));var r=this.buildQueryUrl(o+"/"+e,n);try{return(await this.axios.get(r)).data}catch(t){return!1}};var l=a({},undefined,{components:{DruxtWrapper:u},props:{wrapper:{type:Object,default:function(){return{component:"div",propsData:{}}}}},fetch:async function(){if(!(this.$options||{}).druxt)return!1;var t=this.getModuleComponents(),e={is:((t.filter((function(t){return t.global}))||[])[0]||{}).name||"DruxtWrapper",options:t.map((function(t){return t.name}))||[]},n=await this.getWrapperData(e.is);e.settings=n.druxt||{},e=Object.assign({},e,this.getModulePropsData(n.props)),this.component=e},data:function(){return{component:{$attrs:{},is:"DruxtWrapper",options:[],props:{},propsData:{},settings:{}}}},methods:{getModuleComponents:function(){var t=this;if(!(this.$options.druxt||{}).componentOptions)return[];var e=this.$options.druxt.componentOptions.call(this,this);if(!e||!e.length)return[];var n,o=[],i=function(){var e=[];o=o.concat(s.map((function(n){var o=e.length?[].concat(e[0].parts):[];o.push(r.pascalCase(r.splitByCase(n)));var i=r.pascalCase([t.$options.name].concat(o)),s=!!t.$options.components[i];return e.unshift({global:s,name:i,parts:o}),{global:s,name:i,parts:o}})))};for(var s of e.filter((function(t){return Array.isArray(t)})))i();return o.filter((n=new Set,function(t){return!n.has(t.name)&&n.add(t.name)})).sort((function(t,e){return e.parts.length-t.parts.length}))},getModulePropsData:function(t){if(void 0===t&&(t={}),!(this.$options.druxt||{}).propsData)return{};var e=this.$options.druxt.propsData.call(this,this),n={},o=Object.keys(t).filter((function(t){return Object.keys(e).includes(t)}));for(var r of o)n[r]=e[r];var i=Object.assign({},this.$attrs),s=Object.keys(e).filter((function(e){return!Object.keys(t).includes(e)}));for(var a of s)i[a]=e[a];return{$attrs:i,props:n,propsData:e}},getScopedSlots:function(){var t=this;return{default:function(){return t.$createElement("div",[JSON.stringify(t.component.propsData)])}}},getWrapperData:async function(t){var e={druxt:{},props:{}};if(!this.$options.components[t])return e;this.$options.components[t].options?e=this.$options.components[t].options:"function"==typeof this.$options.components[t]&&this._init&&(e=await this.$options.components[t].call(this)||{});var n=i.util.mergeOptions({},e);return{druxt:n.druxt||{},props:n.props||{}}}},render:function(t){var e={class:this.wrapper.class||void 0,style:this.wrapper.style||void 0,props:this.wrapper.propsData};return this.$fetchState.pending?t(this.wrapper.component,e):t(this.wrapper.component,e,[t(this.component.is,{attrs:this.component.$attrs,props:this.component.props,scopedSlots:this.getScopedSlots()})])}},undefined,undefined,undefined,!1,void 0,void 0,void 0),f=function(){};f.prototype.getComponents=function(t,e,n,o){void 0===n&&(n=!1);var r=[],i={};return e.filter((function(t){return Array.isArray(t)})).map((function(e){var n=[];e.map((function(e){var r=n.length?[].concat(n[0].parts):[];r.push(e);var i=[].concat(r);"string"==typeof o||!1===o&&void 0!==o||!((t||{}).$options||{}).name||(o=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),o&&i.unshift(o);var s=i.map((function(t){return t.toLowerCase().replace(/--|_/g,"-")})).join("-"),a=s.replace(/((\b|[^a-zA-Z0-9]+)[a-zA-Z0-9])/gi,(function(t,e,n){return t.toUpperCase().replace(n,"")})),p=!1;for(var u of[s,a])if(void 0!==(((t||{}).$options||{}).components||{})[u]){p=!0;break}n.unshift({global:p,kebab:s,parts:r,pascal:a,prefix:o})})),n.map((function(t){i[t.pascal]||(i[t.pascal]=!0,r.push(t))}))})),r.filter((function(t){return t.global||!!n})).sort((function(t,e){return e.parts.length-t.parts.length}))},f.prototype.getModuleData=async function(t){if("function"!=typeof((t||{}).$options||{}).druxt)return!1;var e=await t.$options.druxt({vm:t});return(t.$options||{}).name&&(e.name=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),e};var h={components:{DruxtWrapper:u},data:function(){return{component:{is:"DruxtWrapper",options:[],propsData:{}}}},props:{wrapper:{type:Object,default:function(){return{component:"div",propsData:{}}}}},fetch:async function(){console.warn("DruxtComponentMixin is deprecated in favour of DruxtModule.");var t=new f,e=await t.getModuleData(this);if(this.component.propsData=e.propsData||{},e.componentOptions){var n=t.getComponents(this,e.componentOptions,!0);this.component.options=n.map((function(t){return t.pascal}));var o=n.filter((function(t){return t.global}));o.length&&(this.component.is=o[0].pascal)}}};return t.Druxt=p,t.DruxtClass=f,t.DruxtClient=d,t.DruxtComponentMixin=h,t.DruxtModule=l,t.DruxtStore=function(t){var e=t.store;if(void 0===e)throw new TypeError("Vuex store not found.");var n="druxt",o={namespaced:!0,state:function(){return{collections:{},resources:{}}},mutations:{addCollection:function(t,e){var n=e.collection,o=e.type,r=e.hash;t.collections[o]||i.set(t.collections,o,{}),i.set(t.collections[o],r,n)},addResource:function(t,e){var n=e.resource,o=e.hash,r=(n||{}).data||{},s=r.id,a=r.type;s&&a&&(t.resources[a]||i.set(t.resources,a,{}),t.resources[a][s]||i.set(t.resources[a],s,{}),i.set(t.resources[a][s],o,n))}},actions:{getCollection:async function(t,e){var n=t.commit,o=t.state,r=e.type,i=e.query,a=i?s(this.$druxt.buildQueryUrl("",i)):"_default";if((o.collections[r]||{})[a])return o.collections[r][a];var p=await this.$druxt.getCollection(r,i);return n("addCollection",{collection:p,type:r,hash:a}),((p||{}).data||[]).map((function(t){n("addResource",{resource:{data:t},hash:a})})),p},getResource:async function(t,e){var n=t.commit,o=t.state,r=e.type,i=e.id,a=e.query,p=a?s(this.$druxt.buildQueryUrl("",a)):"_default";if(void 0!==((o.resources[r]||{})[i]||{})[p])return o.resources[r][i][p];var u=await this.$druxt.getResource(r,i,a);return n("addResource",{resource:u,hash:p}),u}}};e.registerModule(n,o,{preserveState:Boolean(e.state.druxt)})},t.DruxtWrapper=u,t.default=c,t}({},path,axios,querystring,scule,Vue,md5);

@@ -1025,4 +1025,4 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});function _interopDefault(e){return(e&&(typeof e==='object')&&'default'in e)?e['default']:e}var path=require('path'),axios=_interopDefault(require('axios')),querystring=require('querystring'),scule=require('scule'),Vue=_interopDefault(require('vue')),md5=_interopDefault(require('md5'));/**

if (!state.collections[type]) { state.collections[type] = {}; }
state.collections[type][hash] = collection;
if (!state.collections[type]) { Vue.set(state.collections, type, {}); }
Vue.set(state.collections[type], hash, collection);
},

@@ -1050,5 +1050,5 @@

if (!state.resources[type]) { state.resources[type] = {}; }
if (!state.resources[type][id]) { state.resources[type][id] = {}; }
state.resources[type][id][hash] = resource;
if (!state.resources[type]) { Vue.set(state.resources, type, {}); }
if (!state.resources[type][id]) { Vue.set(state.resources[type], id, {}); }
Vue.set(state.resources[type][id], hash, resource);
},

@@ -1055,0 +1055,0 @@ },

{
"name": "druxt",
"version": "0.5.0",
"version": "0.5.1",
"description": "A Bridge between frameworks, Nuxt.js in the front, Drupal in the back.",

@@ -5,0 +5,0 @@ "repository": {

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