@digitalculture/ochre-sdk 0.18.14 → 0.18.16

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 CHANGED
@@ -37,6 +37,9 @@ type Metadata = {
37
37
  website: string | null;
38
38
  };
39
39
  } | null;
40
+ collection: {
41
+ identification: Identification;
42
+ } | null;
40
43
  item: {
41
44
  identification: Identification;
42
45
  category: string;
package/dist/index.mjs CHANGED
@@ -121,7 +121,7 @@ const dataOptionsSchema = z.object({
121
121
  start: 1,
122
122
  limit: 40
123
123
  });
124
- const apiVersionSuffixSchema = z.enum(["-v1", "-v2"]).transform((suffix) => suffix.replace("-v", ""));
124
+ const apiVersionSuffixSchema = z.enum(["-v1", "-v2"]).transform((suffix) => Number.parseInt(suffix.replace("-v", ""), 10));
125
125
  /**
126
126
  * Schema for validating website properties
127
127
  * @internal
@@ -1103,8 +1103,11 @@ function parseMetadata(metadata) {
1103
1103
  ...baseProjectIdentification,
1104
1104
  website: metadata.project?.identification.website ?? null
1105
1105
  };
1106
+ let collectionIdentification = null;
1107
+ if (metadata.collection) collectionIdentification = parseIdentification(metadata.collection.identification);
1106
1108
  return {
1107
1109
  project: projectIdentification ? { identification: projectIdentification } : null,
1110
+ collection: collectionIdentification ? { identification: collectionIdentification } : null,
1108
1111
  item: metadata.item ? {
1109
1112
  identification,
1110
1113
  category: metadata.item.category,
@@ -3981,7 +3984,7 @@ function parseApiVersionSuffix(abbreviation) {
3981
3984
  abbreviation,
3982
3985
  version: DEFAULT_API_VERSION
3983
3986
  };
3984
- const result = apiVersionSuffixSchema.safeParse(abbreviation);
3987
+ const result = apiVersionSuffixSchema.safeParse(abbreviation.slice(-3));
3985
3988
  if (!result.success) throw new Error("Invalid API version suffix");
3986
3989
  return {
3987
3990
  abbreviation: abbreviation.replace(`-v${result.data}`, ""),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.18.14",
3
+ "version": "0.18.16",
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",