@digitalculture/ochre-sdk 0.2.3 → 0.2.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/index.cjs +13 -5
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +13 -5
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -331,7 +331,11 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
331
331
|
}
|
|
332
332
|
} else if ("person" in link) {
|
|
333
333
|
const linkPerson = Array.isArray(link.person) ? link.person[0] : link.person;
|
|
334
|
-
const linkContent = linkPerson.identification ?
|
|
334
|
+
const linkContent = linkPerson.identification ? ["string", "number", "boolean"].includes(
|
|
335
|
+
typeof linkPerson.identification.label
|
|
336
|
+
) ? parseFakeString(linkPerson.identification.label) : parseStringContent(
|
|
337
|
+
linkPerson.identification.label
|
|
338
|
+
) : null;
|
|
335
339
|
if (linkPerson.publicationDateTime != null) {
|
|
336
340
|
return `<ExternalLink href="https:\\/\\/ochre.lib.uchicago.edu/ochre?uuid=${linkPerson.uuid}" type="${linkPerson.type ?? "person"}" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</ExternalLink>`;
|
|
337
341
|
} else {
|
|
@@ -602,7 +606,7 @@ var componentSchema = import_zod3.z.enum(
|
|
|
602
606
|
function parseIdentification(identification) {
|
|
603
607
|
try {
|
|
604
608
|
const returnIdentification = {
|
|
605
|
-
label: parseStringContent(identification.label),
|
|
609
|
+
label: ["string", "number", "boolean"].includes(typeof identification.label) ? parseFakeString(identification.label) : parseStringContent(identification.label),
|
|
606
610
|
abbreviation: ""
|
|
607
611
|
};
|
|
608
612
|
for (const key of Object.keys(identification).filter(
|
|
@@ -1127,7 +1131,7 @@ function parseSet(set) {
|
|
|
1127
1131
|
license: parseLicense(set.availability),
|
|
1128
1132
|
identification: parseIdentification(set.identification),
|
|
1129
1133
|
isSuppressingBlanks: set.suppressBlanks ?? false,
|
|
1130
|
-
description: set.description ? parseStringContent(set.description) : "",
|
|
1134
|
+
description: set.description ? ["string", "number", "boolean"].includes(typeof set.description) ? parseFakeString(set.description) : parseStringContent(set.description) : "",
|
|
1131
1135
|
creators: set.creators ? parsePersons(
|
|
1132
1136
|
Array.isArray(set.creators.creator) ? set.creators.creator : [set.creators.creator]
|
|
1133
1137
|
) : [],
|
|
@@ -1223,7 +1227,9 @@ function parseSpatialUnit(spatialUnit, isNested = false) {
|
|
|
1223
1227
|
license: "availability" in spatialUnit && spatialUnit.availability ? parseLicense(spatialUnit.availability) : null,
|
|
1224
1228
|
identification: parseIdentification(spatialUnit.identification),
|
|
1225
1229
|
image: spatialUnit.image ? parseImage(spatialUnit.image) : null,
|
|
1226
|
-
description: spatialUnit.description ?
|
|
1230
|
+
description: spatialUnit.description ? ["string", "number", "boolean"].includes(
|
|
1231
|
+
typeof spatialUnit.description
|
|
1232
|
+
) ? parseFakeString(spatialUnit.description) : parseStringContent(spatialUnit.description) : "",
|
|
1227
1233
|
coordinates: spatialUnit.coordinates ? parseCoordinates(spatialUnit.coordinates) : null,
|
|
1228
1234
|
observations: "observations" in spatialUnit && spatialUnit.observations ? parseObservations(
|
|
1229
1235
|
Array.isArray(spatialUnit.observations.observation) ? spatialUnit.observations.observation : [spatialUnit.observations.observation]
|
|
@@ -1419,7 +1425,9 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1419
1425
|
}
|
|
1420
1426
|
properties.href = href;
|
|
1421
1427
|
properties.isExternal = isExternal;
|
|
1422
|
-
properties.label =
|
|
1428
|
+
properties.label = ["string", "number", "boolean"].includes(
|
|
1429
|
+
typeof elementResource.identification.label
|
|
1430
|
+
) ? parseFakeString(elementResource.identification.label) : parseStringContent(
|
|
1423
1431
|
elementResource.identification.label
|
|
1424
1432
|
);
|
|
1425
1433
|
break;
|
package/dist/index.d.cts
CHANGED
|
@@ -792,7 +792,7 @@ type OchreSet = {
|
|
|
792
792
|
identification: OchreIdentification;
|
|
793
793
|
date?: string; // YYYY-MM-DD
|
|
794
794
|
suppressBlanks?: boolean;
|
|
795
|
-
description?: OchreStringContent;
|
|
795
|
+
description?: OchreStringContent | FakeString;
|
|
796
796
|
creators?: { creator: OchrePerson | Array<OchrePerson> };
|
|
797
797
|
items:
|
|
798
798
|
| string
|
|
@@ -857,7 +857,7 @@ type OchreSpatialUnit = {
|
|
|
857
857
|
context?: OchreContext;
|
|
858
858
|
identification: OchreIdentification;
|
|
859
859
|
image?: OchreImage;
|
|
860
|
-
description?: OchreStringContent;
|
|
860
|
+
description?: OchreStringContent | FakeString;
|
|
861
861
|
coordinates?: OchreCoordinates;
|
|
862
862
|
events?: { event: OchreEvent | Array<OchreEvent> };
|
|
863
863
|
observations?: { observation: OchreObservation | Array<OchreObservation> };
|
|
@@ -918,8 +918,8 @@ type OchreProperty = {
|
|
|
918
918
|
* Raw identification structure corresponding to the parsed Identification type
|
|
919
919
|
*/
|
|
920
920
|
type OchreIdentification = {
|
|
921
|
-
label: OchreStringContent;
|
|
922
|
-
abbreviation?: OchreStringContent;
|
|
921
|
+
label: OchreStringContent | FakeString;
|
|
922
|
+
abbreviation?: OchreStringContent | FakeString;
|
|
923
923
|
MIMEType?: string;
|
|
924
924
|
widthPreview?: number;
|
|
925
925
|
heightPreview?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -792,7 +792,7 @@ type OchreSet = {
|
|
|
792
792
|
identification: OchreIdentification;
|
|
793
793
|
date?: string; // YYYY-MM-DD
|
|
794
794
|
suppressBlanks?: boolean;
|
|
795
|
-
description?: OchreStringContent;
|
|
795
|
+
description?: OchreStringContent | FakeString;
|
|
796
796
|
creators?: { creator: OchrePerson | Array<OchrePerson> };
|
|
797
797
|
items:
|
|
798
798
|
| string
|
|
@@ -857,7 +857,7 @@ type OchreSpatialUnit = {
|
|
|
857
857
|
context?: OchreContext;
|
|
858
858
|
identification: OchreIdentification;
|
|
859
859
|
image?: OchreImage;
|
|
860
|
-
description?: OchreStringContent;
|
|
860
|
+
description?: OchreStringContent | FakeString;
|
|
861
861
|
coordinates?: OchreCoordinates;
|
|
862
862
|
events?: { event: OchreEvent | Array<OchreEvent> };
|
|
863
863
|
observations?: { observation: OchreObservation | Array<OchreObservation> };
|
|
@@ -918,8 +918,8 @@ type OchreProperty = {
|
|
|
918
918
|
* Raw identification structure corresponding to the parsed Identification type
|
|
919
919
|
*/
|
|
920
920
|
type OchreIdentification = {
|
|
921
|
-
label: OchreStringContent;
|
|
922
|
-
abbreviation?: OchreStringContent;
|
|
921
|
+
label: OchreStringContent | FakeString;
|
|
922
|
+
abbreviation?: OchreStringContent | FakeString;
|
|
923
923
|
MIMEType?: string;
|
|
924
924
|
widthPreview?: number;
|
|
925
925
|
heightPreview?: number;
|
package/dist/index.js
CHANGED
|
@@ -254,7 +254,11 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
254
254
|
}
|
|
255
255
|
} else if ("person" in link) {
|
|
256
256
|
const linkPerson = Array.isArray(link.person) ? link.person[0] : link.person;
|
|
257
|
-
const linkContent = linkPerson.identification ?
|
|
257
|
+
const linkContent = linkPerson.identification ? ["string", "number", "boolean"].includes(
|
|
258
|
+
typeof linkPerson.identification.label
|
|
259
|
+
) ? parseFakeString(linkPerson.identification.label) : parseStringContent(
|
|
260
|
+
linkPerson.identification.label
|
|
261
|
+
) : null;
|
|
258
262
|
if (linkPerson.publicationDateTime != null) {
|
|
259
263
|
return `<ExternalLink href="https:\\/\\/ochre.lib.uchicago.edu/ochre?uuid=${linkPerson.uuid}" type="${linkPerson.type ?? "person"}" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</ExternalLink>`;
|
|
260
264
|
} else {
|
|
@@ -525,7 +529,7 @@ var componentSchema = z3.enum(
|
|
|
525
529
|
function parseIdentification(identification) {
|
|
526
530
|
try {
|
|
527
531
|
const returnIdentification = {
|
|
528
|
-
label: parseStringContent(identification.label),
|
|
532
|
+
label: ["string", "number", "boolean"].includes(typeof identification.label) ? parseFakeString(identification.label) : parseStringContent(identification.label),
|
|
529
533
|
abbreviation: ""
|
|
530
534
|
};
|
|
531
535
|
for (const key of Object.keys(identification).filter(
|
|
@@ -1050,7 +1054,7 @@ function parseSet(set) {
|
|
|
1050
1054
|
license: parseLicense(set.availability),
|
|
1051
1055
|
identification: parseIdentification(set.identification),
|
|
1052
1056
|
isSuppressingBlanks: set.suppressBlanks ?? false,
|
|
1053
|
-
description: set.description ? parseStringContent(set.description) : "",
|
|
1057
|
+
description: set.description ? ["string", "number", "boolean"].includes(typeof set.description) ? parseFakeString(set.description) : parseStringContent(set.description) : "",
|
|
1054
1058
|
creators: set.creators ? parsePersons(
|
|
1055
1059
|
Array.isArray(set.creators.creator) ? set.creators.creator : [set.creators.creator]
|
|
1056
1060
|
) : [],
|
|
@@ -1146,7 +1150,9 @@ function parseSpatialUnit(spatialUnit, isNested = false) {
|
|
|
1146
1150
|
license: "availability" in spatialUnit && spatialUnit.availability ? parseLicense(spatialUnit.availability) : null,
|
|
1147
1151
|
identification: parseIdentification(spatialUnit.identification),
|
|
1148
1152
|
image: spatialUnit.image ? parseImage(spatialUnit.image) : null,
|
|
1149
|
-
description: spatialUnit.description ?
|
|
1153
|
+
description: spatialUnit.description ? ["string", "number", "boolean"].includes(
|
|
1154
|
+
typeof spatialUnit.description
|
|
1155
|
+
) ? parseFakeString(spatialUnit.description) : parseStringContent(spatialUnit.description) : "",
|
|
1150
1156
|
coordinates: spatialUnit.coordinates ? parseCoordinates(spatialUnit.coordinates) : null,
|
|
1151
1157
|
observations: "observations" in spatialUnit && spatialUnit.observations ? parseObservations(
|
|
1152
1158
|
Array.isArray(spatialUnit.observations.observation) ? spatialUnit.observations.observation : [spatialUnit.observations.observation]
|
|
@@ -1342,7 +1348,9 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1342
1348
|
}
|
|
1343
1349
|
properties.href = href;
|
|
1344
1350
|
properties.isExternal = isExternal;
|
|
1345
|
-
properties.label =
|
|
1351
|
+
properties.label = ["string", "number", "boolean"].includes(
|
|
1352
|
+
typeof elementResource.identification.label
|
|
1353
|
+
) ? parseFakeString(elementResource.identification.label) : parseStringContent(
|
|
1346
1354
|
elementResource.identification.label
|
|
1347
1355
|
);
|
|
1348
1356
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalculture/ochre-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
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",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@changesets/cli": "^2.27.12",
|
|
50
50
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
51
51
|
"@types/node": "^22.13.1",
|
|
52
|
+
"eslint": "^9.19.0",
|
|
52
53
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
53
54
|
"prettier": "^3.4.2",
|
|
54
55
|
"tsup": "^8.3.6",
|