shincloud-cli 1.2.1 → 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,9 +814,52 @@ 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
- import { password } from "@inquirer/prompts";
862
+ import { password, select } from "@inquirer/prompts";
571
863
 
572
864
  // ../core/dist/lib/config.js
573
865
  import fs from "fs";
@@ -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)) {
@@ -772,16 +1214,86 @@ function pickDefined(obj) {
772
1214
  return result;
773
1215
  }
774
1216
 
1217
+ // ../core/dist/lib/resolve-servername-from-me.js
1218
+ function resolveServernameFromMe(meData) {
1219
+ const services = meData.services;
1220
+ const server = services?.server;
1221
+ if (!server) {
1222
+ return { status: "manual", reason: "no_server" };
1223
+ }
1224
+ const targetMode = server.target_mode;
1225
+ const targets = normalizeTargets(server.targets);
1226
+ if (targetMode === "all") {
1227
+ return { status: "manual", reason: "all" };
1228
+ }
1229
+ if (targetMode === "selected") {
1230
+ if (targets.length === 1) {
1231
+ return { status: "auto", servername: targets[0] };
1232
+ }
1233
+ if (targets.length >= 2) {
1234
+ return { status: "choose", targets };
1235
+ }
1236
+ return { status: "manual", reason: "empty_targets" };
1237
+ }
1238
+ return { status: "manual", reason: "empty_targets" };
1239
+ }
1240
+ function manualServernameMessage(reason) {
1241
+ switch (reason) {
1242
+ case "no_server":
1243
+ return "\u3053\u306EAPI\u30AD\u30FC\u3067\u306F\u30B5\u30FC\u30D0\u30FCAPI\u3092\u5229\u7528\u3067\u304D\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u30FC\u533A\u5206\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093\uFF09\u3002";
1244
+ case "all":
1245
+ return "\u3053\u306EAPI\u30AD\u30FC\u306F\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u304C\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08\u300C\u3059\u3079\u3066\u306E\u30B5\u30FC\u30D0\u30FC\u300D\u7B49\uFF09\u3002";
1246
+ case "empty_targets":
1247
+ return "\u3053\u306EAPI\u30AD\u30FC\u306E\u30B5\u30FC\u30D0\u30FC\u5BFE\u8C61\u3092\u7279\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002";
1248
+ }
1249
+ }
1250
+ function normalizeTargets(targets) {
1251
+ if (!Array.isArray(targets)) {
1252
+ return [];
1253
+ }
1254
+ return targets.filter((t) => typeof t === "string" && t !== "");
1255
+ }
1256
+
775
1257
  // ../core/dist/commands/auth/login.js
776
1258
  function maskApiKey(apiKey) {
777
1259
  return `${apiKey.substring(0, 8)}...`;
778
1260
  }
1261
+ async function resolveLoginServername(meData, brand) {
1262
+ const outcome = resolveServernameFromMe(meData);
1263
+ if (outcome.status === "auto") {
1264
+ console.error(` \u30B5\u30FC\u30D0\u30FC\u540D\u3092\u81EA\u52D5\u691C\u51FA\u3057\u307E\u3057\u305F: ${outcome.servername}`);
1265
+ return outcome.servername;
1266
+ }
1267
+ if (outcome.status === "choose") {
1268
+ if (process.stdin.isTTY) {
1269
+ const chosen = await select({
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)
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
+ }
1277
+ console.error(` \u30B5\u30FC\u30D0\u30FC\u540D: ${chosen}`);
1278
+ return chosen;
1279
+ }
1280
+ console.error(" \u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u304C\u8907\u6570\u3042\u308B\u305F\u3081\u81EA\u52D5\u691C\u51FA\u3067\u304D\u307E\u305B\u3093\u3002--servername \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
1281
+ console.error(` \u5019\u88DC: ${outcome.targets.join(", ")}`);
1282
+ console.error(" \u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u3067\u306F --servername \u3067\u5BFE\u8C61\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
1283
+ console.error(` \u4F8B: ${brand.commandName} server --servername <\u30B5\u30FC\u30D0\u30FCID> info`);
1284
+ return void 0;
1285
+ }
1286
+ console.error(` ${manualServernameMessage(outcome.reason)}`);
1287
+ console.error(" \u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u3067\u306F --servername \u3067\u5BFE\u8C61\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
1288
+ console.error(` \u4F8B: ${brand.commandName} server --servername <\u30B5\u30FC\u30D0\u30FCID> info`);
1289
+ return void 0;
1290
+ }
779
1291
  function registerAuthCommands(program, brand) {
780
1292
  const auth = program.command("auth").description("\u8A8D\u8A3C\u8A2D\u5B9A");
781
- 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) => {
782
1294
  const profileName = cmd.optsWithGlobals().profile ?? "default";
783
1295
  let apiKey = opts.apiKey;
784
- let servername = opts.servername;
1296
+ let servername2 = opts.servername;
785
1297
  if (!apiKey) {
786
1298
  apiKey = await password({ message: "API\u30AD\u30FC\u3092\u5165\u529B:", mask: true });
787
1299
  }
@@ -790,10 +1302,11 @@ function registerAuthCommands(program, brand) {
790
1302
  process.exit(1);
791
1303
  }
792
1304
  console.error("\u8A8D\u8A3C\u60C5\u5831\u3092\u691C\u8A3C\u4E2D...");
793
- const client = new ApiClient({ apiKey, apiBase: brand.apiBase });
1305
+ const apiBase = resolveApiBase(brand);
1306
+ const client2 = new ApiClient({ apiKey, apiBase });
794
1307
  let meData;
795
1308
  try {
796
- meData = await client.getMe();
1309
+ meData = await client2.getMe();
797
1310
  } catch (err) {
798
1311
  if (err instanceof ApiError && err.errorCode === "UNAUTHORIZED") {
799
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");
@@ -802,18 +1315,19 @@ function registerAuthCommands(program, brand) {
802
1315
  throw err;
803
1316
  }
804
1317
  console.error("\u2713 \u8A8D\u8A3C\u306B\u6210\u529F\u3057\u307E\u3057\u305F");
805
- if (!servername && meData.servername) {
806
- servername = meData.servername;
807
- console.error(` \u30B5\u30FC\u30D0\u30FC\u540D\u3092\u81EA\u52D5\u691C\u51FA\u3057\u307E\u3057\u305F: ${servername}`);
808
- } else if (!servername) {
809
- console.error(" \u3053\u306EAPI\u30AD\u30FC\u306F\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u304C\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08\u300C\u3059\u3079\u3066\u306E\u30B5\u30FC\u30D0\u30FC\u300D\u7B49\uFF09\u3002");
810
- console.error(" \u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u3067\u306F --servername \u3067\u5BFE\u8C61\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
811
- console.error(` \u4F8B: ${brand.commandName} server --servername <\u30B5\u30FC\u30D0\u30FCID> info`);
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);
812
1326
  }
813
1327
  const config = loadConfig(brand);
814
1328
  config.profiles[profileName] = {
815
1329
  apiKey,
816
- ...servername ? { servername } : {}
1330
+ ...servername2 ? { servername: servername2 } : {}
817
1331
  };
818
1332
  if (!config.defaultProfile) {
819
1333
  config.defaultProfile = profileName;
@@ -846,7 +1360,7 @@ function registerAuthCommands(program, brand) {
846
1360
  profile: profileName,
847
1361
  api_key: maskApiKey(profile.apiKey),
848
1362
  servername: profile.servername ?? null,
849
- api_base: brand.apiBase
1363
+ api_base: resolveApiBase(brand)
850
1364
  }, format);
851
1365
  return;
852
1366
  }
@@ -857,7 +1371,7 @@ function registerAuthCommands(program, brand) {
857
1371
  } else {
858
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");
859
1373
  }
860
- 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)}`);
861
1375
  });
862
1376
  auth.command("profiles").description("\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7\u3092\u8868\u793A").action((_opts, cmd) => {
863
1377
  const format = getFormat(cmd);
@@ -905,12 +1419,12 @@ function registerAuthCommands(program, brand) {
905
1419
  // ../core/dist/commands/server/info.js
906
1420
  function registerServerInfoCommands(parent, brand) {
907
1421
  parent.command("info").description("\u30B5\u30FC\u30D0\u30FC\u60C5\u5831\u3092\u53D6\u5F97").action(async () => {
908
- const client = resolveClient(parent, brand);
909
- printResult(await client.getServerInfo(), getFormat(parent));
1422
+ const client2 = resolveClient(parent, brand);
1423
+ printResult(await client2.getServerInfo(), getFormat(parent));
910
1424
  });
911
1425
  parent.command("usage").description("\u30B5\u30FC\u30D0\u30FC\u5229\u7528\u72B6\u6CC1\u3092\u53D6\u5F97").action(async () => {
912
- const client = resolveClient(parent, brand);
913
- printResult(await client.getServerUsage(), getFormat(parent));
1426
+ const client2 = resolveClient(parent, brand);
1427
+ printResult(await client2.getServerUsage(), getFormat(parent));
914
1428
  });
915
1429
  }
916
1430
 
@@ -918,11 +1432,11 @@ function registerServerInfoCommands(parent, brand) {
918
1432
  function registerCronCommands(parent, brand) {
919
1433
  const cron = parent.command("cron").description("Cron\u8A2D\u5B9A");
920
1434
  cron.command("list").description("Cron\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
921
- const client = resolveClient(parent, brand);
922
- printResult(await client.listCron(), getFormat(parent));
1435
+ const client2 = resolveClient(parent, brand);
1436
+ printResult(await client2.listCron(), getFormat(parent));
923
1437
  });
924
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) => {
925
- const client = resolveClient(parent, brand);
1439
+ const client2 = resolveClient(parent, brand);
926
1440
  const data = pickDefined({
927
1441
  minute: opts.minute,
928
1442
  hour: opts.hour,
@@ -932,10 +1446,10 @@ function registerCronCommands(parent, brand) {
932
1446
  command: opts.command,
933
1447
  comment: opts.comment
934
1448
  });
935
- printResult(await client.addCron(data), getFormat(parent));
1449
+ printResult(await client2.addCron(data), getFormat(parent));
936
1450
  });
937
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) => {
938
- const client = resolveClient(parent, brand);
1452
+ const client2 = resolveClient(parent, brand);
939
1453
  const data = pickDefined({
940
1454
  minute: opts.minute,
941
1455
  hour: opts.hour,
@@ -947,12 +1461,12 @@ function registerCronCommands(parent, brand) {
947
1461
  });
948
1462
  if (opts.enabled !== void 0)
949
1463
  data.enabled = opts.enabled === "true";
950
- printResult(await client.updateCron(cronId, data), getFormat(parent));
1464
+ printResult(await client2.updateCron(cronId, data), getFormat(parent));
951
1465
  });
952
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) => {
953
1467
  await confirmDestructiveAction(parent, `Cron "${cronId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
954
- const client = resolveClient(parent, brand);
955
- printResult(await client.deleteCron(cronId), getFormat(parent));
1468
+ const client2 = resolveClient(parent, brand);
1469
+ printResult(await client2.deleteCron(cronId), getFormat(parent));
956
1470
  });
957
1471
  }
958
1472
 
@@ -960,14 +1474,14 @@ function registerCronCommands(parent, brand) {
960
1474
  function registerWpCommands(parent, brand) {
961
1475
  const wp = parent.command("wp").description("WordPress\u7C21\u5358\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB");
962
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) => {
963
- const client = resolveClient(parent, brand);
1477
+ const client2 = resolveClient(parent, brand);
964
1478
  const params = {};
965
1479
  if (opts.domain)
966
1480
  params.domain = opts.domain;
967
- printResult(await client.listWordpress(params), getFormat(parent));
1481
+ printResult(await client2.listWordpress(params), getFormat(parent));
968
1482
  });
969
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) => {
970
- const client = resolveClient(parent, brand);
1484
+ const client2 = resolveClient(parent, brand);
971
1485
  const data = pickDefined({
972
1486
  url: opts.url,
973
1487
  title: opts.title,
@@ -976,21 +1490,21 @@ function registerWpCommands(parent, brand) {
976
1490
  admin_email: opts.adminEmail,
977
1491
  memo: opts.memo
978
1492
  });
979
- printResult(await client.addWordpress(data), getFormat(parent));
1493
+ printResult(await client2.addWordpress(data), getFormat(parent));
980
1494
  });
