@aspan-corporation/ac-shared 1.2.28 → 1.2.29

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.
@@ -31,11 +31,34 @@ export const processMeta = async ({ id, meta, metaTableName, placeIndexName, siz
31
31
  });
32
32
  }
33
33
  }
34
+ // When EXIF supplies dateCreated but not the derived year/month/day tags
35
+ // (e.g. old extractor version), synthesise them from dateCreated so that
36
+ // year/month search stays consistent with what the UI displays.
37
+ const dateCreatedTag = meta.find((tag) => tag.key === "dateCreated");
38
+ const extraDateTags = (() => {
39
+ if (!dateCreatedTag)
40
+ return [];
41
+ const d = new Date(dateCreatedTag.value);
42
+ if (isNaN(d.getTime()))
43
+ return [];
44
+ const derived = [];
45
+ if (!meta.find((t) => t.key === "yearCreated"))
46
+ derived.push({ key: "yearCreated", value: String(d.getUTCFullYear()) });
47
+ if (!meta.find((t) => t.key === "monthCreated"))
48
+ derived.push({ key: "monthCreated", value: String(d.getUTCMonth() + 1) });
49
+ if (!meta.find((t) => t.key === "dayCreated"))
50
+ derived.push({ key: "dayCreated", value: String(d.getUTCDate()) });
51
+ return derived;
52
+ })();
53
+ // Date tags derived from the S3 key path (used when EXIF has no date).
54
+ const keyDateTags = dateCreatedTag ? [] : extractMetaFromKey(id);
55
+ // Sentinel tags — always written so the search index can filter by absence of data.
56
+ const hasDate = !!(dateCreatedTag || extraDateTags.length > 0 || keyDateTags.length > 0);
57
+ const hasLocation = !!geoPositionResult?.Place?.Country;
34
58
  const newTags = [
35
59
  ...meta,
36
- ...(meta.find((tag) => tag.key === "dateCreated")
37
- ? []
38
- : extractMetaFromKey(id)),
60
+ ...extraDateTags,
61
+ ...keyDateTags,
39
62
  ...(id.endsWith("/")
40
63
  ? []
41
64
  : [
@@ -63,7 +86,9 @@ export const processMeta = async ({ id, meta, metaTableName, placeIndexName, siz
63
86
  : []),
64
87
  ...(geoPositionResult?.Place?.PostalCode
65
88
  ? [{ key: "postalCode", value: geoPositionResult?.Place?.PostalCode }]
66
- : [])
89
+ : []),
90
+ { key: "hasDate", value: hasDate ? "true" : "false" },
91
+ { key: "hasLocation", value: hasLocation ? "true" : "false" },
67
92
  ].map((tag) => ({
68
93
  key: "ac:tau:" + tag.key,
69
94
  value: tag.value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspan-corporation/ac-shared",
3
- "version": "1.2.28",
3
+ "version": "1.2.29",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "exports": {