fluncle 0.116.0 → 0.118.0

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.
Files changed (2) hide show
  1. package/bin/fluncle.mjs +61 -4
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -557,7 +557,7 @@ function parseVersion(version) {
557
557
  var currentVersion;
558
558
  var init_version = __esm(() => {
559
559
  init_output();
560
- currentVersion = "0.116.0".trim() ? "0.116.0".trim() : "0.1.0";
560
+ currentVersion = "0.118.0".trim() ? "0.118.0".trim() : "0.1.0";
561
561
  });
562
562
 
563
563
  // src/update-notifier.ts
@@ -2251,7 +2251,7 @@ function parseVersion2(version) {
2251
2251
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
2252
2252
  var init_version2 = __esm(() => {
2253
2253
  init_output();
2254
- currentVersion2 = "0.116.0".trim() ? "0.116.0".trim() : "0.1.0";
2254
+ currentVersion2 = "0.118.0".trim() ? "0.118.0".trim() : "0.1.0";
2255
2255
  });
2256
2256
 
2257
2257
  // ../../packages/registry/src/index.ts
@@ -5318,7 +5318,8 @@ var exports_admin_artists = {};
5318
5318
  __export(exports_admin_artists, {
5319
5319
  resolveArtistCommand: () => resolveArtistCommand,
5320
5320
  listArtistsCommand: () => listArtistsCommand,
5321
- backfillArtistsCommand: () => backfillArtistsCommand
5321
+ backfillArtistsCommand: () => backfillArtistsCommand,
5322
+ backfillArtistImagesCommand: () => backfillArtistImagesCommand
5322
5323
  });
5323
5324
  async function listArtistsCommand(limit, cursor) {
5324
5325
  const params = new URLSearchParams({ limit: String(limit) });
@@ -5330,6 +5331,13 @@ async function listArtistsCommand(limit, cursor) {
5330
5331
  async function resolveArtistCommand(artistId) {
5331
5332
  return adminApiPost(`/api/admin/artists/${encodeURIComponent(artistId)}/resolve`);
5332
5333
  }
5334
+ async function backfillArtistImagesCommand(limit, dryRun, cursor) {
5335
+ const params = new URLSearchParams({ dryRun: String(dryRun), limit: String(limit) });
5336
+ if (cursor) {
5337
+ params.set("cursor", cursor);
5338
+ }
5339
+ return adminApiPost(`/api/admin/backfill/artist-images?${params.toString()}`);
5340
+ }
5333
5341
  async function backfillArtistsCommand(limit, dryRun, cursor) {
5334
5342
  const params = new URLSearchParams({ dryRun: String(dryRun), limit: String(limit) });
5335
5343
  if (cursor) {
@@ -8242,6 +8250,10 @@ function addAdminCommands(program2) {
8242
8250
  const { backfillArtistsCommand: backfillArtistsCommand2 } = await Promise.resolve().then(() => (init_admin_artists(), exports_admin_artists));
8243
8251
  await runBackfillArtists(options, backfillArtistsCommand2);
8244
8252
  });
8253
+ backfill.command("artist-images").description("Back-fill artist Spotify avatars (image_url) for existing artists").option("--dry-run", "Report which artists would be filled without touching the DB", false).option("--limit <limit>", "Max artists to process", "50").option("--json", "Print JSON", false).action(async (options) => {
8254
+ const { backfillArtistImagesCommand: backfillArtistImagesCommand2 } = await Promise.resolve().then(() => (init_admin_artists(), exports_admin_artists));
8255
+ await runBackfillArtistImages(options, backfillArtistImagesCommand2);
8256
+ });
8245
8257
  artists.command("resolve").description("Resolve an artist's social identity (MB url-rels + Firecrawl gap-fill)").argument("[artistId]").option("--queue", "Show the resolve worklist (artists awaiting resolution), oldest first", false).option("--limit <limit>", "Number of artists to show with --queue", "50").option("--json", "Print JSON", false).allowExcessArguments().action(async (artistId, options) => {
8246
8258
  if (options.queue) {
8247
8259
  const { listArtistsCommand: listArtistsCommand2 } = await Promise.resolve().then(() => (init_admin_artists(), exports_admin_artists));
@@ -8598,6 +8610,51 @@ async function runBackfillArtists(options, backfillArtistsCommand2) {
8598
8610
  console.log(` ${item.logId}: ${item.error}`);
8599
8611
  }
8600
8612
  }
8613
+ async function runBackfillArtistImages(options, backfillArtistImagesCommand2) {
8614
+ const limit = parseListLimit(options.limit);
8615
+ const filled = [];
8616
+ const failed = [];
8617
+ const skipped = [];
8618
+ let cursor;
8619
+ let dryRun = options.dryRun;
8620
+ while (filled.length + failed.length + skipped.length < limit) {
8621
+ const remaining = limit - (filled.length + failed.length + skipped.length);
8622
+ const result = await backfillArtistImagesCommand2(remaining, options.dryRun, cursor);
8623
+ dryRun = result.dryRun;
8624
+ filled.push(...result.filled);
8625
+ failed.push(...result.failed);
8626
+ skipped.push(...result.skipped);
8627
+ if (!options.json) {
8628
+ const verb2 = result.dryRun ? "would fill" : "filled";
8629
+ console.log(` \u2026${verb2} ${result.filledCount}; ${result.failedCount} failed; ${result.skippedCount} without an image`);
8630
+ }
8631
+ if (result.nextCursor === null) {
8632
+ break;
8633
+ }
8634
+ cursor = result.nextCursor;
8635
+ }
8636
+ if (options.json) {
8637
+ printJson({
8638
+ dryRun,
8639
+ failed,
8640
+ failedCount: failed.length,
8641
+ filled,
8642
+ filledCount: filled.length,
8643
+ ok: true,
8644
+ skipped,
8645
+ skippedCount: skipped.length
8646
+ });
8647
+ return;
8648
+ }
8649
+ const verb = dryRun ? "Would fill" : "Filled";
8650
+ console.log(`${verb} ${filled.length} artist avatar(s); ${failed.length} failed; ${skipped.length} without a Spotify image.`);
8651
+ for (const artistId of filled) {
8652
+ console.log(` ${artistId}`);
8653
+ }
8654
+ for (const item of failed) {
8655
+ console.log(` ${item.artistId}: ${item.error}`);
8656
+ }
8657
+ }
8601
8658
  async function runArtistResolveQueue(options, listArtistsCommand2) {
8602
8659
  const limit = parseListLimit(options.limit);
8603
8660
  const result = await listArtistsCommand2(limit ?? 50);
@@ -9688,7 +9745,7 @@ function assertParseArgsCompatiblePositionals(args) {
9688
9745
  if (third && !fourth) {
9689
9746
  throw new Error(`Missing submission id for: ${third}`);
9690
9747
  }
9691
- if (third && fourth && third !== "review" && third !== "reject" && third !== "approve") {
9748
+ if (third && fourth && third !== "review" && third !== "reject" && third !== "approve" && third !== "triage") {
9692
9749
  throw new Error(`Unknown submissions command: ${third}`);
9693
9750
  }
9694
9751
  }
package/package.json CHANGED
@@ -31,5 +31,5 @@
31
31
  "url": "git+https://github.com/mauricekleine/fluncle.git"
32
32
  },
33
33
  "type": "module",
34
- "version": "0.116.0"
34
+ "version": "0.118.0"
35
35
  }