981
1495
  wp.command("update <wpId>").description("WordPress\u8A2D\u5B9A\u3092\u5909\u66F4").option("--memo <value>", "\u30E1\u30E2").action(async (wpId, opts) => {
982
- const client = resolveClient(parent, brand);
983
- 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));
984
1498
  });
985
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) => {
986
1500
  await confirmDestructiveAction(parent, `WordPress "${wpId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
987
- const client = resolveClient(parent, brand);
1501
+ const client2 = resolveClient(parent, brand);
988
1502
  const data = pickDefined({
989
1503
  delete_db: opts.deleteDb !== void 0 ? opts.deleteDb === "true" : void 0,
990
1504
  delete_db_user: opts.deleteDbUser !== void 0 ? opts.deleteDbUser === "true" : void 0,
991
1505
  delete_cron: opts.deleteCron !== void 0 ? opts.deleteCron === "true" : void 0
992
1506
  });
993
- printResult(await client.deleteWordpress(wpId, data), getFormat(parent));
1507
+ printResult(await client2.deleteWordpress(wpId, data), getFormat(parent));
994
1508
  });
995
1509
  }
996
1510
 
@@ -998,29 +1512,29 @@ function registerWpCommands(parent, brand) {
998
1512
  function registerMailCommands(parent, brand) {
999
1513
  const mail = parent.command("mail").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A");
1000
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) => {
1001
- const client = resolveClient(parent, brand);
1515
+ const client2 = resolveClient(parent, brand);
1002
1516
  const params = {};
1003
1517
  if (opts.domain)
1004
1518
  params.domain = opts.domain;
1005
- printResult(await client.listMail(params), getFormat(parent));
1519
+ printResult(await client2.listMail(params), getFormat(parent));
1006
1520
  });
1007
1521
  mail.command("get <mailAccount>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A73\u7D30\u3092\u53D6\u5F97").action(async (mailAccount) => {
1008
- const client = resolveClient(parent, brand);
1009
- printResult(await client.getMail(mailAccount), getFormat(parent));
1522
+ const client2 = resolveClient(parent, brand);
1523
+ printResult(await client2.getMail(mailAccount), getFormat(parent));
1010
1524
  });
1011
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) => {
1012
- const client = resolveClient(parent, brand);
1526
+ const client2 = resolveClient(parent, brand);
1013
1527
  const data = pickDefined({
1014
1528
  mail_address: mailAddress,
1015
1529
  password: opts.password,
1016
1530
  quota_mb: opts.quotaMb !== void 0 ? parseInt(opts.quotaMb, 10) : void 0,
1017
1531
  memo: opts.memo
1018
1532
  });
1019
- printResult(await client.addMail(data), getFormat(parent));
1533
+ printResult(await client2.addMail(data), getFormat(parent));
1020
1534
  });
1021
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) => {
1022
- const client = resolveClient(parent, brand);
1023
- printResult(await client.updateMail(mailAccount, pickDefined({
1536
+ const client2 = resolveClient(parent, brand);
1537
+ printResult(await client2.updateMail(mailAccount, pickDefined({
1024
1538
  password: opts.password,
1025
1539
  quota_mb: opts.quotaMb !== void 0 ? parseInt(opts.quotaMb, 10) : void 0,
1026
1540
  memo: opts.memo
@@ -1028,21 +1542,21 @@ function registerMailCommands(parent, brand) {
1028
1542
  });
1029
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) => {
1030
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`);
1031
- const client = resolveClient(parent, brand);
1032
- printResult(await client.deleteMail(mailAccount), getFormat(parent));
1545
+ const client2 = resolveClient(parent, brand);
1546
+ printResult(await client2.deleteMail(mailAccount), getFormat(parent));
1033
1547
  });
1034
1548
  mail.command("forwarding-get <mailAccount>").description("\u30E1\u30FC\u30EB\u8EE2\u9001\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (mailAccount) => {
1035
- const client = resolveClient(parent, brand);
1036
- printResult(await client.getMailForwarding(mailAccount), getFormat(parent));
1549
+ const client2 = resolveClient(parent, brand);
1550
+ printResult(await client2.getMailForwarding(mailAccount), getFormat(parent));
1037
1551
  });
1038
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) => {
1039
- const client = resolveClient(parent, brand);
1553
+ const client2 = resolveClient(parent, brand);
1040
1554
  const data = {};
1041
1555
  if (opts.forwardingAddresses)
1042
1556
  data.forwarding_addresses = opts.forwardingAddresses.split(",").map((a) => a.trim());
1043
1557
  if (opts.keepInMailbox !== void 0)
1044
1558
  data.keep_in_mailbox = opts.keepInMailbox === "true";
1045
- printResult(await client.updateMailForwarding(mailAccount, data), getFormat(parent));
1559
+ printResult(await client2.updateMailForwarding(mailAccount, data), getFormat(parent));
1046
1560
  });
