ochre-sdk 1.0.18 → 1.0.19

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.
@@ -395,7 +395,7 @@ function parseImageMapArea(area) {
395
395
  const shape = area.shape === "rect" ? "rectangle" : area.shape === "circle" ? "circle" : "polygon";
396
396
  return {
397
397
  uuid: area.uuid,
398
- publicationDateTime: area.publicationDateTime,
398
+ publicationDateTime: area.publicationDateTime ?? null,
399
399
  type: area.type,
400
400
  title: area.title,
401
401
  slug: area.slug ?? null,
@@ -201,9 +201,9 @@ const XMLImage = v.object({
201
201
  fileSize: XMLOptionalNumber,
202
202
  payload: v.optional(v.string("XMLImage: payload is string and optional"))
203
203
  }, "XMLImage: Shape error");
204
- const XMLImageMapArea = v.object({
204
+ const XMLImageMapArea = v.pipe(v.object({
205
205
  uuid: v.pipe(v.string("XMLImageMapArea: uuid is string and required"), v.check(isPseudoUuid, "XMLImageMapArea: uuid is not a valid pseudo-UUID")),
206
- publicationDateTime: customDateTime("XMLImageMapArea: publicationDateTime is not a valid datetime"),
206
+ publicationDateTime: v.optional(customDateTime("XMLImageMapArea: publicationDateTime is not a valid datetime")),
207
207
  type: v.string("XMLImageMapArea: type is string and required"),
208
208
  title: v.string("XMLImageMapArea: title is string and required"),
209
209
  slug: v.optional(v.string("XMLImageMapArea: slug is string and optional")),
@@ -213,7 +213,7 @@ const XMLImageMapArea = v.object({
213
213
  "poly"
214
214
  ], "XMLImageMapArea: shape is rect, circle, or poly"),
215
215
  coords: v.string("XMLImageMapArea: coords is string and required")
216
- }, "XMLImageMapArea: Shape error");
216
+ }, "XMLImageMapArea: Shape error"), v.check((area) => area.type === "person" || area.publicationDateTime != null, "XMLImageMapArea: publicationDateTime is required unless type is person"));
217
217
  const XMLImageMap = v.object({
218
218
  area: v.array(XMLImageMapArea, "XMLImageMap: area is array of XMLImageMapArea"),
219
219
  width: XMLNumber,
@@ -163,7 +163,7 @@ type XMLImage = {
163
163
  };
164
164
  type XMLImageMapArea = {
165
165
  uuid: string;
166
- publicationDateTime: Date;
166
+ publicationDateTime?: Date;
167
167
  type: string;
168
168
  title: string;
169
169
  slug?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
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",