@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 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((value) => ({
893
- content: parseStringContent(value),
894
- type: value.type,
895
- category: value.category !== "value" ? value.category ?? null : null,
896
- uuid: value.uuid ?? null,
897
- publicationDateTime: value.publicationDateTime != null ? new Date(value.publicationDateTime) : null
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((value) => ({
816
- content: parseStringContent(value),
817
- type: value.type,
818
- category: value.category !== "value" ? value.category ?? null : null,
819
- uuid: value.uuid ?? null,
820
- publicationDateTime: value.publicationDateTime != null ? new Date(value.publicationDateTime) : null
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",