1047
1561
  }
1048
1562
 
@@ -1056,11 +1570,11 @@ function parseAddressList(value) {
1056
1570
  function registerSpamFilterCommands(parent, brand) {
1057
1571
  const spamFilter = parent.command("spam-filter").description("\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\u8A2D\u5B9A");
1058
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) => {
1059
- const client = resolveClient(parent, brand);
1573
+ const client2 = resolveClient(parent, brand);
1060
1574
  const params = {};
1061
1575
  if (opts.domain)
1062
1576
  params.domain = opts.domain;
1063
- printResult(await client.listSpamFilter(params), getFormat(parent));
1577
+ printResult(await client2.listSpamFilter(params), getFormat(parent));
1064
1578
  });
1065
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) => {
1066
1580
  const data = {};
@@ -1083,12 +1597,12 @@ function registerSpamFilterCommands(parent, brand) {
1083
1597
  if (Object.keys(data).length === 0) {
1084
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");
1085
1599
  }
1086
- const client = resolveClient(parent, brand);
1087
- printResult(await client.updateSpamFilter(domain, data), getFormat(parent));
1600
+ const client2 = resolveClient(parent, brand);
1601
+ printResult(await client2.updateSpamFilter(domain, data), getFormat(parent));
1088
1602
  });
1089
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) => {
1090
- const client = resolveClient(parent, brand);
1091
- printResult(await client.updateSpamFilterDmarcReceiver(domain, {
1604
+ const client2 = resolveClient(parent, brand);
1605
+ printResult(await client2.updateSpamFilterDmarcReceiver(domain, {
1092
1606
  dmarc_receiver: opts.dmarcReceiver
1093
1607
  }), getFormat(parent));
1094
1608
  });
@@ -1098,14 +1612,14 @@ function registerSpamFilterCommands(parent, brand) {
1098
1612
  function registerMailFilterCommands(parent, brand) {
1099
1613
  const mailFilter = parent.command("mail-filter").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A");
1100
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) => {
1101
- const client = resolveClient(parent, brand);
1615
+ const client2 = resolveClient(parent, brand);
1102
1616
  const params = {};
1103
1617
  if (opts.domain)
1104
1618
  params.domain = opts.domain;
1105
- printResult(await client.listMailFilter(params), getFormat(parent));
1619
+ printResult(await client2.listMailFilter(params), getFormat(parent));
1106
1620
  });
1107
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) => {
1108
- const client = resolveClient(parent, brand);
1622
+ const client2 = resolveClient(parent, brand);
1109
1623
  const data = {
1110
1624
  domain: opts.domain,
1111
1625
  conditions: [{
@@ -1119,12 +1633,12 @@ function registerMailFilterCommands(parent, brand) {
1119
1633
  method: opts.actionMethod || "move"
1120
1634
  }
1121
1635
  };
1122
- printResult(await client.addMailFilter(data), getFormat(parent));
1636
+ printResult(await client2.addMailFilter(data), getFormat(parent));
1123
1637
  });
1124
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) => {
1125
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`);
1126
- const client = resolveClient(parent, brand);
1127
- printResult(await client.deleteMailFilter(filterId), getFormat(parent));
1640
+ const client2 = resolveClient(parent, brand);
1641
+ printResult(await client2.deleteMailFilter(filterId), getFormat(parent));
1128
1642
  });
1129
1643
  }
1130
1644
 
@@ -1132,19 +1646,19 @@ function registerMailFilterCommands(parent, brand) {
1132
1646
  function registerAutoReplyCommands(parent, brand) {
1133
1647
  const autoReply = parent.command("auto-reply").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A");
1134
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) => {
1135
- const client = resolveClient(parent, brand);
1649
+ const client2 = resolveClient(parent, brand);
1136
1650
  const params = {};
1137
1651
  if (opts.domain)
1138
1652
  params.domain = opts.domain;
1139
- printResult(await client.listAutoReply(params), getFormat(parent));
1653
+ printResult(await client2.listAutoReply(params), getFormat(parent));
1140
1654
  });
1141
1655
  autoReply.command("get <mailAddress>").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (mailAccount) => {
1142
- const client = resolveClient(parent, brand);
1143
- printResult(await client.getAutoReply(mailAccount), getFormat(parent));
1656
+ const client2 = resolveClient(parent, brand);
1657
+ printResult(await client2.getAutoReply(mailAccount), getFormat(parent));
1144
1658
  });
1145
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) => {
1146
- const client = resolveClient(parent, brand);
1147
- printResult(await client.addAutoReply({
1660
+ const client2 = resolveClient(parent, brand);
1661
+ printResult(await client2.addAutoReply({
1148
1662
  domain: opts.domain,
1149
1663
  mail_address: opts.mailAddress,
1150
1664
  from_name: opts.fromName,
@@ -1167,13 +1681,13 @@ function registerAutoReplyCommands(parent, brand) {
1167
1681
  if (Object.keys(data).length === 0) {
1168
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");
1169
1683
  }
1170
- const client = resolveClient(parent, brand);
1171
- printResult(await client.updateAutoReply(mailAccount, data), getFormat(parent));
1684
+ const client2 = resolveClient(parent, brand);
1685
+ printResult(await client2.updateAutoReply(mailAccount, data), getFormat(parent));
1172
1686
  });
1173
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) => {
1174
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`);
1175
- const client = resolveClient(parent, brand);
1176
- printResult(await client.deleteAutoReply(mailAccount), getFormat(parent));
1689
+ const client2 = resolveClient(parent, brand);
1690
+ printResult(await client2.deleteAutoReply(mailAccount), getFormat(parent));
1177
1691
  });
1178
1692
  }
1179
1693
 
@@ -1181,15 +1695,15 @@ function registerAutoReplyCommands(parent, brand) {
1181
1695
  function registerSmtpAbroadRestrictionCommands(parent, brand) {
1182
1696
  const smtpAbroadRestriction = parent.command("smtp-abroad-restriction").description("SMTP\u8A8D\u8A3C\u306E\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u8A2D\u5B9A");
1183
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) => {
1184
- const client = resolveClient(parent, brand);
1698
+ const client2 = resolveClient(parent, brand);
1185
1699
  const params = {};
1186
1700
  if (opts.domain)
1187
1701
  params.domain = opts.domain;
1188
- printResult(await client.listSmtpAbroadRestriction(params), getFormat(parent));
1702
+ printResult(await client2.listSmtpAbroadRestriction(params), getFormat(parent));
1189
1703
  });
1190
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) => {
1191
- const client = resolveClient(parent, brand);
1192
- printResult(await client.updateSmtpAbroadRestriction(domain, {
1705
+ const client2 = resolveClient(parent, brand);
1706
+ printResult(await client2.updateSmtpAbroadRestriction(domain, {
1193
1707
  abroad_access_restriction: opts.abroadAccessRestriction
1194
1708
  }), getFormat(parent));
1195
1709
  });
@@ -1199,19 +1713,19 @@ function registerSmtpAbroadRestrictionCommands(parent, brand) {
1199
1713
  function registerDkimCommands(parent, brand) {
1200
1714
  const dkim = parent.command("dkim").description("DKIM\u8A2D\u5B9A");
1201
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) => {
1202
- const client = resolveClient(parent, brand);
1716
+ const client2 = resolveClient(parent, brand);
1203
1717
  const params = {};
1204
1718
  if (opts.domain)
1205
1719
  params.domain = opts.domain;
1206
- printResult(await client.listDkim(params), getFormat(parent));
1720
+ printResult(await client2.listDkim(params), getFormat(parent));
1207
1721
  });
1208
1722
  dkim.command("get <fqdn>").description("DKIM\u8A2D\u5B9A\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (fqdn) => {
1209
- const client = resolveClient(parent, brand);
1210
- printResult(await client.getDkim(fqdn), getFormat(parent));
1723
+ const client2 = resolveClient(parent, brand);
1724
+ printResult(await client2.getDkim(fqdn), getFormat(parent));
1211
1725
  });
1212
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) => {
1213
- const client = resolveClient(parent, brand);
1214
- 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));
1215
1729
  });
1216
1730
  }
1217
1731
 
