druxt 0.21.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DruxtWrapper.vue +1 -1
- package/dist/druxt.esm.js +38 -15
- package/dist/druxt.ssr.js +38 -15
- package/package.json +8 -8
package/dist/druxt.esm.js
CHANGED
|
@@ -250,7 +250,7 @@ class DruxtClient {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
var name = "druxt";
|
|
253
|
-
var version = "0.
|
|
253
|
+
var version = "0.22.0";
|
|
254
254
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
255
255
|
var keywords = [
|
|
256
256
|
"cms",
|
|
@@ -292,26 +292,26 @@ var files = [
|
|
|
292
292
|
var dependencies = {
|
|
293
293
|
"@nuxtjs/axios": "^5.13.6",
|
|
294
294
|
"@nuxtjs/proxy": "^2.1.0",
|
|
295
|
-
"@vue/devtools-api": "^6.
|
|
295
|
+
"@vue/devtools-api": "^6.5.0",
|
|
296
296
|
chalk: "^4.1.2",
|
|
297
|
-
deepmerge: "^4.
|
|
298
|
-
"drupal-jsonapi-params": "^2.
|
|
299
|
-
"express-rate-limit": "^6.
|
|
297
|
+
deepmerge: "^4.3.1",
|
|
298
|
+
"drupal-jsonapi-params": "^2.2.0",
|
|
299
|
+
"express-rate-limit": "^6.7.0",
|
|
300
300
|
"launch-editor": "^2.6.0",
|
|
301
301
|
md5: "^2.3.0",
|
|
302
302
|
querystring: "^0.2.1",
|
|
303
303
|
scule: "^0.3.2"
|
|
304
304
|
};
|
|
305
305
|
var devDependencies = {
|
|
306
|
-
"@storybook/addon-docs": "^6.5.
|
|
306
|
+
"@storybook/addon-docs": "^6.5.16"
|
|
307
307
|
};
|
|
308
308
|
var peerDependencies = {
|
|
309
309
|
axios: "*",
|
|
310
310
|
consola: "*"
|
|
311
311
|
};
|
|
312
312
|
var optionalDependencies = {
|
|
313
|
-
"core-js": "^3.
|
|
314
|
-
vue: "^2.7.
|
|
313
|
+
"core-js": "^3.31.0",
|
|
314
|
+
vue: "^2.7.14",
|
|
315
315
|
vuex: "^3.6.2"
|
|
316
316
|
};
|
|
317
317
|
var publishConfig = {
|
|
@@ -521,13 +521,33 @@ const DruxtStore = ({ store }) => {
|
|
|
521
521
|
}
|
|
522
522
|
resource = merge(state.resources[type][id][prefix] || {}, resource, { arrayMerge: (dst, src) => src });
|
|
523
523
|
Vue.set(state.resources[type][id], prefix, resource);
|
|
524
|
+
},
|
|
525
|
+
flushCollection(state, { type, hash, prefix }) {
|
|
526
|
+
if (!type)
|
|
527
|
+
Vue.set(state, "collections", {});
|
|
528
|
+
else if (type && !hash && !prefix)
|
|
529
|
+
Vue.set(state.collections, type, {});
|
|
530
|
+
else if (type && hash && !prefix)
|
|
531
|
+
Vue.set(state.collections[type], hash, {});
|
|
532
|
+
else if (type && hash && prefix)
|
|
533
|
+
Vue.set(state.collections[type][hash], prefix, {});
|
|
534
|
+
},
|
|
535
|
+
flushResource(state, { type, id, prefix }) {
|
|
536
|
+
if (!type)
|
|
537
|
+
Vue.set(state, "resources", {});
|
|
538
|
+
else if (type && !id && !prefix)
|
|
539
|
+
Vue.set(state.resources, type, {});
|
|
540
|
+
else if (type && id && !prefix)
|
|
541
|
+
Vue.set(state.resources[type], id, {});
|
|
542
|
+
else if (type && id && prefix)
|
|
543
|
+
Vue.set(state.resources[type][id], prefix, {});
|
|
524
544
|
}
|
|
525
545
|
},
|
|
526
546
|
actions: {
|
|
527
|
-
async getCollection({ commit, state }, { type, query, prefix }) {
|
|
547
|
+
async getCollection({ commit, state }, { type, query, prefix, bypassCache = false }) {
|
|
528
548
|
const queryObject = getDrupalJsonApiParams(query).getQueryObject();
|
|
529
549
|
const hash = query ? md5(JSON.stringify({ ...queryObject, fields: {}, include: [] })) : "_default";
|
|
530
|
-
if (((state.collections[type] || {})[hash] || {})[prefix]) {
|
|
550
|
+
if (!bypassCache && ((state.collections[type] || {})[hash] || {})[prefix]) {
|
|
531
551
|
return {
|
|
532
552
|
...state.collections[type][hash][prefix],
|
|
533
553
|
data: state.collections[type][hash][prefix].data.map((o) => ((state.resources[o.type][o.id] || {})[prefix] || {}).data)
|
|
@@ -537,7 +557,7 @@ const DruxtStore = ({ store }) => {
|
|
|
537
557
|
commit("addCollection", { collection: { ...collection }, type, hash, prefix });
|
|
538
558
|
return collection;
|
|
539
559
|
},
|
|
540
|
-
async getResource({ commit, dispatch, state }, { type, id, query, prefix }) {
|
|
560
|
+
async getResource({ commit, dispatch, state }, { type, id, query, prefix, bypassCache = false }) {
|
|
541
561
|
const storedResource = ((state.resources[type] || {})[id] || {})[prefix] ? { ...state.resources[type][id][prefix] } : null;
|
|
542
562
|
const queryObject = getDrupalJsonApiParams(query).getQueryObject();
|
|
543
563
|
queryObject.include = Array.isArray(queryObject.include) ? queryObject.include.join(",") : queryObject.include;
|
|
@@ -566,7 +586,7 @@ const DruxtStore = ({ store }) => {
|
|
|
566
586
|
}
|
|
567
587
|
storedResource.included = included;
|
|
568
588
|
}
|
|
569
|
-
if ((storedResource || {})._druxt_full) {
|
|
589
|
+
if (!bypassCache && (storedResource || {})._druxt_full) {
|
|
570
590
|
return storedResource;
|
|
571
591
|
}
|
|
572
592
|
const isFull = typeof (queryObject.fields || {})[type] !== "string";
|
|
@@ -582,9 +602,12 @@ const DruxtStore = ({ store }) => {
|
|
|
582
602
|
queryObject.fields[type] = (missingFields || []).join(",") || void 0;
|
|
583
603
|
}
|
|
584
604
|
let resource;
|
|
585
|
-
if (!storedResource || fields) {
|
|
586
|
-
|
|
587
|
-
|
|
605
|
+
if (bypassCache || !storedResource || fields) {
|
|
606
|
+
try {
|
|
607
|
+
resource = await this.$druxt.getResource(type, id, getDrupalJsonApiParams(queryObject), prefix);
|
|
608
|
+
commit("addResource", { prefix, resource: { ...resource } });
|
|
609
|
+
} catch (e) {
|
|
610
|
+
}
|
|
588
611
|
}
|
|
589
612
|
const result = { ...((state.resources[type] || {})[id] || {})[prefix] };
|
|
590
613
|
if (queryObject.include && ((resource || {}).included || (storedResource || {}).included)) {
|
package/dist/druxt.ssr.js
CHANGED
|
@@ -263,7 +263,7 @@ class DruxtClient {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
var name = "druxt";
|
|
266
|
-
var version = "0.
|
|
266
|
+
var version = "0.22.0";
|
|
267
267
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
268
268
|
var keywords = [
|
|
269
269
|
"cms",
|
|
@@ -305,26 +305,26 @@ var files = [
|
|
|
305
305
|
var dependencies = {
|
|
306
306
|
"@nuxtjs/axios": "^5.13.6",
|
|
307
307
|
"@nuxtjs/proxy": "^2.1.0",
|
|
308
|
-
"@vue/devtools-api": "^6.
|
|
308
|
+
"@vue/devtools-api": "^6.5.0",
|
|
309
309
|
chalk: "^4.1.2",
|
|
310
|
-
deepmerge: "^4.
|
|
311
|
-
"drupal-jsonapi-params": "^2.
|
|
312
|
-
"express-rate-limit": "^6.
|
|
310
|
+
deepmerge: "^4.3.1",
|
|
311
|
+
"drupal-jsonapi-params": "^2.2.0",
|
|
312
|
+
"express-rate-limit": "^6.7.0",
|
|
313
313
|
"launch-editor": "^2.6.0",
|
|
314
314
|
md5: "^2.3.0",
|
|
315
315
|
querystring: "^0.2.1",
|
|
316
316
|
scule: "^0.3.2"
|
|
317
317
|
};
|
|
318
318
|
var devDependencies = {
|
|
319
|
-
"@storybook/addon-docs": "^6.5.
|
|
319
|
+
"@storybook/addon-docs": "^6.5.16"
|
|
320
320
|
};
|
|
321
321
|
var peerDependencies = {
|
|
322
322
|
axios: "*",
|
|
323
323
|
consola: "*"
|
|
324
324
|
};
|
|
325
325
|
var optionalDependencies = {
|
|
326
|
-
"core-js": "^3.
|
|
327
|
-
vue: "^2.7.
|
|
326
|
+
"core-js": "^3.31.0",
|
|
327
|
+
vue: "^2.7.14",
|
|
328
328
|
vuex: "^3.6.2"
|
|
329
329
|
};
|
|
330
330
|
var publishConfig = {
|
|
@@ -534,13 +534,33 @@ const DruxtStore = ({ store }) => {
|
|
|
534
534
|
}
|
|
535
535
|
resource = merge__default["default"](state.resources[type][id][prefix] || {}, resource, { arrayMerge: (dst, src) => src });
|
|
536
536
|
Vue__default["default"].set(state.resources[type][id], prefix, resource);
|
|
537
|
+
},
|
|
538
|
+
flushCollection(state, { type, hash, prefix }) {
|
|
539
|
+
if (!type)
|
|
540
|
+
Vue__default["default"].set(state, "collections", {});
|
|
541
|
+
else if (type && !hash && !prefix)
|
|
542
|
+
Vue__default["default"].set(state.collections, type, {});
|
|
543
|
+
else if (type && hash && !prefix)
|
|
544
|
+
Vue__default["default"].set(state.collections[type], hash, {});
|
|
545
|
+
else if (type && hash && prefix)
|
|
546
|
+
Vue__default["default"].set(state.collections[type][hash], prefix, {});
|
|
547
|
+
},
|
|
548
|
+
flushResource(state, { type, id, prefix }) {
|
|
549
|
+
if (!type)
|
|
550
|
+
Vue__default["default"].set(state, "resources", {});
|
|
551
|
+
else if (type && !id && !prefix)
|
|
552
|
+
Vue__default["default"].set(state.resources, type, {});
|
|
553
|
+
else if (type && id && !prefix)
|
|
554
|
+
Vue__default["default"].set(state.resources[type], id, {});
|
|
555
|
+
else if (type && id && prefix)
|
|
556
|
+
Vue__default["default"].set(state.resources[type][id], prefix, {});
|
|
537
557
|
}
|
|
538
558
|
},
|
|
539
559
|
actions: {
|
|
540
|
-
async getCollection({ commit, state }, { type, query, prefix }) {
|
|
560
|
+
async getCollection({ commit, state }, { type, query, prefix, bypassCache = false }) {
|
|
541
561
|
const queryObject = getDrupalJsonApiParams(query).getQueryObject();
|
|
542
562
|
const hash = query ? md5__default["default"](JSON.stringify({ ...queryObject, fields: {}, include: [] })) : "_default";
|
|
543
|
-
if (((state.collections[type] || {})[hash] || {})[prefix]) {
|
|
563
|
+
if (!bypassCache && ((state.collections[type] || {})[hash] || {})[prefix]) {
|
|
544
564
|
return {
|
|
545
565
|
...state.collections[type][hash][prefix],
|
|
546
566
|
data: state.collections[type][hash][prefix].data.map((o) => ((state.resources[o.type][o.id] || {})[prefix] || {}).data)
|
|
@@ -550,7 +570,7 @@ const DruxtStore = ({ store }) => {
|
|
|
550
570
|
commit("addCollection", { collection: { ...collection }, type, hash, prefix });
|
|
551
571
|
return collection;
|
|
552
572
|
},
|
|
553
|
-
async getResource({ commit, dispatch, state }, { type, id, query, prefix }) {
|
|
573
|
+
async getResource({ commit, dispatch, state }, { type, id, query, prefix, bypassCache = false }) {
|
|
554
574
|
const storedResource = ((state.resources[type] || {})[id] || {})[prefix] ? { ...state.resources[type][id][prefix] } : null;
|
|
555
575
|
const queryObject = getDrupalJsonApiParams(query).getQueryObject();
|
|
556
576
|
queryObject.include = Array.isArray(queryObject.include) ? queryObject.include.join(",") : queryObject.include;
|
|
@@ -579,7 +599,7 @@ const DruxtStore = ({ store }) => {
|
|
|
579
599
|
}
|
|
580
600
|
storedResource.included = included;
|
|
581
601
|
}
|
|
582
|
-
if ((storedResource || {})._druxt_full) {
|
|
602
|
+
if (!bypassCache && (storedResource || {})._druxt_full) {
|
|
583
603
|
return storedResource;
|
|
584
604
|
}
|
|
585
605
|
const isFull = typeof (queryObject.fields || {})[type] !== "string";
|
|
@@ -595,9 +615,12 @@ const DruxtStore = ({ store }) => {
|
|
|
595
615
|
queryObject.fields[type] = (missingFields || []).join(",") || void 0;
|
|
596
616
|
}
|
|
597
617
|
let resource;
|
|
598
|
-
if (!storedResource || fields) {
|
|
599
|
-
|
|
600
|
-
|
|
618
|
+
if (bypassCache || !storedResource || fields) {
|
|
619
|
+
try {
|
|
620
|
+
resource = await this.$druxt.getResource(type, id, getDrupalJsonApiParams(queryObject), prefix);
|
|
621
|
+
commit("addResource", { prefix, resource: { ...resource } });
|
|
622
|
+
} catch (e) {
|
|
623
|
+
}
|
|
601
624
|
}
|
|
602
625
|
const result = { ...((state.resources[type] || {})[id] || {})[prefix] };
|
|
603
626
|
if (queryObject.include && ((resource || {}).included || (storedResource || {}).included)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The Fully Decoupled Drupal Framework for Nuxt.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -42,26 +42,26 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@nuxtjs/axios": "^5.13.6",
|
|
44
44
|
"@nuxtjs/proxy": "^2.1.0",
|
|
45
|
-
"@vue/devtools-api": "^6.
|
|
45
|
+
"@vue/devtools-api": "^6.5.0",
|
|
46
46
|
"chalk": "^4.1.2",
|
|
47
|
-
"deepmerge": "^4.
|
|
48
|
-
"drupal-jsonapi-params": "^2.
|
|
49
|
-
"express-rate-limit": "^6.
|
|
47
|
+
"deepmerge": "^4.3.1",
|
|
48
|
+
"drupal-jsonapi-params": "^2.2.0",
|
|
49
|
+
"express-rate-limit": "^6.7.0",
|
|
50
50
|
"launch-editor": "^2.6.0",
|
|
51
51
|
"md5": "^2.3.0",
|
|
52
52
|
"querystring": "^0.2.1",
|
|
53
53
|
"scule": "^0.3.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@storybook/addon-docs": "^6.5.
|
|
56
|
+
"@storybook/addon-docs": "^6.5.16"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"axios": "*",
|
|
60
60
|
"consola": "*"
|
|
61
61
|
},
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"core-js": "^3.
|
|
64
|
-
"vue": "^2.7.
|
|
63
|
+
"core-js": "^3.31.0",
|
|
64
|
+
"vue": "^2.7.14",
|
|
65
65
|
"vuex": "^3.6.2"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|