@digitalculture/ochre-sdk 0.5.12 → 0.5.13

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
@@ -1027,10 +1027,16 @@ function parsePropertyValue(propertyValue) {
1027
1027
  category: "propertyValue",
1028
1028
  n: propertyValue.n,
1029
1029
  publicationDateTime: propertyValue.publicationDateTime ? new Date(propertyValue.publicationDateTime) : null,
1030
+ context: propertyValue.context ? parseContext(propertyValue.context) : null,
1031
+ availability: propertyValue.availability ? parseLicense(propertyValue.availability) : null,
1030
1032
  identification: parseIdentification(propertyValue.identification),
1031
- description: ["string", "number", "boolean"].includes(
1033
+ date: propertyValue.date ? new Date(propertyValue.date) : null,
1034
+ creators: propertyValue.creators ? parsePersons(
1035
+ Array.isArray(propertyValue.creators.creator) ? propertyValue.creators.creator : [propertyValue.creators.creator]
1036
+ ) : [],
1037
+ description: propertyValue.description ? ["string", "number", "boolean"].includes(
1032
1038
  typeof propertyValue.description
1033
- ) ? parseFakeString(propertyValue.description) : parseStringContent(propertyValue.description),
1039
+ ) ? parseFakeString(propertyValue.description) : parseStringContent(propertyValue.description) : "",
1034
1040
  notes: propertyValue.notes ? parseNotes(
1035
1041
  Array.isArray(propertyValue.notes.note) ? propertyValue.notes.note : [propertyValue.notes.note]
1036
1042
  ) : [],
@@ -2550,12 +2556,10 @@ async function fetchPropertyValue(uuid) {
2550
2556
  if (error !== null) {
2551
2557
  throw new Error(error);
2552
2558
  }
2553
- if (!("propertyValue" in dataRaw.ochre)) {
2554
- throw new Error(
2555
- "Invalid OCHRE data: API response missing 'propertyValue' key"
2556
- );
2559
+ if (!("value" in dataRaw.ochre)) {
2560
+ throw new Error("Invalid OCHRE data: API response missing 'value' key");
2557
2561
  }
2558
- const propertyValueItem = parsePropertyValue(dataRaw.ochre.propertyValue);
2562
+ const propertyValueItem = parsePropertyValue(dataRaw.ochre.value);
2559
2563
  const data = {
2560
2564
  uuid: parseFakeString(dataRaw.ochre.uuid),
2561
2565
  publicationDateTime: new Date(dataRaw.ochre.publicationDateTime),
package/dist/index.d.cts CHANGED
@@ -351,7 +351,11 @@ type PropertyValue = {
351
351
  category: "propertyValue";
352
352
  n: number;
353
353
  publicationDateTime: Date | null;
354
+ context: Context | null;
355
+ availability: License | null;
354
356
  identification: Identification;
357
+ date: Date | null;
358
+ creators: Array<Person>;
355
359
  description: string;
356
360
  notes: Array<Note>;
357
361
  links: Array<Link>;
@@ -810,7 +814,7 @@ type OchreData = {
810
814
  | { period: OchrePeriod }
811
815
  | { bibliography: OchreBibliography }
812
816
  | { person: OchrePerson }
813
- | { propertyValue: OchrePropertyValue }
817
+ | { value: OchrePropertyValue }
814
818
  );
815
819
  };
816
820
 
@@ -1285,10 +1289,14 @@ type OchreInterpretation = {
1285
1289
  */
1286
1290
  type OchrePropertyValue = {
1287
1291
  uuid: string;
1292
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
1288
1293
  n: number;
1289
- publicationDateTime?: string; // YYYY-MM-DDThh:mm:ss
1294
+ context?: OchreContext;
1295
+ availability?: OchreLicense;
1290
1296
  identification: OchreIdentification;
1291
- description: OchreStringContent | FakeString;
1297
+ date?: string; // YYYY-MM-DD
1298
+ creators?: { creator: OchrePerson | Array<OchrePerson> };
1299
+ description?: OchreStringContent | FakeString;
1292
1300
  notes?: { note: OchreNote | Array<OchreNote> };
1293
1301
  links?: OchreLink | Array<OchreLink>;
1294
1302
  };
package/dist/index.d.ts CHANGED
@@ -351,7 +351,11 @@ type PropertyValue = {
351
351
  category: "propertyValue";
352
352
  n: number;
353
353
  publicationDateTime: Date | null;
354
+ context: Context | null;
355
+ availability: License | null;
354
356
  identification: Identification;
357
+ date: Date | null;
358
+ creators: Array<Person>;
355
359
  description: string;
356
360
  notes: Array<Note>;
357
361
  links: Array<Link>;
@@ -810,7 +814,7 @@ type OchreData = {
810
814
  | { period: OchrePeriod }
811
815
  | { bibliography: OchreBibliography }
812
816
  | { person: OchrePerson }
813
- | { propertyValue: OchrePropertyValue }
817
+ | { value: OchrePropertyValue }
814
818
  );
815
819
  };
816
820
 
@@ -1285,10 +1289,14 @@ type OchreInterpretation = {
1285
1289
  */
1286
1290
  type OchrePropertyValue = {
1287
1291
  uuid: string;
1292
+ publicationDateTime?: string; // YYYY-MM-DDThh:mm:ssZ
1288
1293
  n: number;
1289
- publicationDateTime?: string; // YYYY-MM-DDThh:mm:ss
1294
+ context?: OchreContext;
1295
+ availability?: OchreLicense;
1290
1296
  identification: OchreIdentification;
1291
- description: OchreStringContent | FakeString;
1297
+ date?: string; // YYYY-MM-DD
1298
+ creators?: { creator: OchrePerson | Array<OchrePerson> };
1299
+ description?: OchreStringContent | FakeString;
1292
1300
  notes?: { note: OchreNote | Array<OchreNote> };
1293
1301
  links?: OchreLink | Array<OchreLink>;
1294
1302
  };
package/dist/index.js CHANGED
@@ -947,10 +947,16 @@ function parsePropertyValue(propertyValue) {
947
947
  category: "propertyValue",
948
948
  n: propertyValue.n,
949
949
  publicationDateTime: propertyValue.publicationDateTime ? new Date(propertyValue.publicationDateTime) : null,
950
+ context: propertyValue.context ? parseContext(propertyValue.context) : null,
951
+ availability: propertyValue.availability ? parseLicense(propertyValue.availability) : null,
950
952
  identification: parseIdentification(propertyValue.identification),
951
- description: ["string", "number", "boolean"].includes(
953
+ date: propertyValue.date ? new Date(propertyValue.date) : null,
954
+ creators: propertyValue.creators ? parsePersons(
955
+ Array.isArray(propertyValue.creators.creator) ? propertyValue.creators.creator : [propertyValue.creators.creator]
956
+ ) : [],
957
+ description: propertyValue.description ? ["string", "number", "boolean"].includes(
952
958
  typeof propertyValue.description
953
- ) ? parseFakeString(propertyValue.description) : parseStringContent(propertyValue.description),
959
+ ) ? parseFakeString(propertyValue.description) : parseStringContent(propertyValue.description) : "",
954
960
  notes: propertyValue.notes ? parseNotes(
955
961
  Array.isArray(propertyValue.notes.note) ? propertyValue.notes.note : [propertyValue.notes.note]
956
962
  ) : [],
@@ -2470,12 +2476,10 @@ async function fetchPropertyValue(uuid) {
2470
2476
  if (error !== null) {
2471
2477
  throw new Error(error);
2472
2478
  }
2473
- if (!("propertyValue" in dataRaw.ochre)) {
2474
- throw new Error(
2475
- "Invalid OCHRE data: API response missing 'propertyValue' key"
2476
- );
2479
+ if (!("value" in dataRaw.ochre)) {
2480
+ throw new Error("Invalid OCHRE data: API response missing 'value' key");
2477
2481
  }
2478
- const propertyValueItem = parsePropertyValue(dataRaw.ochre.propertyValue);
2482
+ const propertyValueItem = parsePropertyValue(dataRaw.ochre.value);
2479
2483
  const data = {
2480
2484
  uuid: parseFakeString(dataRaw.ochre.uuid),
2481
2485
  publicationDateTime: new Date(dataRaw.ochre.publicationDateTime),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.5.12",
3
+ "version": "0.5.13",
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",