fluncle 0.247.0 → 0.248.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 +45 -16
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -622,7 +622,7 @@ function parseVersion(version) {
622
622
  var currentVersion;
623
623
  var init_version = __esm(() => {
624
624
  init_output();
625
- currentVersion = "0.247.0".trim() ? "0.247.0".trim() : "0.1.0";
625
+ currentVersion = "0.248.0".trim() ? "0.248.0".trim() : "0.1.0";
626
626
  });
627
627
 
628
628
  // src/update-notifier.ts
@@ -2335,7 +2335,7 @@ function parseVersion2(version) {
2335
2335
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
2336
2336
  var init_version2 = __esm(() => {
2337
2337
  init_output();
2338
- currentVersion2 = "0.247.0".trim() ? "0.247.0".trim() : "0.1.0";
2338
+ currentVersion2 = "0.248.0".trim() ? "0.248.0".trim() : "0.1.0";
2339
2339
  });
2340
2340
 
2341
2341
  // ../../packages/registry/src/index.ts
@@ -13494,7 +13494,7 @@ var init_admin_hub_counts = __esm(() => {
13494
13494
  });
13495
13495
 
13496
13496
  // ../../packages/contracts/src/orpc/admin-labels.ts
13497
- var LabelSeedStateSchema, LabelAdminItemSchema, listLabelsAdmin, updateLabel, listLabelArtistRules, replaceLabelArtistRules, MergeLabelResultSchema, mergeLabel, MB_LABEL_MBID_PATTERN, MintLabelOutcomeSchema, mintLabel, LabelAliasSourceSchema, LabelAliasKindSchema, LabelAliasCandidateSchema, listLabelAliases, confirmLabelAlias, rejectLabelAlias, DescribeLabelBodySchema, describeLabel, draftLabelBio, LabelBioWorkItemSchema, listLabelsMissingBio, adminLabelsContract;
13497
+ var LabelSeedStateSchema, LabelAdminItemSchema, listLabelsAdmin, updateLabel, listLabelArtistRules, replaceLabelArtistRules, MergeLabelResultSchema, mergeLabel, MB_LABEL_MBID_PATTERN, MintLabelOutcomeSchema, LabelTakeOverResultSchema, mintLabel, LabelAliasSourceSchema, LabelAliasKindSchema, LabelAliasCandidateSchema, listLabelAliases, confirmLabelAlias, rejectLabelAlias, DescribeLabelBodySchema, describeLabel, draftLabelBio, LabelBioWorkItemSchema, listLabelsMissingBio, adminLabelsContract;
13498
13498
  var init_admin_labels = __esm(() => {
13499
13499
  init_dist3();
13500
13500
  init_zod();
@@ -13589,7 +13589,15 @@ var init_admin_labels = __esm(() => {
13589
13589
  tags: ["Admin"]
13590
13590
  }).input(object({ canonicalSlug: string2(), slug: string2() })).output(object({ ok: literal(true), result: MergeLabelResultSchema }));
13591
13591
  MB_LABEL_MBID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
13592
- MintLabelOutcomeSchema = _enum(["minted", "adopted", "known"]).meta({ id: "MintLabelOutcome" });
13592
+ MintLabelOutcomeSchema = _enum(["minted", "adopted", "known", "taken_over"]).meta({ id: "MintLabelOutcome" });
13593
+ LabelTakeOverResultSchema = object({
13594
+ clearedFacts: array(string2()),
13595
+ droppedRules: number2(),
13596
+ previousMbLabelId: string2().nullable(),
13597
+ rearmedSeedNode: boolean2(),
13598
+ retiredFrontierNodes: number2(),
13599
+ slug: string2()
13600
+ }).meta({ id: "LabelTakeOverResult" });
13593
13601
  mintLabel = oc.route({
13594
13602
  method: "POST",
13595
13603
  operationId: "mintLabel",
@@ -13600,11 +13608,13 @@ var init_admin_labels = __esm(() => {
13600
13608
  mbLabelId: string2().regex(MB_LABEL_MBID_PATTERN, {
13601
13609
  error: "mbLabelId must be a MusicBrainz label MBID"
13602
13610
  }),
13603
- seedState: LabelSeedStateSchema.optional()
13611
+ seedState: LabelSeedStateSchema.optional(),
13612
+ takeOverSlug: string2().min(1).optional()
13604
13613
  })).output(object({
13605
13614
  label: LabelAdminItemSchema,
13606
13615
  ok: literal(true),
13607
- outcome: MintLabelOutcomeSchema
13616
+ outcome: MintLabelOutcomeSchema,
13617
+ takenOver: LabelTakeOverResultSchema.optional()
13608
13618
  }));
13609
13619
  LabelAliasSourceSchema = _enum(["operator", "apple", "musicbrainz", "discogs", "spotify"]).meta({ id: "LabelAliasSource" });
13610
13620
  LabelAliasKindSchema = _enum(["name", "hint"]).meta({ id: "LabelAliasKind" });
@@ -19133,16 +19143,17 @@ async function updateLabelCommand(slugOrId, seedState, rewalk = false) {
19133
19143
  });
19134
19144
  return response.label;
19135
19145
  }
19136
- async function mintLabelCommand(mbLabelId, seedState) {
19146
+ async function mintLabelCommand(mbLabelId, seedState, takeOverSlug) {
19137
19147
  const mbid = mbLabelId.trim().toLowerCase();
19138
19148
  if (!MBID_PATTERN2.test(mbid)) {
19139
19149
  throw new Error(`'${mbLabelId}' is not a MusicBrainz label MBID`);
19140
19150
  }
19141
19151
  const response = await adminApiPost("/api/v1/admin/labels", {
19142
19152
  mbLabelId: mbid,
19143
- ...seedState === undefined ? {} : { seedState }
19153
+ ...seedState === undefined ? {} : { seedState },
19154
+ ...takeOverSlug === undefined ? {} : { takeOverSlug: takeOverSlug.trim().toLowerCase() }
19144
19155
  });
19145
- return { label: response.label, outcome: response.outcome };
19156
+ return { label: response.label, outcome: response.outcome, takenOver: response.takenOver };
19146
19157
  }
19147
19158
  async function describeLabelCommand(slug, options) {
19148
19159
  return adminApiPost(`/api/v1/admin/labels/${encodeURIComponent(slug)}/bio`, buildBioBody2(options));
@@ -21600,11 +21611,24 @@ function labelUpdateLines(label, options) {
21600
21611
  var LABEL_MINT_WORDS = {
21601
21612
  adopted: "ADOPTED",
21602
21613
  known: "ALREADY KNOWN",
21603
- minted: "MINTED"
21614
+ minted: "MINTED",
21615
+ taken_over: "TAKEN OVER"
21604
21616
  };
21605
- function labelMintLine(label, outcome, requestedMbid) {
21617
+ function labelMintLine(label, outcome, requestedMbid, takenOver) {
21606
21618
  const word = LABEL_MINT_WORDS[outcome] ?? outcome.toUpperCase();
21607
- return `${word} \u2014 ${label.name} (${label.slug}), MusicBrainz ${label.mbLabelId ?? requestedMbid}, seed state ${label.seedState.toUpperCase()}.`;
21619
+ const line = `${word} \u2014 ${label.name} (${label.slug}), MusicBrainz ${label.mbLabelId ?? requestedMbid}, seed state ${label.seedState.toUpperCase()}.`;
21620
+ if (!takenOver) {
21621
+ return line;
21622
+ }
21623
+ const dropped = [
21624
+ `replaced MusicBrainz ${takenOver.previousMbLabelId ?? "none"}`,
21625
+ `${takenOver.droppedRules} artist ${takenOver.droppedRules === 1 ? "rule" : "rules"} dropped`,
21626
+ ...takenOver.clearedFacts.length === 0 ? [] : [`cleared ${takenOver.clearedFacts.join(", ")}`],
21627
+ ...takenOver.retiredFrontierNodes === 0 ? [] : ["retired the old crawl node"],
21628
+ ...takenOver.rearmedSeedNode ? ["re-armed the seed"] : []
21629
+ ].join(" \xB7 ");
21630
+ return `${line}
21631
+ ${dropped}.`;
21608
21632
  }
21609
21633
  var ARTIST_RULE_BOUNDARY = "Rules change what the next crawl takes. Everything already here stays.";
21610
21634
  var UNLISTED_RULE_BOUNDARY = "Unlisted takes the artist page down. The crawl and everything already here stay.";
@@ -22933,18 +22957,22 @@ JSON field reference:
22933
22957
  console.log(line);
22934
22958
  }
22935
22959
  });
22936
- labels.command("mint").description("Mint a label from its MusicBrainz MBID (operator; idempotent)").argument("<mbid>", "The MusicBrainz label MBID").option("--seed-state <state>", "Rule it on arrival: enabled, disabled, or undecided").option("--json", "Print JSON", false).action(async (mbid, options) => {
22960
+ labels.command("mint").description("Mint a label from its MusicBrainz MBID (operator; idempotent)").argument("<mbid>", "The MusicBrainz label MBID").option("--seed-state <state>", "Rule it on arrival: enabled, disabled, or undecided").option("--take-over <slug>", "Re-point this trackless row's identity onto the minted entity").option("--json", "Print JSON", false).action(async (mbid, options) => {
22937
22961
  const seedState = options.seedState;
22938
22962
  if (seedState !== undefined && seedState !== "enabled" && seedState !== "disabled" && seedState !== "undecided") {
22939
22963
  throw new Error("Pass --seed-state enabled|disabled|undecided");
22940
22964
  }
22965
+ const takeOver = options.takeOver?.trim();
22966
+ if (options.takeOver !== undefined && !takeOver) {
22967
+ throw new Error("Pass --take-over <slug>");
22968
+ }
22941
22969
  await Promise.resolve().then(() => init_admin_labels2());
22942
- const { label, outcome } = await mintLabelCommand(mbid, seedState);
22970
+ const { label, outcome, takenOver } = await mintLabelCommand(mbid, seedState, takeOver);
22943
22971
  if (options.json) {
22944
- printJson({ label, ok: true, outcome });
22972
+ printJson({ label, ok: true, outcome, ...takenOver ? { takenOver } : {} });
22945
22973
  return;
22946
22974
  }
22947
- console.log(labelMintLine(label, outcome, mbid));
22975
+ console.log(labelMintLine(label, outcome, mbid, takenOver));
22948
22976
  });
22949
22977
  labels.command("merge").description("Merge a slug-split label into its canonical row (operator; re-points + redirects)").argument("<losingSlug>", "The duplicate label to fold away").argument("<canonicalSlug>", "The label to keep \u2014 everything re-points onto it").option("--json", "Print JSON", false).action(async (losingSlug, canonicalSlug, options) => {
22950
22978
  await Promise.resolve().then(() => init_admin_labels2());
@@ -25961,6 +25989,7 @@ var stringOptions = new Set([
25961
25989
  "--stream",
25962
25990
  "--stream-version",
25963
25991
  "--subject",
25992
+ "--take-over",
25964
25993
  "--target",
25965
25994
  "--title",
25966
25995
  "--through-seq",
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.247.0"
34
+ "version": "0.248.0"
35
35
  }