@digitalculture/ochre-sdk 0.2.4 → 0.2.5
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/index.cjs +15 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -889,13 +889,21 @@ function parseProperties(properties, language = "eng") {
|
|
|
889
889
|
const returnProperties = [];
|
|
890
890
|
for (const property of properties) {
|
|
891
891
|
const valuesToParse = "value" in property && property.value ? Array.isArray(property.value) ? property.value : [property.value] : [];
|
|
892
|
-
const values = valuesToParse.map(
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
892
|
+
const values = valuesToParse.map(
|
|
893
|
+
(value) => !["string", "number", "boolean"].includes(typeof value) && typeof value === "object" && "uuid" in value ? {
|
|
894
|
+
content: parseStringContent(value),
|
|
895
|
+
type: value.type,
|
|
896
|
+
category: value.category !== "value" ? value.category ?? null : null,
|
|
897
|
+
uuid: value.uuid ?? null,
|
|
898
|
+
publicationDateTime: value.publicationDateTime != null ? new Date(value.publicationDateTime) : null
|
|
899
|
+
} : {
|
|
900
|
+
content: parseFakeString(value),
|
|
901
|
+
type: "string",
|
|
902
|
+
category: "value",
|
|
903
|
+
uuid: null,
|
|
904
|
+
publicationDateTime: null
|
|
905
|
+
}
|
|
906
|
+
);
|
|
899
907
|
returnProperties.push({
|
|
900
908
|
label: parseStringContent(property.label, language).replace(/\s*\.{3}$/, "").trim(),
|
|
901
909
|
values,
|
package/dist/index.d.cts
CHANGED
|
@@ -909,7 +909,7 @@ type OchrePropertyValue = OchreStringContent & {
|
|
|
909
909
|
*/
|
|
910
910
|
type OchreProperty = {
|
|
911
911
|
label: OchreStringContent & { uuid: string };
|
|
912
|
-
value?: OchrePropertyValue | Array<OchrePropertyValue
|
|
912
|
+
value?: OchrePropertyValue | Array<OchrePropertyValue> | FakeString;
|
|
913
913
|
comment?: FakeString;
|
|
914
914
|
property?: OchreProperty | Array<OchreProperty>;
|
|
915
915
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -909,7 +909,7 @@ type OchrePropertyValue = OchreStringContent & {
|
|
|
909
909
|
*/
|
|
910
910
|
type OchreProperty = {
|
|
911
911
|
label: OchreStringContent & { uuid: string };
|
|
912
|
-
value?: OchrePropertyValue | Array<OchrePropertyValue
|
|
912
|
+
value?: OchrePropertyValue | Array<OchrePropertyValue> | FakeString;
|
|
913
913
|
comment?: FakeString;
|
|
914
914
|
property?: OchreProperty | Array<OchreProperty>;
|
|
915
915
|
};
|
package/dist/index.js
CHANGED
|
@@ -812,13 +812,21 @@ function parseProperties(properties, language = "eng") {
|
|
|
812
812
|
const returnProperties = [];
|
|
813
813
|
for (const property of properties) {
|
|
814
814
|
const valuesToParse = "value" in property && property.value ? Array.isArray(property.value) ? property.value : [property.value] : [];
|
|
815
|
-
const values = valuesToParse.map(
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
815
|
+
const values = valuesToParse.map(
|
|
816
|
+
(value) => !["string", "number", "boolean"].includes(typeof value) && typeof value === "object" && "uuid" in value ? {
|
|
817
|
+
content: parseStringContent(value),
|
|
818
|
+
type: value.type,
|
|
819
|
+
category: value.category !== "value" ? value.category ?? null : null,
|
|
820
|
+
uuid: value.uuid ?? null,
|
|
821
|
+
publicationDateTime: value.publicationDateTime != null ? new Date(value.publicationDateTime) : null
|
|
822
|
+
} : {
|
|
823
|
+
content: parseFakeString(value),
|
|
824
|
+
type: "string",
|
|
825
|
+
category: "value",
|
|
826
|
+
uuid: null,
|
|
827
|
+
publicationDateTime: null
|
|
828
|
+
}
|
|
829
|
+
);
|
|
822
830
|
returnProperties.push({
|
|
823
831
|
label: parseStringContent(property.label, language).replace(/\s*\.{3}$/, "").trim(),
|
|
824
832
|
values,
|
package/package.json
CHANGED