druxt 0.25.0-dev.20261022212039 → 0.25.0-dev.20261023021249
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/druxt.esm.js +25 -8
- package/dist/druxt.ssr.js +25 -8
- package/package.json +2 -2
package/dist/druxt.esm.js
CHANGED
|
@@ -553,7 +553,7 @@ const cacheClearHandler = (secret) => (req, res) => {
|
|
|
553
553
|
};
|
|
554
554
|
|
|
555
555
|
var name = "druxt";
|
|
556
|
-
var version = "0.25.0-dev.
|
|
556
|
+
var version = "0.25.0-dev.20261023021249";
|
|
557
557
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
558
558
|
var keywords = [
|
|
559
559
|
"cms",
|
|
@@ -614,7 +614,7 @@ var dependencies = {
|
|
|
614
614
|
};
|
|
615
615
|
var devDependencies = {
|
|
616
616
|
"@storybook/addon-docs": "^6.5.16",
|
|
617
|
-
"druxt-test-utils": "0.2.16-dev.
|
|
617
|
+
"druxt-test-utils": "0.2.16-dev.20261023021249"
|
|
618
618
|
};
|
|
619
619
|
var peerDependencies = {
|
|
620
620
|
axios: ">=0.34.0",
|
|
@@ -782,6 +782,20 @@ const getDrupalJsonApiParams = (query) => {
|
|
|
782
782
|
return new DrupalJsonApiParams().initialize(query);
|
|
783
783
|
};
|
|
784
784
|
|
|
785
|
+
const includePaths = (include) => (Array.isArray(include) ? include : String(include || "").split(",")).map((path) => String(path).trim()).filter((path) => path);
|
|
786
|
+
const topIncludes = (include) => Array.from(new Set(includePaths(include).map((path) => path.split(".")[0])));
|
|
787
|
+
const subIncludes = (include, key) => includePaths(include).filter((path) => path.startsWith(`${key}.`)).map((path) => path.slice(key.length + 1)).join(",");
|
|
788
|
+
const fieldsWithIncludes = (fields, include) => Array.from(new Set([...String(fields).split(","), ...topIncludes(include)])).filter((field) => field).join(",");
|
|
789
|
+
const includesFor = (include, fields, relationships = []) => {
|
|
790
|
+
if (!include || typeof fields !== "string")
|
|
791
|
+
return include;
|
|
792
|
+
const listed = fields.split(",");
|
|
793
|
+
return includePaths(include).filter((path) => {
|
|
794
|
+
const key = path.split(".")[0];
|
|
795
|
+
return listed.includes(key) || relationships.includes(key);
|
|
796
|
+
}).join(",");
|
|
797
|
+
};
|
|
798
|
+
|
|
785
799
|
const dehydrateResources = ({ commit, queryObject, resources, prefix }) => {
|
|
786
800
|
return (resources || []).map((data) => {
|
|
787
801
|
const link = decodeURI(((data.links || {}).self || {}).href || "");
|
|
@@ -955,22 +969,25 @@ const DruxtStore = ({ store }) => {
|
|
|
955
969
|
const queryObject = getDrupalJsonApiParams(query).getQueryObject();
|
|
956
970
|
queryObject.include = Array.isArray(queryObject.include) ? queryObject.include.join(",") : queryObject.include;
|
|
957
971
|
if (queryObject.include && typeof (queryObject.fields || {})[type] === "string") {
|
|
958
|
-
|
|
959
|
-
const includes = queryObject.include.split(",").filter((s) => s && !s.includes("."));
|
|
960
|
-
queryObject.fields[type] = Array.from(new Set([...fields2, ...includes])).filter((s) => s).join(",");
|
|
972
|
+
queryObject.fields[type] = fieldsWithIncludes(queryObject.fields[type], queryObject.include);
|
|
961
973
|
}
|
|
974
|
+
const includeFor = (related, include) => {
|
|
975
|
+
const stored2 = ((state.resources[related.type] || {})[related.id] || {})[prefix];
|
|
976
|
+
const relationships = Object.keys(((stored2 || {}).data || {}).relationships || {});
|
|
977
|
+
return includesFor(include, (queryObject.fields || {})[related.type], relationships);
|
|
978
|
+
};
|
|
962
979
|
let included = [];
|
|
963
980
|
if (queryObject.include && storedResource && !bypassCache) {
|
|
964
|
-
const resources = await Promise.all(queryObject.include
|
|
981
|
+
const resources = await Promise.all(topIncludes(queryObject.include).filter((s) => Object.keys(storedResource.data.relationships || {}).includes(s)).map((key) => {
|
|
965
982
|
let { data } = storedResource.data.relationships[key];
|
|
966
983
|
data = Array.isArray(data) ? data : [data];
|
|
967
|
-
const include = queryObject.include
|
|
984
|
+
const include = subIncludes(queryObject.include, key);
|
|
968
985
|
return data.filter((o) => typeof o === "object" && o).map((o) => {
|
|
969
986
|
return dispatch("getResource", {
|
|
970
987
|
id: o.id,
|
|
971
988
|
prefix,
|
|
972
989
|
type: o.type,
|
|
973
|
-
query: { ...queryObject, include }
|
|
990
|
+
query: { ...queryObject, include: includeFor(o, include) }
|
|
974
991
|
});
|
|
975
992
|
});
|
|
976
993
|
}).flat());
|
package/dist/druxt.ssr.js
CHANGED
|
@@ -566,7 +566,7 @@ const cacheClearHandler = (secret) => (req, res) => {
|
|
|
566
566
|
};
|
|
567
567
|
|
|
568
568
|
var name = "druxt";
|
|
569
|
-
var version = "0.25.0-dev.
|
|
569
|
+
var version = "0.25.0-dev.20261023021249";
|
|
570
570
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
571
571
|
var keywords = [
|
|
572
572
|
"cms",
|
|
@@ -627,7 +627,7 @@ var dependencies = {
|
|
|
627
627
|
};
|
|
628
628
|
var devDependencies = {
|
|
629
629
|
"@storybook/addon-docs": "^6.5.16",
|
|
630
|
-
"druxt-test-utils": "0.2.16-dev.
|
|
630
|
+
"druxt-test-utils": "0.2.16-dev.20261023021249"
|
|
631
631
|
};
|
|
632
632
|
var peerDependencies = {
|
|
633
633
|
axios: ">=0.34.0",
|
|
@@ -795,6 +795,20 @@ const getDrupalJsonApiParams = (query) => {
|
|
|
795
795
|
return new drupalJsonapiParams.DrupalJsonApiParams().initialize(query);
|
|
796
796
|
};
|
|
797
797
|
|
|
798
|
+
const includePaths = (include) => (Array.isArray(include) ? include : String(include || "").split(",")).map((path) => String(path).trim()).filter((path) => path);
|
|
799
|
+
const topIncludes = (include) => Array.from(new Set(includePaths(include).map((path) => path.split(".")[0])));
|
|
800
|
+
const subIncludes = (include, key) => includePaths(include).filter((path) => path.startsWith(`${key}.`)).map((path) => path.slice(key.length + 1)).join(",");
|
|
801
|
+
const fieldsWithIncludes = (fields, include) => Array.from(new Set([...String(fields).split(","), ...topIncludes(include)])).filter((field) => field).join(",");
|
|
802
|
+
const includesFor = (include, fields, relationships = []) => {
|
|
803
|
+
if (!include || typeof fields !== "string")
|
|
804
|
+
return include;
|
|
805
|
+
const listed = fields.split(",");
|
|
806
|
+
return includePaths(include).filter((path) => {
|
|
807
|
+
const key = path.split(".")[0];
|
|
808
|
+
return listed.includes(key) || relationships.includes(key);
|
|
809
|
+
}).join(",");
|
|
810
|
+
};
|
|
811
|
+
|
|
798
812
|
const dehydrateResources = ({ commit, queryObject, resources, prefix }) => {
|
|
799
813
|
return (resources || []).map((data) => {
|
|
800
814
|
const link = decodeURI(((data.links || {}).self || {}).href || "");
|
|
@@ -968,22 +982,25 @@ const DruxtStore = ({ store }) => {
|
|
|
968
982
|
const queryObject = getDrupalJsonApiParams(query).getQueryObject();
|
|
969
983
|
queryObject.include = Array.isArray(queryObject.include) ? queryObject.include.join(",") : queryObject.include;
|
|
970
984
|
if (queryObject.include && typeof (queryObject.fields || {})[type] === "string") {
|
|
971
|
-
|
|
972
|
-
const includes = queryObject.include.split(",").filter((s) => s && !s.includes("."));
|
|
973
|
-
queryObject.fields[type] = Array.from(new Set([...fields2, ...includes])).filter((s) => s).join(",");
|
|
985
|
+
queryObject.fields[type] = fieldsWithIncludes(queryObject.fields[type], queryObject.include);
|
|
974
986
|
}
|
|
987
|
+
const includeFor = (related, include) => {
|
|
988
|
+
const stored2 = ((state.resources[related.type] || {})[related.id] || {})[prefix];
|
|
989
|
+
const relationships = Object.keys(((stored2 || {}).data || {}).relationships || {});
|
|
990
|
+
return includesFor(include, (queryObject.fields || {})[related.type], relationships);
|
|
991
|
+
};
|
|
975
992
|
let included = [];
|
|
976
993
|
if (queryObject.include && storedResource && !bypassCache) {
|
|
977
|
-
const resources = await Promise.all(queryObject.include
|
|
994
|
+
const resources = await Promise.all(topIncludes(queryObject.include).filter((s) => Object.keys(storedResource.data.relationships || {}).includes(s)).map((key) => {
|
|
978
995
|
let { data } = storedResource.data.relationships[key];
|
|
979
996
|
data = Array.isArray(data) ? data : [data];
|
|
980
|
-
const include = queryObject.include
|
|
997
|
+
const include = subIncludes(queryObject.include, key);
|
|
981
998
|
return data.filter((o) => typeof o === "object" && o).map((o) => {
|
|
982
999
|
return dispatch("getResource", {
|
|
983
1000
|
id: o.id,
|
|
984
1001
|
prefix,
|
|
985
1002
|
type: o.type,
|
|
986
|
-
query: { ...queryObject, include }
|
|
1003
|
+
query: { ...queryObject, include: includeFor(o, include) }
|
|
987
1004
|
});
|
|
988
1005
|
});
|
|
989
1006
|
}).flat());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt",
|
|
3
|
-
"version": "0.25.0-dev.
|
|
3
|
+
"version": "0.25.0-dev.20261023021249",
|
|
4
4
|
"description": "The Fully Decoupled Drupal Framework for Nuxt.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@storybook/addon-docs": "^6.5.16",
|
|
64
|
-
"druxt-test-utils": "0.2.16-dev.
|
|
64
|
+
"druxt-test-utils": "0.2.16-dev.20261023021249"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"axios": ">=0.34.0",
|