fluncle 0.246.0 → 0.247.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 +56 -3
  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.246.0".trim() ? "0.246.0".trim() : "0.1.0";
625
+ currentVersion = "0.247.0".trim() ? "0.247.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.246.0".trim() ? "0.246.0".trim() : "0.1.0";
2338
+ currentVersion2 = "0.247.0".trim() ? "0.247.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, 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, 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();
@@ -13588,6 +13588,24 @@ var init_admin_labels = __esm(() => {
13588
13588
  summary: "Merge a slug-split label into its canonical row (operator; re-points + redirects)",
13589
13589
  tags: ["Admin"]
13590
13590
  }).input(object({ canonicalSlug: string2(), slug: string2() })).output(object({ ok: literal(true), result: MergeLabelResultSchema }));
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" });
13593
+ mintLabel = oc.route({
13594
+ method: "POST",
13595
+ operationId: "mintLabel",
13596
+ path: "/admin/labels",
13597
+ summary: "Mint a label from its MusicBrainz identity (operator; connect-or-create, idempotent)",
13598
+ tags: ["Admin"]
13599
+ }).input(object({
13600
+ mbLabelId: string2().regex(MB_LABEL_MBID_PATTERN, {
13601
+ error: "mbLabelId must be a MusicBrainz label MBID"
13602
+ }),
13603
+ seedState: LabelSeedStateSchema.optional()
13604
+ })).output(object({
13605
+ label: LabelAdminItemSchema,
13606
+ ok: literal(true),
13607
+ outcome: MintLabelOutcomeSchema
13608
+ }));
13591
13609
  LabelAliasSourceSchema = _enum(["operator", "apple", "musicbrainz", "discogs", "spotify"]).meta({ id: "LabelAliasSource" });
13592
13610
  LabelAliasKindSchema = _enum(["name", "hint"]).meta({ id: "LabelAliasKind" });
13593
13611
  LabelAliasCandidateSchema = object({
@@ -13674,6 +13692,7 @@ var init_admin_labels = __esm(() => {
13674
13692
  list_labels_admin: listLabelsAdmin,
13675
13693
  list_labels_missing_bio: listLabelsMissingBio,
13676
13694
  merge_label: mergeLabel,
13695
+ mint_label: mintLabel,
13677
13696
  reject_label_alias: rejectLabelAlias,
13678
13697
  replace_label_artist_rules: replaceLabelArtistRules,
13679
13698
  update_label: updateLabel
@@ -19114,6 +19133,17 @@ async function updateLabelCommand(slugOrId, seedState, rewalk = false) {
19114
19133
  });
19115
19134
  return response.label;
19116
19135
  }
19136
+ async function mintLabelCommand(mbLabelId, seedState) {
19137
+ const mbid = mbLabelId.trim().toLowerCase();
19138
+ if (!MBID_PATTERN2.test(mbid)) {
19139
+ throw new Error(`'${mbLabelId}' is not a MusicBrainz label MBID`);
19140
+ }
19141
+ const response = await adminApiPost("/api/v1/admin/labels", {
19142
+ mbLabelId: mbid,
19143
+ ...seedState === undefined ? {} : { seedState }
19144
+ });
19145
+ return { label: response.label, outcome: response.outcome };
19146
+ }
19117
19147
  async function describeLabelCommand(slug, options) {
19118
19148
  return adminApiPost(`/api/v1/admin/labels/${encodeURIComponent(slug)}/bio`, buildBioBody2(options));
19119
19149
  }
@@ -21567,6 +21597,15 @@ function labelUpdateLines(label, options) {
21567
21597
  }
21568
21598
  return lines;
21569
21599
  }
21600
+ var LABEL_MINT_WORDS = {
21601
+ adopted: "ADOPTED",
21602
+ known: "ALREADY KNOWN",
21603
+ minted: "MINTED"
21604
+ };
21605
+ function labelMintLine(label, outcome, requestedMbid) {
21606
+ 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()}.`;
21608
+ }
21570
21609
  var ARTIST_RULE_BOUNDARY = "Rules change what the next crawl takes. Everything already here stays.";
21571
21610
  var UNLISTED_RULE_BOUNDARY = "Unlisted takes the artist page down. The crawl and everything already here stay.";
21572
21611
  function artistRuleWriteLine(prefix, boundary = ARTIST_RULE_BOUNDARY) {
@@ -22894,6 +22933,19 @@ JSON field reference:
22894
22933
  console.log(line);
22895
22934
  }
22896
22935
  });
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) => {
22937
+ const seedState = options.seedState;
22938
+ if (seedState !== undefined && seedState !== "enabled" && seedState !== "disabled" && seedState !== "undecided") {
22939
+ throw new Error("Pass --seed-state enabled|disabled|undecided");
22940
+ }
22941
+ await Promise.resolve().then(() => init_admin_labels2());
22942
+ const { label, outcome } = await mintLabelCommand(mbid, seedState);
22943
+ if (options.json) {
22944
+ printJson({ label, ok: true, outcome });
22945
+ return;
22946
+ }
22947
+ console.log(labelMintLine(label, outcome, mbid));
22948
+ });
22897
22949
  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) => {
22898
22950
  await Promise.resolve().then(() => init_admin_labels2());
22899
22951
  const result = await mergeLabelCommand(losingSlug, canonicalSlug);
@@ -25969,6 +26021,7 @@ export {
25969
26021
  UNLISTED_RULE_BOUNDARY,
25970
26022
  artistRuleLines,
25971
26023
  createProgram,
26024
+ labelMintLine,
25972
26025
  labelUpdateLines,
25973
26026
  parseTelemetryTimestamp,
25974
26027
  unmatchedRowLine
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.246.0"
34
+ "version": "0.247.0"
35
35
  }