xserver-cli 1.2.2 → 1.3.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.
package/dist/index.js CHANGED
@@ -5,6 +5,17 @@ import { Command } from "commander";
5
5
 
6
6
  // ../../shared/dist/api-client.js
7
7
  var DEFAULT_TIMEOUT_MS = 3e4;
8
+ var SENSITIVE_FIELD_PATTERN = /(?:password|passphrase|private_key|secret|token|user_pass|auth_code)$/i;
9
+ function redactSensitiveValues(value) {
10
+ if (Array.isArray(value))
11
+ return value.map(redactSensitiveValues);
12
+ if (typeof value !== "object" || value === null)
13
+ return value;
14
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [
15
+ key,
16
+ SENSITIVE_FIELD_PATTERN.test(key) ? "[REDACTED]" : redactSensitiveValues(child)
17
+ ]));
18
+ }
8
19
  var ApiError = class extends Error {
9
20
  httpStatus;
10
21
  errorCode;
@@ -477,6 +488,243 @@ var ApiClient = class {
477
488
  return this.get("/v1/me");
478
489
  }
479
490
  // ================================================================
491
+ // ドメインサービスAPI(/v1/domain・servername非依存)
492
+ // ================================================================
493
+ domainPath(domainName) {
494
+ return `/v1/domain/${enc(domainName)}`;
495
+ }
496
+ async listDomains() {
497
+ return this.get("/v1/domain");
498
+ }
499
+ async getDomainDetail(domainName) {
500
+ return this.get(this.domainPath(domainName));
501
+ }
502
+ async getDomainNameservers(domainName) {
503
+ return this.get(`${this.domainPath(domainName)}/nameservers`);
504
+ }
505
+ async updateDomainNameservers(domainName, data) {
506
+ return this.put(`${this.domainPath(domainName)}/nameservers`, data);
507
+ }
508
+ async getDomainWhois(domainName) {
509
+ return this.get(`${this.domainPath(domainName)}/whois`);
510
+ }
511
+ async updateDomainWhois(domainName, data) {
512
+ return this.put(`${this.domainPath(domainName)}/whois`, data);
513
+ }
514
+ async getDomainRegistrarLock(domainName) {
515
+ return this.get(`${this.domainPath(domainName)}/registrar-lock`);
516
+ }
517
+ async updateDomainRegistrarLock(domainName, data) {
518
+ return this.put(`${this.domainPath(domainName)}/registrar-lock`, data);
519
+ }
520
+ async listDomainDns(domainName) {
521
+ return this.get(`${this.domainPath(domainName)}/dns`);
522
+ }
523
+ async addDomainDns(domainName, data) {
524
+ return this.post(`${this.domainPath(domainName)}/dns`, data);
525
+ }
526
+ async updateDomainDns(domainName, dnsId, data) {
527
+ return this.put(`${this.domainPath(domainName)}/dns/${enc(dnsId)}`, data);
528
+ }
529
+ async deleteDomainDns(domainName, dnsId) {
530
+ return this.delete(`${this.domainPath(domainName)}/dns/${enc(dnsId)}`);
531
+ }
532
+ async checkDomain(domainName) {
533
+ return this.get("/v1/domain/check", { domain_name: domainName });
534
+ }
535
+ async getDomainPricing(params) {
536
+ return this.get("/v1/domain/pricing", params);
537
+ }
538
+ async registerDomain(data, idempotencyKey) {
539
+ return this.post("/v1/domain", data, idempotencyHeaders(idempotencyKey));
540
+ }
541
+ async transferDomain(domainName, data, idempotencyKey) {
542
+ return this.post(`${this.domainPath(domainName)}/transfer`, data, idempotencyHeaders(idempotencyKey));
543
+ }
544
+ async renewDomain(domainName, data, idempotencyKey) {
545
+ return this.post(`${this.domainPath(domainName)}/renew`, data, idempotencyHeaders(idempotencyKey));
546
+ }
547
+ // ================================================================
548
+ // WPhosting API(/v1/wphosting/{contract_id})
549
+ // ================================================================
550
+ wphostingPath(contractId2) {
551
+ return `/v1/wphosting/${enc(contractId2)}`;
552
+ }
553
+ wphostingSitePath(contractId2, servername2) {
554
+ return `${this.wphostingPath(contractId2)}/sites/${enc(servername2)}`;
555
+ }
556
+ async listWphostingSites(contractId2) {
557
+ return this.get(`${this.wphostingPath(contractId2)}/sites`);
558
+ }
559
+ async getWphostingSite(contractId2, servername2) {
560
+ return this.get(this.wphostingSitePath(contractId2, servername2));
561
+ }
562
+ async createWphostingSite(contractId2, data, idempotencyKey) {
563
+ return this.post(`${this.wphostingPath(contractId2)}/sites`, data, idempotencyHeaders(idempotencyKey));
564
+ }
565
+ async deleteWphostingSite(contractId2, servername2, idempotencyKey) {
566
+ return this.delete(this.wphostingSitePath(contractId2, servername2), void 0, idempotencyHeaders(idempotencyKey));
567
+ }
568
+ async getWphostingUsage(contractId2) {
569
+ return this.get(`${this.wphostingPath(contractId2)}/usage`);
570
+ }
571
+ async createWphostingStaging(contractId2, servername2, data, idempotencyKey) {
572
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/staging`, data, idempotencyHeaders(idempotencyKey));
573
+ }
574
+ async listWphostingBackups(contractId2, servername2) {
575
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/backups`);
576
+ }
577
+ async createWphostingBackup(contractId2, servername2, data, idempotencyKey) {
578
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/backups`, data, idempotencyHeaders(idempotencyKey));
579
+ }
580
+ async restoreWphostingBackup(contractId2, servername2, backupId, idempotencyKey) {
581
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/backups/${enc(backupId)}/restore`, void 0, idempotencyHeaders(idempotencyKey));
582
+ }
583
+ async listWphostingBackupRestoreHistory(contractId2, servername2) {
584
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/backups/restore-history`);
585
+ }
586
+ async deleteWphostingBackup(contractId2, servername2, backupId) {
587
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/backups/${enc(backupId)}`);
588
+ }
589
+ async getWphostingWordPress(contractId2, servername2) {
590
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wordpress`);
591
+ }
592
+ async updateWphostingWordPress(contractId2, servername2, data) {
593
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/wordpress`, data);
594
+ }
595
+ async upgradeWphostingWordPress(contractId2, servername2) {
596
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/wordpress/update`);
597
+ }
598
+ async getWphostingMaintenanceMode(contractId2, servername2) {
599
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/maintenance-mode`);
600
+ }
601
+ async updateWphostingMaintenanceMode(contractId2, servername2, data) {
602
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/maintenance-mode`, data);
603
+ }
604
+ async listWphostingPlugins(contractId2, servername2) {
605
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/plugins`);
606
+ }
607
+ async installWphostingPlugin(contractId2, servername2, data) {
608
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/plugins`, data);
609
+ }
610
+ async updateWphostingPlugin(contractId2, servername2, plugin, data) {
611
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/plugins/${enc(plugin)}`, data);
612
+ }
613
+ async upgradeWphostingPlugin(contractId2, servername2, plugin) {
614
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/plugins/${enc(plugin)}/update`);
615
+ }
616
+ async deleteWphostingPlugin(contractId2, servername2, plugin) {
617
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/plugins/${enc(plugin)}`);
618
+ }
619
+ async listWphostingThemes(contractId2, servername2) {
620
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/themes`);
621
+ }
622
+ async installWphostingTheme(contractId2, servername2, data) {
623
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/themes`, data);
624
+ }
625
+ async updateWphostingTheme(contractId2, servername2, theme, data) {
626
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/themes/${enc(theme)}`, data);
627
+ }
628
+ async upgradeWphostingTheme(contractId2, servername2, theme) {
629
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/themes/${enc(theme)}/update`);
630
+ }
631
+ async deleteWphostingTheme(contractId2, servername2, theme) {
632
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/themes/${enc(theme)}`);
633
+ }
634
+ async listWphostingDomains(contractId2, servername2) {
635
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/domains`);
636
+ }
637
+ async addWphostingDomain(contractId2, servername2, data) {
638
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/domains`, data);
639
+ }
640
+ async verifyWphostingDomain(contractId2, servername2, domain) {
641
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/verify`);
642
+ }
643
+ async deleteWphostingDomain(contractId2, servername2, domain) {
644
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}`);
645
+ }
646
+ async updateWphostingSiteUrl(contractId2, servername2, data) {
647
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/site-url`, data);
648
+ }
649
+ async listWphostingDnsRecords(contractId2, servername2, domain) {
650
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns`);
651
+ }
652
+ async addWphostingDnsRecord(contractId2, servername2, domain, data) {
653
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns`, data);
654
+ }
655
+ async updateWphostingDnsRecord(contractId2, servername2, domain, dnsId, data) {
656
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns/${enc(dnsId)}`, data);
657
+ }
658
+ async deleteWphostingDnsRecord(contractId2, servername2, domain, dnsId) {
659
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns/${enc(dnsId)}`);
660
+ }
661
+ async getWphostingPhpVersion(contractId2, servername2) {
662
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/php-version`);
663
+ }
664
+ async updateWphostingPhpVersion(contractId2, servername2, data) {
665
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/php-version`, data);
666
+ }
667
+ async getWphostingAccessLog(contractId2, servername2, params) {
668
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/access-log`, params);
669
+ }
670
+ async getWphostingErrorLog(contractId2, servername2, params) {
671
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/error-log`, params);
672
+ }
673
+ async listWphostingCron(contractId2, servername2) {
674
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/cron`);
675
+ }
676
+ async addWphostingCron(contractId2, servername2, data) {
677
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/cron`, data);
678
+ }
679
+ async updateWphostingCron(contractId2, servername2, cronId, data) {
680
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/cron/${enc(cronId)}`, data);
681
+ }
682
+ async deleteWphostingCron(contractId2, servername2, cronId) {
683
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/cron/${enc(cronId)}`);
684
+ }
685
+ async getWphostingSsh(contractId2, servername2) {
686
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/ssh`);
687
+ }
688
+ async updateWphostingSsh(contractId2, servername2, data) {
689
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/ssh`, data);
690
+ }
691
+ async listWphostingSshKeys(contractId2, servername2) {
692
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key`);
693
+ }
694
+ async addWphostingSshKey(contractId2, servername2, data) {
695
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key`, data);
696
+ }
697
+ async updateWphostingSshKey(contractId2, servername2, keyId, data) {
698
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key/${enc(keyId)}`, data);
699
+ }
700
+ async deleteWphostingSshKey(contractId2, servername2, keyId) {
701
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key/${enc(keyId)}`);
702
+ }
703
+ async listWphostingWpUserRoles(contractId2, servername2) {
704
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/roles`);
705
+ }
706
+ async listWphostingWpUsers(contractId2, servername2, params) {
707
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wp-users`, params);
708
+ }
709
+ async createWphostingWpUser(contractId2, servername2, data) {
710
+ return this.post(`${this.wphostingSitePath(contractId2, servername2)}/wp-users`, data);
711
+ }
712
+ async getWphostingWpUser(contractId2, servername2, userId) {
713
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/${enc(userId)}`);
714
+ }
715
+ async updateWphostingWpUser(contractId2, servername2, userId, data) {
716
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/${enc(userId)}`, data);
717
+ }
718
+ async deleteWphostingWpUser(contractId2, servername2, userId) {
719
+ return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/${enc(userId)}`);
720
+ }
721
+ async getWphostingSecurity(contractId2, servername2) {
722
+ return this.get(`${this.wphostingSitePath(contractId2, servername2)}/security`);
723
+ }
724
+ async updateWphostingSecurity(contractId2, servername2, key, data) {
725
+ return this.put(`${this.wphostingSitePath(contractId2, servername2)}/security/${enc(key)}`, data);
726
+ }
727
+ // ================================================================
480
728
  // HTTP 基盤
481
729
  // ================================================================
482
730
  async get(path2, params) {
@@ -486,19 +734,20 @@ var ApiClient = class {
486
734
  }
487
735
  return this.request("GET", url);
488
736
  }
489
- async post(path2, data) {
490
- return this.request("POST", `${this.apiBase}${path2}`, data);
737
+ async post(path2, data, headers) {
738
+ return this.request("POST", `${this.apiBase}${path2}`, data, headers);
491
739
  }
492
740
  async put(path2, data) {
493
741
  return this.request("PUT", `${this.apiBase}${path2}`, data);
494
742
  }
495
- async delete(path2, data) {
496
- return this.request("DELETE", `${this.apiBase}${path2}`, data);
743
+ async delete(path2, data, headers) {
744
+ return this.request("DELETE", `${this.apiBase}${path2}`, data, headers);
497
745
  }
498
- async request(method, url, body) {
746
+ async request(method, url, body, additionalHeaders) {
499
747
  const headers = {
500
748
  "Authorization": `Bearer ${this.apiKey}`,
501
- "Accept": "application/json"
749
+ "Accept": "application/json",
750
+ ...additionalHeaders
502
751
  };
503
752
  const init = {
504
753
  method,
@@ -513,8 +762,8 @@ var ApiClient = class {
513
762
  const dbg = (msg) => process.stderr.write(`[DEBUG] ${msg}
514
763
  `);
515
764
  dbg(`${method} ${url}`);
516
- if (init.body)
517
- dbg(`Body: ${init.body}`);
765
+ if (body)
766
+ dbg(`Body: ${JSON.stringify(redactSensitiveValues(body))}`);
518
767
  }
519
768
  let response;
520
769
  try {
@@ -565,6 +814,49 @@ var ApiClient = class {
565
814
  function enc(s) {
566
815
  return encodeURIComponent(s);
567
816
  }
817
+ function idempotencyHeaders(idempotencyKey) {
818
+ return idempotencyKey === void 0 ? void 0 : { "Idempotency-Key": idempotencyKey };
819
+ }
820
+
821
+ // ../../shared/dist/brand-config.js
822
+ function domainLegalNoticeLines(brand) {
823
+ return [
824
+ `\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04: ${brand.domainTermsUrl}`,
825
+ `\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066: ${brand.domainPrivacyUrl}`
826
+ ];
827
+ }
828
+
829
+ // ../../shared/dist/domain-acquisition-permission.js
830
+ function record(value) {
831
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
832
+ }
833
+ function diagnosedForbidden(message) {
834
+ return new ApiError(message, 403, "FORBIDDEN", []);
835
+ }
836
+ async function withDomainAcquisitionPermissionDiagnosis(client2, request) {
837
+ try {
838
+ return await request();
839
+ } catch (error) {
840
+ if (!(error instanceof ApiError) || error.httpStatus !== 403 || error.errorCode !== "FORBIDDEN") {
841
+ throw error;
842
+ }
843
+ let meData;
844
+ try {
845
+ meData = await client2.getMe();
846
+ } catch {
847
+ throw error;
848
+ }
849
+ const services = record(meData.services);
850
+ const domain = record(services?.domain);
851
+ if (!domain) {
852
+ throw diagnosedForbidden("\u3053\u306EAPI\u30AD\u30FC\u3067\u306FDomain API\u3092\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002Domain\u30B5\u30FC\u30D3\u30B9\u3092\u542B\u3080API\u30AD\u30FC\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
853
+ }
854
+ if (domain.allow_acquisition === false) {
855
+ throw diagnosedForbidden("\u3053\u306EAPI\u30AD\u30FC\u3067\u306F\u3001\u30C9\u30E1\u30A4\u30F3\u306E\u53D6\u5F97\u53EF\u80FD\u6027\u30FB\u4FA1\u683C\u78BA\u8A8D\u30FB\u65B0\u898F\u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u5951\u7D04\u66F4\u65B0\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002API\u30AD\u30FC\u7BA1\u7406\u753B\u9762\u3067\u300C\u3053\u306E\u30AD\u30FC\u3067\u30C9\u30E1\u30A4\u30F3\u306E\u65B0\u898F\u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u66F4\u65B0\uFF08\u304A\u7533\u3057\u8FBC\u307F\uFF09\u3092\u8A31\u53EF\u3059\u308B\u300D\u3092\u6709\u52B9\u306B\u3057\u305FAPI\u30AD\u30FC\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
856
+ }
857
+ throw error;
858
+ }
859
+ }
568
860
 
569
861
  // ../core/dist/commands/auth/login.js
570
862
  import { password, select } from "@inquirer/prompts";
@@ -609,7 +901,118 @@ function getActiveProfile(brand, profileName) {
609
901
  return config.profiles[name] || null;
610
902
  }
611
903
 
904
+ // ../core/dist/lib/api-base.js
905
+ function resolveApiBase(brand) {
906
+ const envPrefix = brand.brand.toUpperCase();
907
+ return (process.env[`${envPrefix}_API_BASE_URL`] ?? process.env.XSERVER_API_BASE_URL ?? brand.apiBase).replace(/\/+$/, "");
908
+ }
909
+
910
+ // ../core/dist/lib/auth-service-info.js
911
+ var SERVICE_ORDER = ["server", "domain", "wphosting"];
912
+ var NO_DEFAULT_SERVER = "__XSERVER_NO_DEFAULT_SERVER__";
913
+ function servernameChoices(targets) {
914
+ return [
915
+ ...targets.map((target) => ({ value: target, name: target })),
916
+ {
917
+ value: NO_DEFAULT_SERVER,
918
+ name: "\u56FA\u5B9A\u3057\u306A\u3044\uFF08\u30B3\u30DE\u30F3\u30C9\u5B9F\u884C\u6642\u306B --servername \u3067\u6307\u5B9A\uFF09"
919
+ }
920
+ ];
921
+ }
922
+ function record2(value) {
923
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
924
+ }
925
+ function strings(value) {
926
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
927
+ }
928
+ function stringValue(value, fallback) {
929
+ return typeof value === "string" && value !== "" ? value : fallback;
930
+ }
931
+ function parseAuthApiKeyInfo(meData) {
932
+ const rawServices = record2(meData.services);
933
+ const services = [];
934
+ for (const name of SERVICE_ORDER) {
935
+ const block = record2(rawServices?.[name]);
936
+ if (!block)
937
+ continue;
938
+ const service = {
939
+ name,
940
+ permissionType: stringValue(block.permission_type, "unknown"),
941
+ targetMode: stringValue(block.target_mode, "unknown"),
942
+ targets: strings(block.targets)
943
+ };
944
+ if (name === "domain" && typeof block.allow_acquisition === "boolean") {
945
+ service.allowAcquisition = block.allow_acquisition;
946
+ }
947
+ if (name === "wphosting") {
948
+ service.siteTargetMode = stringValue(block.site_target_mode, "unknown");
949
+ service.sites = strings(block.sites);
950
+ }
951
+ services.push(service);
952
+ }
953
+ return {
954
+ expiresAt: typeof meData.expires_at === "string" ? meData.expires_at : null,
955
+ services
956
+ };
957
+ }
958
+ function hasAuthService(info, name) {
959
+ return info.services.some((service) => service.name === name);
960
+ }
961
+ function permissionLabel(value) {
962
+ if (value === "full")
963
+ return "\u3059\u3079\u3066\u306E\u64CD\u4F5C";
964
+ if (value === "read")
965
+ return "\u8AAD\u307F\u53D6\u308A\u5C02\u7528";
966
+ if (value === "custom")
967
+ return "\u30AB\u30B9\u30BF\u30E0";
968
+ return value === "unknown" ? "\u4E0D\u660E" : value;
969
+ }
970
+ function targetLines(service) {
971
+ if (service.name === "wphosting") {
972
+ if (service.targetMode === "all")
973
+ return [" \u5BFE\u8C61\u5951\u7D04: \u3059\u3079\u3066"];
974
+ return [" \u5BFE\u8C61\u5951\u7D04:", ...service.targets.map((target) => ` - ${target}`)];
975
+ }
976
+ const label = service.name === "server" ? "\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC" : "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3";
977
+ if (service.targetMode === "all") {
978
+ return [` ${label}: \u3059\u3079\u3066`];
979
+ }
980
+ const lines = [` ${label}:`];
981
+ lines.push(...service.targets.map((target) => ` - ${target}`));
982
+ return lines;
983
+ }
984
+ function siteTargetLines(service) {
985
+ if (service.name !== "wphosting")
986
+ return [];
987
+ if (service.siteTargetMode === "all")
988
+ return [" \u5BFE\u8C61\u30B5\u30A4\u30C8: \u3059\u3079\u3066"];
989
+ const sites = service.sites ?? [];
990
+ return [" \u5BFE\u8C61\u30B5\u30A4\u30C8:", ...sites.map((site) => ` - ${site}`)];
991
+ }
992
+ function formatAuthApiKeyInfo(info) {
993
+ const lines = ["\u5229\u7528\u53EF\u80FD\u306A\u30B5\u30FC\u30D3\u30B9:"];
994
+ if (info.services.length === 0) {
995
+ lines.push(" \u306A\u3057");
996
+ }
997
+ for (const service of info.services) {
998
+ const label = service.name === "server" ? "Server" : service.name === "domain" ? "Domain" : "XServer for WordPress";
999
+ lines.push(` ${label}`);
1000
+ lines.push(` \u6A29\u9650: ${permissionLabel(service.permissionType)}`);
1001
+ lines.push(...targetLines(service));
1002
+ lines.push(...siteTargetLines(service));
1003
+ if (service.name === "domain" && service.allowAcquisition !== void 0) {
1004
+ lines.push(` \u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u66F4\u65B0: ${service.allowAcquisition ? "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u3059" : "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}`);
1005
+ }
1006
+ }
1007
+ if (info.expiresAt) {
1008
+ lines.push("", `API\u30AD\u30FC\u6709\u52B9\u671F\u9650: ${info.expiresAt}`);
1009
+ }
1010
+ return lines;
1011
+ }
1012
+
612
1013
  // ../core/dist/lib/command-helper.js
1014
+ import { createInterface } from "readline/promises";
1015
+ import { stdin as input, stderr as output } from "process";
613
1016
  import { confirm } from "@inquirer/prompts";
614
1017
 
615
1018
  // ../core/dist/lib/output.js
@@ -728,11 +1131,11 @@ function resolveClient(cmd, brand) {
728
1131
  process.exit(1);
729
1132
  }
730
1133
  const debug = !!(rootOpts.debug || process.env.XSERVER_DEBUG === "1");
731
- const servername = resolveServername(cmd) ?? profile.servername;
1134
+ const servername2 = resolveServername(cmd) ?? profile.servername;
732
1135
  return new ApiClient({
733
1136
  apiKey: profile.apiKey,
734
- apiBase: brand.apiBase,
735
- servername,
1137
+ apiBase: resolveApiBase(brand),
1138
+ servername: servername2,
736
1139
  debug
737
1140
  });
738
1141
  }
