feat: IMVU imports on the hub: grants, requests and the importer's job queue
Pull request / title (pull_request) Successful in 1s
CI / test (pull_request) Successful in 1m15s
CI / image (apps/api/Dockerfile, t5de-hub-api) (pull_request) Skipped
CI / image (apps/web/Dockerfile, t5de-hub-web) (pull_request) Skipped

Creators grant a catalog leave to import their IMVU products (whole shop less
exclusions, or listed products) from a linked IMVU account, agreeing to a versioned
consent text; the catalog's team accepts or declines. Requests queue covered
products (or add them to the library when imported already), suggest, or count.
Importers claim jobs with the catalog's importer key, get t5de-import tokens, and
the catalog registers imported revisions as published products owned by the creator.
Narrowing or withdrawing a grant withdraws products; unlinking suspends grants;
an hourly batch rechecks imported products with IMVU daily. Website: /imports and
the console's catalog imports page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-11-05 19:46:10 -08:00
1 parent eca1884918
commit 7d708aebdb
24 files changed
+6521 -153

No files matched your search

+53
View File
@@ -120,3 +120,56 @@ export async function membership(_: ActionState, form: FormData): Promise<Action
return membership === "member" ? "You're a member." : "Asked. The catalog's team will decide.";
});
}
// ---- imports (docs/imports.md) ----
/** Turns the importer on (its key, shown once) or off, pauses or resumes it, or makes a new key. */
export async function setImporter(_: ActionState, form: FormData): Promise<ActionState> {
return onCatalog(form, async (id) => {
revalidatePath(`/console/catalogs/${id}/imports`);
const intent = field(form, "intent");
if (intent === "key") {
const { key } = unwrap(await api.catalogs({ id }).importer.key.post());
return `New importer key (shown once; put it in the importer's IMPORTER_KEY and restart it): ${key}`;
}
const body =
intent === "on" ? { enabled: true } : intent === "off" ? { enabled: false } : { paused: intent === "pause" };
const r = unwrap(await api.catalogs({ id }).importer.post(body));
if (r.key) return `Imports are on. The importer's key (shown once; put it in IMPORTER_KEY): ${r.key}`;
});
}
/** The catalog's team accepts, declines or ends a creator's grant. */
export async function decideGrant(_: ActionState, form: FormData): Promise<ActionState> {
return onCatalog(form, async (id) => {
revalidatePath(`/console/catalogs/${id}/imports`);
const grant = field(form, "grant");
const intent = field(form, "intent");
const reason = field(form, "reason");
if (intent === "end") {
unwrap(await api.imports.grants({ id: grant }).delete(reason ? { reason } : {}));
return "Ended. Its imported products were taken away.";
}
const decision = intent === "accept" ? "accept" : "decline";
const r = unwrap(
await api.imports
.grants({ id: grant })({ decision })
.post(reason ? { reason } : {}),
);
return decision === "accept" ? `Accepted. ${r.queued} queued for the importer.` : "Declined.";
});
}
/** Retries a failed import job (or imports a product again). */
export async function retryJob(_: ActionState, form: FormData): Promise<ActionState> {
return onCatalog(form, async (id) => {
revalidatePath(`/console/catalogs/${id}/imports`);
unwrap(
await api
.catalogs({ id })
.importer.jobs({ job: field(form, "job") })
.retry.post(),
);
return "Queued.";
});
}