@@ -1225,11 +1739,11 @@ function parseNotificationMailAddresses(value) {
1225
1739
  function registerDmarcCommands(parent, brand) {
1226
1740
  const dmarc = parent.command("dmarc").description("\u9001\u4FE1\u5074DMARC\u8A2D\u5B9A");
1227
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) => {
1228
- const client = resolveClient(parent, brand);
1742
+ const client2 = resolveClient(parent, brand);
1229
1743
  const params = {};
1230
1744
  if (opts.domain)
1231
1745
  params.domain = opts.domain;
1232
- printResult(await client.listDmarc(params), getFormat(parent));
1746
+ printResult(await client2.listDmarc(params), getFormat(parent));
1233
1747
  });
1234
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) => {
1235
1749
  const data = {};
@@ -1244,8 +1758,8 @@ function registerDmarcCommands(parent, brand) {
1244
1758
  if (Object.keys(data).length === 0) {
1245
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");
1246
1760
  }
1247
- const client = resolveClient(parent, brand);
1248
- printResult(await client.updateDmarc(domain, data), getFormat(parent));
1761
+ const client2 = resolveClient(parent, brand);
1762
+ printResult(await client2.updateDmarc(domain, data), getFormat(parent));
1249
1763
  });
1250
1764
  }
1251
1765
 
@@ -1254,26 +1768,26 @@ var UPDATE_ACTIONS = ["reset", "enable_gmail", "custom"];
1254
1768
  function registerSpfCommands(parent, brand) {
1255
1769
  const spf = parent.command("spf").description("SPF\u8A2D\u5B9A");
1256
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) => {
1257
- const client = resolveClient(parent, brand);
1771
+ const client2 = resolveClient(parent, brand);
1258
1772
  const params = {};
1259
1773
  if (opts.domain)
1260
1774
  params.domain = opts.domain;
1261
- printResult(await client.listSpf(params), getFormat(parent));
1775
+ printResult(await client2.listSpf(params), getFormat(parent));
1262
1776
  });
1263
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) => {
1264
- const client = resolveClient(parent, brand);
1265
- 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));
1266
1780
  });
1267
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) => {
1268
1782
  const body = { action: opts.action };
1269
1783
  if (opts.spfRecord !== void 0)
1270
1784
  body.spf_record = opts.spfRecord;
1271
- const client = resolveClient(parent, brand);
1272
- printResult(await client.updateSpf(fqdn, body), getFormat(parent));
1785
+ const client2 = resolveClient(parent, brand);
1786
+ printResult(await client2.updateSpf(fqdn, body), getFormat(parent));
1273
1787
  });
1274
1788
  spf.command("delete <fqdn>").description("SPF\u8A2D\u5B9A\u3092\u524A\u9664").action(async (fqdn) => {
1275
- const client = resolveClient(parent, brand);
1276
- printResult(await client.deleteSpf(fqdn), getFormat(parent));
1789
+ const client2 = resolveClient(parent, brand);
1790
+ printResult(await client2.deleteSpf(fqdn), getFormat(parent));
1277
1791
  });
1278
1792
  }
1279
1793
 
@@ -1281,14 +1795,14 @@ function registerSpfCommands(parent, brand) {
1281
1795
  function registerFtpCommands(parent, brand) {
1282
1796
  const ftp = parent.command("ftp").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A");
1283
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) => {
1284
- const client = resolveClient(parent, brand);
1798
+ const client2 = resolveClient(parent, brand);
1285
1799
  const params = {};
1286
1800
  if (opts.domain)
1287
1801
  params.domain = opts.domain;
1288
- printResult(await client.listFtp(params), getFormat(parent));
1802
+ printResult(await client2.listFtp(params), getFormat(parent));
1289
1803
  });
1290
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) => {
1291
- const client = resolveClient(parent, brand);
1805
+ const client2 = resolveClient(parent, brand);
1292
1806
  const data = pickDefined({
1293
1807
  ftp_account: ftpAccount,
1294
1808
  password: opts.password,
@@ -1296,11 +1810,11 @@ function registerFtpCommands(parent, brand) {
1296
1810
  quota_mb: opts.quota !== void 0 ? parseInt(opts.quota, 10) : void 0,
1297
1811
  memo: opts.memo
1298
1812
  });
1299
- printResult(await client.addFtp(data), getFormat(parent));
1813
+ printResult(await client2.addFtp(data), getFormat(parent));
1300
1814
  });
1301
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) => {
1302
- const client = resolveClient(parent, brand);
1303
- printResult(await client.updateFtp(ftpAccount, pickDefined({
1816
+ const client2 = resolveClient(parent, brand);
1817
+ printResult(await client2.updateFtp(ftpAccount, pickDefined({
1304
1818
  password: opts.password,
1305
1819
  directory: opts.directory,
1306
1820
  quota_mb: opts.quota !== void 0 ? parseInt(opts.quota, 10) : void 0,
@@ -1309,8 +1823,8 @@ function registerFtpCommands(parent, brand) {
1309
1823
  });
1310
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) => {
1311
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`);
1312
- const client = resolveClient(parent, brand);
1313
- printResult(await client.deleteFtp(ftpAccount), getFormat(parent));
1826
+ const client2 = resolveClient(parent, brand);
1827
+ printResult(await client2.deleteFtp(ftpAccount), getFormat(parent));
1314
1828
  });
1315
1829
  }
1316
1830
 
@@ -1318,64 +1832,64 @@ function registerFtpCommands(parent, brand) {
1318
1832
  function registerDbCommands(parent, brand) {
1319
1833
  const db = parent.command("db").description("MySQL\u8A2D\u5B9A");
1320
1834
  db.command("list").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1321
- const client = resolveClient(parent, brand);
1322
- printResult(await client.listDb(), getFormat(parent));
1835
+ const client2 = resolveClient(parent, brand);
1836
+ printResult(await client2.listDb(), getFormat(parent));
1323
1837
  });
1324
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) => {
1325
- const client = resolveClient(parent, brand);
1326
- printResult(await client.addDb(pickDefined({
1839
+ const client2 = resolveClient(parent, brand);
1840
+ printResult(await client2.addDb(pickDefined({
1327
1841
  name_suffix: nameSuffix,
1328
1842
  character_set: opts.characterSet,
1329
1843
  memo: opts.memo
1330
1844
  })), getFormat(parent));
1331
1845
  });
1332
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) => {
1333
- const client = resolveClient(parent, brand);
1334
- printResult(await client.updateDb(dbName, pickDefined({
1847
+ const client2 = resolveClient(parent, brand);
1848
+ printResult(await client2.updateDb(dbName, pickDefined({
1335
1849
  memo: opts.memo
1336
1850
  })), getFormat(parent));
1337
1851
  });
1338
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) => {
1339
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`);
1340
- const client = resolveClient(parent, brand);
1341
- printResult(await client.deleteDb(dbName), getFormat(parent));
1854
+ const client2 = resolveClient(parent, brand);
1855
+ printResult(await client2.deleteDb(dbName), getFormat(parent));
1342
1856
  });
1343
1857
  db.command("user-list").description("MySQL\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1344
- const client = resolveClient(parent, brand);
1345
- printResult(await client.listDbUser(), getFormat(parent));
1858
+ const client2 = resolveClient(parent, brand);
1859
+ printResult(await client2.listDbUser(), getFormat(parent));
1346
1860
  });
1347
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) => {
1348
- const client = resolveClient(parent, brand);
1349
- printResult(await client.addDbUser(pickDefined({
1862
+ const client2 = resolveClient(parent, brand);
1863
+ printResult(await client2.addDbUser(pickDefined({
1350
1864
  name_suffix: nameSuffix,
1351
1865
  password: opts.password,
1352
1866
  memo: opts.memo
1353
1867
  })), getFormat(parent));
1354
1868
  });
1355
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) => {
1356
- const client = resolveClient(parent, brand);
1357
- printResult(await client.updateDbUser(dbUser, pickDefined({
1870
+ const client2 = resolveClient(parent, brand);
1871
+ printResult(await client2.updateDbUser(dbUser, pickDefined({
1358
1872
  password: opts.password,
1359
1873
  memo: opts.memo
1360
1874
  })), getFormat(parent));
1361
1875
  });
1362
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) => {
1363
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`);
1364
- const client = resolveClient(parent, brand);
1365
- printResult(await client.deleteDbUser(dbUser), getFormat(parent));
1878
+ const client2 = resolveClient(parent, brand);
1879
+ printResult(await client2.deleteDbUser(dbUser), getFormat(parent));
1366
1880
  });
1367
1881
  db.command("grant-list <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u306E\u6A29\u9650\u4E00\u89A7\u3092\u53D6\u5F97").action(async (dbUser) => {
1368
- const client = resolveClient(parent, brand);
1369
- printResult(await client.listDbUserGrant(dbUser), getFormat(parent));
1882
+ const client2 = resolveClient(parent, brand);
1883
+ printResult(await client2.listDbUserGrant(dbUser), getFormat(parent));
1370
1884
  });
1371
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) => {
1372
- const client = resolveClient(parent, brand);
1373
- 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));
1374
1888
  });
1375
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) => {
1376
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`);
1377
- const client = resolveClient(parent, brand);
1378
- 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));
1379
1893
  });
1380
1894
  }
1381
1895
 
@@ -1383,15 +1897,15 @@ function registerDbCommands(parent, brand) {
1383
1897
  function registerPhpVersionCommands(parent, brand) {
1384
1898
  const phpVer = parent.command("php-version").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u8A2D\u5B9A");
1385
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) => {
1386
- const client = resolveClient(parent, brand);
1900
+ const client2 = resolveClient(parent, brand);
1387
1901
  const params = {};
1388
1902
  if (opts.domain)
1389
1903
  params.domain = opts.domain;
1390
- printResult(await client.getPhpVersion(params), getFormat(parent));
1904
+ printResult(await client2.getPhpVersion(params), getFormat(parent));
1391
1905
  });
1392
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) => {
1393
- const client = resolveClient(parent, brand);
1394
- 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));
1395
1909
  });