@@ -753,6 +1156,9 @@ function getFormat(cmd) {
753
1156
  function printResult(data, format) {
754
1157
  console.log(formatOutput(data, format));
755
1158
  }
1159
+ function printPreview(data, format) {
1160
+ console.error(formatOutput(data, format));
1161
+ }
756
1162
  async function confirmDestructiveAction(cmd, message) {
757
1163
  const root = findRoot(cmd);
758
1164
  if (root.opts().yes || process.argv.includes("--yes") || process.argv.includes("-y"))
@@ -763,6 +1169,42 @@ async function confirmDestructiveAction(cmd, message) {
763
1169
  process.exit(1);
764
1170
  }
765
1171
  }
1172
+ function billingPurchasePhrase(domain, totalPrice) {
1173
+ return `${domain} \u3092\u7A0E\u8FBC${totalPrice}\u5186\u3067\u627F\u8A8D`;
1174
+ }
1175
+ function billingPurchaseMessage(params) {
1176
+ const phrase = billingPurchasePhrase(params.domain, params.totalPrice);
1177
+ return [
1178
+ `\u8AB2\u91D1\u78BA\u8A8D: ${params.operation}`,
1179
+ `\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3: ${params.domain}`,
1180
+ `\u7A0E\u8FBC\u5408\u8A08: ${params.totalPrice}\u5186`,
1181
+ ...domainLegalNoticeLines(params.brand),
1182
+ "\u7533\u8ACB\u5F8C\u306F\u8AB2\u91D1\u3055\u308C\u3001\u539F\u5247\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002",
1183
+ `\u7D9A\u884C\u3059\u308B\u5834\u5408\u306F\u6B21\u3092\u6B63\u78BA\u306B\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: ${phrase}`,
1184
+ ""
1185
+ ].join("\n");
1186
+ }
1187
+ async function confirmBillingPurchase(params) {
1188
+ if (!input.isTTY || !output.isTTY) {
1189
+ throw new Error("\u8AB2\u91D1\u3092\u4F34\u3046\u5B9F\u7533\u8ACB\u306F\u5BFE\u8A71\u7AEF\u672B\uFF08TTY\uFF09\u3067\u306E\u307F\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002\u975E\u5BFE\u8A71\u74B0\u5883\u3067\u306F --dry-run \u306E\u307F\u5229\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
1190
+ }
1191
+ const phrase = billingPurchasePhrase(params.domain, params.totalPrice);
1192
+ output.write(billingPurchaseMessage(params));
1193
+ const rl = createInterface({ input, output, terminal: true });
1194
+ try {
1195
+ const answer = (await rl.question("> ")).trim();
1196
+ if (answer !== phrase) {
1197
+ throw new Error("\u78BA\u8A8D\u6587\u5B57\u5217\u304C\u4E00\u81F4\u3057\u306A\u3044\u305F\u3081\u3001\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\u3002");
1198
+ }
1199
+ } finally {
1200
+ rl.close();
1201
+ }
1202
+ }
1203
+ function printIdempotencyKeyNotice(idempotencyKey, domain) {
1204
+ console.error(`Idempotency-Key: ${idempotencyKey}`);
1205
+ console.error("\u5165\u529B\u4E0D\u5099\u30FB\u6B8B\u9AD8\u4E0D\u8DB3\u30FB\u4FA1\u683C\u4E0D\u4E00\u81F4\u306A\u3069\u3067\u5374\u4E0B\u3055\u308C\u305F\u5834\u5408\u306F\u3001\u3053\u306E\u30AD\u30FC\u306E\u307E\u307E\u518D\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002");
1206
+ console.error(`\u5FDC\u7B54\u3092\u53D7\u3051\u53D6\u308C\u306A\u304B\u3063\u305F\u5834\u5408\u3084\u30B5\u30FC\u30D0\u30FC\u30A8\u30E9\u30FC\u306E\u5834\u5408\u306F\u3001\u540C\u3058\u30AD\u30FC\u3067\u306E\u518D\u9001\u306F48\u6642\u9593 409 DUPLICATE_REQUEST \u306B\u306A\u308A\u307E\u3059\u3002domain show ${domain} \u3068\u8ACB\u6C42\u5C65\u6B74\u3067\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3001\u672A\u5B9F\u884C\u3068\u78BA\u8A8D\u3067\u304D\u305F\u3068\u304D\u306E\u307F\u65B0\u3057\u3044\u30AD\u30FC\u3067\u518D\u7533\u8ACB\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
1207
+ }
766
1208
  function pickDefined(obj) {
767
1209
  const result = {};
768
1210
  for (const [key, value] of Object.entries(obj)) {
@@ -825,9 +1267,13 @@ async function resolveLoginServername(meData, brand) {
825
1267
  if (outcome.status === "choose") {
826
1268
  if (process.stdin.isTTY) {
827
1269
  const chosen = await select({
828
- message: "\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u3092\u9078\u629E:",
829
- choices: outcome.targets.map((target) => ({ value: target, name: target }))
1270
+ message: "\u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u306E\u65E2\u5B9A\u30B5\u30FC\u30D0\u30FC\u3092\u9078\u629E:",
1271
+ choices: servernameChoices(outcome.targets)
830
1272
  });
1273
+ if (chosen === NO_DEFAULT_SERVER) {
1274
+ console.error(" \u30B5\u30FC\u30D0\u30FC\u540D: \u672A\u56FA\u5B9A\uFF08\u30B3\u30DE\u30F3\u30C9\u5B9F\u884C\u6642\u306B --servername \u3067\u6307\u5B9A\uFF09");
1275
+ return void 0;
1276
+ }
831
1277
  console.error(` \u30B5\u30FC\u30D0\u30FC\u540D: ${chosen}`);
832
1278
  return chosen;
833
1279
  }
@@ -844,10 +1290,10 @@ async function resolveLoginServername(meData, brand) {
844
1290
  }
845
1291
  function registerAuthCommands(program, brand) {
846
1292
  const auth = program.command("auth").description("\u8A8D\u8A3C\u8A2D\u5B9A");
847
- auth.command("login").description("API\u30AD\u30FC\u3092\u8A2D\u5B9A\uFF08\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u304C1\u53F0\u306E\u30AD\u30FC\u306F\u30B5\u30FC\u30D0\u30FC\u540D\u3092\u81EA\u52D5\u691C\u51FA\uFF09").option("--api-key <key>", "API\u30AD\u30FC").option("--servername <name>", "\u30B5\u30FC\u30D0\u30FC\u540D\uFF08\u81EA\u52D5\u691C\u51FA\u3092\u4E0A\u66F8\u304D\uFF09").action(async (opts, cmd) => {
1293
+ auth.command("login").description("API\u30AD\u30FC\u3092\u691C\u8A3C\u3057\u3001\u5229\u7528\u53EF\u80FD\u30B5\u30FC\u30D3\u30B9\u3068\u8A8D\u8A3C\u8A2D\u5B9A\u3092\u4FDD\u5B58").option("--api-key <key>", "API\u30AD\u30FC").option("--servername <name>", "\u30B5\u30FC\u30D0\u30FC\u540D\uFF08\u81EA\u52D5\u691C\u51FA\u3092\u4E0A\u66F8\u304D\uFF09").action(async (opts, cmd) => {
848
1294
  const profileName = cmd.optsWithGlobals().profile ?? "default";
849
1295
  let apiKey = opts.apiKey;
850
- let servername = opts.servername;
1296
+ let servername2 = opts.servername;
851
1297
  if (!apiKey) {
852
1298
  apiKey = await password({ message: "API\u30AD\u30FC\u3092\u5165\u529B:", mask: true });
853
1299
  }
@@ -856,10 +1302,11 @@ function registerAuthCommands(program, brand) {
856
1302
  process.exit(1);
857
1303
  }
858
1304
  console.error("\u8A8D\u8A3C\u60C5\u5831\u3092\u691C\u8A3C\u4E2D...");
859
- const client = new ApiClient({ apiKey, apiBase: brand.apiBase });
1305
+ const apiBase = resolveApiBase(brand);
1306
+ const client2 = new ApiClient({ apiKey, apiBase });
860
1307
  let meData;
861
1308
  try {
862
- meData = await client.getMe();
1309
+ meData = await client2.getMe();
863
1310
  } catch (err) {
864
1311
  if (err instanceof ApiError && err.errorCode === "UNAUTHORIZED") {
865
1312
  console.error("\u30A8\u30E9\u30FC: API\u30AD\u30FC\u304C\u7121\u52B9\u3067\u3059\u3002\u6B63\u3057\u3044API\u30AD\u30FC\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
@@ -868,13 +1315,19 @@ function registerAuthCommands(program, brand) {
868
1315
  throw err;
869
1316
  }
870
1317
  console.error("\u2713 \u8A8D\u8A3C\u306B\u6210\u529F\u3057\u307E\u3057\u305F");
871
- if (!servername) {
872
- servername = await resolveLoginServername(meData, brand);
1318
+ const apiKeyInfo = parseAuthApiKeyInfo(meData);
1319
+ console.error("");
1320
+ for (const line of formatAuthApiKeyInfo(apiKeyInfo)) {
1321
+ console.error(line);
1322
+ }
1323
+ console.error("");
1324
+ if (!servername2 && hasAuthService(apiKeyInfo, "server")) {
1325
+ servername2 = await resolveLoginServername(meData, brand);
873
1326
  }
874
1327
  const config = loadConfig(brand);
875
1328
  config.profiles[profileName] = {
876
1329
  apiKey,
877
- ...servername ? { servername } : {}
1330
+ ...servername2 ? { servername: servername2 } : {}
878
1331
  };
879
1332
  if (!config.defaultProfile) {
880
1333
  config.defaultProfile = profileName;
@@ -907,7 +1360,7 @@ function registerAuthCommands(program, brand) {
907
1360
  profile: profileName,
908
1361
  api_key: maskApiKey(profile.apiKey),
909
1362
  servername: profile.servername ?? null,
910
- api_base: brand.apiBase
1363
+ api_base: resolveApiBase(brand)
911
1364
  }, format);
912
1365
  return;
913
1366
  }
@@ -918,7 +1371,7 @@ function registerAuthCommands(program, brand) {
918
1371
  } else {
919
1372
  console.log("\u30B5\u30FC\u30D0\u30FC\u540D: \u672A\u56FA\u5B9A\uFF08\u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u3067\u306F --servername \u3067\u6307\u5B9A\uFF09");
920
1373
  }
921
- console.log(`API\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8: ${brand.apiBase}`);
1374
+ console.log(`API\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8: ${resolveApiBase(brand)}`);
922
1375
  });
923
1376
  auth.command("profiles").description("\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7\u3092\u8868\u793A").action((_opts, cmd) => {
924
1377
  const format = getFormat(cmd);
@@ -966,12 +1419,12 @@ function registerAuthCommands(program, brand) {
966
1419
  // ../core/dist/commands/server/info.js
967
1420
  function registerServerInfoCommands(parent, brand) {
968
1421
  parent.command("info").description("\u30B5\u30FC\u30D0\u30FC\u60C5\u5831\u3092\u53D6\u5F97").action(async () => {
969
- const client = resolveClient(parent, brand);
970
- printResult(await client.getServerInfo(), getFormat(parent));
1422
+ const client2 = resolveClient(parent, brand);
1423
+ printResult(await client2.getServerInfo(), getFormat(parent));
971
1424
  });
972
1425
  parent.command("usage").description("\u30B5\u30FC\u30D0\u30FC\u5229\u7528\u72B6\u6CC1\u3092\u53D6\u5F97").action(async () => {
973
- const client = resolveClient(parent, brand);
974
- printResult(await client.getServerUsage(), getFormat(parent));
1426
+ const client2 = resolveClient(parent, brand);
1427
+ printResult(await client2.getServerUsage(), getFormat(parent));
975
1428
  });
976
1429
  }
977
1430
 
@@ -979,11 +1432,11 @@ function registerServerInfoCommands(parent, brand) {
979
1432
  function registerCronCommands(parent, brand) {
980
1433
  const cron = parent.command("cron").description("Cron\u8A2D\u5B9A");
981
1434
  cron.command("list").description("Cron\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
982
- const client = resolveClient(parent, brand);
983
- printResult(await client.listCron(), getFormat(parent));
1435
+ const client2 = resolveClient(parent, brand);
1436
+ printResult(await client2.listCron(), getFormat(parent));
984
1437
  });
985
1438
  cron.command("add").description("Cron\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--minute <value>", "\u5206\uFF08\u4F8B: */5, 0, *\uFF09").requiredOption("--hour <value>", "\u6642\uFF08\u4F8B: *, 3, 0-6\uFF09").requiredOption("--command <value>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--day <value>", "\u65E5", "*").option("--month <value>", "\u6708", "*").option("--weekday <value>", "\u66DC\u65E5", "*").option("--comment <value>", "\u30E1\u30E2").action(async (opts) => {
986
- const client = resolveClient(parent, brand);
1439
+ const client2 = resolveClient(parent, brand);
987
1440
  const data = pickDefined({
988
1441
  minute: opts.minute,
989
1442
  hour: opts.hour,
@@ -993,10 +1446,10 @@ function registerCronCommands(parent, brand) {
993
1446
  command: opts.command,
994
1447
  comment: opts.comment
995
1448
  });
996
- printResult(await client.addCron(data), getFormat(parent));
1449
+ printResult(await client2.addCron(data), getFormat(parent));
997
1450
  });
998
1451
  cron.command("update <cronId>").description("Cron\u3092\u66F4\u65B0").option("--minute <value>", "\u5206").option("--hour <value>", "\u6642").option("--day <value>", "\u65E5").option("--month <value>", "\u6708").option("--weekday <value>", "\u66DC\u65E5").option("--command <value>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--comment <value>", "\u30E1\u30E2").option("--enabled <value>", "\u6709\u52B9/\u7121\u52B9 (true/false)").action(async (cronId, opts) => {
999
- const client = resolveClient(parent, brand);
1452
+ const client2 = resolveClient(parent, brand);
1000
1453
  const data = pickDefined({
1001
1454
  minute: opts.minute,
1002
1455
  hour: opts.hour,
@@ -1008,12 +1461,12 @@ function registerCronCommands(parent, brand) {
1008
1461
  });
1009
1462
  if (opts.enabled !== void 0)
1010
1463
  data.enabled = opts.enabled === "true";
1011
- printResult(await client.updateCron(cronId, data), getFormat(parent));
1464
+ printResult(await client2.updateCron(cronId, data), getFormat(parent));
1012
1465
  });
1013
1466
  cron.command("delete <cronId>").description("Cron\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (cronId) => {
1014
1467
  await confirmDestructiveAction(parent, `Cron "${cronId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1015
- const client = resolveClient(parent, brand);
1016
- printResult(await client.deleteCron(cronId), getFormat(parent));
1468
+ const client2 = resolveClient(parent, brand);
1469
+ printResult(await client2.deleteCron(cronId), getFormat(parent));
1017
1470
  });
1018
1471
  }
1019
1472
 
@@ -1021,14 +1474,14 @@ function registerCronCommands(parent, brand) {
1021
1474
  function registerWpCommands(parent, brand) {
1022
1475
  const wp = parent.command("wp").description("WordPress\u7C21\u5358\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB");
1023
1476
  wp.command("list").description("WordPress\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1024
- const client = resolveClient(parent, brand);
1477
+ const client2 = resolveClient(parent, brand);
1025
1478
  const params = {};
1026
1479
  if (opts.domain)
1027
1480
  params.domain = opts.domain;
1028
- printResult(await client.listWordpress(params), getFormat(parent));
1481
+ printResult(await client2.listWordpress(params), getFormat(parent));
1029
1482
  });
1030
1483
  wp.command("add").description("WordPress\u3092\u65B0\u898F\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").requiredOption("--url <url>", "\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u5148URL\uFF08\u4F8B: example.com/blog\uFF09").requiredOption("--title <title>", "\u30B5\u30A4\u30C8\u30BF\u30A4\u30C8\u30EB").requiredOption("--admin-username <username>", "\u7BA1\u7406\u8005\u30E6\u30FC\u30B6\u30FC\u540D").requiredOption("--admin-password <password>", "\u7BA1\u7406\u8005\u30D1\u30B9\u30EF\u30FC\u30C9").requiredOption("--admin-email <email>", "\u7BA1\u7406\u8005\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9").option("--memo <value>", "\u30E1\u30E2").action(async (opts) => {
1031
- const client = resolveClient(parent, brand);
1484
+ const client2 = resolveClient(parent, brand);
1032
1485
  const data = pickDefined({
1033
1486
  url: opts.url,
1034
1487
  title: opts.title,
@@ -1037,21 +1490,21 @@ function registerWpCommands(parent, brand) {
1037
1490
  admin_email: opts.adminEmail,
1038
1491
  memo: opts.memo
1039
1492
  });
1040
- printResult(await client.addWordpress(data), getFormat(parent));
1493
+ printResult(await client2.addWordpress(data), getFormat(parent));
1041
1494
  });
1042
1495
  wp.command("update <wpId>").description("WordPress\u8A2D\u5B9A\u3092\u5909\u66F4").option("--memo <value>", "\u30E1\u30E2").action(async (wpId, opts) => {
1043
- const client = resolveClient(parent, brand);
1044
- printResult(await client.updateWordpress(wpId, pickDefined({ memo: opts.memo })), getFormat(parent));
1496
+ const client2 = resolveClient(parent, brand);
1497
+ printResult(await client2.updateWordpress(wpId, pickDefined({ memo: opts.memo })), getFormat(parent));
1045
1498
  });
1046
1499
  wp.command("delete <wpId>").description("WordPress\u3092\u524A\u9664").option("--delete-db <value>", "\u95A2\u9023\u3059\u308BMySQL\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3082\u524A\u9664\u3059\u308B\u304B\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--delete-db-user <value>", "\u95A2\u9023\u3059\u308BMySQL\u30E6\u30FC\u30B6\u30FC\u3082\u524A\u9664\u3059\u308B\u304B\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: false\uFF09").option("--delete-cron <value>", "\u30AD\u30E3\u30C3\u30B7\u30E5\u81EA\u52D5\u524A\u9664Cron\u3082\u524A\u9664\u3059\u308B\u304B\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (wpId, opts) => {
1047
1500
  await confirmDestructiveAction(parent, `WordPress "${wpId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1048
- const client = resolveClient(parent, brand);
1501
+ const client2 = resolveClient(parent, brand);
1049
1502
  const data = pickDefined({
1050
1503
  delete_db: opts.deleteDb !== void 0 ? opts.deleteDb === "true" : void 0,
1051
1504
  delete_db_user: opts.deleteDbUser !== void 0 ? opts.deleteDbUser === "true" : void 0,
1052
1505
  delete_cron: opts.deleteCron !== void 0 ? opts.deleteCron === "true" : void 0
1053
1506
  });
1054
- printResult(await client.deleteWordpress(wpId, data), getFormat(parent));
1507
+ printResult(await client2.deleteWordpress(wpId, data), getFormat(parent));
1055
1508
  });
1056
1509
  }
1057
1510
 
@@ -1059,29 +1512,29 @@ function registerWpCommands(parent, brand) {
1059
1512
  function registerMailCommands(parent, brand) {
1060
1513
  const mail = parent.command("mail").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A");
1061
1514
  mail.command("list").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1062
- const client = resolveClient(parent, brand);
1515
+ const client2 = resolveClient(parent, brand);
1063
1516
  const params = {};
1064
1517
  if (opts.domain)
1065
1518
  params.domain = opts.domain;
1066
- printResult(await client.listMail(params), getFormat(parent));
1519
+ printResult(await client2.listMail(params), getFormat(parent));
1067
1520
  });
1068
1521
  mail.command("get <mailAccount>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A73\u7D30\u3092\u53D6\u5F97").action(async (mailAccount) => {
1069
- const client = resolveClient(parent, brand);
1070
- printResult(await client.getMail(mailAccount), getFormat(parent));
1522
+ const client2 = resolveClient(parent, brand);
1523
+ printResult(await client2.getMail(mailAccount), getFormat(parent));
1071
1524
  });
1072
1525
  mail.command("add <mailAddress>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--quota-mb <mb>", "\u5BB9\u91CF\uFF08MB\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (mailAddress, opts) => {
1073
- const client = resolveClient(parent, brand);
1526
+ const client2 = resolveClient(parent, brand);
1074
1527
  const data = pickDefined({
1075
1528
  mail_address: mailAddress,
1076
1529
  password: opts.password,
1077
1530
  quota_mb: opts.quotaMb !== void 0 ? parseInt(opts.quotaMb, 10) : void 0,
1078
1531
  memo: opts.memo
1079
1532
  });
1080
- printResult(await client.addMail(data), getFormat(parent));
1533
+ printResult(await client2.addMail(data), getFormat(parent));
1081
1534
  });
1082
1535
  mail.command("update <mailAccount>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A\u3092\u5909\u66F4").option("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--quota-mb <mb>", "\u5BB9\u91CF\uFF08MB\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (mailAccount, opts) => {
1083
- const client = resolveClient(parent, brand);
1084
- printResult(await client.updateMail(mailAccount, pickDefined({
1536
+ const client2 = resolveClient(parent, brand);
1537
+ printResult(await client2.updateMail(mailAccount, pickDefined({
1085
1538
  password: opts.password,
1086
1539
  quota_mb: opts.quotaMb !== void 0 ? parseInt(opts.quotaMb, 10) : void 0,
1087
1540
  memo: opts.memo
@@ -1089,21 +1542,21 @@ function registerMailCommands(parent, brand) {
1089
1542
  });
1090
1543
  mail.command("delete <mailAccount>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (mailAccount) => {
1091
1544
  await confirmDestructiveAction(parent, `\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8 "${mailAccount}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1092
- const client = resolveClient(parent, brand);
1093
- printResult(await client.deleteMail(mailAccount), getFormat(parent));
1545
+ const client2 = resolveClient(parent, brand);
1546
+ printResult(await client2.deleteMail(mailAccount), getFormat(parent));
1094
1547
  });
1095
1548
  mail.command("forwarding-get <mailAccount>").description("\u30E1\u30FC\u30EB\u8EE2\u9001\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (mailAccount) => {
1096
- const client = resolveClient(parent, brand);
1097
- printResult(await client.getMailForwarding(mailAccount), getFormat(parent));
1549
+ const client2 = resolveClient(parent, brand);
1550
+ printResult(await client2.getMailForwarding(mailAccount), getFormat(parent));
1098
1551
  });
1099
1552
  mail.command("forwarding-update <mailAccount>").description("\u30E1\u30FC\u30EB\u8EE2\u9001\u8A2D\u5B9A\u3092\u66F4\u65B0").option("--forwarding-addresses <addresses>", "\u8EE2\u9001\u5148\u30A2\u30C9\u30EC\u30B9\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").option("--keep-in-mailbox <value>", "\u8EE2\u9001\u5F8C\u3082\u30E1\u30FC\u30EB\u30DC\u30C3\u30AF\u30B9\u306B\u6B8B\u3059\u304B\uFF08true/false\uFF09").action(async (mailAccount, opts) => {
1100
- const client = resolveClient(parent, brand);
1553
+ const client2 = resolveClient(parent, brand);
1101
1554
  const data = {};
1102
1555
  if (opts.forwardingAddresses)
1103
1556
  data.forwarding_addresses = opts.forwardingAddresses.split(",").map((a) => a.trim());
1104
1557
  if (opts.keepInMailbox !== void 0)
1105
1558
  data.keep_in_mailbox = opts.keepInMailbox === "true";
1106
- printResult(await client.updateMailForwarding(mailAccount, data), getFormat(parent));
1559
+ printResult(await client2.updateMailForwarding(mailAccount, data), getFormat(parent));
1107
1560
  });
1108
1561
  }
1109
1562
 
@@ -1117,11 +1570,11 @@ function parseAddressList(value) {
1117
1570
  function registerSpamFilterCommands(parent, brand) {
1118
1571
  const spamFilter = parent.command("spam-filter").description("\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\u8A2D\u5B9A");
1119
1572
  spamFilter.command("list").description("\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1120
- const client = resolveClient(parent, brand);
1573
+ const client2 = resolveClient(parent, brand);
1121
1574
  const params = {};
1122
1575
  if (opts.domain)
1123
1576
  params.domain = opts.domain;
1124
- printResult(await client.listSpamFilter(params), getFormat(parent));
1577
+ printResult(await client2.listSpamFilter(params), getFormat(parent));
1125
1578
  });
1126
1579
  spamFilter.command("update <domain>").description("\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09").option("--filter-type <value>", "\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\uFF08off / standard / cloudmark_authority\uFF09").option("--detection-action <action>", "\u691C\u77E5\u6642\u306E\u51E6\u7406\uFF08inbox / spam / trash / delete\uFF09").option("--white-list <addresses>", "\u30DB\u30EF\u30A4\u30C8\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u7A7A\u6587\u5B57\u3067\u30AF\u30EA\u30A2\uFF09").option("--black-list <addresses>", "\u30D6\u30E9\u30C3\u30AF\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u7A7A\u6587\u5B57\u3067\u30AF\u30EA\u30A2\uFF09").option("--spam-level <level>", "\u6A19\u6E96\u30B9\u30D1\u30E0\u30D5\u30A3\u30EB\u30BF\u5224\u5B9A\u57FA\u6E96\uFF08very_lenient / lenient / normal / strict / very_strict / strictest\uFF09").option("--strict-non-japanese-subject <value>", "\u65E5\u672C\u8A9E\u3092\u542B\u307E\u306A\u3044\u4EF6\u540D\u306B\u5BFE\u3057\u3066\u5224\u5B9A\u3092\u53B3\u3057\u304F\u3059\u308B\uFF08true/false\uFF09").option("--strict-html-mail <value>", "HTML\u30E1\u30FC\u30EB\u306B\u5BFE\u3057\u3066\u5224\u5B9A\u3092\u53B3\u3057\u304F\u3059\u308B\uFF08true/false\uFF09").action(async (domain, opts) => {
1127
1580
  const data = {};
@@ -1144,12 +1597,12 @@ function registerSpamFilterCommands(parent, brand) {
1144
1597
  if (Object.keys(data).length === 0) {
1145
1598
  throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1146
1599
  }
1147
- const client = resolveClient(parent, brand);
1148
- printResult(await client.updateSpamFilter(domain, data), getFormat(parent));
1600
+ const client2 = resolveClient(parent, brand);
1601
+ printResult(await client2.updateSpamFilter(domain, data), getFormat(parent));
1149
1602
  });
1150
1603
  spamFilter.command("dmarc-receiver-update <domain>").description("\u53D7\u4FE1\u5074DMARC\u8A2D\u5B9A\u3092\u66F4\u65B0").requiredOption("--dmarc-receiver <value>", "\u53D7\u4FE1\u5074DMARC\u8A2D\u5B9A\uFF08true/false\uFF09").action(async (domain, opts) => {
1151
- const client = resolveClient(parent, brand);
1152
- printResult(await client.updateSpamFilterDmarcReceiver(domain, {
1604
+ const client2 = resolveClient(parent, brand);
1605
+ printResult(await client2.updateSpamFilterDmarcReceiver(domain, {
1153
1606
  dmarc_receiver: opts.dmarcReceiver
1154
1607
  }), getFormat(parent));
1155
1608
  });
@@ -1159,14 +1612,14 @@ function registerSpamFilterCommands(parent, brand) {
1159
1612
  function registerMailFilterCommands(parent, brand) {
1160
1613
  const mailFilter = parent.command("mail-filter").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A");
1161
1614
  mailFilter.command("list").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A\u306E\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1162
- const client = resolveClient(parent, brand);
1615
+ const client2 = resolveClient(parent, brand);
1163
1616
  const params = {};
1164
1617
  if (opts.domain)
1165
1618
  params.domain = opts.domain;
1166
- printResult(await client.listMailFilter(params), getFormat(parent));
1619
+ printResult(await client2.listMailFilter(params), getFormat(parent));
1167
1620
  });
1168
1621
  mailFilter.command("add").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--condition-keyword <keyword>", "\u6761\u4EF6\u30AD\u30FC\u30EF\u30FC\u30C9").requiredOption("--condition-field <field>", "\u6761\u4EF6\u5BFE\u8C61\uFF08subject / from / to / body / header\uFF09").option("--condition-match-type <type>", "\u4E00\u81F4\u6761\u4EF6\uFF08contain / match / start_from\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: contain\uFF09").requiredOption("--action-type <type>", "\u30A2\u30AF\u30B7\u30E7\u30F3\u7A2E\u5225\uFF08mail_address / spam_folder / trash / delete\uFF09").option("--action-target <target>", "\u8EE2\u9001\u5148\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08action-type\u304Cmail_address\u306E\u5834\u5408\uFF09").option("--action-method <method>", "\u51E6\u7406\u65B9\u6CD5\uFF08move / copy\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: move\uFF09").action(async (opts) => {
1169
- const client = resolveClient(parent, brand);
1622
+ const client2 = resolveClient(parent, brand);
1170
1623
  const data = {
1171
1624
  domain: opts.domain,
1172
1625
  conditions: [{
@@ -1180,12 +1633,12 @@ function registerMailFilterCommands(parent, brand) {
1180
1633
  method: opts.actionMethod || "move"
1181
1634
  }
1182
1635
  };
1183
- printResult(await client.addMailFilter(data), getFormat(parent));
1636
+ printResult(await client2.addMailFilter(data), getFormat(parent));
1184
1637
  });
1185
1638
  mailFilter.command("delete <filterId>").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (filterId) => {
1186
1639
  await confirmDestructiveAction(parent, `\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A "${filterId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1187
- const client = resolveClient(parent, brand);
1188
- printResult(await client.deleteMailFilter(filterId), getFormat(parent));
1640
+ const client2 = resolveClient(parent, brand);
1641
+ printResult(await client2.deleteMailFilter(filterId), getFormat(parent));
1189
1642
  });
1190
1643
  }
1191
1644
 
@@ -1193,19 +1646,19 @@ function registerMailFilterCommands(parent, brand) {
1193
1646
  function registerAutoReplyCommands(parent, brand) {
1194
1647
  const autoReply = parent.command("auto-reply").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A");
1195
1648
  autoReply.command("list").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u306E\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1196
- const client = resolveClient(parent, brand);
1649
+ const client2 = resolveClient(parent, brand);
1197
1650
  const params = {};
1198
1651
  if (opts.domain)
1199
1652
  params.domain = opts.domain;
1200
- printResult(await client.listAutoReply(params), getFormat(parent));
1653
+ printResult(await client2.listAutoReply(params), getFormat(parent));
1201
1654
  });
1202
1655
  autoReply.command("get <mailAddress>").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (mailAccount) => {
1203
- const client = resolveClient(parent, brand);
1204
- printResult(await client.getAutoReply(mailAccount), getFormat(parent));
1656
+ const client2 = resolveClient(parent, brand);
1657
+ printResult(await client2.getAutoReply(mailAccount), getFormat(parent));
1205
1658
  });
1206
1659
  autoReply.command("add").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--mail-address <address>", "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9").requiredOption("--from-name <name>", "\u9001\u4FE1\u8005\u540D").requiredOption("--subject <subject>", "\u4EF6\u540D").requiredOption("--body <body>", "\u672C\u6587").requiredOption("--quote-incoming <value>", "\u53D7\u4FE1\u30E1\u30FC\u30EB\u306E\u5F15\u7528\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (opts) => {
1207
- const client = resolveClient(parent, brand);
1208
- printResult(await client.addAutoReply({
1660
+ const client2 = resolveClient(parent, brand);
1661
+ printResult(await client2.addAutoReply({
1209
1662
  domain: opts.domain,
1210
1663
  mail_address: opts.mailAddress,
1211
1664
  from_name: opts.fromName,
@@ -1228,13 +1681,13 @@ function registerAutoReplyCommands(parent, brand) {
1228
1681
  if (Object.keys(data).length === 0) {
1229
1682
  throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08--from-name / --subject / --body / --quote-incoming\uFF09");
1230
1683
  }
1231
- const client = resolveClient(parent, brand);
1232
- printResult(await client.updateAutoReply(mailAccount, data), getFormat(parent));
1684
+ const client2 = resolveClient(parent, brand);
1685
+ printResult(await client2.updateAutoReply(mailAccount, data), getFormat(parent));
1233
1686
  });
1234
1687
  autoReply.command("delete <mailAddress>").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (mailAccount) => {
1235
1688
  await confirmDestructiveAction(parent, `\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A "${mailAccount}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1236
- const client = resolveClient(parent, brand);
1237
- printResult(await client.deleteAutoReply(mailAccount), getFormat(parent));
1689
+ const client2 = resolveClient(parent, brand);
1690
+ printResult(await client2.deleteAutoReply(mailAccount), getFormat(parent));
1238
1691
  });
1239
1692
  }
1240
1693
 
@@ -1242,15 +1695,15 @@ function registerAutoReplyCommands(parent, brand) {
1242
1695
  function registerSmtpAbroadRestrictionCommands(parent, brand) {
1243
1696
  const smtpAbroadRestriction = parent.command("smtp-abroad-restriction").description("SMTP\u8A8D\u8A3C\u306E\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u8A2D\u5B9A");
1244
1697
  smtpAbroadRestriction.command("list").description("SMTP\u8A8D\u8A3C\u306E\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1245
- const client = resolveClient(parent, brand);
1698
+ const client2 = resolveClient(parent, brand);
1246
1699
  const params = {};
1247
1700
  if (opts.domain)
1248
1701
  params.domain = opts.domain;
1249
- printResult(await client.listSmtpAbroadRestriction(params), getFormat(parent));
1702
+ printResult(await client2.listSmtpAbroadRestriction(params), getFormat(parent));
1250
1703
  });
1251
1704
  smtpAbroadRestriction.command("update <domain>").description("SMTP\u8A8D\u8A3C\u306E\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u8A2D\u5B9A\u3092\u66F4\u65B0").requiredOption("--abroad-access-restriction <value>", "\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (domain, opts) => {
1252
- const client = resolveClient(parent, brand);
1253
- printResult(await client.updateSmtpAbroadRestriction(domain, {
1705
+ const client2 = resolveClient(parent, brand);
1706
+ printResult(await client2.updateSmtpAbroadRestriction(domain, {
1254
1707
  abroad_access_restriction: opts.abroadAccessRestriction
1255
1708
  }), getFormat(parent));
1256
1709
  });
@@ -1260,19 +1713,19 @@ function registerSmtpAbroadRestrictionCommands(parent, brand) {
1260
1713
  function registerDkimCommands(parent, brand) {
1261
1714
  const dkim = parent.command("dkim").description("DKIM\u8A2D\u5B9A");
1262
1715
  dkim.command("list").description("DKIM\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1263
- const client = resolveClient(parent, brand);
1716
+ const client2 = resolveClient(parent, brand);
1264
1717
  const params = {};
1265
1718
  if (opts.domain)
1266
1719
  params.domain = opts.domain;
1267
- printResult(await client.listDkim(params), getFormat(parent));
1720
+ printResult(await client2.listDkim(params), getFormat(parent));
1268
1721
  });
1269
1722
  dkim.command("get <fqdn>").description("DKIM\u8A2D\u5B9A\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (fqdn) => {
1270
- const client = resolveClient(parent, brand);
1271
- printResult(await client.getDkim(fqdn), getFormat(parent));
1723
+ const client2 = resolveClient(parent, brand);
1724
+ printResult(await client2.getDkim(fqdn), getFormat(parent));
1272
1725
  });
1273
1726
  dkim.command("update <fqdn>").description("DKIM\u8A2D\u5B9A\u306E\u6709\u52B9/\u7121\u52B9\u3092\u5207\u308A\u66FF\u3048").requiredOption("--enabled <value>", "DKIM\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (fqdn, opts) => {
1274
- const client = resolveClient(parent, brand);
1275
- printResult(await client.updateDkim(fqdn, { enabled: opts.enabled }), getFormat(parent));
1727
+ const client2 = resolveClient(parent, brand);
1728
+ printResult(await client2.updateDkim(fqdn, { enabled: opts.enabled }), getFormat(parent));
1276
1729
  });
1277
1730
  }
1278
1731
 
@@ -1286,11 +1739,11 @@ function parseNotificationMailAddresses(value) {
1286
1739
  function registerDmarcCommands(parent, brand) {
1287
1740
  const dmarc = parent.command("dmarc").description("\u9001\u4FE1\u5074DMARC\u8A2D\u5B9A");
1288
1741
  dmarc.command("list").description("\u9001\u4FE1\u5074DMARC\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1289
- const client = resolveClient(parent, brand);
1742
+ const client2 = resolveClient(parent, brand);
1290
1743
  const params = {};
1291
1744
  if (opts.domain)
1292
1745
  params.domain = opts.domain;
1293
- printResult(await client.listDmarc(params), getFormat(parent));
1746
+ printResult(await client2.listDmarc(params), getFormat(parent));
1294
1747
  });
1295
1748
  dmarc.command("update <domain>").description("\u9001\u4FE1\u5074DMARC\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09").option("--policy <policy>", "DMARC\u30DD\u30EA\u30B7\u30FC\uFF08none / quarantine / reject\uFF09").option("--report-enabled <value>", "\u30EC\u30DD\u30FC\u30C8\u901A\u77E5\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false \u307E\u305F\u306F 1/0\uFF09\u3002false \u306E\u3068\u304D\u901A\u77E5\u5148\u306F\u81EA\u52D5\u7684\u306B\u7A7A\u306B\u306A\u308B").option("--notification-mail-addresses <addresses>", "\u30EC\u30DD\u30FC\u30C8\u901A\u77E5\u5148\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09\u3002--report-enabled true \u306E\u3068\u304D\u306F1\u4EF6\u4EE5\u4E0A\u5FC5\u9808").action(async (domain, opts) => {
1296
1749
  const data = {};
@@ -1305,8 +1758,8 @@ function registerDmarcCommands(parent, brand) {
1305
1758
  if (Object.keys(data).length === 0) {
1306
1759
  throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1307
1760
  }
1308
- const client = resolveClient(parent, brand);
1309
- printResult(await client.updateDmarc(domain, data), getFormat(parent));
1761
+ const client2 = resolveClient(parent, brand);
1762
+ printResult(await client2.updateDmarc(domain, data), getFormat(parent));
1310
1763
  });
1311
1764
  }
1312
1765
 
@@ -1315,26 +1768,26 @@ var UPDATE_ACTIONS = ["reset", "enable_gmail", "custom"];
1315
1768
  function registerSpfCommands(parent, brand) {
1316
1769
  const spf = parent.command("spf").description("SPF\u8A2D\u5B9A");
1317
1770
  spf.command("list").description("SPF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1318
- const client = resolveClient(parent, brand);
1771
+ const client2 = resolveClient(parent, brand);
1319
1772
  const params = {};
1320
1773
  if (opts.domain)
1321
1774
  params.domain = opts.domain;
1322
- printResult(await client.listSpf(params), getFormat(parent));
1775
+ printResult(await client2.listSpf(params), getFormat(parent));
1323
1776
  });
1324
1777
  spf.command("add").description("SPF\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--fqdn <fqdn>", "FQDN\uFF08example.com \u307E\u305F\u306F sub.example.com\uFF09").action(async (opts) => {
1325
- const client = resolveClient(parent, brand);
1326
- printResult(await client.addSpf({ fqdn: opts.fqdn }), getFormat(parent));
1778
+ const client2 = resolveClient(parent, brand);
1779
+ printResult(await client2.addSpf({ fqdn: opts.fqdn }), getFormat(parent));
1327
1780
  });
1328
1781
  spf.command("update <fqdn>").description("SPF\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08reset / enable_gmail / custom\uFF09").requiredOption("--action <action>", `\u64CD\u4F5C\u7A2E\u5225\uFF08${UPDATE_ACTIONS.join(" / ")}\uFF09`).option("--spf-record <record>", "\u30AB\u30B9\u30BF\u30E0SPF\u30EC\u30B3\u30FC\u30C9\uFF08action=custom \u306E\u3068\u304D\u5FC5\u9808\uFF09").action(async (fqdn, opts) => {
1329
1782
  const body = { action: opts.action };
1330
1783
  if (opts.spfRecord !== void 0)
1331
1784
  body.spf_record = opts.spfRecord;
1332
- const client = resolveClient(parent, brand);
1333
- printResult(await client.updateSpf(fqdn, body), getFormat(parent));
1785
+ const client2 = resolveClient(parent, brand);
1786
+ printResult(await client2.updateSpf(fqdn, body), getFormat(parent));
1334
1787
  });
1335
1788
  spf.command("delete <fqdn>").description("SPF\u8A2D\u5B9A\u3092\u524A\u9664").action(async (fqdn) => {
1336
- const client = resolveClient(parent, brand);
1337
- printResult(await client.deleteSpf(fqdn), getFormat(parent));
1789
+ const client2 = resolveClient(parent, brand);
1790
+ printResult(await client2.deleteSpf(fqdn), getFormat(parent));
1338
1791
  });
1339
1792
  }
1340
1793
 
@@ -1342,14 +1795,14 @@ function registerSpfCommands(parent, brand) {
1342
1795
  function registerFtpCommands(parent, brand) {
1343
1796
  const ftp = parent.command("ftp").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A");
1344
1797
  ftp.command("list").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1345
- const client = resolveClient(parent, brand);
1798
+ const client2 = resolveClient(parent, brand);
1346
1799
  const params = {};
1347
1800
  if (opts.domain)
1348
1801
  params.domain = opts.domain;
1349
- printResult(await client.listFtp(params), getFormat(parent));
1802
+ printResult(await client2.listFtp(params), getFormat(parent));
1350
1803
  });
1351
1804
  ftp.command("add <ftpAccount>").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--directory <dir>", "\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA").option("--quota <mb>", "\u5BB9\u91CF\u5236\u9650\uFF08MB\u30020\u3067\u7121\u5236\u9650\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (ftpAccount, opts) => {
1352
- const client = resolveClient(parent, brand);
1805
+ const client2 = resolveClient(parent, brand);
1353
1806
  const data = pickDefined({
1354
1807
  ftp_account: ftpAccount,
1355
1808
  password: opts.password,
@@ -1357,11 +1810,11 @@ function registerFtpCommands(parent, brand) {
1357
1810
  quota_mb: opts.quota !== void 0 ? parseInt(opts.quota, 10) : void 0,
1358
1811
  memo: opts.memo
1359
1812
  });
1360
- printResult(await client.addFtp(data), getFormat(parent));
1813
+ printResult(await client2.addFtp(data), getFormat(parent));
1361
1814
  });
1362
1815
  ftp.command("update <ftpAccount>").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A\u3092\u5909\u66F4").option("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--directory <dir>", "\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA").option("--quota <mb>", "\u5BB9\u91CF\u5236\u9650\uFF08MB\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (ftpAccount, opts) => {
1363
- const client = resolveClient(parent, brand);
1364
- printResult(await client.updateFtp(ftpAccount, pickDefined({
1816
+ const client2 = resolveClient(parent, brand);
1817
+ printResult(await client2.updateFtp(ftpAccount, pickDefined({
1365
1818
  password: opts.password,
1366
1819
  directory: opts.directory,
1367
1820
  quota_mb: opts.quota !== void 0 ? parseInt(opts.quota, 10) : void 0,
@@ -1370,8 +1823,8 @@ function registerFtpCommands(parent, brand) {
1370
1823
  });
1371
1824
  ftp.command("delete <ftpAccount>").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (ftpAccount) => {
1372
1825
  await confirmDestructiveAction(parent, `FTP\u30A2\u30AB\u30A6\u30F3\u30C8 "${ftpAccount}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1373
- const client = resolveClient(parent, brand);
1374
- printResult(await client.deleteFtp(ftpAccount), getFormat(parent));
1826
+ const client2 = resolveClient(parent, brand);
1827
+ printResult(await client2.deleteFtp(ftpAccount), getFormat(parent));
1375
1828
  });
1376
1829
  }
1377
1830
 
@@ -1379,64 +1832,64 @@ function registerFtpCommands(parent, brand) {
1379
1832
  function registerDbCommands(parent, brand) {
1380
1833
  const db = parent.command("db").description("MySQL\u8A2D\u5B9A");
1381
1834
  db.command("list").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1382
- const client = resolveClient(parent, brand);
1383
- printResult(await client.listDb(), getFormat(parent));
1835
+ const client2 = resolveClient(parent, brand);
1836
+ printResult(await client2.listDb(), getFormat(parent));
1384
1837
  });
1385
1838
  db.command("add <nameSuffix>").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u65B0\u898F\u4F5C\u6210").option("--character-set <charset>", "\u6587\u5B57\u30B3\u30FC\u30C9\uFF08utf8mb4 / UTF-8 / EUC-JP / SHIFT-JIS / Binary\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: utf8mb4\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (nameSuffix, opts) => {
1386
- const client = resolveClient(parent, brand);
1387
- printResult(await client.addDb(pickDefined({
1839
+ const client2 = resolveClient(parent, brand);
1840
+ printResult(await client2.addDb(pickDefined({
1388
1841
  name_suffix: nameSuffix,
1389
1842
  character_set: opts.characterSet,
1390
1843
  memo: opts.memo
1391
1844
  })), getFormat(parent));
1392
1845
  });
1393
1846
  db.command("update <dbName>").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u30E1\u30E2\u3092\u66F4\u65B0").option("--memo <value>", "\u30E1\u30E2").action(async (dbName, opts) => {
1394
- const client = resolveClient(parent, brand);
1395
- printResult(await client.updateDb(dbName, pickDefined({
1847
+ const client2 = resolveClient(parent, brand);
1848
+ printResult(await client2.updateDb(dbName, pickDefined({
1396
1849
  memo: opts.memo
1397
1850
  })), getFormat(parent));
1398
1851
  });
1399
1852
  db.command("delete <dbName>").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dbName) => {
1400
1853
  await confirmDestructiveAction(parent, `\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 "${dbName}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1401
- const client = resolveClient(parent, brand);
1402
- printResult(await client.deleteDb(dbName), getFormat(parent));
1854
+ const client2 = resolveClient(parent, brand);
1855
+ printResult(await client2.deleteDb(dbName), getFormat(parent));
1403
1856
  });
1404
1857
  db.command("user-list").description("MySQL\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1405
- const client = resolveClient(parent, brand);
1406
- printResult(await client.listDbUser(), getFormat(parent));
1858
+ const client2 = resolveClient(parent, brand);
1859
+ printResult(await client2.listDbUser(), getFormat(parent));
1407
1860
  });
1408
1861
  db.command("user-add <nameSuffix>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u3092\u65B0\u898F\u4F5C\u6210").requiredOption("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--memo <value>", "\u30E1\u30E2").action(async (nameSuffix, opts) => {
1409
- const client = resolveClient(parent, brand);
1410
- printResult(await client.addDbUser(pickDefined({
1862
+ const client2 = resolveClient(parent, brand);
1863
+ printResult(await client2.addDbUser(pickDefined({
1411
1864
  name_suffix: nameSuffix,
1412
1865
  password: opts.password,
1413
1866
  memo: opts.memo
1414
1867
  })), getFormat(parent));
1415
1868
  });
1416
1869
  db.command("user-update <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u8A2D\u5B9A\u3092\u5909\u66F4").option("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--memo <value>", "\u30E1\u30E2").action(async (dbUser, opts) => {
1417
- const client = resolveClient(parent, brand);
1418
- printResult(await client.updateDbUser(dbUser, pickDefined({
1870
+ const client2 = resolveClient(parent, brand);
1871
+ printResult(await client2.updateDbUser(dbUser, pickDefined({
1419
1872
  password: opts.password,
1420
1873
  memo: opts.memo
1421
1874
  })), getFormat(parent));
1422
1875
  });
1423
1876
  db.command("user-delete <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dbUser) => {
1424
1877
  await confirmDestructiveAction(parent, `MySQL\u30E6\u30FC\u30B6\u30FC "${dbUser}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1425
- const client = resolveClient(parent, brand);
1426
- printResult(await client.deleteDbUser(dbUser), getFormat(parent));
1878
+ const client2 = resolveClient(parent, brand);
1879
+ printResult(await client2.deleteDbUser(dbUser), getFormat(parent));
1427
1880
  });
1428
1881
  db.command("grant-list <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u306E\u6A29\u9650\u4E00\u89A7\u3092\u53D6\u5F97").action(async (dbUser) => {
1429
- const client = resolveClient(parent, brand);
1430
- printResult(await client.listDbUserGrant(dbUser), getFormat(parent));
1882
+ const client2 = resolveClient(parent, brand);
1883
+ printResult(await client2.listDbUserGrant(dbUser), getFormat(parent));
1431
1884
  });
1432
1885
  db.command("grant-add <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u306B\u6A29\u9650\u3092\u8FFD\u52A0").requiredOption("--db-name <dbName>", "\u5BFE\u8C61\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D").action(async (dbUser, opts) => {
1433
- const client = resolveClient(parent, brand);
1434
- printResult(await client.addDbUserGrant(dbUser, { db_name: opts.dbName }), getFormat(parent));
1886
+ const client2 = resolveClient(parent, brand);
1887
+ printResult(await client2.addDbUserGrant(dbUser, { db_name: opts.dbName }), getFormat(parent));
1435
1888
  });
1436
1889
  db.command("grant-delete <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u306E\u6A29\u9650\u3092\u524A\u9664").requiredOption("--db-name <dbName>", "\u5BFE\u8C61\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dbUser, opts) => {
1437
1890
  await confirmDestructiveAction(parent, `MySQL\u30E6\u30FC\u30B6\u30FC "${dbUser}" \u306E\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 "${opts.dbName}" \u3078\u306E\u6A29\u9650\u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1438
- const client = resolveClient(parent, brand);
1439
- printResult(await client.deleteDbUserGrant(dbUser, { db_name: opts.dbName }), getFormat(parent));
1891
+ const client2 = resolveClient(parent, brand);
1892
+ printResult(await client2.deleteDbUserGrant(dbUser, { db_name: opts.dbName }), getFormat(parent));
1440
1893
  });
1441
1894
  }
1442
1895
 
@@ -1444,15 +1897,15 @@ function registerDbCommands(parent, brand) {
1444
1897
  function registerPhpVersionCommands(parent, brand) {
1445
1898
  const phpVer = parent.command("php-version").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u8A2D\u5B9A");
1446
1899
  phpVer.command("get").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u78BA\u8A8D").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1447
- const client = resolveClient(parent, brand);
1900
+ const client2 = resolveClient(parent, brand);
1448
1901
  const params = {};
1449
1902
  if (opts.domain)
1450
1903
  params.domain = opts.domain;
1451
- printResult(await client.getPhpVersion(params), getFormat(parent));
1904
+ printResult(await client2.getPhpVersion(params), getFormat(parent));
1452
1905
  });
1453
1906
  phpVer.command("update <domain>").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5909\u66F4").requiredOption("--php <version>", "PHP\u30D0\u30FC\u30B8\u30E7\u30F3\uFF08\u4F8B: 8.2\uFF09").action(async (domain, opts) => {
1454
- const client = resolveClient(parent, brand);
1455
- printResult(await client.updatePhpVersion(domain, { version: opts.php }), getFormat(parent));
1907
+ const client2 = resolveClient(parent, brand);
1908
+ printResult(await client2.updatePhpVersion(domain, { version: opts.php }), getFormat(parent));
1456
1909
  });
1457
1910
  }
1458
1911
 
@@ -1460,15 +1913,15 @@ function registerPhpVersionCommands(parent, brand) {
1460
1913
  function registerServerDomainCommands(parent, brand) {
1461
1914
  const domain = parent.command("domain").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
1462
1915
  domain.command("list").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1463
- const client = resolveClient(parent, brand);
1464
- printResult(await client.listDomain(), getFormat(parent));
1916
+ const client2 = resolveClient(parent, brand);
1917
+ printResult(await client2.listDomain(), getFormat(parent));
1465
1918
  });
1466
1919
  domain.command("get <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u8A73\u7D30\u3092\u53D6\u5F97").action(async (domainName) => {
1467
- const client = resolveClient(parent, brand);
1468
- printResult(await client.getDomain(domainName), getFormat(parent));
1920
+ const client2 = resolveClient(parent, brand);
1921
+ printResult(await client2.getDomain(domainName), getFormat(parent));
1469
1922
  });
1470
1923
  domain.command("add <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u65B0\u898F\u8FFD\u52A0").option("--ssl <value>", "SSL\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--redirect-https <value>", "HTTPS\u8EE2\u9001\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: ssl\u3068\u540C\u3058\u5024\uFF09").option("--ai-crawler-block <value>", "AI\u30AF\u30ED\u30FC\u30E9\u30FC\u906E\u65AD\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (domainName, opts) => {
1471
- const client = resolveClient(parent, brand);
1924
+ const client2 = resolveClient(parent, brand);
1472
1925
  const data = { domain: domainName };
1473
1926
  if (opts.ssl !== void 0)
1474
1927
  data.ssl = opts.ssl === "true";
@@ -1478,27 +1931,27 @@ function registerServerDomainCommands(parent, brand) {
1478
1931
  data.ai_crawler_block_enabled = opts.aiCrawlerBlock === "true";
1479
1932
  if (opts.memo !== void 0)
1480
1933
  data.memo = opts.memo;
1481
- printResult(await client.addDomain(data), getFormat(parent));
1934
+ printResult(await client2.addDomain(data), getFormat(parent));
1482
1935
  });
1483
1936
  domain.command("update <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u5909\u66F4").option("--memo <value>", "\u30E1\u30E2").action(async (domainName, opts) => {
1484
- const client = resolveClient(parent, brand);
1485
- printResult(await client.updateDomain(domainName, pickDefined({
1937
+ const client2 = resolveClient(parent, brand);
1938
+ printResult(await client2.updateDomain(domainName, pickDefined({
1486
1939
  memo: opts.memo
1487
1940
  })), getFormat(parent));
1488
1941
  });
1489
1942
  domain.command("delete <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u524A\u9664").option("--delete-files", "\u30E6\u30FC\u30B6\u30FC\u516C\u958B\u9818\u57DF\u306E\u30C9\u30E1\u30A4\u30F3\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3082\u524A\u9664\u3059\u308B").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domainName, opts) => {
1490
1943
  const suffix = opts.deleteFiles ? "\uFF08\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3057\u307E\u3059\uFF09" : "";
1491
1944
  await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A "${domainName}" \u3092\u524A\u9664\u3057\u307E\u3059${suffix}\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1492
- const client = resolveClient(parent, brand);
1945
+ const client2 = resolveClient(parent, brand);
1493
1946
  const data = {};
1494
1947
  if (opts.deleteFiles)
1495
1948
  data.delete_files = true;
1496
- printResult(await client.deleteDomain(domainName, data), getFormat(parent));
1949
+ printResult(await client2.deleteDomain(domainName, data), getFormat(parent));
1497
1950
  });
1498
1951
  domain.command("reset <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u521D\u671F\u5316").requiredOption("--type <type>", "\u30EA\u30BB\u30C3\u30C8\u7A2E\u5225\uFF08all: \u5168\u521D\u671F\u5316 / web: Web\u9818\u57DF\u306E\u307F / other: Web\u4EE5\u5916\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domainName, opts) => {
1499
1952
  await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A "${domainName}" \u3092 "${opts.type}" \u3067\u521D\u671F\u5316\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1500
- const client = resolveClient(parent, brand);
1501
- printResult(await client.resetDomain(domainName, { type: opts.type }), getFormat(parent));
1953
+ const client2 = resolveClient(parent, brand);
1954
+ printResult(await client2.resetDomain(domainName, { type: opts.type }), getFormat(parent));
1502
1955
  });
1503
1956
  }
1504
1957
 
@@ -1506,14 +1959,14 @@ function registerServerDomainCommands(parent, brand) {
1506
1959
  function registerSubdomainCommands(parent, brand) {
1507
1960
  const subdomain = parent.command("subdomain").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
1508
1961
  subdomain.command("list").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1509
- const client = resolveClient(parent, brand);
1962
+ const client2 = resolveClient(parent, brand);
1510
1963
  const params = {};
1511
1964
  if (opts.domain)
1512
1965
  params.domain = opts.domain;
1513
- printResult(await client.listSubdomain(params), getFormat(parent));
1966
+ printResult(await client2.listSubdomain(params), getFormat(parent));
1514
1967
  });
1515
1968
  subdomain.command("add <subdomain>").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u3092\u65B0\u898F\u8FFD\u52A0").option("--document-root-type <type>", "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30EB\u30FC\u30C8\u7A2E\u5225\uFF08subdomain_only: /public_html/sub, full_subdomain: /public_html/sub.example.com\uFF09").option("--ssl <value>", "SSL\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (subdomainName, opts) => {
1516
- const client = resolveClient(parent, brand);
1969
+ const client2 = resolveClient(parent, brand);
1517
1970
  const data = { subdomain: subdomainName };
1518
1971
  if (opts.documentRootType !== void 0)
1519
1972
  data.document_root_type = opts.documentRootType;
@@ -1521,22 +1974,22 @@ function registerSubdomainCommands(parent, brand) {
1521
1974
  data.ssl = opts.ssl === "true";
1522
1975
  if (opts.memo !== void 0)
1523
1976
  data.memo = opts.memo;
1524
- printResult(await client.addSubdomain(data), getFormat(parent));
1977
+ printResult(await client2.addSubdomain(data), getFormat(parent));
1525
1978
  });
1526
1979
  subdomain.command("update <subdomain>").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u306E\u30E1\u30E2\u3092\u66F4\u65B0").option("--memo <value>", "\u30E1\u30E2").action(async (subdomainName, opts) => {
1527
- const client = resolveClient(parent, brand);
1528
- printResult(await client.updateSubdomain(subdomainName, pickDefined({
1980
+ const client2 = resolveClient(parent, brand);
1981
+ printResult(await client2.updateSubdomain(subdomainName, pickDefined({
1529
1982
  memo: opts.memo
1530
1983
  })), getFormat(parent));
1531
1984
  });
1532
1985
  subdomain.command("delete <subdomain>").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u3092\u524A\u9664").option("--delete-files", "\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3059\u308B").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (subdomainName, opts) => {
1533
1986
  const suffix = opts.deleteFiles ? "\uFF08\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3057\u307E\u3059\uFF09" : "";
1534
1987
  await confirmDestructiveAction(parent, `\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3 "${subdomainName}" \u3092\u524A\u9664\u3057\u307E\u3059${suffix}\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1535
- const client = resolveClient(parent, brand);
1988
+ const client2 = resolveClient(parent, brand);
1536
1989
  const data = {};
1537
1990
  if (opts.deleteFiles)
1538
1991
  data.delete_files = true;
1539
- printResult(await client.deleteSubdomain(subdomainName, data), getFormat(parent));
1992
+ printResult(await client2.deleteSubdomain(subdomainName, data), getFormat(parent));
1540
1993
  });
1541
1994
  }
1542
1995
 
@@ -1544,22 +1997,22 @@ function registerSubdomainCommands(parent, brand) {
1544
1997
  function registerSslCommands(parent, brand) {
1545
1998
  const ssl = parent.command("ssl").description("SSL\u8A2D\u5B9A");
1546
1999
  ssl.command("list").description("SSL\u8A2D\u5B9A\u306E\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1547
- const client = resolveClient(parent, brand);
2000
+ const client2 = resolveClient(parent, brand);
1548
2001
  const params = {};
1549
2002
  if (opts.domain)
1550
2003
  params.domain = opts.domain;
1551
- printResult(await client.listSsl(params), getFormat(parent));
2004
+ printResult(await client2.listSsl(params), getFormat(parent));
1552
2005
  });
1553
2006
  ssl.command("install <commonName>").description("\u7121\u6599SSL\u3092\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").action(async (commonName) => {
1554
- const client = resolveClient(parent, brand);
1555
- printResult(await client.installSsl(pickDefined({
2007
+ const client2 = resolveClient(parent, brand);
2008
+ printResult(await client2.installSsl(pickDefined({
1556
2009
  common_name: commonName
1557
2010
  })), getFormat(parent));
1558
2011
  });
1559
2012
  ssl.command("uninstall <commonName>").description("\u7121\u6599SSL\u3092\u30A2\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (commonName) => {
1560
2013
  await confirmDestructiveAction(parent, `\u7121\u6599SSL "${commonName}" \u3092\u30A2\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1561
- const client = resolveClient(parent, brand);
1562
- printResult(await client.uninstallSsl(commonName), getFormat(parent));
2014
+ const client2 = resolveClient(parent, brand);
2015
+ printResult(await client2.uninstallSsl(commonName), getFormat(parent));
1563
2016
  });
1564
2017
  }
1565
2018
 
@@ -1567,15 +2020,15 @@ function registerSslCommands(parent, brand) {
1567
2020
  function registerDnsCommands(parent, brand) {
1568
2021
  const dns = parent.command("dns").description("DNS\u30EC\u30B3\u30FC\u30C9\u8A2D\u5B9A");
1569
2022
  dns.command("list").description("DNS\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1570
- const client = resolveClient(parent, brand);
2023
+ const client2 = resolveClient(parent, brand);
1571
2024
  const params = {};
1572
2025
  if (opts.domain)
1573
2026
  params.domain = opts.domain;
1574
- printResult(await client.listDns(params), getFormat(parent));
2027
+ printResult(await client2.listDns(params), getFormat(parent));
1575
2028
  });
1576
2029
  dns.command("add").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--host <host>", "\u30DB\u30B9\u30C8\u540D\uFF08@\u3067apex\uFF09").requiredOption("--type <type>", "\u30EC\u30B3\u30FC\u30C9\u30BF\u30A4\u30D7\uFF08A / AAAA / CNAME / MX / TXT / SRV / CAA\uFF09").requiredOption("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860-86400\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: 3600\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6\uFF08MX/SRV\u30EC\u30B3\u30FC\u30C9\u7528\uFF09").action(async (opts) => {
1577
- const client = resolveClient(parent, brand);
1578
- printResult(await client.addDns(pickDefined({
2030
+ const client2 = resolveClient(parent, brand);
2031
+ printResult(await client2.addDns(pickDefined({
1579
2032
  domain: opts.domain,
1580
2033
  host: opts.host,
1581
2034
  type: opts.type,
@@ -1585,8 +2038,8 @@ function registerDnsCommands(parent, brand) {
1585
2038
  })), getFormat(parent));
1586
2039
  });
1587
2040
  dns.command("update <dnsId>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u66F4\u65B0").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3").option("--host <host>", "\u30DB\u30B9\u30C8\u540D").option("--type <type>", "\u30EC\u30B3\u30FC\u30C9\u30BF\u30A4\u30D7").option("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860-86400\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6").action(async (dnsId, opts) => {
1588
- const client = resolveClient(parent, brand);
1589
- printResult(await client.updateDns(dnsId, pickDefined({
2041
+ const client2 = resolveClient(parent, brand);
2042
+ printResult(await client2.updateDns(dnsId, pickDefined({
1590
2043
  domain: opts.domain,
1591
2044
  host: opts.host,
1592
2045
  type: opts.type,
@@ -1597,8 +2050,8 @@ function registerDnsCommands(parent, brand) {
1597
2050
  });
1598
2051
  dns.command("delete <dnsId>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dnsId) => {
1599
2052
  await confirmDestructiveAction(parent, `DNS\u30EC\u30B3\u30FC\u30C9 "${dnsId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1600
- const client = resolveClient(parent, brand);
1601
- printResult(await client.deleteDns(dnsId), getFormat(parent));
2053
+ const client2 = resolveClient(parent, brand);
2054
+ printResult(await client2.deleteDns(dnsId), getFormat(parent));
1602
2055
  });
1603
2056
  }
1604
2057
 
@@ -1606,25 +2059,25 @@ function registerDnsCommands(parent, brand) {
1606
2059
  function registerSshCommands(parent, brand) {
1607
2060
  const ssh = parent.command("ssh").description("SSH\u8A2D\u5B9A");
1608
2061
  ssh.command("show").description("SSH\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async () => {
1609
- const client = resolveClient(parent, brand);
1610
- printResult(await client.getSsh(), getFormat(parent));
2062
+ const client2 = resolveClient(parent, brand);
2063
+ printResult(await client2.getSsh(), getFormat(parent));
1611
2064
  });
1612
2065
  ssh.command("update").description("SSH\u8A2D\u5B9A\u3092\u5909\u66F4").option("--ssh-enabled <value>", "SSH\u63A5\u7D9A\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false\uFF09").option("--abroad-access-restriction <value>", "\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false\uFF09").action(async (opts) => {
1613
- const client = resolveClient(parent, brand);
2066
+ const client2 = resolveClient(parent, brand);
1614
2067
  const data = {};
1615
2068
  if (opts.sshEnabled !== void 0)
1616
2069
  data.ssh_enabled = opts.sshEnabled === "true";
1617
2070
  if (opts.abroadAccessRestriction !== void 0)
1618
2071
  data.abroad_access_restriction = opts.abroadAccessRestriction === "true";
1619
- printResult(await client.updateSsh(data), getFormat(parent));
2072
+ printResult(await client2.updateSsh(data), getFormat(parent));
1620
2073
  });
1621
2074
  const key = ssh.command("key").description("SSH\u516C\u958B\u9375\u7BA1\u7406");
1622
2075
  key.command("list").description("SSH\u516C\u958B\u9375\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1623
- const client = resolveClient(parent, brand);
1624
- printResult(await client.listSshKey(), getFormat(parent));
2076
+ const client2 = resolveClient(parent, brand);
2077
+ printResult(await client2.listSshKey(), getFormat(parent));
1625
2078
  });
1626
2079
  key.command("add").description("SSH\u516C\u958B\u9375\u3092\u767B\u9332").option("--public-key <key>", "\u516C\u958B\u9375\uFF08\u624B\u52D5\u767B\u9332\u6642\uFF09").option("--generate", "\u30B5\u30FC\u30D0\u30FC\u5074\u3067\u9375\u30DA\u30A2\u3092\u81EA\u52D5\u751F\u6210").option("--passphrase <value>", "\u30D1\u30B9\u30D5\u30EC\u30FC\u30BA\uFF08\u81EA\u52D5\u751F\u6210\u6642\uFF09").requiredOption("--label <value>", "\u30E9\u30D9\u30EB").action(async (opts) => {
1627
- const client = resolveClient(parent, brand);
2080
+ const client2 = resolveClient(parent, brand);
1628
2081
  const data = { label: opts.label };
1629
2082
  if (opts.generate) {
1630
2083
  data.generate = true;
@@ -1634,19 +2087,19 @@ function registerSshCommands(parent, brand) {
1634
2087
  if (opts.publicKey)
1635
2088
  data.public_key = opts.publicKey;
1636
2089
  }
1637
- printResult(await client.addSshKey(data), getFormat(parent));
2090
+ printResult(await client2.addSshKey(data), getFormat(parent));
1638
2091
  });
1639
2092
  key.command("update <keyId>").description("SSH\u516C\u958B\u9375\u3092\u66F4\u65B0").option("--label <value>", "\u30E9\u30D9\u30EB").option("--status <value>", "\u30B9\u30C6\u30FC\u30BF\u30B9\uFF08on/off\uFF09").action(async (keyId, opts) => {
1640
- const client = resolveClient(parent, brand);
1641
- printResult(await client.updateSshKey(keyId, pickDefined({
2093
+ const client2 = resolveClient(parent, brand);
2094
+ printResult(await client2.updateSshKey(keyId, pickDefined({
1642
2095
  label: opts.label,
1643
2096
  status: opts.status
1644
2097
  })), getFormat(parent));
1645
2098
  });
1646
2099
  key.command("delete <keyId>").description("SSH\u516C\u958B\u9375\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (keyId) => {
1647
2100
  await confirmDestructiveAction(parent, `SSH\u516C\u958B\u9375 "${keyId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1648
- const client = resolveClient(parent, brand);
1649
- printResult(await client.deleteSshKey(keyId), getFormat(parent));
2101
+ const client2 = resolveClient(parent, brand);
2102
+ printResult(await client2.deleteSshKey(keyId), getFormat(parent));
1650
2103
  });
1651
2104
  }
1652
2105
 
@@ -1654,22 +2107,22 @@ function registerSshCommands(parent, brand) {
1654
2107
  function registerLogCommands(parent, brand) {
1655
2108
  const log = parent.command("log").description("\u30ED\u30B0");
1656
2109
  log.command("access").description("\u30A2\u30AF\u30BB\u30B9\u30ED\u30B0\u3092\u53D6\u5F97").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").option("--lines <n>", "\u53D6\u5F97\u884C\u6570").option("--keyword <keyword>", "\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22").action(async (opts) => {
1657
- const client = resolveClient(parent, brand);
2110
+ const client2 = resolveClient(parent, brand);
1658
2111
  const params = { domain: opts.domain };
1659
2112
  if (opts.lines)
1660
2113
  params.lines = opts.lines;
1661
2114
  if (opts.keyword)
1662
2115
  params.keyword = opts.keyword;
1663
- printResult(await client.getAccessLog(params), getFormat(parent));
2116
+ printResult(await client2.getAccessLog(params), getFormat(parent));
1664
2117
  });
1665
2118
  log.command("error").description("\u30A8\u30E9\u30FC\u30ED\u30B0\u3092\u53D6\u5F97").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").option("--lines <n>", "\u53D6\u5F97\u884C\u6570").option("--keyword <keyword>", "\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22").action(async (opts) => {
1666
- const client = resolveClient(parent, brand);
2119
+ const client2 = resolveClient(parent, brand);
1667
2120
  const params = { domain: opts.domain };
1668
2121
  if (opts.lines)
1669
2122
  params.lines = opts.lines;
1670
2123
  if (opts.keyword)
1671
2124
  params.keyword = opts.keyword;
1672
- printResult(await client.getErrorLog(params), getFormat(parent));
2125
+ printResult(await client2.getErrorLog(params), getFormat(parent));
1673
2126
  });
1674
2127
  }
1675
2128
 
@@ -1677,8 +2130,8 @@ function registerLogCommands(parent, brand) {
1677
2130
  function registerResourceMonitorCommands(parent, brand) {
1678
2131
  const resourceMonitor = parent.command("resource-monitor").description("\u30EA\u30BD\u30FC\u30B9\u30E2\u30CB\u30BF\u30FC");
1679
2132
  resourceMonitor.command("get").description("\u6307\u5B9A\u65E5\u306ECPU\u30FB\u30E1\u30E2\u30EA\u30FB\u8EE2\u9001\u91CF\u6642\u7CFB\u5217\u3092\u53D6\u5F97").requiredOption("--date <date>", "\u5BFE\u8C61\u65E5\uFF08Y-m-d \u307E\u305F\u306F Ymd\u3002\u5F53\u65E5\u542B\u3080\u76F4\u8FD11\u304B\u6708\uFF09").action(async (opts) => {
1680
- const client = resolveClient(parent, brand);
1681
- printResult(await client.getResourceMonitor(opts.date), getFormat(parent));
2133
+ const client2 = resolveClient(parent, brand);
2134
+ printResult(await client2.getResourceMonitor(opts.date), getFormat(parent));
1682
2135
  });
1683
2136
  }
1684
2137
 
@@ -1686,11 +2139,11 @@ function registerResourceMonitorCommands(parent, brand) {
1686
2139
  function registerWafCommands(parent, brand) {
1687
2140
  const waf = parent.command("waf").description("WAF\u8A2D\u5B9A");
1688
2141
  waf.command("list").description("WAF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1689
- const client = resolveClient(parent, brand);
2142
+ const client2 = resolveClient(parent, brand);
1690
2143
  const params = {};
1691
2144
  if (opts.domain)
1692
2145
  params.domain = opts.domain;
1693
- printResult(await client.listWaf(params), getFormat(parent));
2146
+ printResult(await client2.listWaf(params), getFormat(parent));
1694
2147
  });
1695
2148
  waf.command("update <domain>").description("WAF\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09").option("--xss-protection <value>", "XSS\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--sql-injection-protection <value>", "SQL\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--file-protection <value>", "\u30D5\u30A1\u30A4\u30EB\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--mail-protection <value>", "\u30E1\u30FC\u30EB\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--command-protection <value>", "\u30B3\u30DE\u30F3\u30C9\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--php-protection <value>", "PHP\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (domain, opts) => {
1696
2149
  const data = {};
@@ -1709,8 +2162,8 @@ function registerWafCommands(parent, brand) {
1709
2162
  if (Object.keys(data).length === 0) {
1710
2163
  throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1711
2164
  }
1712
- const client = resolveClient(parent, brand);
1713
- printResult(await client.updateWaf(domain, data), getFormat(parent));
2165
+ const client2 = resolveClient(parent, brand);
2166
+ printResult(await client2.updateWaf(domain, data), getFormat(parent));
1714
2167
  });
1715
2168
  }
1716
2169
 
@@ -1761,11 +2214,11 @@ function buildUpdateData(opts) {
1761
2214
  function registerPhpIniCommands(parent, brand) {
1762
2215
  const phpIni = parent.command("php-ini").description("php.ini\u8A2D\u5B9A\uFF08php-version \u3068\u306F\u5225\uFF09");
1763
2216
  phpIni.command("list").description("php.ini\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1764
- const client = resolveClient(parent, brand);
2217
+ const client2 = resolveClient(parent, brand);
1765
2218
  const params = {};
1766
2219
  if (opts.domain)
1767
2220
  params.domain = opts.domain;
1768
- printResult(await client.listPhpIni(params), getFormat(parent));
2221
+ printResult(await client2.listPhpIni(params), getFormat(parent));
1769
2222
  });
1770
2223
  const update = phpIni.command("update <domain>").description("php.ini\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09");
1771
2224
  for (const { cli, desc } of PHP_INI_UPDATE_OPTIONS) {
@@ -1776,13 +2229,13 @@ function registerPhpIniCommands(parent, brand) {
1776
2229
  if (Object.keys(data).length === 0) {
1777
2230
  throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1778
2231
  }
1779
- const client = resolveClient(parent, brand);
1780
- printResult(await client.updatePhpIni(domain, data), getFormat(parent));
2232
+ const client2 = resolveClient(parent, brand);
2233
+ printResult(await client2.updatePhpIni(domain, data), getFormat(parent));
1781
2234
  });
1782
2235
  phpIni.command("reset <domain>").description("php.ini\u8A2D\u5B9A\u3092\u521D\u671F\u5024\u306B\u623B\u3059").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domain) => {
1783
2236
  await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306E php.ini \u3092\u521D\u671F\u5024\u306B\u623B\u3057\u307E\u3059\u3002\u3053\u306E\u64CD\u4F5C\u306F\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1784
- const client = resolveClient(parent, brand);
1785
- printResult(await client.resetPhpIni(domain), getFormat(parent));
2237
+ const client2 = resolveClient(parent, brand);
2238
+ printResult(await client2.resetPhpIni(domain), getFormat(parent));
1786
2239
  });
1787
2240
  }
1788
2241
 
@@ -1877,11 +2330,11 @@ function buildUpdateData2(domain, opts) {
1877
2330
  function registerWordPressSecurityCommands(parent, brand) {
1878
2331
  const wordpressSecurity = parent.command("wordpress-security").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A");
1879
2332
  wordpressSecurity.command("get").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1880
- const client = resolveClient(parent, brand);
2333
+ const client2 = resolveClient(parent, brand);
1881
2334
  const params = {};
1882
2335
  if (opts.domain)
1883
2336
  params.domain = opts.domain;
1884
- printResult(await client.getWordPressSecurity(params), getFormat(parent));
2337
+ printResult(await client2.getWordPressSecurity(params), getFormat(parent));
1885
2338
  });
1886
2339
  const update = wordpressSecurity.command("update <domain>").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09");
1887
2340
  for (const { cli, desc } of UPDATE_OPTIONS) {
@@ -1889,8 +2342,8 @@ function registerWordPressSecurityCommands(parent, brand) {
1889
2342
  }
1890
2343
  update.action(async (domain, opts) => {
1891
2344
  const data = buildUpdateData2(domain, opts);
1892
- const client = resolveClient(parent, brand);
1893
- printResult(await client.updateWordPressSecurity(data), getFormat(parent));
2345
+ const client2 = resolveClient(parent, brand);
2346
+ printResult(await client2.updateWordPressSecurity(data), getFormat(parent));
1894
2347
  });
1895
2348
  }
1896
2349
 
@@ -1898,15 +2351,15 @@ function registerWordPressSecurityCommands(parent, brand) {
1898
2351
  function registerXAcceleratorCommands(parent, brand) {
1899
2352
  const xAccelerator = parent.command("x-accelerator").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A");
1900
2353
  xAccelerator.command("list").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1901
- const client = resolveClient(parent, brand);
2354
+ const client2 = resolveClient(parent, brand);
1902
2355
  const params = {};
1903
2356
  if (opts.domain)
1904
2357
  params.domain = opts.domain;
1905
- printResult(await client.listXAccelerator(params), getFormat(parent));
2358
+ printResult(await client2.listXAccelerator(params), getFormat(parent));
1906
2359
  });
1907
2360
  xAccelerator.command("update <domain>").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--xaccelerator-status <status>", "X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\uFF08off / v1 / v2\uFF09").action(async (domain, opts) => {
1908
- const client = resolveClient(parent, brand);
1909
- printResult(await client.updateXAccelerator(domain, { xaccelerator_status: opts.xacceleratorStatus }), getFormat(parent));
2361
+ const client2 = resolveClient(parent, brand);
2362
+ printResult(await client2.updateXAccelerator(domain, { xaccelerator_status: opts.xacceleratorStatus }), getFormat(parent));
1910
2363
  });
1911
2364
  }
1912
2365
 
@@ -1914,20 +2367,20 @@ function registerXAcceleratorCommands(parent, brand) {
1914
2367
  function registerServerCacheCommands(parent, brand) {
1915
2368
  const serverCache = parent.command("server-cache").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
1916
2369
  serverCache.command("list").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1917
- const client = resolveClient(parent, brand);
2370
+ const client2 = resolveClient(parent, brand);
1918
2371
  const params = {};
1919
2372
  if (opts.domain)
1920
2373
  params.domain = opts.domain;
1921
- printResult(await client.listServerCache(params), getFormat(parent));
2374
+ printResult(await client2.listServerCache(params), getFormat(parent));
1922
2375
  });
1923
2376
  serverCache.command("update <domain>").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--server-cache-status <status>", "\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\uFF08on / off\uFF09").action(async (domain, opts) => {
1924
- const client = resolveClient(parent, brand);
1925
- printResult(await client.updateServerCache(domain, { server_cache_status: opts.serverCacheStatus }), getFormat(parent));
2377
+ const client2 = resolveClient(parent, brand);
2378
+ printResult(await client2.updateServerCache(domain, { server_cache_status: opts.serverCacheStatus }), getFormat(parent));
1926
2379
  });
1927
2380
  serverCache.command("clear-cache <domain>").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u306E\u5185\u5BB9\u3092\u524A\u9664\uFF08\u30D1\u30FC\u30B8\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domain) => {
1928
2381
  await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306E\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u5185\u5BB9\u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1929
- const client = resolveClient(parent, brand);
1930
- printResult(await client.clearServerCache(domain), getFormat(parent));
2382
+ const client2 = resolveClient(parent, brand);
2383
+ printResult(await client2.clearServerCache(domain), getFormat(parent));
1931
2384
  });
1932
2385
  }
1933
2386
 
@@ -1935,15 +2388,15 @@ function registerServerCacheCommands(parent, brand) {
1935
2388
  function registerBrowserCacheCommands(parent, brand) {
1936
2389
  const browserCache = parent.command("browser-cache").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
1937
2390
  browserCache.command("list").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1938
- const client = resolveClient(parent, brand);
2391
+ const client2 = resolveClient(parent, brand);
1939
2392
  const params = {};
1940
2393
  if (opts.domain)
1941
2394
  params.domain = opts.domain;
1942
- printResult(await client.listBrowserCache(params), getFormat(parent));
2395
+ printResult(await client2.listBrowserCache(params), getFormat(parent));
1943
2396
  });
1944
2397
  browserCache.command("update <domain>").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--browser-cache-status <status>", "\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\uFF08all / ignore-css-js / off\uFF09").action(async (domain, opts) => {
1945
- const client = resolveClient(parent, brand);
1946
- printResult(await client.updateBrowserCache(domain, { browser_cache_status: opts.browserCacheStatus }), getFormat(parent));
2398
+ const client2 = resolveClient(parent, brand);
2399
+ printResult(await client2.updateBrowserCache(domain, { browser_cache_status: opts.browserCacheStatus }), getFormat(parent));
1947
2400
  });
1948
2401
  }
1949
2402
 
@@ -1951,14 +2404,14 @@ function registerBrowserCacheCommands(parent, brand) {
1951
2404
  function registerUrlRedirectCommands(parent, brand) {
1952
2405
  const urlRedirect = parent.command("url-redirect").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A");
1953
2406
  urlRedirect.command("list").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1954
- const client = resolveClient(parent, brand);
2407
+ const client2 = resolveClient(parent, brand);
1955
2408
  const params = {};
1956
2409
  if (opts.domain)
1957
2410
  params.domain = opts.domain;
1958
- printResult(await client.listUrlRedirect(params), getFormat(parent));
2411
+ printResult(await client2.listUrlRedirect(params), getFormat(parent));
1959
2412
  });
1960
2413
  urlRedirect.command("add").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5951\u7D04\u30C9\u30E1\u30A4\u30F3").requiredOption("--from-host <host>", "\u8EE2\u9001\u5143\u30DB\u30B9\u30C8\uFF08FQDN\uFF09").option("--from-path <path>", "\u8EE2\u9001\u5143\u30D1\u30B9\uFF08\u7701\u7565\u6642\u306F /\u3002\u5148\u982D\u304C / \u3067\u306A\u3044\u5834\u5408\u306F API \u5074\u3067 / \u3092\u4ED8\u4E0E\uFF09").requiredOption("--redirect-to-url <url>", "\u8EE2\u9001\u5148URL\uFF08http \u307E\u305F\u306F https\uFF09").requiredOption("--status-code <code>", "\u8EE2\u9001\u6642\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u30B3\u30FC\u30C9\uFF08301 / 302\uFF09").action(async (opts) => {
1961
- const client = resolveClient(parent, brand);
2414
+ const client2 = resolveClient(parent, brand);
1962
2415
  const data = {
1963
2416
  domain: opts.domain,
1964
2417
  from_host: opts.fromHost,
@@ -1967,12 +2420,12 @@ function registerUrlRedirectCommands(parent, brand) {
1967
2420
  };
1968
2421
  if (opts.fromPath !== void 0)
1969
2422
  data.from_path = opts.fromPath;
1970
- printResult(await client.addUrlRedirect(data), getFormat(parent));
2423
+ printResult(await client2.addUrlRedirect(data), getFormat(parent));
1971
2424
  });
1972
2425
  urlRedirect.command("delete <redirectId>").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (redirectId) => {
1973
2426
  await confirmDestructiveAction(parent, `\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A "${redirectId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1974
- const client = resolveClient(parent, brand);
1975
- printResult(await client.deleteUrlRedirect(redirectId), getFormat(parent));
2427
+ const client2 = resolveClient(parent, brand);
2428
+ printResult(await client2.deleteUrlRedirect(redirectId), getFormat(parent));
1976
2429
  });
1977
2430
  }
1978
2431
 
@@ -1980,33 +2433,33 @@ function registerUrlRedirectCommands(parent, brand) {
1980
2433
  function registerAccessDenyCommands(parent, brand) {
1981
2434
  const accessDeny = parent.command("access-deny").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A");
1982
2435
  accessDeny.command("list").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
1983
- const client = resolveClient(parent, brand);
2436
+ const client2 = resolveClient(parent, brand);
1984
2437
  const params = {};
1985
2438
  if (opts.domain)
1986
2439
  params.domain = opts.domain;
1987
- printResult(await client.listAccessDeny(params), getFormat(parent));
2440
+ printResult(await client2.listAccessDeny(params), getFormat(parent));
1988
2441
  });
1989
2442
  accessDeny.command("add").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5951\u7D04\u30C9\u30E1\u30A4\u30F3").requiredOption("--ip-address <address>", "\u62D2\u5426IP\u30A2\u30C9\u30EC\u30B9\u30FB\u30DB\u30B9\u30C8\uFF08IPv4 / CIDR / \u90E8\u5206IP / \u30DB\u30B9\u30C8\u540D\uFF09").option("--memo <memo>", "\u30E1\u30E2\uFF08\u6700\u5927500\u6587\u5B57\uFF09").action(async (opts) => {
1990
- const client = resolveClient(parent, brand);
2443
+ const client2 = resolveClient(parent, brand);
1991
2444
  const data = {
1992
2445
  domain: opts.domain,
1993
2446
  ip_address: opts.ipAddress
1994
2447
  };
1995
2448
  if (opts.memo !== void 0)
1996
2449
  data.memo = opts.memo;
1997
- printResult(await client.addAccessDeny(data), getFormat(parent));
2450
+ printResult(await client2.addAccessDeny(data), getFormat(parent));
1998
2451
  });
1999
2452
  accessDeny.command("update <denyId>").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u306E\u30E1\u30E2\u3092\u66F4\u65B0").option("--memo <memo>", "\u30E1\u30E2\uFF08\u7701\u7565\u307E\u305F\u306F\u7A7A\u6587\u5B57\u3067\u30AF\u30EA\u30A2\uFF09").action(async (denyId, opts) => {
2000
2453
  if (opts.memo === void 0) {
2001
2454
  throw new Error("--memo \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2002
2455
  }
2003
- const client = resolveClient(parent, brand);
2004
- printResult(await client.updateAccessDeny(denyId, { memo: opts.memo }), getFormat(parent));
2456
+ const client2 = resolveClient(parent, brand);
2457
+ printResult(await client2.updateAccessDeny(denyId, { memo: opts.memo }), getFormat(parent));
2005
2458
  });
2006
2459
  accessDeny.command("delete <denyId>").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (denyId) => {
2007
2460
  await confirmDestructiveAction(parent, `\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A "${denyId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
2008
- const client = resolveClient(parent, brand);
2009
- printResult(await client.deleteAccessDeny(denyId), getFormat(parent));
2461
+ const client2 = resolveClient(parent, brand);
2462
+ printResult(await client2.deleteAccessDeny(denyId), getFormat(parent));
2010
2463
  });
2011
2464
  }
2012
2465
 
@@ -2047,11 +2500,11 @@ function buildUpdateData3(opts) {
2047
2500
  function registerXPageSpeedCommands(parent, brand) {
2048
2501
  const xPageSpeed = parent.command("xpagespeed").description("XPageSpeed\u8A2D\u5B9A");
2049
2502
  xPageSpeed.command("list").description("XPageSpeed\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
2050
- const client = resolveClient(parent, brand);
2503
+ const client2 = resolveClient(parent, brand);
2051
2504
  const params = {};
2052
2505
  if (opts.domain)
2053
2506
  params.domain = opts.domain;
2054
- printResult(await client.listXPageSpeed(params), getFormat(parent));
2507
+ printResult(await client2.listXPageSpeed(params), getFormat(parent));
2055
2508
  });
2056
2509
  const update = xPageSpeed.command("update <domain>").description("XPageSpeed\u306E\u6700\u9069\u5316\u6A5F\u80FD\u3092\u5909\u66F4\uFF081\u30EA\u30AF\u30A8\u30B9\u30C8\u30671\u6A5F\u80FD\u306E\u307F\uFF09");
2057
2510
  for (const { cli, desc } of UPDATE_OPTIONS2) {
@@ -2059,8 +2512,8 @@ function registerXPageSpeedCommands(parent, brand) {
2059
2512
  }
2060
2513
  update.action(async (domain, opts) => {
2061
2514
  const data = buildUpdateData3(opts);
2062
- const client = resolveClient(parent, brand);
2063
- printResult(await client.updateXPageSpeed(domain, data), getFormat(parent));
2515
+ const client2 = resolveClient(parent, brand);
2516
+ printResult(await client2.updateXPageSpeed(domain, data), getFormat(parent));
2064
2517
  });
2065
2518
  }
2066
2519
 
@@ -2097,16 +2550,16 @@ function parseDomainElements(values) {
2097
2550
  function registerAutoBackupCommands(parent, brand) {
2098
2551
  const autoBackup = parent.command("auto-backup").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
2099
2552
  autoBackup.command("backup-dates").description("\u9078\u629E\u53EF\u80FD\u306A\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
2100
- const client = resolveClient(parent, brand);
2101
- printResult(await client.listAutoBackupBackupDates(), getFormat(parent));
2553
+ const client2 = resolveClient(parent, brand);
2554
+ printResult(await client2.listAutoBackupBackupDates(), getFormat(parent));
2102
2555
  });
2103
2556
  autoBackup.command("list").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
2104
- const client = resolveClient(parent, brand);
2105
- printResult(await client.listAutoBackup(), getFormat(parent));
2557
+ const client2 = resolveClient(parent, brand);
2558
+ printResult(await client2.listAutoBackup(), getFormat(parent));
2106
2559
  });
2107
2560
  autoBackup.command("show <requestId>").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (requestId) => {
2108
- const client = resolveClient(parent, brand);
2109
- printResult(await client.getAutoBackup(requestId), getFormat(parent));
2561
+ const client2 = resolveClient(parent, brand);
2562
+ printResult(await client2.getAutoBackup(requestId), getFormat(parent));
2110
2563
  });
2111
2564
  autoBackup.command("create").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u307E\u305F\u306F\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u3080").requiredOption("--backup-date <date>", "\u5BFE\u8C61\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\uFF08Y-m-d\uFF09").requiredOption("--operation-type <type>", "\u51E6\u7406\u7A2E\u5225\uFF08fetch / restore\uFF09").requiredOption("--scope <scope>", "\u51E6\u7406\u65B9\u6CD5\uFF08all / selected\uFF09").option("--domain-elements <value>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\uFF08scope=selected \u306E\u3068\u304D\u5FC5\u9808\u3002\u7E70\u308A\u8FD4\u3057\u53EF\uFF09\u3002\u5F62\u5F0F: example.com=web,setting\uFF08elements: web / setting / mail\uFF09", collectFlagValue, []).option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7\uFF08restore \u6642\uFF09").action(async (opts) => {
2112
2565
  const operationType = opts.operationType;
@@ -2128,8 +2581,8 @@ function registerAutoBackupCommands(parent, brand) {
2128
2581
  } else if (domainElementValues.length > 0) {
2129
2582
  validationError("\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F \u51E6\u7406\u65B9\u6CD5 \u304C selected \u306E\u5834\u5408\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002");
2130
2583
  }
2131
- const client = resolveClient(parent, brand);
2132
- printResult(await client.createAutoBackup(data), getFormat(parent));
2584
+ const client2 = resolveClient(parent, brand);
2585
+ printResult(await client2.createAutoBackup(data), getFormat(parent));
2133
2586
  });
2134
2587
  }
2135
2588
 
@@ -2137,24 +2590,24 @@ function registerAutoBackupCommands(parent, brand) {
2137
2590
  function registerMysqlBackupCommands(parent, brand) {
2138
2591
  const mysqlBackup = parent.command("mysql-backup").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
2139
2592
  mysqlBackup.command("databases").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u72B6\u614B\u3092\u53D6\u5F97").action(async () => {
2140
- const client = resolveClient(parent, brand);
2141
- printResult(await client.listMysqlBackupDatabases(), getFormat(parent));
2593
+ const client2 = resolveClient(parent, brand);
2594
+ printResult(await client2.listMysqlBackupDatabases(), getFormat(parent));
2142
2595
  });
2143
2596
  mysqlBackup.command("list").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
2144
- const client = resolveClient(parent, brand);
2145
- printResult(await client.listMysqlBackup(), getFormat(parent));
2597
+ const client2 = resolveClient(parent, brand);
2598
+ printResult(await client2.listMysqlBackup(), getFormat(parent));
2146
2599
  });
2147
2600
  mysqlBackup.command("show <requestId>").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u8A73\u7D30\u3092\u53D6\u5F97").action(async (requestId) => {
2148
- const client = resolveClient(parent, brand);
2149
- printResult(await client.getMysqlBackup(requestId), getFormat(parent));
2601
+ const client2 = resolveClient(parent, brand);
2602
+ printResult(await client2.getMysqlBackup(requestId), getFormat(parent));
2150
2603
  });
2151
2604
  mysqlBackup.command("create").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u307E\u305F\u306F\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u3080").requiredOption("--db-name <name>", "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D").requiredOption("--backup-date <date>", "\u5BFE\u8C61\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\uFF08Y-m-d\uFF09").requiredOption("--operation-type <type>", "\u51E6\u7406\u7A2E\u5225\uFF08fetch / restore\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7\uFF08restore \u6642\uFF09").action(async (opts) => {
2152
2605
  const operationType = opts.operationType;
2153
2606
  if (operationType === "restore") {
2154
2607
  await confirmDestructiveAction(parent, `\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 "${opts.dbName}" \u306E MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u307F\u307E\u3059\u3002\u5BFE\u8C61 DB \u304C\u4E0A\u66F8\u304D\u3055\u308C\u3001\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
2155
2608
  }
2156
- const client = resolveClient(parent, brand);
2157
- printResult(await client.createMysqlBackup({
2609
+ const client2 = resolveClient(parent, brand);
2610
+ printResult(await client2.createMysqlBackup({
2158
2611
  db_name: opts.dbName,
2159
2612
  backup_date: opts.backupDate,
2160
2613
  operation_type: operationType
@@ -2173,13 +2626,917 @@ function registerMeCommand(program, brand) {
2173
2626
  process.exit(1);
2174
2627
  }
2175
2628
  const debug = !!(rootOpts.debug || process.env.XSERVER_DEBUG === "1");
2176
- const client = new ApiClient({
2629
+ const client2 = new ApiClient({
2177
2630
  apiKey: profile.apiKey,
2178
- apiBase: brand.apiBase,
2631
+ apiBase: resolveApiBase(brand),
2179
2632
  servername: profile.servername,
2180
2633
  debug
2181
2634
  });
2182
- printResult(await client.getMe(), getFormat(cmd));
2635
+ printResult(await client2.getMe(), getFormat(cmd));
2636
+ });
2637
+ }
2638
+
2639
+ // ../core/dist/commands/domain/index.js
2640
+ import { randomUUID } from "crypto";
2641
+
2642
+ // ../core/dist/lib/domain-validation.js
2643
+ var DNS_TYPES = /* @__PURE__ */ new Set(["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SRV"]);
2644
+ var IDEMPOTENCY_KEY_PATTERN = /^[A-Za-z0-9_-]{8,64}$/;
2645
+ function isObject(value) {
2646
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2647
+ }
2648
+ function parseInteger(value, optionName, minimum, maximum) {
2649
+ if (!/^\d+$/.test(value)) {
2650
+ throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2651
+ }
2652
+ const parsed = Number(value);
2653
+ if (!Number.isSafeInteger(parsed) || parsed < minimum || maximum !== void 0 && parsed > maximum) {
2654
+ const range = maximum === void 0 ? `${minimum}\u4EE5\u4E0A` : `${minimum}\uFF5E${maximum}`;
2655
+ throw new Error(`${optionName} \u306F${range}\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2656
+ }
2657
+ return parsed;
2658
+ }
2659
+ function parseStrictBoolean(value, optionName) {
2660
+ if (value === "true")
2661
+ return true;
2662
+ if (value === "false")
2663
+ return false;
2664
+ throw new Error(`${optionName} \u306F true \u307E\u305F\u306F false \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2665
+ }
2666
+ function parseNameservers(value) {
2667
+ const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
2668
+ if (nameservers.length < 1 || nameservers.length > 13) {
2669
+ throw new Error("--nameservers \u306F1\uFF5E13\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2670
+ }
2671
+ validateNameserverHostnames(nameservers, 253);
2672
+ if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
2673
+ throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
2674
+ }
2675
+ return nameservers;
2676
+ }
2677
+ function parseRegistrationNameservers(value) {
2678
+ const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
2679
+ if (nameservers.length < 1 || nameservers.length > 6) {
2680
+ throw new Error("--nameservers \u306F1\uFF5E6\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2681
+ }
2682
+ validateNameserverHostnames(nameservers, 255);
2683
+ if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
2684
+ throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
2685
+ }
2686
+ return nameservers;
2687
+ }
2688
+ function validateNameserverHostnames(nameservers, maximumLength) {
2689
+ const hostnamePattern = /^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$/;
2690
+ for (const nameserver of nameservers) {
2691
+ if (nameserver.length > maximumLength || !hostnamePattern.test(nameserver)) {
2692
+ throw new Error(`\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u306F\u5404${maximumLength}\u6587\u5B57\u4EE5\u5185\u306E\u30DB\u30B9\u30C8\u540D\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2693
+ }
2694
+ }
2695
+ }
2696
+ function parseWhoisData(value) {
2697
+ let parsed;
2698
+ try {
2699
+ parsed = JSON.parse(value);
2700
+ } catch {
2701
+ throw new Error("--data \u306F\u6709\u52B9\u306AJSON\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2702
+ }
2703
+ if (!isObject(parsed)) {
2704
+ throw new Error("--data \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2705
+ }
2706
+ if (Object.prototype.hasOwnProperty.call(parsed, "whois_privacy_flag")) {
2707
+ throw new Error("whois_privacy_flag \u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002whois_privacy \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044");
2708
+ }
2709
+ const hasPrivacy = Object.prototype.hasOwnProperty.call(parsed, "whois_privacy");
2710
+ const hasFields = Object.prototype.hasOwnProperty.call(parsed, "fields");
2711
+ if (!hasPrivacy && !hasFields) {
2712
+ throw new Error("--data \u306B\u306F whois_privacy \u307E\u305F\u306F fields \u306E\u3044\u305A\u308C\u304B\u304C\u5FC5\u8981\u3067\u3059");
2713
+ }
2714
+ if (hasPrivacy && typeof parsed.whois_privacy !== "boolean") {
2715
+ throw new Error("whois_privacy \u306Fboolean\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2716
+ }
2717
+ if (hasFields && !isObject(parsed.fields)) {
2718
+ throw new Error("fields \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2719
+ }
2720
+ return parsed;
2721
+ }
2722
+ function validateDnsType(value) {
2723
+ const type = value.toUpperCase();
2724
+ if (!DNS_TYPES.has(type)) {
2725
+ throw new Error("--type \u306F A / AAAA / CNAME / MX / TXT / NS / SRV \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2726
+ }
2727
+ return type;
2728
+ }
2729
+ function validateDnsHost(value) {
2730
+ if (value.length === 0 || value.length > 64) {
2731
+ throw new Error("--host \u306F1\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2732
+ }
2733
+ return value;
2734
+ }
2735
+ function validateDnsContent(value) {
2736
+ if (value.length === 0 || value.length > 1024) {
2737
+ throw new Error("--content \u306F1\uFF5E1024\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2738
+ }
2739
+ return value;
2740
+ }
2741
+ function validateDnsId(value) {
2742
+ if (!/^[1-9]\d*$/.test(value)) {
2743
+ throw new Error("dns_id \u306F\u6B63\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2744
+ }
2745
+ return value;
2746
+ }
2747
+ function validateIdempotencyKey(value) {
2748
+ if (!IDEMPOTENCY_KEY_PATTERN.test(value)) {
2749
+ throw new Error("--idempotency-key \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2750
+ }
2751
+ return value;
2752
+ }
2753
+ function validateDate(value, optionName) {
2754
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
2755
+ throw new Error(`${optionName} \u306FYYYY-MM-DD\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2756
+ }
2757
+ const [year, month, day] = value.split("-").map(Number);
2758
+ const date = new Date(Date.UTC(year, month - 1, day));
2759
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
2760
+ throw new Error(`${optionName} \u306B\u5B58\u5728\u3059\u308B\u65E5\u4ED8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2761
+ }
2762
+ return value;
2763
+ }
2764
+ function requireAtLeastOneField(data, message) {
2765
+ if (Object.keys(data).length === 0) {
2766
+ throw new Error(message);
2767
+ }
2768
+ }
2769
+
2770
+ // ../core/dist/commands/domain/index.js
2771
+ function dnsData(opts) {
2772
+ return pickDefined({
2773
+ host: opts.host === void 0 ? void 0 : validateDnsHost(opts.host),
2774
+ type: opts.type === void 0 ? void 0 : validateDnsType(opts.type),
2775
+ content: opts.content === void 0 ? void 0 : validateDnsContent(opts.content),
2776
+ ttl: opts.ttl === void 0 ? void 0 : parseInteger(opts.ttl, "--ttl", 60, 86400),
2777
+ priority: opts.priority === void 0 ? void 0 : parseInteger(opts.priority, "--priority", 0, 999)
2778
+ });
2779
+ }
2780
+ function addPurchaseOptions(command) {
2781
+ return command.requiredOption("--expected-total-price <yen>", "\u4E8B\u524D\u78BA\u8A8D\u3057\u305F\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09").option("--confirm-purchase", "\u8AB2\u91D1\u3092\u4F34\u3046\u7533\u8ACB\u3092\u660E\u793A\u7684\u306B\u78BA\u8A8D").option("--dry-run", "\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u307F\u5B9F\u884C").option("--idempotency-key <key>", "\u5B9F\u7533\u8ACB\u306E\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\uFF09");
2782
+ }
2783
+ function purchaseValues(opts) {
2784
+ const expectedTotalPrice = parseInteger(opts.expectedTotalPrice, "--expected-total-price", 0);
2785
+ const idempotencyKey = validateIdempotencyKey(opts.idempotencyKey ?? randomUUID());
2786
+ return { expectedTotalPrice, idempotencyKey };
2787
+ }
2788
+ function requirePurchaseConfirmation(opts) {
2789
+ if (!opts.confirmPurchase) {
2790
+ throw new Error("\u5B9F\u7533\u8ACB\u306B\u306F --confirm-purchase \u304C\u5FC5\u8981\u3067\u3059\uFF08--yes \u3067\u306F\u7701\u7565\u3067\u304D\u307E\u305B\u3093\uFF09\u3002\u7D9A\u3051\u3066TTY\u3067\u78BA\u8A8D\u6587\u5B57\u5217\u306E\u5165\u529B\u3082\u5FC5\u8981\u3067\u3059");
2791
+ }
2792
+ }
2793
+ function requireTermsAgreement(opts) {
2794
+ if (!opts.agreeToTerms) {
2795
+ throw new Error("\u65B0\u898F\u53D6\u5F97\u30FB\u79FB\u7BA1\u306B\u306F --agree-to-terms \u306B\u3088\u308B\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u3078\u306E\u660E\u793A\u540C\u610F\u304C\u5FC5\u8981\u3067\u3059");
2796
+ }
2797
+ }
2798
+ function printPurchaseWarning(operation, domain, totalPrice, brand) {
2799
+ console.error([
2800
+ `\u8AB2\u91D1\u64CD\u4F5C: ${operation}`,
2801
+ `\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3: ${domain}`,
2802
+ `\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D: ${totalPrice}\u5186`,
2803
+ ...domainLegalNoticeLines(brand),
2804
+ "\u5B9F\u7533\u8ACB\u5F8C\u306F\u539F\u5247\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002"
2805
+ ].join("\n"));
2806
+ }
2807
+ function totalPriceFromPreview(preview, expectedTotalPrice) {
2808
+ const totalPrice = Number(preview?.total_price);
2809
+ if (!Number.isFinite(totalPrice)) {
2810
+ throw new Error("dry-run\u7D50\u679C\u304B\u3089\u5408\u8A08\u91D1\u984D\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002");
2811
+ }
2812
+ if (totalPrice !== expectedTotalPrice) {
2813
+ throw new Error(`\u4FA1\u683C\u4E0D\u4E00\u81F4\u306E\u305F\u3081\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\uFF08\u898B\u7A4D ${totalPrice}\u5186 / \u6307\u5B9A ${expectedTotalPrice}\u5186\uFF09\u3002`);
2814
+ }
2815
+ return totalPrice;
2816
+ }
2817
+ function registerDomainCommands(parent, brand) {
2818
+ parent.command("list").description("\u4FDD\u6709\u30C9\u30E1\u30A4\u30F3\u306E\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
2819
+ const client2 = resolveClient(parent, brand);
2820
+ printResult(await client2.listDomains(), getFormat(parent));
2821
+ });
2822
+ parent.command("show <domain>").description("\u4FDD\u6709\u30C9\u30E1\u30A4\u30F3\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (domain) => {
2823
+ const client2 = resolveClient(parent, brand);
2824
+ printResult(await client2.getDomainDetail(domain), getFormat(parent));
2825
+ });
2826
+ const nameservers = parent.command("nameservers").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u5074\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u8A2D\u5B9A");
2827
+ nameservers.command("show <domain>").description("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u53D6\u5F97").action(async (domain) => {
2828
+ const client2 = resolveClient(parent, brand);
2829
+ printResult(await client2.getDomainNameservers(domain), getFormat(parent));
2830
+ });
2831
+ nameservers.command("update <domain>").description("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u5168\u7F6E\u63DB").requiredOption("--nameservers <list>", "\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\uFF081\uFF5E13\u4EF6\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (domain, opts) => {
2832
+ const client2 = resolveClient(parent, brand);
2833
+ printResult(await client2.updateDomainNameservers(domain, { nameservers: parseNameservers(String(opts.nameservers)) }), getFormat(parent));
2834
+ });
2835
+ const whois = parent.command("whois").description("Whois\u60C5\u5831\u8A2D\u5B9A");
2836
+ whois.command("show <domain>").description("Whois\u60C5\u5831\u3092\u53D6\u5F97").action(async (domain) => {
2837
+ const client2 = resolveClient(parent, brand);
2838
+ printResult(await client2.getDomainWhois(domain), getFormat(parent));
2839
+ });
2840
+ whois.command("update <domain>").description("Whois\u60C5\u5831\u3092\u66F4\u65B0").requiredOption("--data <json>", "whois_privacy \u307E\u305F\u306F fields \u3092\u542B\u3080JSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8").action(async (domain, opts) => {
2841
+ const client2 = resolveClient(parent, brand);
2842
+ printResult(await client2.updateDomainWhois(domain, parseWhoisData(String(opts.data))), getFormat(parent));
2843
+ });
2844
+ const registrarLock = parent.command("registrar-lock").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u30ED\u30C3\u30AF\u8A2D\u5B9A");
2845
+ registrarLock.command("show <domain>").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u30ED\u30C3\u30AF\u306E\u72B6\u614B\u3092\u53D6\u5F97").action(async (domain) => {
2846
+ const client2 = resolveClient(parent, brand);
2847
+ printResult(await client2.getDomainRegistrarLock(domain), getFormat(parent));
2848
+ });
2849
+ registrarLock.command("update <domain>").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u30ED\u30C3\u30AF\u3092\u5909\u66F4").requiredOption("--locked <bool>", "\u30ED\u30C3\u30AF\u72B6\u614B\uFF08true / false\uFF09").action(async (domain, opts) => {
2850
+ const client2 = resolveClient(parent, brand);
2851
+ printResult(await client2.updateDomainRegistrarLock(domain, {
2852
+ locked: parseStrictBoolean(String(opts.locked), "--locked")
2853
+ }), getFormat(parent));
2854
+ });
2855
+ const dns = parent.command("dns").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u5074DNS\u30EC\u30B3\u30FC\u30C9\u8A2D\u5B9A");
2856
+ dns.command("list <domain>").description("DNS\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97").action(async (domain) => {
2857
+ const client2 = resolveClient(parent, brand);
2858
+ printResult(await client2.listDomainDns(domain), getFormat(parent));
2859
+ });
2860
+ dns.command("add <domain>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u8FFD\u52A0").requiredOption("--host <host>", "\u30DB\u30B9\u30C8\u540D\uFF08@\u3067apex\uFF09").requiredOption("--type <type>", "A / AAAA / CNAME / MX / TXT / NS / SRV").requiredOption("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860\uFF5E86400\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6\uFF080\uFF5E999\uFF09").action(async (domain, opts) => {
2861
+ const client2 = resolveClient(parent, brand);
2862
+ printResult(await client2.addDomainDns(domain, dnsData(opts)), getFormat(parent));
2863
+ });
2864
+ dns.command("update <domain> <dns_id>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u90E8\u5206\u66F4\u65B0").option("--host <host>", "\u30DB\u30B9\u30C8\u540D").option("--type <type>", "A / AAAA / CNAME / MX / TXT / NS / SRV").option("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860\uFF5E86400\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6\uFF080\uFF5E999\uFF09").action(async (domain, dnsId, opts) => {
2865
+ const data = dnsData(opts);
2866
+ requireAtLeastOneField(data, "DNS\u66F4\u65B0\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
2867
+ const client2 = resolveClient(parent, brand);
2868
+ printResult(await client2.updateDomainDns(domain, validateDnsId(dnsId), data), getFormat(parent));
2869
+ });
2870
+ dns.command("delete <domain> <dns_id>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664").action(async (domain, dnsId) => {
2871
+ const validatedDnsId = validateDnsId(dnsId);
2872
+ const client2 = resolveClient(parent, brand);
2873
+ const response = await client2.listDomainDns(domain);
2874
+ const records = typeof response === "object" && response !== null && Array.isArray(response.records) ? response.records : [];
2875
+ const target = records.find((record3) => String(record3.id) === validatedDnsId);
2876
+ if (!target) {
2877
+ throw new Error(`DNS\u30EC\u30B3\u30FC\u30C9 ${validatedDnsId} \u3092\u4E00\u89A7\u304B\u3089\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F`);
2878
+ }
2879
+ printPreview(target, getFormat(parent));
2880
+ await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306EDNS\u30EC\u30B3\u30FC\u30C9 "${validatedDnsId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
2881
+ printResult(await client2.deleteDomainDns(domain, validatedDnsId), getFormat(parent));
2882
+ });
2883
+ parent.command("check <domain>").description("\u30C9\u30E1\u30A4\u30F3\u306E\u53D6\u5F97\u53EF\u5426\u3068\u898B\u7A4D\u3092\u78BA\u8A8D").action(async (domain) => {
2884
+ const client2 = resolveClient(parent, brand);
2885
+ printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.checkDomain(domain)), getFormat(parent));
2886
+ });
2887
+ parent.command("pricing").description("TLD\u5225\u306E\u4FA1\u683C\u4E00\u89A7\u3092\u53D6\u5F97").option("--tld <list>", "TLD\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (opts) => {
2888
+ const client2 = resolveClient(parent, brand);
2889
+ const params = opts.tld === void 0 ? void 0 : { tld: String(opts.tld) };
2890
+ printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.getDomainPricing(params)), getFormat(parent));
2891
+ });
2892
+ addPurchaseOptions(parent.command("register <domain>").description("\u30C9\u30E1\u30A4\u30F3\u3092\u65B0\u898F\u53D6\u5F97").requiredOption("--years <n>", "\u5951\u7D04\u5E74\u6570\uFF081\uFF5E5\uFF09").option("--agree-to-terms", "\u30C9\u30E1\u30A4\u30F3\u53D6\u5F97\u306E\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u306B\u540C\u610F").option("--nameservers <list>", "\u53D6\u5F97\u6642\u306B\u8A2D\u5B9A\u3059\u308B\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\uFF081\uFF5E6\u4EF6\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09")).action(async (domain, opts) => {
2893
+ requireTermsAgreement(opts);
2894
+ const { expectedTotalPrice, idempotencyKey } = purchaseValues(opts);
2895
+ const client2 = resolveClient(parent, brand);
2896
+ const baseData = {
2897
+ domain_name: domain,
2898
+ years: parseInteger(opts.years, "--years", 1, 5),
2899
+ expected_total_price: expectedTotalPrice,
2900
+ agree_to_terms: true,
2901
+ ...opts.nameservers === void 0 ? {} : { nameservers: parseRegistrationNameservers(opts.nameservers) }
2902
+ };
2903
+ const preview = await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.registerDomain({ ...baseData, dry_run: true }));
2904
+ if (opts.dryRun) {
2905
+ printResult(preview, getFormat(parent));
2906
+ return;
2907
+ }
2908
+ printPreview(preview, getFormat(parent));
2909
+ const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
2910
+ printPurchaseWarning("\u30C9\u30E1\u30A4\u30F3\u65B0\u898F\u53D6\u5F97", domain, totalPrice, brand);
2911
+ requirePurchaseConfirmation(opts);
2912
+ await confirmBillingPurchase({
2913
+ operation: "\u30C9\u30E1\u30A4\u30F3\u65B0\u898F\u53D6\u5F97",
2914
+ domain,
2915
+ totalPrice,
2916
+ brand
2917
+ });
2918
+ printIdempotencyKeyNotice(idempotencyKey, domain);
2919
+ printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.registerDomain({ ...baseData, dry_run: false }, idempotencyKey)), getFormat(parent));
2920
+ });
2921
+ addPurchaseOptions(parent.command("transfer <domain>").description("\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1\u3092\u7533\u8ACB").option("--agree-to-terms", "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1\u306E\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u306B\u540C\u610F").requiredOption("--auth-code <code>", "\u79FB\u7BA1\u5143\u3067\u53D6\u5F97\u3057\u305FAuthCode")).action(async (domain, opts) => {
2922
+ requireTermsAgreement(opts);
2923
+ const { expectedTotalPrice, idempotencyKey } = purchaseValues(opts);
2924
+ const client2 = resolveClient(parent, brand);
2925
+ const baseData = {
2926
+ auth_code: opts.authCode,
2927
+ expected_total_price: expectedTotalPrice,
2928
+ agree_to_terms: true
2929
+ };
2930
+ const preview = await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.transferDomain(domain, { ...baseData, dry_run: true }));
2931
+ if (opts.dryRun) {
2932
+ printResult(preview, getFormat(parent));
2933
+ return;
2934
+ }
2935
+ printPreview(preview, getFormat(parent));
2936
+ const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
2937
+ printPurchaseWarning("\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1", domain, totalPrice, brand);
2938
+ requirePurchaseConfirmation(opts);
2939
+ await confirmBillingPurchase({
2940
+ operation: "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1",
2941
+ domain,
2942
+ totalPrice,
2943
+ brand
2944
+ });
2945
+ printIdempotencyKeyNotice(idempotencyKey, domain);
2946
+ printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.transferDomain(domain, { ...baseData, dry_run: false }, idempotencyKey)), getFormat(parent));
2947
+ });
2948
+ addPurchaseOptions(parent.command("renew <domain>").description("\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u3092\u66F4\u65B0").requiredOption("--years <n>", "\u66F4\u65B0\u5E74\u6570\uFF081\uFF5E5\uFF09").requiredOption("--current-expiry-date <date>", "\u73FE\u5728\u306E\u6709\u52B9\u671F\u9650\uFF08YYYY-MM-DD\uFF09")).action(async (domain, opts) => {
2949
+ const { expectedTotalPrice, idempotencyKey } = purchaseValues(opts);
2950
+ const client2 = resolveClient(parent, brand);
2951
+ const baseData = {
2952
+ years: parseInteger(opts.years, "--years", 1, 5),
2953
+ current_expiry_date: validateDate(opts.currentExpiryDate, "--current-expiry-date"),
2954
+ expected_total_price: expectedTotalPrice
2955
+ };
2956
+ const preview = await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.renewDomain(domain, { ...baseData, dry_run: true }));
2957
+ if (opts.dryRun) {
2958
+ printResult(preview, getFormat(parent));
2959
+ return;
2960
+ }
2961
+ printPreview(preview, getFormat(parent));
2962
+ const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
2963
+ printPurchaseWarning("\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u66F4\u65B0", domain, totalPrice, brand);
2964
+ requirePurchaseConfirmation(opts);
2965
+ await confirmBillingPurchase({
2966
+ operation: "\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u66F4\u65B0",
2967
+ domain,
2968
+ totalPrice,
2969
+ brand
2970
+ });
2971
+ printIdempotencyKeyNotice(idempotencyKey, domain);
2972
+ printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.renewDomain(domain, { ...baseData, dry_run: false }, idempotencyKey)), getFormat(parent));
2973
+ });
2974
+ }
2975
+
2976
+ // ../core/dist/commands/wphosting/index.js
2977
+ import { randomUUID as randomUUID2 } from "crypto";
2978
+
2979
+ // ../core/dist/lib/wphosting-validation.js
2980
+ var DNS_TYPES2 = /* @__PURE__ */ new Set(["A", "AAAA", "CNAME", "MX", "TXT", "SRV"]);
2981
+ var IDEMPOTENCY_KEY_PATTERN2 = /^[A-Za-z0-9_-]{8,64}$/;
2982
+ function isWphostingSupportedBrand(brand) {
2983
+ return brand.brand === "xserver";
2984
+ }
2985
+ function parseWphostingInteger(value, optionName, minimum, maximum) {
2986
+ if (!/^\d+$/.test(value))
2987
+ throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2988
+ const parsed = Number(value);
2989
+ if (!Number.isSafeInteger(parsed) || parsed < minimum || maximum !== void 0 && parsed > maximum) {
2990
+ const range = maximum === void 0 ? `${minimum}\u4EE5\u4E0A` : `${minimum}\uFF5E${maximum}`;
2991
+ throw new Error(`${optionName} \u306F${range}\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
2992
+ }
2993
+ return parsed;
2994
+ }
2995
+ function parseWphostingBoolean(value, optionName) {
2996
+ if (value === "true")
2997
+ return true;
2998
+ if (value === "false")
2999
+ return false;
3000
+ throw new Error(`${optionName} \u306F true \u307E\u305F\u306F false \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3001
+ }
3002
+ function validateWphostingEnum(value, optionName, allowed) {
3003
+ if (!allowed.includes(value)) {
3004
+ throw new Error(`${optionName} \u306F ${allowed.join(" / ")} \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3005
+ }
3006
+ return value;
3007
+ }
3008
+ function validateWphostingContractId(value) {
3009
+ if (value.length > 64 || !/^WP-[A-Za-z0-9]+$/.test(value)) {
3010
+ throw new Error("--contract-id \u306F WP- \u3067\u59CB\u307E\u308B\u82F1\u6570\u5B57\u306E\u5951\u7D04ID\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3011
+ }
3012
+ return value;
3013
+ }
3014
+ function validateWphostingServername(value) {
3015
+ if (value.length > 255 || !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value)) {
3016
+ throw new Error("--servername \u306F\u82F1\u6570\u5B57\u3067\u59CB\u307E\u308B255\u6587\u5B57\u4EE5\u5185\u306E\u8B58\u5225\u5B50\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3017
+ }
3018
+ return value;
3019
+ }
3020
+ function validateWphostingPositiveId(value, optionName) {
3021
+ if (!/^[1-9]\d*$/.test(value))
3022
+ throw new Error(`${optionName} \u306F\u6B63\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3023
+ return value;
3024
+ }
3025
+ function validateWphostingOpaqueId(value, optionName) {
3026
+ if (value.length > 255 || !/^[A-Za-z0-9_-]+$/.test(value)) {
3027
+ throw new Error(`${optionName} \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E255\u6587\u5B57\u4EE5\u5185\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3028
+ }
3029
+ return value;
3030
+ }
3031
+ function validateWphostingDnsType(value) {
3032
+ const type = value.toUpperCase();
3033
+ if (!DNS_TYPES2.has(type)) {
3034
+ throw new Error("--type \u306F A / AAAA / CNAME / MX / TXT / SRV \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3035
+ }
3036
+ return type;
3037
+ }
3038
+ function validateWphostingDate(value, optionName = "--date") {
3039
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
3040
+ throw new Error(`${optionName} \u306FYYYY-MM-DD\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3041
+ const [year, month, day] = value.split("-").map(Number);
3042
+ const date = new Date(Date.UTC(year, month - 1, day));
3043
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
3044
+ throw new Error(`${optionName} \u306B\u5B58\u5728\u3059\u308B\u65E5\u4ED8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3045
+ }
3046
+ return value;
3047
+ }
3048
+ function validateWphostingIdempotencyKey(value) {
3049
+ if (!IDEMPOTENCY_KEY_PATTERN2.test(value)) {
3050
+ throw new Error("--idempotency-key \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3051
+ }
3052
+ return value;
3053
+ }
3054
+ function validateWphostingSecurityKey(value) {
3055
+ if (value.length > 100 || !/^[a-z0-9_]+$/.test(value)) {
3056
+ throw new Error("--key \u306F security list \u3067\u53D6\u5F97\u3057\u305F\u8A2D\u5B9A\u30AD\u30FC\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3057
+ }
3058
+ return value;
3059
+ }
3060
+ function validateWphostingServerId(value) {
3061
+ if (!/^[a-z][a-z0-9]{0,11}$/.test(value)) {
3062
+ throw new Error("--server-id \u306F\u5C0F\u6587\u5B57\u82F1\u5B57\u3067\u59CB\u307E\u308B12\u6587\u5B57\u4EE5\u5185\u306E\u5C0F\u6587\u5B57\u82F1\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3063
+ }
3064
+ return value;
3065
+ }
3066
+ function validateWphostingLength(value, optionName, maximum, minimum = 1) {
3067
+ if (value.length < minimum || value.length > maximum) {
3068
+ throw new Error(`${optionName} \u306F${minimum}\uFF5E${maximum}\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3069
+ }
3070
+ return value;
3071
+ }
3072
+ function validateWphostingEmail(value, optionName) {
3073
+ validateWphostingLength(value, optionName, 100);
3074
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
3075
+ throw new Error(`${optionName} \u306F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
3076
+ }
3077
+ return value;
3078
+ }
3079
+ function validateWphostingWpLogin(value, optionName, maximum, allowSpace = false) {
3080
+ validateWphostingLength(value, optionName, maximum);
3081
+ const pattern = allowSpace ? /^[0-9A-Za-z _\-.@]+$/ : /^[0-9A-Za-z_\-.@]+$/;
3082
+ if (!pattern.test(value)) {
3083
+ throw new Error(`${optionName} \u306B\u4F7F\u7528\u3067\u304D\u306A\u3044\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059`);
3084
+ }
3085
+ return value;
3086
+ }
3087
+ function validateWphostingSitePassword(value, username) {
3088
+ validateWphostingLength(value, "--wp-password", 64, 7);
3089
+ if (!/^[A-Za-z0-9!#$%=~^|:_\[\]().+\-*\/@&<>`;?,]+$/.test(value) || !/[A-Za-z]/.test(value) || !/[^A-Za-z]/.test(value)) {
3090
+ throw new Error("--wp-password \u306F\u534A\u89D2\u82F1\u5B57\u3068\u6570\u5B57\u307E\u305F\u306F\u8A18\u53F7\u3092\u542B\u3080\u8A31\u53EF\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3091
+ }
3092
+ if (value === username)
3093
+ throw new Error("--wp-password \u306F --wp-username \u3068\u7570\u306A\u308B\u6587\u5B57\u5217\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3094
+ return value;
3095
+ }
3096
+ function requireWphostingFields(data, message = "\u66F4\u65B0\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044") {
3097
+ if (Object.keys(data).length === 0)
3098
+ throw new Error(message);
3099
+ }
3100
+
3101
+ // ../core/dist/commands/wphosting/index.js
3102
+ function client(parent, brand) {
3103
+ return resolveClient(parent, brand);
3104
+ }
3105
+ function contractId(parent) {
3106
+ return validateWphostingContractId(String(parent.opts().contractId));
3107
+ }
3108
+ function servername(opts) {
3109
+ return validateWphostingServername(String(opts.servername));
3110
+ }
3111
+ function siteCategory(parent, name, description) {
3112
+ const category = parent.command(name).description(description).requiredOption("--servername <site>", "\u5BFE\u8C61\u30B5\u30A4\u30C8\u306Eservername\uFF08\u660E\u793A\u6307\u5B9A\u5FC5\u9808\uFF09");
3113
+ category.hook("preAction", (_command, actionCommand) => {
3114
+ actionCommand.setOptionValue("servername", actionCommand.optsWithGlobals().servername);
3115
+ });
3116
+ return category;
3117
+ }
3118
+ function asyncKey(opts) {
3119
+ const key = validateWphostingIdempotencyKey(String(opts.idempotencyKey ?? randomUUID2()));
3120
+ console.error(`Idempotency-Key: ${key}\uFF08\u518D\u5B9F\u884C\u6642\u306F\u540C\u3058\u30AD\u30FC\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09`);
3121
+ return key;
3122
+ }
3123
+ function asyncOption(command) {
3124
+ return command.option("--idempotency-key <key>", "\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u672A\u6307\u5B9A\u6642\u306F\u81EA\u52D5\u751F\u6210\uFF09");
3125
+ }
3126
+ function objectRows(response, keys) {
3127
+ if (typeof response !== "object" || response === null)
3128
+ return [];
3129
+ const record3 = response;
3130
+ for (const key of keys) {
3131
+ if (Array.isArray(record3[key]))
3132
+ return record3[key];
3133
+ }
3134
+ return [];
3135
+ }
3136
+ function findTarget(response, keys, id, idKeys) {
3137
+ return objectRows(response, keys).find((row) => idKeys.some((key) => String(row[key]) === id));
3138
+ }
3139
+ async function previewListTarget(parent, response, keys, id, idKeys, label) {
3140
+ const target = findTarget(response, keys, id, idKeys);
3141
+ if (!target)
3142
+ throw new Error(`${label} "${id}" \u3092\u4E00\u89A7\u304B\u3089\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F`);
3143
+ printPreview(target, getFormat(parent));
3144
+ }
3145
+ function resourceData(opts) {
3146
+ return {
3147
+ disk_limit_gb: parseWphostingInteger(String(opts.diskLimitGb), "--disk-limit-gb", 10),
3148
+ vcpu_limit: parseWphostingInteger(String(opts.vcpuLimit), "--vcpu-limit", 1),
3149
+ memory_limit_gb: parseWphostingInteger(String(opts.memoryLimitGb), "--memory-limit-gb", 1)
3150
+ };
3151
+ }
3152
+ function pluginThemeData(opts, theme) {
3153
+ const data = pickDefined({
3154
+ status: opts.status === void 0 ? void 0 : validateWphostingEnum(String(opts.status), "--status", theme ? ["active"] : ["active", "inactive"]),
3155
+ auto_update: opts.autoUpdate === void 0 ? void 0 : parseWphostingBoolean(String(opts.autoUpdate), "--auto-update")
3156
+ });
3157
+ requireWphostingFields(data);
3158
+ return data;
3159
+ }
3160
+ function dnsData2(opts, required) {
3161
+ const data = pickDefined({
3162
+ host: opts.host,
3163
+ type: opts.type === void 0 ? void 0 : validateWphostingDnsType(String(opts.type)),
3164
+ content: opts.content,
3165
+ ttl: opts.ttl === void 0 ? void 0 : parseWphostingInteger(String(opts.ttl), "--ttl", 60, 86400),
3166
+ priority: opts.priority === void 0 ? void 0 : parseWphostingInteger(String(opts.priority), "--priority", 0, 65535)
3167
+ });
3168
+ if (!required)
3169
+ requireWphostingFields(data);
3170
+ return data;
3171
+ }
3172
+ function addDnsOptions(command, required) {
3173
+ const option = required ? "requiredOption" : "option";
3174
+ command[option]("--host <host>", "\u30DB\u30B9\u30C8\u540D\uFF08@\u3067apex\uFF09");
3175
+ command[option]("--type <type>", "A / AAAA / CNAME / MX / TXT / SRV");
3176
+ command[option]("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024");
3177
+ return command.option("--ttl <seconds>", "TTL\uFF0860\uFF5E86400\uFF09").option("--priority <n>", "\u512A\u5148\u5EA6\uFF080\uFF5E65535\uFF09");
3178
+ }
3179
+ function cronData(opts, required) {
3180
+ const data = pickDefined({
3181
+ minute: opts.minute,
3182
+ hour: opts.hour,
3183
+ day: opts.day,
3184
+ month: opts.month,
3185
+ weekday: opts.weekday,
3186
+ command: opts.command,
3187
+ comment: opts.comment,
3188
+ enabled: opts.enabled === void 0 ? void 0 : parseWphostingBoolean(String(opts.enabled), "--enabled")
3189
+ });
3190
+ if (!required)
3191
+ requireWphostingFields(data);
3192
+ return data;
3193
+ }
3194
+ function registerWphostingCommands(parent, brand) {
3195
+ const cid = () => contractId(parent);
3196
+ const api = () => client(parent, brand);
3197
+ const sites = parent.command("sites").description("\u30B5\u30A4\u30C8\u60C5\u5831\u30FB\u4F5C\u6210\u30FB\u524A\u9664");
3198
+ sites.command("list").description("\u30B5\u30A4\u30C8\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
3199
+ printResult(await api().listWphostingSites(cid()), getFormat(parent));
3200
+ });
3201
+ sites.command("show").description("\u30B5\u30A4\u30C8\u8A73\u7D30\u3092\u53D6\u5F97").requiredOption("--servername <site>", "\u5BFE\u8C61\u30B5\u30A4\u30C8\u306Eservername\uFF08\u660E\u793A\u6307\u5B9A\u5FC5\u9808\uFF09").action(async (opts) => {
3202
+ printResult(await api().getWphostingSite(cid(), servername(opts)), getFormat(parent));
3203
+ });
3204
+ asyncOption(sites.command("create").description("\u30B5\u30A4\u30C8\u3092\u4F5C\u6210").requiredOption("--wp-sitename <name>", "WordPress\u30B5\u30A4\u30C8\u540D").requiredOption("--wp-username <name>", "WordPress\u7BA1\u7406\u30E6\u30FC\u30B6\u30FC").requiredOption("--wp-password <password>", "WordPress\u7BA1\u7406\u30D1\u30B9\u30EF\u30FC\u30C9\uFF087\uFF5E64\u6587\u5B57\uFF09").requiredOption("--wp-mailaddress <email>", "WordPress\u7BA1\u7406\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9").requiredOption("--disk-limit-gb <gb>", "\u30C7\u30A3\u30B9\u30AF\u4E0A\u9650GB\uFF0810\u4EE5\u4E0A\uFF09").requiredOption("--vcpu-limit <n>", "vCPU\u4E0A\u9650\uFF081\u4EE5\u4E0A\uFF09").requiredOption("--memory-limit-gb <gb>", "\u30E1\u30E2\u30EA\u4E0A\u9650GB\uFF081\u4EE5\u4E0A\uFF09").option("--wp-theme <theme>", "default / cocoon-master / lightning").option("--server-id <id>", "\u521D\u671FURL\u306E\u30B5\u30FC\u30D0\u30FCID").option("--security-auto-optimize <bool>", "\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u81EA\u52D5\u6700\u9069\u5316\uFF08true / false\uFF09").option("--memo <memo>", "\u30E1\u30E2\uFF08255\u6587\u5B57\u4EE5\u5185\uFF09")).action(async (opts) => {
3205
+ const data = {
3206
+ ...resourceData(opts),
3207
+ wp_sitename: validateWphostingLength(String(opts.wpSitename), "--wp-sitename", 255),
3208
+ wp_username: validateWphostingWpLogin(String(opts.wpUsername), "--wp-username", 255, true),
3209
+ wp_password: validateWphostingSitePassword(String(opts.wpPassword), String(opts.wpUsername)),
3210
+ wp_mailaddress: validateWphostingEmail(String(opts.wpMailaddress), "--wp-mailaddress"),
3211
+ ...pickDefined({
3212
+ wp_theme: opts.wpTheme === void 0 ? void 0 : validateWphostingEnum(String(opts.wpTheme), "--wp-theme", ["default", "cocoon-master", "lightning"]),
3213
+ server_id: opts.serverId === void 0 ? void 0 : validateWphostingServerId(String(opts.serverId)),
3214
+ security_auto_optimize: opts.securityAutoOptimize === void 0 ? void 0 : parseWphostingBoolean(String(opts.securityAutoOptimize), "--security-auto-optimize"),
3215
+ memo: opts.memo === void 0 ? void 0 : validateWphostingLength(String(opts.memo), "--memo", 255)
3216
+ })
3217
+ };
3218
+ const result = await api().createWphostingSite(cid(), data, asyncKey(opts));
3219
+ printResult(result, getFormat(parent));
3220
+ });
3221
+ asyncOption(sites.command("delete").description("\u30B5\u30A4\u30C8\u3092\u524A\u9664").requiredOption("--servername <site>", "\u5BFE\u8C61\u30B5\u30A4\u30C8\u306Eservername\uFF08\u660E\u793A\u6307\u5B9A\u5FC5\u9808\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7")).action(async (opts) => {
3222
+ const site = servername(opts);
3223
+ const detail = await api().getWphostingSite(cid(), site);
3224
+ printPreview(detail, getFormat(parent));
3225
+ console.error("\u8B66\u544A: \u672C\u756A\u30B5\u30A4\u30C8\u3092\u524A\u9664\u3059\u308B\u3068\u3001\u7D10\u3065\u304F\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0\u74B0\u5883\u3082\u9023\u52D5\u3057\u3066\u524A\u9664\u3055\u308C\u307E\u3059\u3002");
3226
+ await confirmDestructiveAction(parent, `\u30B5\u30A4\u30C8 "${site}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3227
+ printResult(await api().deleteWphostingSite(cid(), site, asyncKey(opts)), getFormat(parent));
3228
+ });
3229
+ parent.command("usage").description("\u5951\u7D04\u4E0A\u9650\u3068\u30B5\u30A4\u30C8\u5225\u4F7F\u7528\u91CF").command("show").description("\u5229\u7528\u72B6\u6CC1\u3092\u53D6\u5F97").action(async () => {
3230
+ printResult(await api().getWphostingUsage(cid()), getFormat(parent));
3231
+ });
3232
+ const staging = siteCategory(parent, "staging", "\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0\u74B0\u5883");
3233
+ asyncOption(staging.command("create").description("\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0\u74B0\u5883\u3092\u4F5C\u6210").requiredOption("--disk-limit-gb <gb>", "\u30C7\u30A3\u30B9\u30AF\u4E0A\u9650GB\uFF0810\u4EE5\u4E0A\uFF09").requiredOption("--vcpu-limit <n>", "vCPU\u4E0A\u9650\uFF081\u4EE5\u4E0A\uFF09").requiredOption("--memory-limit-gb <gb>", "\u30E1\u30E2\u30EA\u4E0A\u9650GB\uFF081\u4EE5\u4E0A\uFF09").option("--server-id <id>", "\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0URL\u306E\u30B5\u30FC\u30D0\u30FCID").option("--security-auto-optimize <bool>", "\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u81EA\u52D5\u6700\u9069\u5316\uFF08true / false\uFF09")).action(async (opts) => {
3234
+ const data = {
3235
+ ...resourceData(opts),
3236
+ ...pickDefined({
3237
+ server_id: opts.serverId === void 0 ? void 0 : validateWphostingServerId(String(opts.serverId)),
3238
+ security_auto_optimize: opts.securityAutoOptimize === void 0 ? void 0 : parseWphostingBoolean(String(opts.securityAutoOptimize), "--security-auto-optimize")
3239
+ })
3240
+ };
3241
+ const result = await api().createWphostingStaging(cid(), servername(opts), data, asyncKey(opts));
3242
+ printResult(result, getFormat(parent));
3243
+ });
3244
+ const backups = siteCategory(parent, "backups", "\u624B\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7");
3245
+ backups.command("list").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
3246
+ printResult(await api().listWphostingBackups(cid(), servername(opts)), getFormat(parent));
3247
+ });
3248
+ asyncOption(backups.command("create").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3092\u4F5C\u6210").option("--memo <memo>", "\u30E1\u30E2\uFF08255\u6587\u5B57\u4EE5\u5185\uFF09")).action(async (opts) => {
3249
+ const site = servername(opts);
3250
+ const data = pickDefined({
3251
+ memo: opts.memo === void 0 ? void 0 : validateWphostingLength(String(opts.memo), "--memo", 255)
3252
+ });
3253
+ printResult(await api().createWphostingBackup(cid(), site, data, asyncKey(opts)), getFormat(parent));
3254
+ });
3255
+ asyncOption(backups.command("restore").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3092\u5FA9\u5143").requiredOption("--backup-id <id>", "\u5FA9\u5143\u3059\u308B\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7")).action(async (opts) => {
3256
+ const site = servername(opts);
3257
+ const backupId = validateWphostingOpaqueId(String(opts.backupId), "--backup-id");
3258
+ const list = await api().listWphostingBackups(cid(), site);
3259
+ await previewListTarget(parent, list, ["backups"], backupId, ["id", "backup_id"], "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7");
3260
+ console.error("\u8B66\u544A: \u73FE\u5728\u306E\u30B5\u30A4\u30C8\u5185\u5BB9\u306F\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u5185\u5BB9\u3067\u4E0A\u66F8\u304D\u3055\u308C\u3001\u5FA9\u5143\u64CD\u4F5C\u306F\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002");
3261
+ await confirmDestructiveAction(parent, `\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7 "${backupId}" \u3092\u5FA9\u5143\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3262
+ printResult(await api().restoreWphostingBackup(cid(), site, backupId, asyncKey(opts)), getFormat(parent));
3263
+ });
3264
+ backups.command("restore-history").description("\u5FA9\u5143\u5C65\u6B74\u3092\u53D6\u5F97").action(async (opts) => {
3265
+ printResult(await api().listWphostingBackupRestoreHistory(cid(), servername(opts)), getFormat(parent));
3266
+ });
3267
+ backups.command("delete").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3092\u524A\u9664").requiredOption("--backup-id <id>", "\u524A\u9664\u3059\u308B\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
3268
+ const site = servername(opts);
3269
+ const id = validateWphostingOpaqueId(String(opts.backupId), "--backup-id");
3270
+ await previewListTarget(parent, await api().listWphostingBackups(cid(), site), ["backups"], id, ["id", "backup_id"], "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7");
3271
+ await confirmDestructiveAction(parent, `\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7 "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u524A\u9664\u5F8C\u306F\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3272
+ printResult(await api().deleteWphostingBackup(cid(), site, id), getFormat(parent));
3273
+ });
3274
+ const wordpress = siteCategory(parent, "wordpress", "WordPress\u672C\u4F53");
3275
+ wordpress.command("show").description("WordPress\u60C5\u5831\u3092\u53D6\u5F97").action(async (opts) => {
3276
+ printResult(await api().getWphostingWordPress(cid(), servername(opts)), getFormat(parent));
3277
+ });
3278
+ wordpress.command("update").description("WordPress\u81EA\u52D5\u66F4\u65B0\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--auto-update-scope <scope>", "none / minor / all").action(async (opts) => {
3279
+ const data = { auto_update_scope: validateWphostingEnum(String(opts.autoUpdateScope), "--auto-update-scope", ["none", "minor", "all"]) };
3280
+ printResult(await api().updateWphostingWordPress(cid(), servername(opts), data), getFormat(parent));
3281
+ });
3282
+ wordpress.command("upgrade").description("WordPress\u672C\u4F53\u3092\u66F4\u65B0").action(async (opts) => {
3283
+ printResult(await api().upgradeWphostingWordPress(cid(), servername(opts)), getFormat(parent));
3284
+ });
3285
+ const maintenance = siteCategory(parent, "maintenance-mode", "\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\u30E2\u30FC\u30C9");
3286
+ maintenance.command("show").description("\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (opts) => {
3287
+ printResult(await api().getWphostingMaintenanceMode(cid(), servername(opts)), getFormat(parent));
3288
+ });
3289
+ maintenance.command("update").description("\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--enabled <bool>", "true / false").action(async (opts) => {
3290
+ printResult(await api().updateWphostingMaintenanceMode(cid(), servername(opts), {
3291
+ enabled: parseWphostingBoolean(String(opts.enabled), "--enabled")
3292
+ }), getFormat(parent));
3293
+ });
3294
+ registerExtensionCommands(parent, brand, "plugins");
3295
+ registerExtensionCommands(parent, brand, "themes");
3296
+ const domains = siteCategory(parent, "domains", "\u30B5\u30A4\u30C8\u306E\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
3297
+ domains.command("list").description("\u30C9\u30E1\u30A4\u30F3\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
3298
+ printResult(await api().listWphostingDomains(cid(), servername(opts)), getFormat(parent));
3299
+ });
3300
+ domains.command("add").description("\u30C9\u30E1\u30A4\u30F3\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u8FFD\u52A0\u3059\u308B\u30C9\u30E1\u30A4\u30F3").action(async (opts) => {
3301
+ printResult(await api().addWphostingDomain(cid(), servername(opts), { domain: String(opts.domain) }), getFormat(parent));
3302
+ });
3303
+ domains.command("verify").description("\u30C9\u30E1\u30A4\u30F3\u6240\u6709\u8005\u78BA\u8A8D\u3092\u5B9F\u884C").requiredOption("--domain <domain>", "\u78BA\u8A8D\u3059\u308B\u30C9\u30E1\u30A4\u30F3").action(async (opts) => {
3304
+ printResult(await api().verifyWphostingDomain(cid(), servername(opts), String(opts.domain)), getFormat(parent));
3305
+ });
3306
+ domains.command("delete").description("\u30C9\u30E1\u30A4\u30F3\u3092\u524A\u9664").requiredOption("--domain <domain>", "\u524A\u9664\u3059\u308B\u30C9\u30E1\u30A4\u30F3").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
3307
+ const site = servername(opts);
3308
+ const domain = String(opts.domain);
3309
+ await previewListTarget(parent, await api().listWphostingDomains(cid(), site), ["domains"], domain, ["domain", "name"], "\u30C9\u30E1\u30A4\u30F3");
3310
+ await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A "${domain}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3311
+ printResult(await api().deleteWphostingDomain(cid(), site, domain), getFormat(parent));
3312
+ });
3313
+ const siteUrl = siteCategory(parent, "site-url", "\u30D7\u30E9\u30A4\u30DE\u30EA\u30C9\u30E1\u30A4\u30F3");
3314
+ siteUrl.command("update").description("\u30B5\u30A4\u30C8URL\u3092\u5909\u66F4").requiredOption("--domain <domain>", "\u5909\u66F4\u5148\u30C9\u30E1\u30A4\u30F3").option("--auto-redirect <bool>", "\u65E7URL\u304B\u3089\u65B0URL\u3078\u81EA\u52D5\u8EE2\u9001\uFF08true / false\u3001\u672A\u6307\u5B9A\u6642true\uFF09").action(async (opts) => {
3315
+ printResult(await api().updateWphostingSiteUrl(cid(), servername(opts), pickDefined({
3316
+ domain: String(opts.domain),
3317
+ auto_redirect: opts.autoRedirect === void 0 ? void 0 : parseWphostingBoolean(String(opts.autoRedirect), "--auto-redirect")
3318
+ })), getFormat(parent));
3319
+ });
3320
+ const dns = siteCategory(parent, "dns", "WPhosting\u30B5\u30A4\u30C8\u306EDNS\u30EC\u30B3\u30FC\u30C9");
3321
+ dns.command("list").description("DNS\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").action(async (opts) => {
3322
+ printResult(await api().listWphostingDnsRecords(cid(), servername(opts), String(opts.domain)), getFormat(parent));
3323
+ });
3324
+ addDnsOptions(dns.command("add").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3"), true).action(async (opts) => {
3325
+ printResult(await api().addWphostingDnsRecord(cid(), servername(opts), String(opts.domain), dnsData2(opts, true)), getFormat(parent));
3326
+ });
3327
+ addDnsOptions(dns.command("update").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u66F4\u65B0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--dns-id <id>", "DNS\u30EC\u30B3\u30FC\u30C9ID"), false).action(async (opts) => {
3328
+ printResult(await api().updateWphostingDnsRecord(cid(), servername(opts), String(opts.domain), validateWphostingPositiveId(String(opts.dnsId), "--dns-id"), dnsData2(opts, false)), getFormat(parent));
3329
+ });
3330
+ dns.command("delete").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--dns-id <id>", "DNS\u30EC\u30B3\u30FC\u30C9ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
3331
+ const site = servername(opts);
3332
+ const domain = String(opts.domain);
3333
+ const id = validateWphostingPositiveId(String(opts.dnsId), "--dns-id");
3334
+ await previewListTarget(parent, await api().listWphostingDnsRecords(cid(), site, domain), ["records", "dns_records"], id, ["id", "dns_id"], "DNS\u30EC\u30B3\u30FC\u30C9");
3335
+ await confirmDestructiveAction(parent, `DNS\u30EC\u30B3\u30FC\u30C9 "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3336
+ printResult(await api().deleteWphostingDnsRecord(cid(), site, domain, id), getFormat(parent));
3337
+ });
3338
+ const phpVersion = siteCategory(parent, "php-version", "PHP\u30D0\u30FC\u30B8\u30E7\u30F3");
3339
+ phpVersion.command("show").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u53D6\u5F97").action(async (opts) => {
3340
+ printResult(await api().getWphostingPhpVersion(cid(), servername(opts)), getFormat(parent));
3341
+ });
3342
+ phpVersion.command("update").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5909\u66F4").requiredOption("--php <version>", "GET\u3067\u53D6\u5F97\u3057\u305Favailable\u306E\u5024").action(async (opts) => {
3343
+ if (!/^\d+\.\d+$/.test(String(opts.php)))
3344
+ throw new Error("--php \u306F 8.3 \u306E\u3088\u3046\u306A\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
3345
+ printResult(await api().updateWphostingPhpVersion(cid(), servername(opts), { version: String(opts.php) }), getFormat(parent));
3346
+ });
3347
+ registerLogCommand(parent, brand, "access-log", true);
3348
+ registerLogCommand(parent, brand, "error-log", false);
3349
+ registerWphostingCron(parent, brand);
3350
+ registerWphostingSsh(parent, brand);
3351
+ registerWphostingUsers(parent, brand);
3352
+ const security = siteCategory(parent, "security", "WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A");
3353
+ security.command("list").description("\u516C\u958B\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (opts) => {
3354
+ printResult(await api().getWphostingSecurity(cid(), servername(opts)), getFormat(parent));
3355
+ });
3356
+ security.command("update").description("\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--key <key>", "\u516C\u958B\u5BFE\u8C61\u306E\u8A2D\u5B9A\u30AD\u30FC").requiredOption("--enabled <bool>", "true / false").action(async (opts) => {
3357
+ printResult(await api().updateWphostingSecurity(cid(), servername(opts), validateWphostingSecurityKey(String(opts.key)), { is_enable: parseWphostingBoolean(String(opts.enabled), "--enabled") }), getFormat(parent));
3358
+ });
3359
+ }
3360
+ function registerExtensionCommands(parent, brand, kind) {
3361
+ const singular = kind === "plugins" ? "plugin" : "theme";
3362
+ const category = siteCategory(parent, kind, kind === "plugins" ? "WordPress\u30D7\u30E9\u30B0\u30A4\u30F3" : "WordPress\u30C6\u30FC\u30DE");
3363
+ const methodKind = kind === "plugins" ? "Plugin" : "Theme";
3364
+ const api = () => client(parent, brand);
3365
+ const cid = () => contractId(parent);
3366
+ category.command("list").description("\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
3367
+ printResult(await api()[`listWphosting${methodKind}s`](cid(), servername(opts)), getFormat(parent));
3368
+ });
3369
+ category.command("install").description("\u516C\u5F0F\u30EA\u30DD\u30B8\u30C8\u30EA\u304B\u3089\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").requiredOption(`--${singular} <slug>`, `${singular} slug`).option("--activate <bool>", "\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u5F8C\u306B\u6709\u52B9\u5316\uFF08true / false\u3001\u672A\u6307\u5B9A\u6642false\uFF09").action(async (opts) => {
3370
+ const slug = String(opts[singular]);
3371
+ printResult(await api()[`installWphosting${methodKind}`](cid(), servername(opts), pickDefined({
3372
+ [singular]: slug,
3373
+ activate: opts.activate === void 0 ? void 0 : parseWphostingBoolean(String(opts.activate), "--activate")
3374
+ })), getFormat(parent));
3375
+ });
3376
+ category.command("update").description("\u72B6\u614B\u30FB\u81EA\u52D5\u66F4\u65B0\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption(`--${singular} <slug>`, `${singular} slug`).option("--status <status>", kind === "plugins" ? "active / inactive" : "active").option("--auto-update <bool>", "true / false").action(async (opts) => {
3377
+ printResult(await api()[`updateWphosting${methodKind}`](cid(), servername(opts), String(opts[singular]), pluginThemeData(opts, kind === "themes")), getFormat(parent));
3378
+ });
3379
+ category.command("upgrade").description("\u30D0\u30FC\u30B8\u30E7\u30F3\u66F4\u65B0\u3092\u5B9F\u884C").requiredOption(`--${singular} <slug>`, `${singular} slug`).action(async (opts) => {
3380
+ printResult(await api()[`upgradeWphosting${methodKind}`](cid(), servername(opts), String(opts[singular])), getFormat(parent));
3381
+ });
3382
+ category.command("delete").description("\u524A\u9664").requiredOption(`--${singular} <slug>`, `${singular} slug`).option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
3383
+ const site = servername(opts);
3384
+ const slug = String(opts[singular]);
3385
+ const list = await api()[`listWphosting${methodKind}s`](cid(), site);
3386
+ await previewListTarget(parent, list, [kind], slug, [singular, "slug", "name"], singular);
3387
+ await confirmDestructiveAction(parent, `${singular} "${slug}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3388
+ printResult(await api()[`deleteWphosting${methodKind}`](cid(), site, slug), getFormat(parent));
3389
+ });
3390
+ }
3391
+ function registerLogCommand(parent, brand, name, hasDate) {
3392
+ const category = siteCategory(parent, name, name === "access-log" ? "\u30A2\u30AF\u30BB\u30B9\u30ED\u30B0" : "\u30A8\u30E9\u30FC\u30ED\u30B0");
3393
+ const command = category.command("show").description("\u30ED\u30B0\u3092\u53D6\u5F97").option("--keyword <keyword>", "\u7D5E\u308A\u8FBC\u307F\u30AD\u30FC\u30EF\u30FC\u30C9").option("--line-number <n>", "\u53D6\u5F97\u884C\u6570\uFF081\uFF5E50000\uFF09");
3394
+ if (hasDate)
3395
+ command.option("--date <date>", "\u5BFE\u8C61\u65E5\uFF08YYYY-MM-DD\uFF09");
3396
+ command.action(async (opts) => {
3397
+ const params = pickDefined({
3398
+ date: opts.date === void 0 ? void 0 : validateWphostingDate(String(opts.date)),
3399
+ keyword: opts.keyword === void 0 ? void 0 : String(opts.keyword),
3400
+ line_number: opts.lineNumber === void 0 ? void 0 : String(parseWphostingInteger(String(opts.lineNumber), "--line-number", 1, 5e4))
3401
+ });
3402
+ const method = hasDate ? "getWphostingAccessLog" : "getWphostingErrorLog";
3403
+ printResult(await client(parent, brand)[method](contractId(parent), servername(opts), params), getFormat(parent));
3404
+ });
3405
+ }
3406
+ function registerWphostingCron(parent, brand) {
3407
+ const cron = siteCategory(parent, "cron", "WPhosting\u30B5\u30A4\u30C8\u306ECron\u8A2D\u5B9A");
3408
+ const api = () => client(parent, brand);
3409
+ const cid = () => contractId(parent);
3410
+ cron.command("list").description("Cron\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
3411
+ printResult(await api().listWphostingCron(cid(), servername(opts)), getFormat(parent));
3412
+ });
3413
+ cron.command("add").description("Cron\u3092\u8FFD\u52A0").requiredOption("--minute <value>", "\u5206").requiredOption("--hour <value>", "\u6642").requiredOption("--day <value>", "\u65E5").requiredOption("--month <value>", "\u6708").requiredOption("--weekday <value>", "\u66DC\u65E5").requiredOption("--command <command>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--comment <comment>", "\u30B3\u30E1\u30F3\u30C8").action(async (opts) => {
3414
+ printResult(await api().addWphostingCron(cid(), servername(opts), cronData(opts, true)), getFormat(parent));
3415
+ });
3416
+ cron.command("update").description("Cron\u3092\u66F4\u65B0").requiredOption("--cron-id <id>", "Cron ID").option("--minute <value>", "\u5206").option("--hour <value>", "\u6642").option("--day <value>", "\u65E5").option("--month <value>", "\u6708").option("--weekday <value>", "\u66DC\u65E5").option("--command <command>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--comment <comment>", "\u30B3\u30E1\u30F3\u30C8").option("--enabled <bool>", "true / false").action(async (opts) => {
3417
+ printResult(await api().updateWphostingCron(cid(), servername(opts), validateWphostingOpaqueId(String(opts.cronId), "--cron-id"), cronData(opts, false)), getFormat(parent));
3418
+ });
3419
+ cron.command("delete").description("Cron\u3092\u524A\u9664").requiredOption("--cron-id <id>", "Cron ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
3420
+ const site = servername(opts);
3421
+ const id = validateWphostingOpaqueId(String(opts.cronId), "--cron-id");
3422
+ await previewListTarget(parent, await api().listWphostingCron(cid(), site), ["cron", "crons"], id, ["id", "cron_id"], "Cron");
3423
+ await confirmDestructiveAction(parent, `Cron "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3424
+ printResult(await api().deleteWphostingCron(cid(), site, id), getFormat(parent));
3425
+ });
3426
+ }
3427
+ function registerWphostingSsh(parent, brand) {
3428
+ const ssh = siteCategory(parent, "ssh", "WPhosting\u30B5\u30A4\u30C8\u306ESSH\u8A2D\u5B9A");
3429
+ const api = () => client(parent, brand);
3430
+ const cid = () => contractId(parent);
3431
+ ssh.command("show").description("SSH\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (opts) => {
3432
+ printResult(await api().getWphostingSsh(cid(), servername(opts)), getFormat(parent));
3433
+ });
3434
+ ssh.command("update").description("SSH\u8A2D\u5B9A\u3092\u5909\u66F4").option("--ssh-enabled <bool>", "SSH\u3092\u6709\u52B9\u5316\uFF08true / false\uFF09").option("--abroad-access-restriction <bool>", "\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\uFF08true / false\uFF09").action(async (opts) => {
3435
+ const data = pickDefined({
3436
+ ssh_enabled: opts.sshEnabled === void 0 ? void 0 : parseWphostingBoolean(String(opts.sshEnabled), "--ssh-enabled"),
3437
+ abroad_access_restriction: opts.abroadAccessRestriction === void 0 ? void 0 : parseWphostingBoolean(String(opts.abroadAccessRestriction), "--abroad-access-restriction")
3438
+ });
3439
+ requireWphostingFields(data);
3440
+ printResult(await api().updateWphostingSsh(cid(), servername(opts), data), getFormat(parent));
3441
+ });
3442
+ const keys = ssh.command("keys").description("SSH\u516C\u958B\u9375");
3443
+ keys.command("list").description("\u516C\u958B\u9375\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
3444
+ printResult(await api().listWphostingSshKeys(cid(), servername(opts)), getFormat(parent));
3445
+ });
3446
+ keys.command("add").description("\u516C\u958B\u9375\u3092\u767B\u9332\u307E\u305F\u306F\u751F\u6210").requiredOption("--label <label>", "\u30E9\u30D9\u30EB\uFF081\uFF5E500\u6587\u5B57\uFF09").option("--public-key <key>", "\u767B\u9332\u3059\u308B\u516C\u958B\u9375").option("--generate <bool>", "\u9375\u30DA\u30A2\u3092\u751F\u6210\uFF08true / false\uFF09").option("--passphrase <passphrase>", "\u751F\u6210\u9375\u306E\u30D1\u30B9\u30D5\u30EC\u30FC\u30BA").action(async (opts) => {
3447
+ const generate = opts.generate === void 0 ? false : parseWphostingBoolean(String(opts.generate), "--generate");
3448
+ if (!generate && opts.publicKey === void 0)
3449
+ throw new Error("--public-key \u307E\u305F\u306F --generate true \u304C\u5FC5\u8981\u3067\u3059");
3450
+ if (generate && opts.publicKey !== void 0)
3451
+ throw new Error("--generate true \u3068 --public-key \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
3452
+ if (!generate && opts.passphrase !== void 0)
3453
+ throw new Error("--passphrase \u306F --generate true \u306E\u5834\u5408\u3060\u3051\u6307\u5B9A\u3067\u304D\u307E\u3059");
3454
+ const data = pickDefined({
3455
+ label: validateWphostingLength(String(opts.label), "--label", 500),
3456
+ public_key: opts.publicKey,
3457
+ generate: generate || void 0,
3458
+ passphrase: opts.passphrase === void 0 ? void 0 : validateWphostingLength(String(opts.passphrase), "--passphrase", 32, 6)
3459
+ });
3460
+ if (generate)
3461
+ console.error("\u6CE8\u610F: \u751F\u6210\u3055\u308C\u305Fprivate_key\u306F\u3053\u306E\u5FDC\u7B54\u3067\u4E00\u5EA6\u3060\u3051\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u5B89\u5168\u306A\u5834\u6240\u3078\u76F4\u3061\u306B\u4FDD\u5B58\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
3462
+ printResult(await api().addWphostingSshKey(cid(), servername(opts), data), getFormat(parent));
3463
+ });
3464
+ keys.command("update").description("\u516C\u958B\u9375\u3092\u66F4\u65B0").requiredOption("--key-id <id>", "\u516C\u958B\u9375ID").option("--label <label>", "\u30E9\u30D9\u30EB\uFF081\uFF5E500\u6587\u5B57\uFF09").option("--status <status>", "on / off").action(async (opts) => {
3465
+ const data = pickDefined({
3466
+ label: opts.label === void 0 ? void 0 : validateWphostingLength(String(opts.label), "--label", 500),
3467
+ status: opts.status === void 0 ? void 0 : validateWphostingEnum(String(opts.status), "--status", ["on", "off"])
3468
+ });
3469
+ requireWphostingFields(data);
3470
+ printResult(await api().updateWphostingSshKey(cid(), servername(opts), validateWphostingPositiveId(String(opts.keyId), "--key-id"), data), getFormat(parent));
3471
+ });
3472
+ keys.command("delete").description("\u516C\u958B\u9375\u3092\u524A\u9664").requiredOption("--key-id <id>", "\u516C\u958B\u9375ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
3473
+ const site = servername(opts);
3474
+ const id = validateWphostingPositiveId(String(opts.keyId), "--key-id");
3475
+ await previewListTarget(parent, await api().listWphostingSshKeys(cid(), site), ["keys", "ssh_keys"], id, ["id", "key_id"], "SSH\u516C\u958B\u9375");
3476
+ await confirmDestructiveAction(parent, `SSH\u516C\u958B\u9375 "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3477
+ printResult(await api().deleteWphostingSshKey(cid(), site, id), getFormat(parent));
3478
+ });
3479
+ }
3480
+ function wpUserData(opts, create) {
3481
+ const data = pickDefined({
3482
+ user_login: opts.userLogin === void 0 ? void 0 : validateWphostingWpLogin(String(opts.userLogin), "--user-login", 60),
3483
+ user_email: opts.userEmail === void 0 ? void 0 : validateWphostingEmail(String(opts.userEmail), "--user-email"),
3484
+ user_pass: opts.userPass === void 0 ? void 0 : validateWphostingLength(String(opts.userPass), "--user-pass", 64, 7),
3485
+ role: opts.role === void 0 ? void 0 : validateWphostingLength(String(opts.role), "--role", 64),
3486
+ display_name: opts.displayName === void 0 ? void 0 : validateWphostingLength(String(opts.displayName), "--display-name", 255),
3487
+ first_name: opts.firstName === void 0 ? void 0 : validateWphostingLength(String(opts.firstName), "--first-name", 255),
3488
+ last_name: opts.lastName === void 0 ? void 0 : validateWphostingLength(String(opts.lastName), "--last-name", 255),
3489
+ user_url: opts.userUrl === void 0 ? void 0 : validateWphostingLength(String(opts.userUrl), "--user-url", 255),
3490
+ send_email: opts.sendEmail === void 0 ? void 0 : parseWphostingBoolean(String(opts.sendEmail), "--send-email")
3491
+ });
3492
+ if (!create)
3493
+ requireWphostingFields(data);
3494
+ return data;
3495
+ }
3496
+ function addWpUserFields(command, create) {
3497
+ const option = create ? "requiredOption" : "option";
3498
+ if (create)
3499
+ command.requiredOption("--user-login <login>", "\u30E6\u30FC\u30B6\u30FC\u540D\uFF0860\u6587\u5B57\u4EE5\u5185\uFF09");
3500
+ command[option]("--user-email <email>", "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08100\u6587\u5B57\u4EE5\u5185\uFF09");
3501
+ command[option]("--user-pass <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9\uFF0864\u6587\u5B57\u4EE5\u5185\uFF09");
3502
+ command[option]("--role <role>", "\u6A29\u9650\u30B0\u30EB\u30FC\u30D7");
3503
+ command.option("--display-name <name>", "\u8868\u793A\u540D").option("--first-name <name>", "\u540D").option("--last-name <name>", "\u59D3").option("--user-url <url>", "\u30B5\u30A4\u30C8URL");
3504
+ if (create)
3505
+ command.option("--send-email <bool>", "\u901A\u77E5\u30E1\u30FC\u30EB\u9001\u4FE1\uFF08true / false\uFF09");
3506
+ return command;
3507
+ }
3508
+ function registerWphostingUsers(parent, brand) {
3509
+ const users = siteCategory(parent, "wp-users", "WordPress\u30E6\u30FC\u30B6\u30FC");
3510
+ const api = () => client(parent, brand);
3511
+ const cid = () => contractId(parent);
3512
+ users.command("roles").description("\u6A29\u9650\u30B0\u30EB\u30FC\u30D7\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
3513
+ printResult(await api().listWphostingWpUserRoles(cid(), servername(opts)), getFormat(parent));
3514
+ });
3515
+ users.command("list").description("\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3092\u53D6\u5F97").option("--search <value>", "\u691C\u7D22\u8A9E").option("--orderby <field>", "ID / user_login / display_name / user_email / user_registered").option("--order <order>", "asc / desc").action(async (opts) => {
3516
+ const params = pickDefined({
3517
+ search: opts.search === void 0 ? void 0 : String(opts.search),
3518
+ orderby: opts.orderby === void 0 ? void 0 : validateWphostingEnum(String(opts.orderby), "--orderby", ["ID", "user_login", "display_name", "user_email", "user_registered"]),
3519
+ order: opts.order === void 0 ? void 0 : validateWphostingEnum(String(opts.order), "--order", ["asc", "desc"])
3520
+ });
3521
+ printResult(await api().listWphostingWpUsers(cid(), servername(opts), params), getFormat(parent));
3522
+ });
3523
+ addWpUserFields(users.command("create").description("\u30E6\u30FC\u30B6\u30FC\u3092\u4F5C\u6210"), true).action(async (opts) => {
3524
+ printResult(await api().createWphostingWpUser(cid(), servername(opts), wpUserData(opts, true)), getFormat(parent));
3525
+ });
3526
+ users.command("show").description("\u30E6\u30FC\u30B6\u30FC\u8A73\u7D30\u3092\u53D6\u5F97").requiredOption("--user-id <id>", "\u30E6\u30FC\u30B6\u30FCID").action(async (opts) => {
3527
+ printResult(await api().getWphostingWpUser(cid(), servername(opts), validateWphostingPositiveId(String(opts.userId), "--user-id")), getFormat(parent));
3528
+ });
3529
+ addWpUserFields(users.command("update").description("\u30E6\u30FC\u30B6\u30FC\u3092\u66F4\u65B0").requiredOption("--user-id <id>", "\u30E6\u30FC\u30B6\u30FCID"), false).action(async (opts) => {
3530
+ printResult(await api().updateWphostingWpUser(cid(), servername(opts), validateWphostingPositiveId(String(opts.userId), "--user-id"), wpUserData(opts, false)), getFormat(parent));
3531
+ });
3532
+ users.command("delete").description("\u30E6\u30FC\u30B6\u30FC\u3092\u524A\u9664").requiredOption("--user-id <id>", "\u30E6\u30FC\u30B6\u30FCID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
3533
+ const site = servername(opts);
3534
+ const id = validateWphostingPositiveId(String(opts.userId), "--user-id");
3535
+ const target = await api().getWphostingWpUser(cid(), site, id);
3536
+ printPreview(target, getFormat(parent));
3537
+ console.error("\u8B66\u544A: \u3053\u306E\u30E6\u30FC\u30B6\u30FC\u304C\u6240\u6709\u3059\u308B\u6295\u7A3F\u306A\u3069\u3082\u524A\u9664\u3055\u308C\u307E\u3059\u3002");
3538
+ await confirmDestructiveAction(parent, `WordPress\u30E6\u30FC\u30B6\u30FC "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
3539
+ printResult(await api().deleteWphostingWpUser(cid(), site, id), getFormat(parent));
2183
3540
  });
2184
3541
  }
2185
3542
 
@@ -2194,6 +3551,12 @@ function run(brand, version = "0.0.0") {
2194
3551
  }, "table").option("--profile <name>", "\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").option("--debug", "\u30C7\u30D0\u30C3\u30B0\u51FA\u529B\u3092\u6709\u52B9\u5316\uFF08\u30EA\u30AF\u30A8\u30B9\u30C8URL\u30FB\u30EC\u30B9\u30DD\u30F3\u30B9\u30D8\u30C3\u30C0\u3092\u8868\u793A\uFF09");
