@displaydev/cli 0.7.0 → 0.8.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.
@@ -434,6 +434,26 @@ export var ApiClient = /*#__PURE__*/ function() {
434
434
  return form;
435
435
  }
436
436
  },
437
+ {
438
+ key: "renameArtifact",
439
+ value: /**
440
+ * Metadata-only rename: updates the artifact's display name and
441
+ * re-derives the URL slug. Does not bump the version or touch
442
+ * storage. Maps to `PATCH /v1/artifacts/:shortId` — see
443
+ * feat-artifact-rename.md §2a.
444
+ */ function renameArtifact(shortId, name) {
445
+ return _async_to_generator(function() {
446
+ return _ts_generator(this, function(_state) {
447
+ return [
448
+ 2,
449
+ this.request('PATCH', "/v1/artifacts/".concat(shortId), {
450
+ name: name
451
+ })
452
+ ];
453
+ });
454
+ }).call(this);
455
+ }
456
+ },
437
457
  {
438
458
  key: "getOrgBranding",
439
459
  value: function getOrgBranding() {
package/dist/main.js CHANGED
@@ -618,6 +618,65 @@ program.command('share <shortId>').description('Change an artifact\'s visibility
618
618
  });
619
619
  })();
620
620
  });
621
+ // --- rename ---
622
+ program.command('rename <shortId>').description('Rename a published artifact. Slug re-derives from the new name; old URLs still resolve via shortId.').requiredOption('--name <name>', 'New display name').action(function(shortId, opts) {
623
+ return _async_to_generator(function() {
624
+ var auth, client, result, err, msg;
625
+ return _ts_generator(this, function(_state) {
626
+ switch(_state.label){
627
+ case 0:
628
+ return [
629
+ 4,
630
+ resolveAuthOrConfig()
631
+ ];
632
+ case 1:
633
+ auth = _state.sent();
634
+ client = createClient(auth);
635
+ _state.label = 2;
636
+ case 2:
637
+ _state.trys.push([
638
+ 2,
639
+ 4,
640
+ ,
641
+ 5
642
+ ]);
643
+ return [
644
+ 4,
645
+ client.renameArtifact(shortId, opts.name)
646
+ ];
647
+ case 3:
648
+ result = _state.sent();
649
+ console.log(result.url);
650
+ console.log("Renamed to ".concat(result.name, " (").concat(result.shortId, ")"));
651
+ return [
652
+ 3,
653
+ 5
654
+ ];
655
+ case 4:
656
+ err = _state.sent();
657
+ if (_instanceof(err, ApiError) && err.status === 404) {
658
+ console.error("Artifact not found: ".concat(shortId));
659
+ process.exit(4);
660
+ }
661
+ if (_instanceof(err, ApiError) && err.status === 401) {
662
+ console.error('Your credential is no longer valid. Run: dsp login (or rotate DISPLAYDEV_API_KEY).');
663
+ process.exit(1);
664
+ }
665
+ msg = _instanceof(err, Error) ? err.message : String(err);
666
+ console.error(msg);
667
+ process.exit(1);
668
+ return [
669
+ 3,
670
+ 5
671
+ ];
672
+ case 5:
673
+ return [
674
+ 2
675
+ ];
676
+ }
677
+ });
678
+ })();
679
+ });
621
680
  // --- find ---
622
681
  program.command('find [query]').description('Search for artifacts').option('--by <email>', 'Filter by publisher email').option('--mine', 'Show only artifacts you published').option('--since <date>', 'Filter by date (ISO format)').option('--sort <col>', 'Sort column: updated_at, view_count, name', 'updated_at').option('--dir <direction>', 'Sort direction: asc or desc').option('--limit <n>', 'Max rows to fetch (1-100)', function(v) {
623
682
  return parseInt(v, 10);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@displaydev/cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "dsp": "dist/main.js"