fix: rename sidecar() helper → callSidecar() and fix mariadb healthcheck
The new `const sidecar` axios instance (added in 243e5d3) clashed with the
pre-existing `async function sidecar()` fetch helper, causing `npm run build`
to fail with a rolldown redeclaration error. Rename the fetch helper and all
its call sites to `callSidecar`.
Also replace the mariadb healthcheck command: `healthcheck.sh` calls the
`mariadb` CLI which isn't on PATH in the current image layer, causing the
container to stay permanently unhealthy and the deploy webhook to abort before
the `npm run build` step runs — leaving the old JS bundle serving from nginx.
Switch to `mysqladmin ping` which is available in all MariaDB 11 images.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,7 +42,7 @@ services:
|
|||||||
# silently no-op on Debian/Ubuntu and macOS Docker Desktop.
|
# silently no-op on Debian/Ubuntu and macOS Docker Desktop.
|
||||||
- ./mariadb/init:/docker-entrypoint-initdb.d:ro,Z
|
- ./mariadb/init:/docker-entrypoint-initdb.d:ro,Z
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 12
|
retries: 12
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ export async function listFolderCounts(paths: string[]): Promise<Record<string,
|
|||||||
// on the way out, then re-key the response back to user-relative on
|
// on the way out, then re-key the response back to user-relative on
|
||||||
// the way in so callers' map keys line up with their input array.
|
// the way in so callers' map keys line up with their input array.
|
||||||
const serverPaths = paths.map((p) => toOriginalsPath(p));
|
const serverPaths = paths.map((p) => toOriginalsPath(p));
|
||||||
const data = (await sidecar('POST', '/folders/counts', { paths: serverPaths })) as Record<
|
const data = (await callSidecar('POST', '/folders/counts', { paths: serverPaths })) as Record<
|
||||||
string,
|
string,
|
||||||
number
|
number
|
||||||
>;
|
>;
|
||||||
@@ -875,7 +875,7 @@ export interface RenameResult {
|
|||||||
newRelPath: string;
|
newRelPath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sidecar(method: string, urlPath: string, body?: unknown): Promise<unknown> {
|
async function callSidecar(method: string, urlPath: string, body?: unknown): Promise<unknown> {
|
||||||
const res = await fetch(`/api/sidecar${urlPath}`, {
|
const res = await fetch(`/api/sidecar${urlPath}`, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
@@ -893,20 +893,20 @@ async function sidecar(method: string, urlPath: string, body?: unknown): Promise
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function createFolder(relPath: string): Promise<{ path: string }> {
|
export async function createFolder(relPath: string): Promise<{ path: string }> {
|
||||||
return sidecar('POST', '/folders', { path: relPath }) as Promise<{ path: string }>;
|
return callSidecar('POST', '/folders', { path: relPath }) as Promise<{ path: string }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function renameFolder(
|
export async function renameFolder(
|
||||||
relPath: string,
|
relPath: string,
|
||||||
newName: string
|
newName: string
|
||||||
): Promise<{ oldPath: string; newPath: string }> {
|
): Promise<{ oldPath: string; newPath: string }> {
|
||||||
return sidecar('POST', `/folders/${encodeURIComponent(relPath)}/rename`, {
|
return callSidecar('POST', `/folders/${encodeURIComponent(relPath)}/rename`, {
|
||||||
newName
|
newName
|
||||||
}) as Promise<{ oldPath: string; newPath: string }>;
|
}) as Promise<{ oldPath: string; newPath: string }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteFolder(relPath: string): Promise<{ path: string }> {
|
export async function deleteFolder(relPath: string): Promise<{ path: string }> {
|
||||||
return sidecar('DELETE', `/folders/${encodeURIComponent(relPath)}`) as Promise<{
|
return callSidecar('DELETE', `/folders/${encodeURIComponent(relPath)}`) as Promise<{
|
||||||
path: string;
|
path: string;
|
||||||
}>;
|
}>;
|
||||||
}
|
}
|
||||||
@@ -939,7 +939,7 @@ export interface CrossFolderScanResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function scanCrossFolderDuplicates(): Promise<CrossFolderScanResult> {
|
export async function scanCrossFolderDuplicates(): Promise<CrossFolderScanResult> {
|
||||||
return sidecar('GET', '/duplicates/scan') as Promise<CrossFolderScanResult>;
|
return callSidecar('GET', '/duplicates/scan') as Promise<CrossFolderScanResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ArchiveDuplicatesResult {
|
export interface ArchiveDuplicatesResult {
|
||||||
@@ -950,7 +950,7 @@ export interface ArchiveDuplicatesResult {
|
|||||||
export async function archiveDuplicatePaths(
|
export async function archiveDuplicatePaths(
|
||||||
paths: string[]
|
paths: string[]
|
||||||
): Promise<ArchiveDuplicatesResult> {
|
): Promise<ArchiveDuplicatesResult> {
|
||||||
return sidecar('POST', '/duplicates/archive', { paths }) as Promise<ArchiveDuplicatesResult>;
|
return callSidecar('POST', '/duplicates/archive', { paths }) as Promise<ArchiveDuplicatesResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Heap convert (move/copy heap photos to a folder) ────────────────────────
|
// ── Heap convert (move/copy heap photos to a folder) ────────────────────────
|
||||||
@@ -982,7 +982,7 @@ export async function convertHeap(
|
|||||||
uid: string,
|
uid: string,
|
||||||
body: HeapConvertBody
|
body: HeapConvertBody
|
||||||
): Promise<HeapConvertResult> {
|
): Promise<HeapConvertResult> {
|
||||||
return sidecar('POST', `/albums/${uid}/convert`, body) as Promise<HeapConvertResult>;
|
return callSidecar('POST', `/albums/${uid}/convert`, body) as Promise<HeapConvertResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Photo marks (rating + color) ─────────────────────────────────────────────
|
// ── Photo marks (rating + color) ─────────────────────────────────────────────
|
||||||
@@ -998,19 +998,19 @@ export interface PhotoMark {
|
|||||||
export type PhotoMarksMap = Record<string, PhotoMark>;
|
export type PhotoMarksMap = Record<string, PhotoMark>;
|
||||||
|
|
||||||
export async function getAllMarks(): Promise<PhotoMarksMap> {
|
export async function getAllMarks(): Promise<PhotoMarksMap> {
|
||||||
const data = await sidecar('GET', '/photos/marks');
|
const data = await callSidecar('GET', '/photos/marks');
|
||||||
return (data ?? {}) as PhotoMarksMap;
|
return (data ?? {}) as PhotoMarksMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setMark(photoUid: string, patch: PhotoMark): Promise<PhotoMark> {
|
export async function setMark(photoUid: string, patch: PhotoMark): Promise<PhotoMark> {
|
||||||
return sidecar('PUT', `/photos/${photoUid}/marks`, patch) as Promise<PhotoMark>;
|
return callSidecar('PUT', `/photos/${photoUid}/marks`, patch) as Promise<PhotoMark>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function bulkSetMarks(
|
export async function bulkSetMarks(
|
||||||
ids: string[],
|
ids: string[],
|
||||||
patch: PhotoMark
|
patch: PhotoMark
|
||||||
): Promise<{ count: number; marks: PhotoMarksMap }> {
|
): Promise<{ count: number; marks: PhotoMarksMap }> {
|
||||||
return sidecar('POST', '/photos/marks/bulk', { ids, patch }) as Promise<{
|
return callSidecar('POST', '/photos/marks/bulk', { ids, patch }) as Promise<{
|
||||||
count: number;
|
count: number;
|
||||||
marks: PhotoMarksMap;
|
marks: PhotoMarksMap;
|
||||||
}>;
|
}>;
|
||||||
|
|||||||
Reference in New Issue
Block a user