@aspan-corporation/ac-shared 1.2.28 → 1.2.30
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/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
|
package/lib/utils/thumbsKey.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const EXTENSION_JPEG = "jpeg";
|
|
|
2
2
|
export declare const EXTENSION_JPG = "jpg";
|
|
3
3
|
export declare const EXTENSION_WEBP = "webp";
|
|
4
4
|
export declare const EXTENSION_HEIC = "heic";
|
|
5
|
+
export declare const EXTENSION_PNG = "png";
|
|
5
6
|
export declare const EXTENSION_MOV = "mov";
|
|
6
7
|
export declare const EXTENSION_MP4 = "mp4";
|
|
7
8
|
export declare const EXTENSION_THUMBS = "webp";
|
package/lib/utils/thumbsKey.js
CHANGED
|
@@ -2,14 +2,20 @@ export const EXTENSION_JPEG = "jpeg";
|
|
|
2
2
|
export const EXTENSION_JPG = "jpg";
|
|
3
3
|
export const EXTENSION_WEBP = "webp";
|
|
4
4
|
export const EXTENSION_HEIC = "heic";
|
|
5
|
+
export const EXTENSION_PNG = "png";
|
|
5
6
|
export const EXTENSION_MOV = "mov";
|
|
6
7
|
export const EXTENSION_MP4 = "mp4";
|
|
7
8
|
export const EXTENSION_THUMBS = EXTENSION_WEBP;
|
|
8
9
|
export const EXTENSION_ENCODED_VIDEO = EXTENSION_MP4;
|
|
10
|
+
// Image source formats the resizer can decode with Sharp/libvips. PNG is
|
|
11
|
+
// included (libvips decodes it natively). RAW/DNG is intentionally excluded —
|
|
12
|
+
// the sharp layer isn't built with a RAW loader (libraw), so those can't be
|
|
13
|
+
// decoded without a layer change.
|
|
9
14
|
export const ALLOWED_EXTENSIONS = [
|
|
10
15
|
EXTENSION_JPEG,
|
|
11
16
|
EXTENSION_JPG,
|
|
12
|
-
EXTENSION_HEIC
|
|
17
|
+
EXTENSION_HEIC,
|
|
18
|
+
EXTENSION_PNG
|
|
13
19
|
];
|
|
14
20
|
export const ALLOWED_VIDEO_EXTENSIONS = [EXTENSION_MOV, EXTENSION_MP4];
|
|
15
21
|
export const DIM_THUMBNAIL_WIDTH = 320;
|