@aspan-corporation/ac-shared 1.2.27 → 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.
- package/lib/services/dynamoDB.js +3 -3
- package/lib/utils/processMeta.js +29 -4
- package/package.json +1 -1
package/lib/services/dynamoDB.js
CHANGED
|
@@ -37,12 +37,12 @@ export class DynamoDBService {
|
|
|
37
37
|
return !!result.Item;
|
|
38
38
|
}
|
|
39
39
|
async scanCommand(scanCommandInput) {
|
|
40
|
-
return await this.
|
|
40
|
+
return await this.documentClient.send(new ScanCommand(scanCommandInput));
|
|
41
41
|
}
|
|
42
42
|
async batchWriteCommand(batchWriteCommandInput) {
|
|
43
|
-
return await this.
|
|
43
|
+
return await this.documentClient.send(new BatchWriteCommand(batchWriteCommandInput));
|
|
44
44
|
}
|
|
45
45
|
async batchGetCommand(batchGetCommandInput) {
|
|
46
|
-
return await this.
|
|
46
|
+
return await this.documentClient.send(new BatchGetCommand(batchGetCommandInput));
|
|
47
47
|
}
|
|
48
48
|
}
|
package/lib/utils/processMeta.js
CHANGED
|
@@ -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
|
-
...
|
|
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
|