1396
1910
  }
1397
1911
 
@@ -1399,15 +1913,15 @@ function registerPhpVersionCommands(parent, brand) {
1399
1913
  function registerServerDomainCommands(parent, brand) {
1400
1914
  const domain = parent.command("domain").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
1401
1915
  domain.command("list").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1402
- const client = resolveClient(parent, brand);
1403
- printResult(await client.listDomain(), getFormat(parent));
1916
+ const client2 = resolveClient(parent, brand);
1917
+ printResult(await client2.listDomain(), getFormat(parent));
1404
1918
  });
1405
1919
  domain.command("get <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u8A73\u7D30\u3092\u53D6\u5F97").action(async (domainName) => {
1406
- const client = resolveClient(parent, brand);
1407
- printResult(await client.getDomain(domainName), getFormat(parent));
1920
+ const client2 = resolveClient(parent, brand);
1921
+ printResult(await client2.getDomain(domainName), getFormat(parent));
1408
1922
  });
1409
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) => {
1410
- const client = resolveClient(parent, brand);
1924
+ const client2 = resolveClient(parent, brand);
1411
1925
  const data = { domain: domainName };
1412
1926
  if (opts.ssl !== void 0)
1413
1927
  data.ssl = opts.ssl === "true";
@@ -1417,27 +1931,27 @@ function registerServerDomainCommands(parent, brand) {
1417
1931
  data.ai_crawler_block_enabled = opts.aiCrawlerBlock === "true";
1418
1932
  if (opts.memo !== void 0)
1419
1933
  data.memo = opts.memo;
1420
- printResult(await client.addDomain(data), getFormat(parent));
1934
+ printResult(await client2.addDomain(data), getFormat(parent));
1421
1935
  });
1422
1936
  domain.command("update <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u5909\u66F4").option("--memo <value>", "\u30E1\u30E2").action(async (domainName, opts) => {
1423
- const client = resolveClient(parent, brand);
1424
- printResult(await client.updateDomain(domainName, pickDefined({
1937
+ const client2 = resolveClient(parent, brand);
1938
+ printResult(await client2.updateDomain(domainName, pickDefined({
1425
1939
  memo: opts.memo
1426
1940
  })), getFormat(parent));
1427
1941
  });
1428
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) => {
1429
1943
  const suffix = opts.deleteFiles ? "\uFF08\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3057\u307E\u3059\uFF09" : "";
1430
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`);
1431
- const client = resolveClient(parent, brand);
1945
+ const client2 = resolveClient(parent, brand);
1432
1946
  const data = {};
1433
1947
  if (opts.deleteFiles)
1434
1948
  data.delete_files = true;
1435
- printResult(await client.deleteDomain(domainName, data), getFormat(parent));
1949
+ printResult(await client2.deleteDomain(domainName, data), getFormat(parent));
1436
1950
  });
1437
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) => {
1438
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`);
1439
- const client = resolveClient(parent, brand);
1440
- 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));
1441
1955
  });
1442
1956
  }
1443
1957
 
@@ -1445,14 +1959,14 @@ function registerServerDomainCommands(parent, brand) {
1445
1959
  function registerSubdomainCommands(parent, brand) {
1446
1960
  const subdomain = parent.command("subdomain").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
1447
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) => {
1448
- const client = resolveClient(parent, brand);
1962
+ const client2 = resolveClient(parent, brand);
1449
1963
  const params = {};
1450
1964
  if (opts.domain)
1451
1965
  params.domain = opts.domain;
1452
- printResult(await client.listSubdomain(params), getFormat(parent));
1966
+ printResult(await client2.listSubdomain(params), getFormat(parent));
1453
1967
  });
1454
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) => {
1455
- const client = resolveClient(parent, brand);
1969
+ const client2 = resolveClient(parent, brand);
1456
1970
  const data = { subdomain: subdomainName };
1457
1971
  if (opts.documentRootType !== void 0)
1458
1972
  data.document_root_type = opts.documentRootType;
@@ -1460,22 +1974,22 @@ function registerSubdomainCommands(parent, brand) {
1460
1974
  data.ssl = opts.ssl === "true";
1461
1975
  if (opts.memo !== void 0)
1462
1976
  data.memo = opts.memo;
1463
- printResult(await client.addSubdomain(data), getFormat(parent));
1977
+ printResult(await client2.addSubdomain(data), getFormat(parent));
1464
1978
  });
1465
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) => {
1466
- const client = resolveClient(parent, brand);
1467
- printResult(await client.updateSubdomain(subdomainName, pickDefined({
1980
+ const client2 = resolveClient(parent, brand);
1981
+ printResult(await client2.updateSubdomain(subdomainName, pickDefined({
1468
1982
  memo: opts.memo
1469
1983
  })), getFormat(parent));
1470
1984
  });
1471
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) => {
1472
1986
  const suffix = opts.deleteFiles ? "\uFF08\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3057\u307E\u3059\uFF09" : "";
1473
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`);
1474
- const client = resolveClient(parent, brand);
1988
+ const client2 = resolveClient(parent, brand);
1475
1989
  const data = {};
1476
1990
  if (opts.deleteFiles)
1477
1991
  data.delete_files = true;
1478
- printResult(await client.deleteSubdomain(subdomainName, data), getFormat(parent));
1992
+ printResult(await client2.deleteSubdomain(subdomainName, data), getFormat(parent));
1479
1993
  });
1480
1994
  }
1481
1995
 
@@ -1483,22 +1997,22 @@ function registerSubdomainCommands(parent, brand) {
1483
1997
  function registerSslCommands(parent, brand) {
1484
1998
  const ssl = parent.command("ssl").description("SSL\u8A2D\u5B9A");
1485
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) => {
1486
- const client = resolveClient(parent, brand);
2000
+ const client2 = resolveClient(parent, brand);
1487
2001
  const params = {};
1488
2002
  if (opts.domain)
1489
2003
  params.domain = opts.domain;
1490
- printResult(await client.listSsl(params), getFormat(parent));
2004
+ printResult(await client2.listSsl(params), getFormat(parent));
1491
2005
  });
1492
2006
  ssl.command("install <commonName>").description("\u7121\u6599SSL\u3092\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").action(async (commonName) => {
1493
- const client = resolveClient(parent, brand);
1494
- printResult(await client.installSsl(pickDefined({
2007
+ const client2 = resolveClient(parent, brand);
2008
+ printResult(await client2.installSsl(pickDefined({
1495
2009
  common_name: commonName
1496
2010
  })), getFormat(parent));
1497
2011
  });
1498
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) => {
1499
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`);
1500
- const client = resolveClient(parent, brand);
1501
- printResult(await client.uninstallSsl(commonName), getFormat(parent));
2014
+ const client2 = resolveClient(parent, brand);
2015
+ printResult(await client2.uninstallSsl(commonName), getFormat(parent));
1502
2016
  });
1503
2017
  }
1504
2018
 