2195
3552
  registerAuthCommands(program, brand);
2196
3553
  registerMeCommand(program, brand);
3554
+ if (isWphostingSupportedBrand(brand)) {
3555
+ const wphosting = program.command("wphosting").description("XServer for WordPress API").requiredOption("--contract-id <id>", "WPhosting\u5951\u7D04ID\uFF08\u4F8B: WP-AB234567\uFF09");
3556
+ registerWphostingCommands(wphosting, brand);
3557
+ }
3558
+ const domain = program.command("domain").description("\u30C9\u30E1\u30A4\u30F3\u30B5\u30FC\u30D3\u30B9API\uFF08\u53D6\u5F97\u30FB\u5951\u7D04\u30FBDNS\u30FBWhois\u306A\u3069\uFF09");
3559
+ registerDomainCommands(domain, brand);
2197
3560
  const server = program.command("server").description("\u30B5\u30FC\u30D0\u30FC\u7BA1\u7406API\uFF08WordPress\u30FB\u30E1\u30FC\u30EB\u30FBDB\u306A\u3069\uFF09").option("--servername <name>", "\u30B5\u30FC\u30D0\u30FC\u540D\uFF08\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u4E0A\u66F8\u304D\uFF09");
2198
3561
  registerServerInfoCommands(server, brand);
