@localazy/strapi-plugin 1.0.3 → 1.0.4
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/server/index.js
CHANGED
|
@@ -811,7 +811,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
811
811
|
baseMerge(object, source, srcIndex);
|
|
812
812
|
});
|
|
813
813
|
const name = "@localazy/strapi-plugin";
|
|
814
|
-
const version$1 = "1.0.
|
|
814
|
+
const version$1 = "1.0.4";
|
|
815
815
|
const description = "The official Strapi Plugin by Localazy.";
|
|
816
816
|
const keywords = [
|
|
817
817
|
"strapi",
|
|
@@ -885,7 +885,7 @@ const dependencies = {
|
|
|
885
885
|
const devDependencies = {
|
|
886
886
|
"@david-vaclavek/deep-keys": "^0.5.0",
|
|
887
887
|
"@localazy/api-client": "^2.1.6",
|
|
888
|
-
"@localazy/conventional-changelog-preset": "^1.2.
|
|
888
|
+
"@localazy/conventional-changelog-preset": "^1.2.12",
|
|
889
889
|
"@localazy/generic-connector-client": "^0.3.0",
|
|
890
890
|
"@strapi/design-system": "^2.0.0-rc.14",
|
|
891
891
|
"@strapi/icons": "^2.0.0-rc.14",
|
|
@@ -26005,21 +26005,48 @@ const parsedLocalazyEntryToUpdateEntry = async (allModels, localazyEntry, fullyP
|
|
|
26005
26005
|
);
|
|
26006
26006
|
return populatedEntry;
|
|
26007
26007
|
};
|
|
26008
|
-
const
|
|
26008
|
+
const isMediaObject = (obj) => {
|
|
26009
|
+
if (typeof obj !== "object" || obj === null) return false;
|
|
26010
|
+
return "url" in obj && "name" in obj && "ext" in obj && ("mime" in obj || "mimeType" in obj) && typeof obj.url === "string" && typeof obj.name === "string" && typeof obj.ext === "string";
|
|
26011
|
+
};
|
|
26012
|
+
const dropPropertyDeepWithSkip = (obj, propertyName, isRoot = true, skipPredicates = []) => {
|
|
26009
26013
|
if (Array.isArray(obj)) {
|
|
26010
|
-
return obj.filter((item) =>
|
|
26014
|
+
return obj.filter((item) => {
|
|
26015
|
+
if (skipPredicates.length > 0) {
|
|
26016
|
+
return true;
|
|
26017
|
+
}
|
|
26018
|
+
return isRoot || !(typeof item === "object" && item !== null && propertyName in item);
|
|
26019
|
+
}).map(
|
|
26020
|
+
(item) => typeof item === "object" && item !== null ? dropPropertyDeepWithSkip(item, propertyName, false, skipPredicates) : item
|
|
26021
|
+
);
|
|
26011
26022
|
}
|
|
26012
26023
|
if (typeof obj === "object" && obj !== null) {
|
|
26024
|
+
const shouldSkip = skipPredicates.some((predicate) => predicate(obj));
|
|
26025
|
+
if (shouldSkip) {
|
|
26026
|
+
const result2 = {};
|
|
26027
|
+
for (const key in obj) {
|
|
26028
|
+
if (key === propertyName) {
|
|
26029
|
+
result2[key] = obj[key];
|
|
26030
|
+
} else {
|
|
26031
|
+
result2[key] = typeof obj[key] === "object" && obj[key] !== null ? dropPropertyDeepWithSkip(obj[key], propertyName, false, skipPredicates) : obj[key];
|
|
26032
|
+
}
|
|
26033
|
+
}
|
|
26034
|
+
return result2;
|
|
26035
|
+
}
|
|
26013
26036
|
const result = {};
|
|
26014
26037
|
for (const key in obj) {
|
|
26015
|
-
if (
|
|
26016
|
-
|
|
26038
|
+
if (key === propertyName && !isRoot) {
|
|
26039
|
+
continue;
|
|
26017
26040
|
}
|
|
26041
|
+
result[key] = typeof obj[key] === "object" && obj[key] !== null ? dropPropertyDeepWithSkip(obj[key], propertyName, false, skipPredicates) : obj[key];
|
|
26018
26042
|
}
|
|
26019
26043
|
return result;
|
|
26020
26044
|
}
|
|
26021
26045
|
return obj;
|
|
26022
26046
|
};
|
|
26047
|
+
const dropDocumentIdExceptMedia = (obj) => {
|
|
26048
|
+
return dropPropertyDeepWithSkip(obj, "documentId", true, [isMediaObject]);
|
|
26049
|
+
};
|
|
26023
26050
|
const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
26024
26051
|
async createEntry(uid, strapiContentTypesModels, translatedModel, baseEntry, isoStrapi) {
|
|
26025
26052
|
const StrapiI18nService2 = getStrapiI18nService();
|
|
@@ -26032,7 +26059,7 @@ const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
|
26032
26059
|
);
|
|
26033
26060
|
const omitKeys = ["locale", "localizations", "createdAt", "createdBy", "updatedAt", "updatedBy", "publishedAt"];
|
|
26034
26061
|
let filteredBaseEntry = omitDeep(baseEntry, omitKeys);
|
|
26035
|
-
filteredBaseEntry =
|
|
26062
|
+
filteredBaseEntry = dropDocumentIdExceptMedia(filteredBaseEntry);
|
|
26036
26063
|
let mergedCreateEntry = {};
|
|
26037
26064
|
merge(mergedCreateEntry, filteredBaseEntry, createEntry);
|
|
26038
26065
|
mergedCreateEntry = omitDeep(mergedCreateEntry, omitKeys);
|
package/dist/server/index.mjs
CHANGED
|
@@ -798,7 +798,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
798
798
|
baseMerge(object, source, srcIndex);
|
|
799
799
|
});
|
|
800
800
|
const name = "@localazy/strapi-plugin";
|
|
801
|
-
const version$1 = "1.0.
|
|
801
|
+
const version$1 = "1.0.4";
|
|
802
802
|
const description = "The official Strapi Plugin by Localazy.";
|
|
803
803
|
const keywords = [
|
|
804
804
|
"strapi",
|
|
@@ -872,7 +872,7 @@ const dependencies = {
|
|
|
872
872
|
const devDependencies = {
|
|
873
873
|
"@david-vaclavek/deep-keys": "^0.5.0",
|
|
874
874
|
"@localazy/api-client": "^2.1.6",
|
|
875
|
-
"@localazy/conventional-changelog-preset": "^1.2.
|
|
875
|
+
"@localazy/conventional-changelog-preset": "^1.2.12",
|
|
876
876
|
"@localazy/generic-connector-client": "^0.3.0",
|
|
877
877
|
"@strapi/design-system": "^2.0.0-rc.14",
|
|
878
878
|
"@strapi/icons": "^2.0.0-rc.14",
|
|
@@ -25992,21 +25992,48 @@ const parsedLocalazyEntryToUpdateEntry = async (allModels, localazyEntry, fullyP
|
|
|
25992
25992
|
);
|
|
25993
25993
|
return populatedEntry;
|
|
25994
25994
|
};
|
|
25995
|
-
const
|
|
25995
|
+
const isMediaObject = (obj) => {
|
|
25996
|
+
if (typeof obj !== "object" || obj === null) return false;
|
|
25997
|
+
return "url" in obj && "name" in obj && "ext" in obj && ("mime" in obj || "mimeType" in obj) && typeof obj.url === "string" && typeof obj.name === "string" && typeof obj.ext === "string";
|
|
25998
|
+
};
|
|
25999
|
+
const dropPropertyDeepWithSkip = (obj, propertyName, isRoot = true, skipPredicates = []) => {
|
|
25996
26000
|
if (Array.isArray(obj)) {
|
|
25997
|
-
return obj.filter((item) =>
|
|
26001
|
+
return obj.filter((item) => {
|
|
26002
|
+
if (skipPredicates.length > 0) {
|
|
26003
|
+
return true;
|
|
26004
|
+
}
|
|
26005
|
+
return isRoot || !(typeof item === "object" && item !== null && propertyName in item);
|
|
26006
|
+
}).map(
|
|
26007
|
+
(item) => typeof item === "object" && item !== null ? dropPropertyDeepWithSkip(item, propertyName, false, skipPredicates) : item
|
|
26008
|
+
);
|
|
25998
26009
|
}
|
|
25999
26010
|
if (typeof obj === "object" && obj !== null) {
|
|
26011
|
+
const shouldSkip = skipPredicates.some((predicate) => predicate(obj));
|
|
26012
|
+
if (shouldSkip) {
|
|
26013
|
+
const result2 = {};
|
|
26014
|
+
for (const key in obj) {
|
|
26015
|
+
if (key === propertyName) {
|
|
26016
|
+
result2[key] = obj[key];
|
|
26017
|
+
} else {
|
|
26018
|
+
result2[key] = typeof obj[key] === "object" && obj[key] !== null ? dropPropertyDeepWithSkip(obj[key], propertyName, false, skipPredicates) : obj[key];
|
|
26019
|
+
}
|
|
26020
|
+
}
|
|
26021
|
+
return result2;
|
|
26022
|
+
}
|
|
26000
26023
|
const result = {};
|
|
26001
26024
|
for (const key in obj) {
|
|
26002
|
-
if (
|
|
26003
|
-
|
|
26025
|
+
if (key === propertyName && !isRoot) {
|
|
26026
|
+
continue;
|
|
26004
26027
|
}
|
|
26028
|
+
result[key] = typeof obj[key] === "object" && obj[key] !== null ? dropPropertyDeepWithSkip(obj[key], propertyName, false, skipPredicates) : obj[key];
|
|
26005
26029
|
}
|
|
26006
26030
|
return result;
|
|
26007
26031
|
}
|
|
26008
26032
|
return obj;
|
|
26009
26033
|
};
|
|
26034
|
+
const dropDocumentIdExceptMedia = (obj) => {
|
|
26035
|
+
return dropPropertyDeepWithSkip(obj, "documentId", true, [isMediaObject]);
|
|
26036
|
+
};
|
|
26010
26037
|
const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
26011
26038
|
async createEntry(uid, strapiContentTypesModels, translatedModel, baseEntry, isoStrapi) {
|
|
26012
26039
|
const StrapiI18nService2 = getStrapiI18nService();
|
|
@@ -26019,7 +26046,7 @@ const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
|
26019
26046
|
);
|
|
26020
26047
|
const omitKeys = ["locale", "localizations", "createdAt", "createdBy", "updatedAt", "updatedBy", "publishedAt"];
|
|
26021
26048
|
let filteredBaseEntry = omitDeep(baseEntry, omitKeys);
|
|
26022
|
-
filteredBaseEntry =
|
|
26049
|
+
filteredBaseEntry = dropDocumentIdExceptMedia(filteredBaseEntry);
|
|
26023
26050
|
let mergedCreateEntry = {};
|
|
26024
26051
|
merge(mergedCreateEntry, filteredBaseEntry, createEntry);
|
|
26025
26052
|
mergedCreateEntry = omitDeep(mergedCreateEntry, omitKeys);
|
|
@@ -1 +1,3 @@
|
|
|
1
1
|
export declare const dropPropertyDeep: (obj: any, propertyName: string, isRoot?: boolean) => any;
|
|
2
|
+
export declare const dropPropertyDeepWithSkip: (obj: any, propertyName: string, isRoot?: boolean, skipPredicates?: ((obj: any) => boolean)[]) => any;
|
|
3
|
+
export declare const dropDocumentIdExceptMedia: (obj: any) => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localazy/strapi-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "The official Strapi Plugin by Localazy.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@david-vaclavek/deep-keys": "^0.5.0",
|
|
82
82
|
"@localazy/api-client": "^2.1.6",
|
|
83
|
-
"@localazy/conventional-changelog-preset": "^1.2.
|
|
83
|
+
"@localazy/conventional-changelog-preset": "^1.2.12",
|
|
84
84
|
"@localazy/generic-connector-client": "^0.3.0",
|
|
85
85
|
"@strapi/design-system": "^2.0.0-rc.14",
|
|
86
86
|
"@strapi/icons": "^2.0.0-rc.14",
|