@@ -1506,15 +2020,15 @@ function registerSslCommands(parent, brand) {
1506
2020
  function registerDnsCommands(parent, brand) {
1507
2021
  const dns = parent.command("dns").description("DNS\u30EC\u30B3\u30FC\u30C9\u8A2D\u5B9A");
1508
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) => {
1509
- const client = resolveClient(parent, brand);
2023
+ const client2 = resolveClient(parent, brand);
1510
2024
  const params = {};
1511
2025
  if (opts.domain)
1512
2026
  params.domain = opts.domain;
1513
- printResult(await client.listDns(params), getFormat(parent));
2027
+ printResult(await client2.listDns(params), getFormat(parent));
1514
2028
  });
1515
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) => {
1516
- const client = resolveClient(parent, brand);
1517
- printResult(await client.addDns(pickDefined({
2030
+ const client2 = resolveClient(parent, brand);
2031
+ printResult(await client2.addDns(pickDefined({
1518
2032
  domain: opts.domain,
1519
2033
  host: opts.host,
1520
2034
  type: opts.type,
@@ -1524,8 +2038,8 @@ function registerDnsCommands(parent, brand) {
1524
2038
  })), getFormat(parent));
1525
2039
  });
1526
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) => {
1527
- const client = resolveClient(parent, brand);
1528
- printResult(await client.updateDns(dnsId, pickDefined({
2041
+ const client2 = resolveClient(parent, brand);
2042
+ printResult(await client2.updateDns(dnsId, pickDefined({
1529
2043
  domain: opts.domain,
1530
2044
  host: opts.host,
1531
2045
  type: opts.type,
@@ -1536,8 +2050,8 @@ function registerDnsCommands(parent, brand) {
1536
2050
  });
1537
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) => {
1538
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`);
1539
- const client = resolveClient(parent, brand);
1540
- printResult(await client.deleteDns(dnsId), getFormat(parent));
2053
+ const client2 = resolveClient(parent, brand);
2054
+ printResult(await client2.deleteDns(dnsId), getFormat(parent));
1541
2055
  });
1542
2056
  }
1543
2057
 
@@ -1545,25 +2059,25 @@ function registerDnsCommands(parent, brand) {
1545
2059
  function registerSshCommands(parent, brand) {
1546
2060
  const ssh = parent.command("ssh").description("SSH\u8A2D\u5B9A");
1547
2061
  ssh.command("show").description("SSH\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async () => {
1548
- const client = resolveClient(parent, brand);
1549
- printResult(await client.getSsh(), getFormat(parent));
2062
+ const client2 = resolveClient(parent, brand);
2063
+ printResult(await client2.getSsh(), getFormat(parent));
1550
2064
  });
1551
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) => {
1552
- const client = resolveClient(parent, brand);
2066
+ const client2 = resolveClient(parent, brand);
1553
2067
  const data = {};
1554
2068
  if (opts.sshEnabled !== void 0)
1555
2069
  data.ssh_enabled = opts.sshEnabled === "true";
1556
2070
  if (opts.abroadAccessRestriction !== void 0)
1557
2071
  data.abroad_access_restriction = opts.abroadAccessRestriction === "true";
1558
- printResult(await client.updateSsh(data), getFormat(parent));
2072
+ printResult(await client2.updateSsh(data), getFormat(parent));
1559
2073
  });
1560
2074
  const key = ssh.command("key").description("SSH\u516C\u958B\u9375\u7BA1\u7406");
1561
2075
  key.command("list").description("SSH\u516C\u958B\u9375\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
1562
- const client = resolveClient(parent, brand);
1563
- printResult(await client.listSshKey(), getFormat(parent));
2076
+ const client2 = resolveClient(parent, brand);
2077
+ printResult(await client2.listSshKey(), getFormat(parent));
1564
2078
  });
1565
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) => {
1566
- const client = resolveClient(parent, brand);
2080
+ const client2 = resolveClient(parent, brand);
1567
2081
  const data = { label: opts.label };
1568
2082
  if (opts.generate) {
1569
2083
  data.generate = true;
@@ -1573,19 +2087,19 @@ function registerSshCommands(parent, brand) {
1573
2087
  if (opts.publicKey)
1574
2088
  data.public_key = opts.publicKey;
1575
2089
  }
1576
- printResult(await client.addSshKey(data), getFormat(parent));
2090
+ printResult(await client2.addSshKey(data), getFormat(parent));
1577
2091
  });
1578
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) => {
1579
- const client = resolveClient(parent, brand);
1580
- printResult(await client.updateSshKey(keyId, pickDefined({
2093
+ const client2 = resolveClient(parent, brand);
2094
+ printResult(await client2.updateSshKey(keyId, pickDefined({
1581
2095
  label: opts.label,
1582
2096
  status: opts.status
1583
2097
  })), getFormat(parent));
1584
2098
  });
1585
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) => {
1586
2100
  await confirmDestructiveAction(parent, `SSH\u516C\u958B\u9375 "${keyId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
1587
- const client = resolveClient(parent, brand);
1588
- printResult(await client.deleteSshKey(keyId), getFormat(parent));
2101
+ const client2 = resolveClient(parent, brand);
2102
+ printResult(await client2.deleteSshKey(keyId), getFormat(parent));
1589
2103
  });
1590
2104
  }
1591
2105
 
@@ -1593,22 +2107,22 @@ function registerSshCommands(parent, brand) {
1593
2107
  function registerLogCommands(parent, brand) {
1594
2108
  const log = parent.command("log").description("\u30ED\u30B0");
1595
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) => {
1596
- const client = resolveClient(parent, brand);
2110
+ const client2 = resolveClient(parent, brand);
1597
2111
  const params = { domain: opts.domain };
1598
2112
  if (opts.lines)
1599
2113
  params.lines = opts.lines;
1600
2114
  if (opts.keyword)
1601
2115
  params.keyword = opts.keyword;
1602
- printResult(await client.getAccessLog(params), getFormat(parent));
2116
+ printResult(await client2.getAccessLog(params), getFormat(parent));
1603
2117
  });
1604
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) => {
1605
- const client = resolveClient(parent, brand);
2119
+ const client2 = resolveClient(parent, brand);
1606
2120
  const params = { domain: opts.domain };
1607
2121
  if (opts.lines)
1608
2122
  params.lines = opts.lines;
1609
2123
  if (opts.keyword)
1610
2124
  params.keyword = opts.keyword;
1611
- printResult(await client.getErrorLog(params), getFormat(parent));
2125
+ printResult(await client2.getErrorLog(params), getFormat(parent));
1612
2126
  });
1613
2127
  }
1614
2128
 
@@ -1616,8 +2130,8 @@ function registerLogCommands(parent, brand) {
1616
2130
  function registerResourceMonitorCommands(parent, brand) {
1617
2131
  const resourceMonitor = parent.command("resource-monitor").description("\u30EA\u30BD\u30FC\u30B9\u30E2\u30CB\u30BF\u30FC");
1618
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) => {
1619
- const client = resolveClient(parent, brand);
1620
- printResult(await client.getResourceMonitor(opts.date), getFormat(parent));
2133
+ const client2 = resolveClient(parent, brand);
2134
+ printResult(await client2.getResourceMonitor(opts.date), getFormat(parent));
1621
2135
  });
1622
2136
  }
1623
2137
 
@@ -1625,11 +2139,11 @@ function registerResourceMonitorCommands(parent, brand) {
1625
2139
  function registerWafCommands(parent, brand) {
1626
2140
  const waf = parent.command("waf").description("WAF\u8A2D\u5B9A");
1627
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) => {
1628
- const client = resolveClient(parent, brand);
2142
+ const client2 = resolveClient(parent, brand);
1629
2143
  const params = {};
1630
2144
  if (opts.domain)
1631
2145
  params.domain = opts.domain;
1632
- printResult(await client.listWaf(params), getFormat(parent));
2146
+ printResult(await client2.listWaf(params), getFormat(parent));
1633
2147
  });
1634
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) => {
1635
2149
  const data = {};
@@ -1648,8 +2162,8 @@ function registerWafCommands(parent, brand) {
1648
2162
  if (Object.keys(data).length === 0) {
1649
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");
1650
2164
  }
1651
- const client = resolveClient(parent, brand);
1652
- printResult(await client.updateWaf(domain, data), getFormat(parent));
2165
+ const client2 = resolveClient(parent, brand);
2166
+ printResult(await client2.updateWaf(domain, data), getFormat(parent));
1653
2167
  });
1654
2168
  }
1655
2169
 
@@ -1700,11 +2214,11 @@ function buildUpdateData(opts) {
1700
2214
  function registerPhpIniCommands(parent, brand) {
1701
2215
  const phpIni = parent.command("php-ini").description("php.ini\u8A2D\u5B9A\uFF08php-version \u3068\u306F\u5225\uFF09");
1702
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) => {
1703
- const client = resolveClient(parent, brand);
2217
+ const client2 = resolveClient(parent, brand);
1704
2218
  const params = {};
1705
2219
  if (opts.domain)
1706
2220
  params.domain = opts.domain;
1707
- printResult(await client.listPhpIni(params), getFormat(parent));
2221
+ printResult(await client2.listPhpIni(params), getFormat(parent));
1708
2222
  });
1709
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");
1710
2224
  for (const { cli, desc } of PHP_INI_UPDATE_OPTIONS) {
@@ -1715,13 +2229,13 @@ function registerPhpIniCommands(parent, brand) {
1715
2229
  if (Object.keys(data).length === 0) {
1716
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");
1717
2231
  }
1718
- const client = resolveClient(parent, brand);
1719
- printResult(await client.updatePhpIni(domain, data), getFormat(parent));
2232
+ const client2 = resolveClient(parent, brand);
2233
+ printResult(await client2.updatePhpIni(domain, data), getFormat(parent));
1720
2234
  });
1721
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) => {
1722
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`);
1723
- const client = resolveClient(parent, brand);
1724
- printResult(await client.resetPhpIni(domain), getFormat(parent));
2237
+ const client2 = resolveClient(parent, brand);
2238
+ printResult(await client2.resetPhpIni(domain), getFormat(parent));
1725
2239
  });
1726
2240
  }
1727
2241
 
@@ -1816,11 +2330,11 @@ function buildUpdateData2(domain, opts) {
1816
2330
  function registerWordPressSecurityCommands(parent, brand) {
1817
2331
  const wordpressSecurity = parent.command("wordpress-security").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A");
1818
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) => {
1819
- const client = resolveClient(parent, brand);
2333
+ const client2 = resolveClient(parent, brand);
1820
2334
  const params = {};
1821
2335
  if (opts.domain)
1822
2336
  params.domain = opts.domain;
1823
- printResult(await client.getWordPressSecurity(params), getFormat(parent));
2337
+ printResult(await client2.getWordPressSecurity(params), getFormat(parent));
1824
2338
  });
1825
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");
1826
2340
  for (const { cli, desc } of UPDATE_OPTIONS) {
@@ -1828,8 +2342,8 @@ function registerWordPressSecurityCommands(parent, brand) {
1828
2342
  }
1829
2343
  update.action(async (domain, opts) => {
1830
2344
  const data = buildUpdateData2(domain, opts);
1831
- const client = resolveClient(parent, brand);
1832
- printResult(await client.updateWordPressSecurity(data), getFormat(parent));
2345
+ const client2 = resolveClient(parent, brand);
2346
+ printResult(await client2.updateWordPressSecurity(data), getFormat(parent));
1833
2347
  });
1834
2348
  }
1835
2349
 
@@ -1837,15 +2351,15 @@ function registerWordPressSecurityCommands(parent, brand) {
1837
2351
  function registerXAcceleratorCommands(parent, brand) {
1838
2352
  const xAccelerator = parent.command("x-accelerator").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A");
1839
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) => {
1840
- const client = resolveClient(parent, brand);
2354
+ const client2 = resolveClient(parent, brand);
1841
2355
  const params = {};
1842
2356
  if (opts.domain)
1843
2357
  params.domain = opts.domain;
1844
- printResult(await client.listXAccelerator(params), getFormat(parent));
2358
+ printResult(await client2.listXAccelerator(params), getFormat(parent));
1845
2359
  });
1846
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) => {
1847
- const client = resolveClient(parent, brand);
1848
- 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));
1849
2363
  });
1850
2364
  }
1851
2365
 
@@ -1853,20 +2367,20 @@ function registerXAcceleratorCommands(parent, brand) {
1853
2367
  function registerServerCacheCommands(parent, brand) {
1854
2368
  const serverCache = parent.command("server-cache").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
1855
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) => {
1856
- const client = resolveClient(parent, brand);
2370
+ const client2 = resolveClient(parent, brand);
1857
2371
  const params = {};
1858
2372
  if (opts.domain)
1859
2373
  params.domain = opts.domain;
1860
- printResult(await client.listServerCache(params), getFormat(parent));
2374
+ printResult(await client2.listServerCache(params), getFormat(parent));
1861
2375
  });
1862
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) => {
1863
- const client = resolveClient(parent, brand);
1864
- 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));
1865
2379
  });
1866
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) => {
1867
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`);
1868
- const client = resolveClient(parent, brand);
1869
- printResult(await client.clearServerCache(domain), getFormat(parent));
2382
+ const client2 = resolveClient(parent, brand);
2383
+ printResult(await client2.clearServerCache(domain), getFormat(parent));
1870
2384
  });
