fluncle 0.99.0 → 0.100.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 +67 -2
  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.99.0".trim() ? "0.99.0".trim() : "0.1.0";
560
+ currentVersion = "0.100.0".trim() ? "0.100.0".trim() : "0.1.0";
561
561
  });
562
562
 
563
563
  // src/update-notifier.ts
@@ -2187,7 +2187,7 @@ function parseVersion2(version) {
2187
2187
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
2188
2188
  var init_version2 = __esm(() => {
2189
2189
  init_output();
2190
- currentVersion2 = "0.99.0".trim() ? "0.99.0".trim() : "0.1.0";
2190
+ currentVersion2 = "0.100.0".trim() ? "0.100.0".trim() : "0.1.0";
2191
2191
  });
2192
2192
 
2193
2193
  // ../../packages/registry/src/index.ts
@@ -5097,6 +5097,22 @@ var init_auth_lastfm = __esm(() => {
5097
5097
  init_api();
5098
5098
  });
5099
5099
 
5100
+ // src/commands/admin-artists.ts
5101
+ var exports_admin_artists = {};
5102
+ __export(exports_admin_artists, {
5103
+ backfillArtistsCommand: () => backfillArtistsCommand
5104
+ });
5105
+ async function backfillArtistsCommand(limit, dryRun, cursor) {
5106
+ const params = new URLSearchParams({ dryRun: String(dryRun), limit: String(limit) });
5107
+ if (cursor) {
5108
+ params.set("cursor", cursor);
5109
+ }
5110
+ return adminApiPost(`/api/admin/backfill/artists?${params.toString()}`);
5111
+ }
5112
+ var init_admin_artists = __esm(() => {
5113
+ init_api();
5114
+ });
5115
+
5100
5116
  // src/interactive.ts
5101
5117
  var exports_interactive = {};
5102
5118
  __export(exports_interactive, {
@@ -7914,6 +7930,10 @@ function addAdminCommands(program2) {
7914
7930
  const { backfillDiscogsCommand: backfillDiscogsCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
7915
7931
  await runBackfillDiscogs(options, backfillDiscogsCommand2);
7916
7932
  });
7933
+ backfill.command("artists").description("Back-fill the artist entity (artists + track_artists) for existing findings").option("--dry-run", "Report which findings would be upserted without touching the DB", false).option("--limit <limit>", "Max findings to process", "50").option("--json", "Print JSON", false).action(async (options) => {
7934
+ const { backfillArtistsCommand: backfillArtistsCommand2 } = await Promise.resolve().then(() => (init_admin_artists(), exports_admin_artists));
7935
+ await runBackfillArtists(options, backfillArtistsCommand2);
7936
+ });
7917
7937
  }
7918
7938
  async function runTrackPreviewArchive(idOrLogId, options, previewArchiveUploadCommand2) {
7919
7939
  if (!idOrLogId || !options.file || !options.source || !options.mime) {
@@ -8126,6 +8146,51 @@ async function runBackfillDiscogs(options, backfillDiscogsCommand2) {
8126
8146
  console.log(` ${item.logId}: release ${item.releaseId}${master}`);
8127
8147
  }
8128
8148
  }
8149
+ async function runBackfillArtists(options, backfillArtistsCommand2) {
8150
+ const limit = parseListLimit(options.limit);
8151
+ const upserted = [];
8152
+ const failed = [];
8153
+ const skipped = [];
8154
+ let cursor;
8155
+ let dryRun = options.dryRun;
8156
+ while (upserted.length + failed.length < limit) {
8157
+ const remaining = limit - (upserted.length + failed.length);
8158
+ const result = await backfillArtistsCommand2(remaining, options.dryRun, cursor);
8159
+ dryRun = result.dryRun;
8160
+ upserted.push(...result.upserted);
8161
+ failed.push(...result.failed);
8162
+ skipped.push(...result.skipped);
8163
+ if (!options.json) {
8164
+ const verb2 = result.dryRun ? "would upsert" : "upserted";
8165
+ console.log(` \u2026${verb2} ${result.upsertedCount}; ${result.failedCount} failed; ${result.skippedCount} skipped`);
8166
+ }
8167
+ if (result.nextCursor === null) {
8168
+ break;
8169
+ }
8170
+ cursor = result.nextCursor;
8171
+ }
8172
+ if (options.json) {
8173
+ printJson({
8174
+ dryRun,
8175
+ failed,
8176
+ failedCount: failed.length,
8177
+ ok: true,
8178
+ skipped,
8179
+ skippedCount: skipped.length,
8180
+ upserted,
8181
+ upsertedCount: upserted.length
8182
+ });
8183
+ return;
8184
+ }
8185
+ const verb = dryRun ? "Would upsert" : "Upserted";
8186
+ console.log(`${verb} ${upserted.length} artist entity row(s); ${failed.length} failed; ${skipped.length} skipped.`);
8187
+ for (const logId of upserted) {
8188
+ console.log(` ${logId}`);
8189
+ }
8190
+ for (const item of failed) {
8191
+ console.log(` ${item.logId}: ${item.error}`);
8192
+ }
8193
+ }
8129
8194
  async function runTrackVideo(idOrLogId, options, trackVideoCommand2) {
8130
8195
  if (!idOrLogId) {
8131
8196
  throw new Error("Missing id. Usage: fluncle admin tracks video <track_id|log_id> (--dir <dir> | --footage <file> [--footage-social <file>] [--footage-notext <file>] [--footage-landscape <file>] [--footage-landscape-social <file>] [--poster <file>] [--cover <file>] [--note <file>] [--composition <file>] [--props <file>] [--render <file>] [--intent <file>] [--metrics <file>] [--scene <file>] | --plate <file> [--plate-background <file>]) [--allow-partial]");
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.99.0"
34
+ "version": "0.100.0"
35
35
  }