2199
3562
  registerCronCommands(server, brand);
@@ -2235,21 +3598,23 @@ function run(brand, version = "0.0.0") {
2235
3598
  console.error(` - ${e}`);
2236
3599
  }
2237
3600
  }
2238
- process.exit(1);
3601
+ process.exitCode = 1;
3602
+ return;
2239
3603
  }
2240
3604
  if (err instanceof Error) {
2241
3605
  console.error(`\u30A8\u30E9\u30FC: ${err.message}`);
2242
- process.exit(1);
3606
+ process.exitCode = 1;
3607
+ return;
2243
3608
  }
2244
3609
  console.error("\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F");
2245
- process.exit(1);
3610
+ process.exitCode = 1;
2246
3611
  });
2247
3612
  }
2248
3613
 
2249
3614
  // package.json
2250
3615
  var package_default = {
2251
3616
  name: "xserver-cli",
2252
- version: "1.2.2",
3617
+ version: "1.3.0",
2253
3618
  description: "Official CLI for XServer API \u2014 manage your XServer hosting from the terminal",
2254
3619
  type: "module",
2255
3620
  bin: {
@@ -2296,6 +3661,8 @@ run({
2296
3661
  brand: "xserver",
2297
3662
  apiBase: "https://api.xserver.ne.jp",
2298
3663
  displayName: "XServer API",
3664
+ domainTermsUrl: "https://www.xdomain.ne.jp/rule/rule.php",
3665
+ domainPrivacyUrl: "https://www.xdomain.ne.jp/privacy_announcement.php",
2299
3666
  commandName: "xserver",
2300
3667
  configDir: "xserver-cli"
2301
3668
  }, package_default.version);