ochre-sdk 0.19.13 → 0.19.15
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.d.mts +4 -0
- package/dist/index.mjs +18 -21
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -37,6 +37,7 @@ type Identification = {
|
|
|
37
37
|
*/
|
|
38
38
|
type Metadata = {
|
|
39
39
|
project: {
|
|
40
|
+
uuid: string;
|
|
40
41
|
identification: Identification & {
|
|
41
42
|
website: string | null;
|
|
42
43
|
};
|
|
@@ -44,10 +45,12 @@ type Metadata = {
|
|
|
44
45
|
page: "item" | "entry" | null;
|
|
45
46
|
} | null;
|
|
46
47
|
collection: {
|
|
48
|
+
uuid: string;
|
|
47
49
|
identification: Identification;
|
|
48
50
|
page: "item" | "entry";
|
|
49
51
|
} | null;
|
|
50
52
|
publication: {
|
|
53
|
+
uuid: string;
|
|
51
54
|
identification: Identification;
|
|
52
55
|
page: "item" | "entry";
|
|
53
56
|
} | null;
|
|
@@ -387,6 +390,7 @@ type Concept = {
|
|
|
387
390
|
license: License | null;
|
|
388
391
|
context: Context | null;
|
|
389
392
|
identification: Identification;
|
|
393
|
+
status: "live" | "pending";
|
|
390
394
|
image: Image | null;
|
|
391
395
|
description: string | null;
|
|
392
396
|
coordinates: Array<Coordinate>;
|
package/dist/index.mjs
CHANGED
|
@@ -593,24 +593,23 @@ function flattenItemProperties(item) {
|
|
|
593
593
|
* @internal
|
|
594
594
|
*/
|
|
595
595
|
const uuidSchema = z.string().refine(isPseudoUuid, { error: "Invalid pseudo-UUID" });
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
596
|
+
const fakeStringSchema = z.union([
|
|
597
|
+
z.string(),
|
|
598
|
+
z.number(),
|
|
599
|
+
z.boolean()
|
|
600
|
+
]);
|
|
601
|
+
const richTextStringContentSchema = z.union([fakeStringSchema, z.object({
|
|
602
|
+
content: fakeStringSchema.optional(),
|
|
602
603
|
rend: z.string().optional(),
|
|
603
604
|
whitespace: z.string().optional()
|
|
604
|
-
});
|
|
605
|
+
})]);
|
|
605
606
|
/**
|
|
606
607
|
* Schema for validating rich text string content
|
|
607
608
|
* @internal
|
|
608
609
|
*/
|
|
609
610
|
const richTextStringSchema = z.object({
|
|
610
611
|
string: z.union([
|
|
611
|
-
|
|
612
|
-
z.number(),
|
|
613
|
-
z.boolean(),
|
|
612
|
+
fakeStringSchema,
|
|
614
613
|
richTextStringContentSchema,
|
|
615
614
|
z.array(richTextStringContentSchema)
|
|
616
615
|
]),
|
|
@@ -847,21 +846,24 @@ function parseMetadata(metadata) {
|
|
|
847
846
|
code: metadata.item.identification.code ?? null
|
|
848
847
|
};
|
|
849
848
|
else identification = parseIdentification(metadata.item.identification);
|
|
850
|
-
const
|
|
849
|
+
const projectIdentification = metadata.project?.identification ? parseIdentification(metadata.project.identification) : null;
|
|
851
850
|
return {
|
|
852
|
-
project:
|
|
851
|
+
project: projectIdentification ? {
|
|
852
|
+
uuid: metadata.project?.uuid ?? "",
|
|
853
853
|
identification: {
|
|
854
|
-
...
|
|
854
|
+
...projectIdentification,
|
|
855
855
|
website: metadata.project?.identification.website ?? null
|
|
856
856
|
},
|
|
857
857
|
dateFormat: metadata.project?.dateFormat ?? null,
|
|
858
858
|
page: metadata.project?.page ?? null
|
|
859
859
|
} : null,
|
|
860
860
|
collection: metadata.collection ? {
|
|
861
|
+
uuid: metadata.collection.uuid,
|
|
861
862
|
identification: parseIdentification(metadata.collection.identification),
|
|
862
863
|
page: metadata.collection.page
|
|
863
864
|
} : null,
|
|
864
865
|
publication: metadata.publication ? {
|
|
866
|
+
uuid: metadata.publication.uuid,
|
|
865
867
|
identification: parseIdentification(metadata.publication.identification),
|
|
866
868
|
page: metadata.publication.page
|
|
867
869
|
} : null,
|
|
@@ -1840,6 +1842,7 @@ function parseConcept(concept, metadata, persistentUrl, belongsTo) {
|
|
|
1840
1842
|
license: "availability" in concept && concept.availability ? parseLicense(concept.availability) : null,
|
|
1841
1843
|
context: "context" in concept && concept.context ? parseContext(concept.context) : null,
|
|
1842
1844
|
identification: parseIdentification(concept.identification),
|
|
1845
|
+
status: concept.status ?? "pending",
|
|
1843
1846
|
image: concept.image ? parseImage(concept.image) : null,
|
|
1844
1847
|
description: concept.description ? parseStringContent(concept.description) : null,
|
|
1845
1848
|
coordinates: parseCoordinates(concept.coordinates),
|
|
@@ -2183,15 +2186,9 @@ const propertyValueQueryItemSchema = z.object({
|
|
|
2183
2186
|
uuid: z.string(),
|
|
2184
2187
|
itemUuid: z.string().optional(),
|
|
2185
2188
|
dataType: z.string(),
|
|
2186
|
-
rawValue:
|
|
2187
|
-
z.string(),
|
|
2188
|
-
z.number(),
|
|
2189
|
-
z.boolean()
|
|
2190
|
-
]).optional(),
|
|
2189
|
+
rawValue: fakeStringSchema.optional(),
|
|
2191
2190
|
content: z.union([
|
|
2192
|
-
|
|
2193
|
-
z.number(),
|
|
2194
|
-
z.boolean(),
|
|
2191
|
+
fakeStringSchema,
|
|
2195
2192
|
richTextStringSchema,
|
|
2196
2193
|
z.array(richTextStringSchema)
|
|
2197
2194
|
]).optional()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ochre-sdk",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.15",
|
|
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",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"zod": "^4.3.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@antfu/eslint-config": "^7.
|
|
49
|
+
"@antfu/eslint-config": "^7.5.0",
|
|
50
50
|
"@types/node": "^24.10.13",
|
|
51
51
|
"bumpp": "^10.4.1",
|
|
52
|
-
"eslint": "^10.0.
|
|
52
|
+
"eslint": "^10.0.2",
|
|
53
53
|
"prettier": "^3.8.1",
|
|
54
54
|
"tsdown": "^0.20.3",
|
|
55
55
|
"typescript": "^5.9.3",
|