1871
2385
  }
1872
2386
 
@@ -1874,15 +2388,15 @@ function registerServerCacheCommands(parent, brand) {
1874
2388
  function registerBrowserCacheCommands(parent, brand) {
1875
2389
  const browserCache = parent.command("browser-cache").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
1876
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) => {
1877
- const client = resolveClient(parent, brand);
2391
+ const client2 = resolveClient(parent, brand);
1878
2392
  const params = {};
1879
2393
  if (opts.domain)
1880
2394
  params.domain = opts.domain;
1881
- printResult(await client.listBrowserCache(params), getFormat(parent));
2395
+ printResult(await client2.listBrowserCache(params), getFormat(parent));
1882
2396
  });
1883
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) => {
1884
- const client = resolveClient(parent, brand);
1885
- 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));
1886
2400
  });
1887
2401
  }
1888
2402
 
@@ -1890,14 +2404,14 @@ function registerBrowserCacheCommands(parent, brand) {
1890
2404
  function registerUrlRedirectCommands(parent, brand) {
1891
2405
  const urlRedirect = parent.command("url-redirect").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A");
1892
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) => {
1893
- const client = resolveClient(parent, brand);
2407
+ const client2 = resolveClient(parent, brand);
1894
2408
  const params = {};
1895
2409
  if (opts.domain)
1896
2410
  params.domain = opts.domain;
1897
- printResult(await client.listUrlRedirect(params), getFormat(parent));
2411
+ printResult(await client2.listUrlRedirect(params), getFormat(parent));
1898
2412
  });
1899
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) => {
1900
- const client = resolveClient(parent, brand);
2414
+ const client2 = resolveClient(parent, brand);
1901
2415
  const data = {
1902
2416
  domain: opts.domain,
1903
2417
  from_host: opts.fromHost,
@@ -1906,12 +2420,12 @@ function registerUrlRedirectCommands(parent, brand) {
1906
2420
  };
1907
2421
  if (opts.fromPath !== void 0)
1908
2422
  data.from_path = opts.fromPath;
1909
- printResult(await client.addUrlRedirect(data), getFormat(parent));
2423
+ printResult(await client2.addUrlRedirect(data), getFormat(parent));
1910
2424
  });
1911
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) => {
1912
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`);
1913
- const client = resolveClient(parent, brand);
1914
- printResult(await client.deleteUrlRedirect(redirectId), getFormat(parent));
2427
+ const client2 = resolveClient(parent, brand);
2428
+ printResult(await client2.deleteUrlRedirect(redirectId), getFormat(parent));
1915
2429
  });
1916
2430
  }
1917
2431
 
@@ -1919,33 +2433,33 @@ function registerUrlRedirectCommands(parent, brand) {
1919
2433
  function registerAccessDenyCommands(parent, brand) {
1920
2434
  const accessDeny = parent.command("access-deny").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A");
1921
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) => {
1922
- const client = resolveClient(parent, brand);
2436
+ const client2 = resolveClient(parent, brand);
1923
2437
  const params = {};
1924
2438
  if (opts.domain)
1925
2439
  params.domain = opts.domain;
1926
- printResult(await client.listAccessDeny(params), getFormat(parent));
2440
+ printResult(await client2.listAccessDeny(params), getFormat(parent));
1927
2441
  });
1928
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) => {
1929
- const client = resolveClient(parent, brand);
2443
+ const client2 = resolveClient(parent, brand);
1930
2444
  const data = {
1931
2445
  domain: opts.domain,
1932
2446
  ip_address: opts.ipAddress
1933
2447
  };
1934
2448
  if (opts.memo !== void 0)
1935
2449
  data.memo = opts.memo;
1936
- printResult(await client.addAccessDeny(data), getFormat(parent));
2450
+ printResult(await client2.addAccessDeny(data), getFormat(parent));
1937
2451
  });
1938
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) => {
1939
2453
  if (opts.memo === void 0) {
1940
2454
  throw new Error("--memo \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
1941
2455
  }
1942
- const client = resolveClient(parent, brand);
1943
- 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));
1944
2458
  });
1945
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) => {
1946
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`);
1947
- const client = resolveClient(parent, brand);
1948
- printResult(await client.deleteAccessDeny(denyId), getFormat(parent));
2461
+ const client2 = resolveClient(parent, brand);
2462
+ printResult(await client2.deleteAccessDeny(denyId), getFormat(parent));
1949
2463
  });
