feat(studio): recover matching Nitro sources and persist import phases
This commit is contained in:
1 parent
00e33623f7
commit
13bd3695cb
45 files changed
+903
-28
No files matched your search
@@ -6,7 +6,10 @@ import { getSource } from "./clone-sources";
|
||||
import { importSingleFurni } from "./furni-import";
|
||||
|
||||
/** Called only inside the shared import lease and catalog export lock. */
|
||||
export async function runSyncJobItem(item: ImportJobItem) {
|
||||
export async function runSyncJobItem(
|
||||
item: ImportJobItem,
|
||||
onProgress?: (status: string) => void | Promise<void>,
|
||||
) {
|
||||
const [existing] = await db
|
||||
.select({ id: ItemsBase.id })
|
||||
.from(ItemsBase)
|
||||
@@ -22,7 +25,11 @@ export async function runSyncJobItem(item: ImportJobItem) {
|
||||
const source = await getSource(item.cloneSourceId);
|
||||
if (!source || !item.cloneEntry)
|
||||
throw Error("Synchronization source no longer available");
|
||||
const result = await cloneSingleFurni({ source, entry: item.cloneEntry });
|
||||
const result = await cloneSingleFurni({
|
||||
source,
|
||||
entry: item.cloneEntry,
|
||||
onProgress,
|
||||
});
|
||||
const [created] = result.ok
|
||||
? await db
|
||||
.select({ id: ItemsBase.id })
|
||||
@@ -32,5 +39,5 @@ export async function runSyncJobItem(item: ImportJobItem) {
|
||||
: [];
|
||||
return { ...result, itemId: created?.id };
|
||||
}
|
||||
return importSingleFurni({ ...item, repairExisting: false });
|
||||
return importSingleFurni({ ...item, repairExisting: false, onProgress });
|
||||
}
|
||||
Reference in new issue
Block a user