1950
2464
  }
1951
2465
 
@@ -1986,11 +2500,11 @@ function buildUpdateData3(opts) {
1986
2500
  function registerXPageSpeedCommands(parent, brand) {
1987
2501
  const xPageSpeed = parent.command("xpagespeed").description("XPageSpeed\u8A2D\u5B9A");
1988
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) => {
1989
- const client = resolveClient(parent, brand);
2503
+ const client2 = resolveClient(parent, brand);
1990
2504
  const params = {};
1991
2505
  if (opts.domain)
1992
2506
  params.domain = opts.domain;
1993
- printResult(await client.listXPageSpeed(params), getFormat(parent));
2507
+ printResult(await client2.listXPageSpeed(params), getFormat(parent));
1994
2508
  });
1995
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");
1996
2510
  for (const { cli, desc } of UPDATE_OPTIONS2) {
@@ -1998,8 +2512,8 @@ function registerXPageSpeedCommands(parent, brand) {
1998
2512
  }
1999
2513
  update.action(async (domain, opts) => {
2000
2514
  const data = buildUpdateData3(opts);
2001
- const client = resolveClient(parent, brand);
2002
- printResult(await client.updateXPageSpeed(domain, data), getFormat(parent));
2515
+ const client2 = resolveClient(parent, brand);
2516
+ printResult(await client2.updateXPageSpeed(domain, data), getFormat(parent));
2003
2517
  });
2004
2518
  }
2005
2519
 
@@ -2036,16 +2550,16 @@ function parseDomainElements(values) {
2036
2550
  function registerAutoBackupCommands(parent, brand) {
2037
2551
  const autoBackup = parent.command("auto-backup").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
2038
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 () => {
2039
- const client = resolveClient(parent, brand);
2040
- printResult(await client.listAutoBackupBackupDates(), getFormat(parent));
2553
+ const client2 = resolveClient(parent, brand);
2554
+ printResult(await client2.listAutoBackupBackupDates(), getFormat(parent));
2041
2555
  });
2042
2556
  autoBackup.command("list").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
2043
- const client = resolveClient(parent, brand);
2044
- printResult(await client.listAutoBackup(), getFormat(parent));
2557
+ const client2 = resolveClient(parent, brand);
2558
+ printResult(await client2.listAutoBackup(), getFormat(parent));
2045
2559
  });
2046
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) => {
2047
- const client = resolveClient(parent, brand);
2048
- printResult(await client.getAutoBackup(requestId), getFormat(parent));
2561
+ const client2 = resolveClient(parent, brand);
2562
+ printResult(await client2.getAutoBackup(requestId), getFormat(parent));
2049
2563
  });
2050
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) => {
2051
2565
  const operationType = opts.operationType;
@@ -2067,8 +2581,8 @@ function registerAutoBackupCommands(parent, brand) {
2067
2581
  } else if (domainElementValues.length > 0) {
2068
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");
2069
2583
  }
2070
- const client = resolveClient(parent, brand);
2071
- printResult(await client.createAutoBackup(data), getFormat(parent));
2584
+ const client2 = resolveClient(parent, brand);
2585
+ printResult(await client2.createAutoBackup(data), getFormat(parent));
2072
2586
  });
2073
2587
  }
2074
2588
 
@@ -2076,24 +2590,24 @@ function registerAutoBackupCommands(parent, brand) {
2076
2590
  function registerMysqlBackupCommands(parent, brand) {
2077
2591
  const mysqlBackup = parent.command("mysql-backup").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
2078
2592
  mysqlBackup.command("databases").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u72B6\u614B\u3092\u53D6\u5F97").action(async () => {
2079
- const client = resolveClient(parent, brand);
2080
- printResult(await client.listMysqlBackupDatabases(), getFormat(parent));
2593
+ const client2 = resolveClient(parent, brand);
2594
+ printResult(await client2.listMysqlBackupDatabases(), getFormat(parent));
2081
2595
  });
2082
2596
  mysqlBackup.command("list").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
2083
- const client = resolveClient(parent, brand);
2084
- printResult(await client.listMysqlBackup(), getFormat(parent));
2597
+ const client2 = resolveClient(parent, brand);
2598
+ printResult(await client2.listMysqlBackup(), getFormat(parent));
2085
2599
  });
2086
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) => {
2087
- const client = resolveClient(parent, brand);
2088
- printResult(await client.getMysqlBackup(requestId), getFormat(parent));
2601
+ const client2 = resolveClient(parent, brand);
2602
+ printResult(await client2.getMysqlBackup(requestId), getFormat(parent));
2089
2603
  });
2090
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) => {
2091
2605
  const operationType = opts.operationType;
2092
2606
  if (operationType === "restore") {
2093
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`);
2094
2608
  }
2095
- const client = resolveClient(parent, brand);
2096
- printResult(await client.createMysqlBackup({
2609
+ const client2 = resolveClient(parent, brand);
2610
+ printResult(await client2.createMysqlBackup({
2097
2611
  db_name: opts.dbName,
2098
2612
  backup_date: opts.backupDate,
2099
2613
  operation_type: operationType
@@ -2112,13 +2626,917 @@ function registerMeCommand(program, brand) {
2112
2626
  process.exit(1);
2113
2627
  }
2114
2628
  const debug = !!(rootOpts.debug || process.env.XSERVER_DEBUG === "1");
2115
- const client = new ApiClient({
2629
+ const client2 = new ApiClient({
2116
2630
  apiKey: profile.apiKey,
2117
- apiBase: brand.apiBase,
2631
+ apiBase: resolveApiBase(brand),
2118
2632
  servername: profile.servername,
2119
2633
  debug
2120
2634
  });
2121
- 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));
2122
3540
  });
2123
3541
  }
2124
3542
 
@@ -2133,6 +3551,12 @@ function run(brand, version = "0.0.0") {
2133
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");
2134
3552
  registerAuthCommands(program, brand);
2135
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);
2136
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");
2137
3561
  registerServerInfoCommands(server, brand);
2138
3562
  registerCronCommands(server, brand);
@@ -2174,21 +3598,23 @@ function run(brand, version = "0.0.0") {
2174
3598
  console.error(` - ${e}`);
2175
3599
  }
2176
3600
  }
2177
- process.exit(1);
3601
+ process.exitCode = 1;
3602
+ return;
2178
3603
  }
2179
3604
  if (err instanceof Error) {
2180
3605
  console.error(`\u30A8\u30E9\u30FC: ${err.message}`);
2181
- process.exit(1);
3606
+ process.exitCode = 1;
3607
+ return;
2182
3608
  }
2183
3609
  console.error("\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F");
2184
- process.exit(1);
3610
+ process.exitCode = 1;
2185
3611
  });
2186
3612
  }
2187
3613
 
2188
3614
  // package.json
2189
3615
  var package_default = {
2190
3616
  name: "shincloud-cli",
2191
- version: "1.2.1",
3617
+ version: "1.3.0",
2192
3618
  description: "Official CLI for Shincloud API \u2014 manage your Shincloud hosting from the terminal",
2193
3619
  type: "module",
2194
3620
  bin: {
@@ -2235,6 +3661,8 @@ run({
2235
3661
  brand: "shincloud",
2236
3662
  apiBase: "https://api.shin-server.jp",
2237
3663
  displayName: "\u30B7\u30F3\u30AF\u30E9\u30A6\u30C9 API",
3664
+ domainTermsUrl: "https://www.shin-domain.jp/rule/rule.php",
3665
+ domainPrivacyUrl: "https://www.shin-domain.jp/privacy_announcement.php",
2238
3666
  commandName: "shincloud",
2239
3667
  configDir: "shincloud-cli"
2240
3668
  }, package_default.version);