@mtndev/cli 2.0.0 → 2.0.1
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/CHANGELOG.md +13 -0
- package/cjs/__chunks/VH7oDXx4.cjs +28 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.cjs +261 -12
- package/cjs/commands/aws/ec2/allow-ip/index.cjs +25 -55
- package/cjs/commands/aws/ec2/allow-ip/schema.cjs +33 -13
- package/cjs/commands/aws/ec2/allow-ip/utils.cjs +379 -39
- package/cjs/commands/aws/iam/admin-group.cjs +111 -15
- package/cjs/commands/aws/iam/break-glass/handler.cjs +127 -12
- package/cjs/commands/aws/iam/break-glass/index.cjs +7 -19
- package/cjs/commands/aws/iam/break-glass/schema.cjs +21 -12
- package/cjs/commands/aws/iam/check-admin/handler.cjs +89 -10
- package/cjs/commands/aws/iam/check-admin/index.cjs +7 -17
- package/cjs/commands/aws/iam/check-admin/schema.cjs +19 -12
- package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
- package/cjs/commands/aws/iam/policies/sts-federation.json +11 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
- package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
- package/cjs/commands/aws/iam/policies/user-admins-write-list.json +117 -0
- package/cjs/commands/aws/iam/remove-admin/handler.cjs +120 -11
- package/cjs/commands/aws/iam/remove-admin/index.cjs +7 -18
- package/cjs/commands/aws/iam/remove-admin/schema.cjs +22 -12
- package/cjs/commands/aws/iam/setup-acl/handler.cjs +227 -14
- package/cjs/commands/aws/iam/setup-acl/index.cjs +13 -33
- package/cjs/commands/aws/iam/setup-acl/schema.cjs +19 -7
- package/cjs/commands/aws/iam/setup-acl/utils.cjs +305 -20
- package/cjs/commands/aws/iam/users/handler.cjs +59 -12
- package/cjs/commands/aws/iam/users/index.cjs +18 -41
- package/cjs/commands/aws/iam/users/schema.cjs +17 -7
- package/cjs/commands/aws/iam/users/utils.cjs +454 -30
- package/cjs/commands/aws/index.cjs +223 -229
- package/cjs/commands/aws/route53/add-record/handler.cjs +264 -18
- package/cjs/commands/aws/route53/add-record/index.cjs +26 -57
- package/cjs/commands/aws/route53/add-record/schema.cjs +43 -11
- package/cjs/commands/aws/route53/add-record/utils.cjs +404 -37
- package/cjs/commands/aws/route53/remove-record/handler.cjs +114 -14
- package/cjs/commands/aws/route53/remove-record/index.cjs +5 -18
- package/cjs/commands/aws/route53/remove-record/schema.cjs +22 -8
- package/cjs/commands/aws/schema.cjs +19 -10
- package/cjs/commands/aws/ses/send-email/handler.cjs +73 -12
- package/cjs/commands/aws/ses/send-email/index.cjs +9 -23
- package/cjs/commands/aws/ses/send-email/schema.cjs +24 -7
- package/cjs/commands/aws/ses/send-email/utils.cjs +87 -11
- package/cjs/commands/aws/ses/smtp-password.cjs +72 -10
- package/cjs/commands/aws/utils/exec-aws.cjs +145 -16
- package/cjs/commands/aws/utils/resolve-policy-path.cjs +15 -6
- package/cjs/commands/aws/utils/resolve-profile.cjs +93 -11
- package/cjs/commands/aws/utils/tty.cjs +54 -10
- package/cjs/commands/db/create-readonly-user/handler.cjs +254 -11
- package/cjs/commands/db/create-readonly-user/index.cjs +18 -40
- package/cjs/commands/db/create-readonly-user/mysql.cjs +102 -9
- package/cjs/commands/db/create-readonly-user/postgres.cjs +209 -9
- package/cjs/commands/db/create-readonly-user/schema.cjs +39 -12
- package/cjs/commands/db/create-readonly-user/utils.cjs +160 -22
- package/cjs/commands/db/index.cjs +46 -44
- package/cjs/commands/doppler/handler.cjs +95 -11
- package/cjs/commands/doppler/index.cjs +33 -68
- package/cjs/commands/doppler/schema.cjs +130 -14
- package/cjs/commands/doppler/set-secret.cjs +378 -19
- package/cjs/commands/doppler/utils/exec.cjs +106 -12
- package/cjs/commands/doppler/utils.cjs +412 -34
- package/cjs/commands/icons/handler.cjs +82 -8
- package/cjs/commands/icons/index.cjs +15 -31
- package/cjs/commands/icons/schema.cjs +101 -13
- package/cjs/commands/icons/utils.cjs +131 -13
- package/cjs/commands/index.cjs +54 -161
- package/cjs/commands/schema.cjs +25 -8
- package/cjs/index.cjs +3 -4
- package/esm/commands/aws/ec2/allow-ip/handler.js +258 -12
- package/esm/commands/aws/ec2/allow-ip/index.js +4 -55
- package/esm/commands/aws/ec2/allow-ip/schema.js +29 -13
- package/esm/commands/aws/ec2/allow-ip/utils.js +363 -39
- package/esm/commands/aws/iam/admin-group.js +104 -15
- package/esm/commands/aws/iam/break-glass/handler.js +124 -12
- package/esm/commands/aws/iam/break-glass/index.js +4 -19
- package/esm/commands/aws/iam/break-glass/schema.js +19 -12
- package/esm/commands/aws/iam/check-admin/handler.js +86 -10
- package/esm/commands/aws/iam/check-admin/index.js +4 -17
- package/esm/commands/aws/iam/check-admin/schema.js +17 -12
- package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
- package/esm/commands/aws/iam/policies/sts-federation.json +11 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
- package/esm/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
- package/esm/commands/aws/iam/policies/user-admins-write-list.json +117 -0
- package/esm/commands/aws/iam/remove-admin/handler.js +117 -11
- package/esm/commands/aws/iam/remove-admin/index.js +4 -18
- package/esm/commands/aws/iam/remove-admin/schema.js +20 -12
- package/esm/commands/aws/iam/setup-acl/handler.js +224 -14
- package/esm/commands/aws/iam/setup-acl/index.js +4 -33
- package/esm/commands/aws/iam/setup-acl/schema.js +18 -7
- package/esm/commands/aws/iam/setup-acl/utils.js +298 -20
- package/esm/commands/aws/iam/users/handler.js +56 -12
- package/esm/commands/aws/iam/users/index.js +4 -41
- package/esm/commands/aws/iam/users/schema.js +16 -7
- package/esm/commands/aws/iam/users/utils.js +440 -30
- package/esm/commands/aws/index.js +142 -229
- package/esm/commands/aws/route53/add-record/handler.js +258 -18
- package/esm/commands/aws/route53/add-record/index.js +4 -57
- package/esm/commands/aws/route53/add-record/schema.js +40 -11
- package/esm/commands/aws/route53/add-record/utils.js +389 -37
- package/esm/commands/aws/route53/remove-record/handler.js +111 -14
- package/esm/commands/aws/route53/remove-record/index.js +3 -18
- package/esm/commands/aws/route53/remove-record/schema.js +21 -8
- package/esm/commands/aws/schema.js +16 -10
- package/esm/commands/aws/ses/send-email/handler.js +70 -12
- package/esm/commands/aws/ses/send-email/index.js +4 -23
- package/esm/commands/aws/ses/send-email/schema.js +23 -7
- package/esm/commands/aws/ses/send-email/utils.js +84 -11
- package/esm/commands/aws/ses/smtp-password.js +69 -10
- package/esm/commands/aws/utils/exec-aws.js +136 -15
- package/esm/commands/aws/utils/resolve-policy-path.js +14 -6
- package/esm/commands/aws/utils/resolve-profile.js +88 -11
- package/esm/commands/aws/utils/tty.js +51 -10
- package/esm/commands/db/create-readonly-user/handler.js +251 -11
- package/esm/commands/db/create-readonly-user/index.js +4 -40
- package/esm/commands/db/create-readonly-user/mysql.js +98 -9
- package/esm/commands/db/create-readonly-user/postgres.js +205 -9
- package/esm/commands/db/create-readonly-user/schema.js +35 -12
- package/esm/commands/db/create-readonly-user/utils.js +151 -22
- package/esm/commands/db/index.js +31 -44
- package/esm/commands/doppler/handler.js +92 -11
- package/esm/commands/doppler/index.js +6 -68
- package/esm/commands/doppler/schema.js +125 -15
- package/esm/commands/doppler/set-secret.js +370 -19
- package/esm/commands/doppler/utils/exec.js +100 -12
- package/esm/commands/doppler/utils.js +396 -34
- package/esm/commands/icons/handler.js +79 -8
- package/esm/commands/icons/index.js +4 -31
- package/esm/commands/icons/schema.js +97 -15
- package/esm/commands/icons/utils.js +125 -13
- package/esm/commands/index.js +47 -155
- package/esm/commands/schema.js +22 -7
- package/esm/index.js +3 -4
- package/package.json +5 -2
- package/vitest.config.ts +11 -0
- package/cjs/__chunks/2FSYDFUV.cjs +0 -146
- package/cjs/__chunks/3A5ZYU5M.cjs +0 -105
- package/cjs/__chunks/3BY5Y4W7.cjs +0 -1
- package/cjs/__chunks/3NOHGUCF.cjs +0 -9
- package/cjs/__chunks/3T2LXW7J.cjs +0 -387
- package/cjs/__chunks/4SFWHCB3.cjs +0 -133
- package/cjs/__chunks/4XT5JEAS.cjs +0 -1
- package/cjs/__chunks/AZEB4H4I.cjs +0 -208
- package/cjs/__chunks/B2KFW7T7.cjs +0 -1
- package/cjs/__chunks/B5ENMOCD.cjs +0 -288
- package/cjs/__chunks/B6XM5KSF.cjs +0 -338
- package/cjs/__chunks/BDU2UCE5.cjs +0 -1
- package/cjs/__chunks/BLMSMR5E.cjs +0 -46
- package/cjs/__chunks/CMUD7LLN.cjs +0 -47
- package/cjs/__chunks/DTQ2LB3I.cjs +0 -49
- package/cjs/__chunks/FM5MVRQF.cjs +0 -23
- package/cjs/__chunks/FRHST54J.cjs +0 -135
- package/cjs/__chunks/FU4VP2LN.cjs +0 -1
- package/cjs/__chunks/G5K4PVIL.cjs +0 -26
- package/cjs/__chunks/GU3R54MK.cjs +0 -127
- package/cjs/__chunks/GUL36IFZ.cjs +0 -61
- package/cjs/__chunks/GZMTNK5N.cjs +0 -1
- package/cjs/__chunks/H74JSDBU.cjs +0 -30
- package/cjs/__chunks/INFOPAHN.cjs +0 -117
- package/cjs/__chunks/J36P6UNE.cjs +0 -75
- package/cjs/__chunks/JB7T7PKQ.cjs +0 -538
- package/cjs/__chunks/JSL2JDMW.cjs +0 -1
- package/cjs/__chunks/K4QNHRTP.cjs +0 -163
- package/cjs/__chunks/KU76LC42.cjs +0 -192
- package/cjs/__chunks/LFDSHANP.cjs +0 -34
- package/cjs/__chunks/LHE24ECK.cjs +0 -192
- package/cjs/__chunks/LIKQ3SI4.cjs +0 -1
- package/cjs/__chunks/LXDF5QVZ.cjs +0 -313
- package/cjs/__chunks/LXOOJR2R.cjs +0 -74
- package/cjs/__chunks/N5MXFOQZ.cjs +0 -167
- package/cjs/__chunks/N7D56LPP.cjs +0 -25
- package/cjs/__chunks/NFXQNOQH.cjs +0 -393
- package/cjs/__chunks/NIMXXHJQ.cjs +0 -92
- package/cjs/__chunks/NLKJIUEX.cjs +0 -126
- package/cjs/__chunks/NT2XXAI6.cjs +0 -89
- package/cjs/__chunks/NWZGFHKH.cjs +0 -121
- package/cjs/__chunks/R3GUC7O7.cjs +0 -110
- package/cjs/__chunks/RPVAXPJ4.cjs +0 -1
- package/cjs/__chunks/S3LVCWPN.cjs +0 -23
- package/cjs/__chunks/SBBNW2BF.cjs +0 -249
- package/cjs/__chunks/T2A7TN4F.cjs +0 -81
- package/cjs/__chunks/TKNNDDIB.cjs +0 -97
- package/cjs/__chunks/TNSRDJPR.cjs +0 -1
- package/cjs/__chunks/UWHPE2GI.cjs +0 -20
- package/cjs/__chunks/W6K7BV74.cjs +0 -1
- package/cjs/__chunks/WBOQ6AUN.cjs +0 -320
- package/cjs/__chunks/WHGN5PZI.cjs +0 -299
- package/cjs/__chunks/WOYF2L6T.cjs +0 -11
- package/cjs/__chunks/X26XY2N6.cjs +0 -18
- package/cjs/__chunks/XMKOKRXZ.cjs +0 -16
- package/cjs/__chunks/XTJPQ3EX.cjs +0 -1
- package/cjs/__chunks/YRHFKTW2.cjs +0 -63
- package/cjs/__chunks/ZMDIOZPT.cjs +0 -22
- package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.cjs +0 -28
- package/cjs/commands/aws/iam/policies/sts-federation.cjs +0 -19
- package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +0 -183
- package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +0 -49
- package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +0 -64
- package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +0 -125
- package/esm/__chunks/2FTTEFEK.js +0 -97
- package/esm/__chunks/33UYMUQD.js +0 -338
- package/esm/__chunks/3BKWTHLJ.js +0 -25
- package/esm/__chunks/3HE4BEJX.js +0 -105
- package/esm/__chunks/3QLI5BDL.js +0 -387
- package/esm/__chunks/5GIUAFXL.js +0 -89
- package/esm/__chunks/5ZBVGSOK.js +0 -0
- package/esm/__chunks/6G4PXXKF.js +0 -75
- package/esm/__chunks/73BJG53F.js +0 -11
- package/esm/__chunks/7VF4Q43Q.js +0 -0
- package/esm/__chunks/AEDEAYF5.js +0 -0
- package/esm/__chunks/AZCP3SFJ.js +0 -0
- package/esm/__chunks/B2DVQ2UL.js +0 -61
- package/esm/__chunks/CVQVHLW5.js +0 -0
- package/esm/__chunks/D62SPZXC.js +0 -0
- package/esm/__chunks/DLEJ25GZ.js +0 -121
- package/esm/__chunks/DMYFNF54.js +0 -192
- package/esm/__chunks/DNFTUMGD.js +0 -23
- package/esm/__chunks/DVKD6YSR.js +0 -49
- package/esm/__chunks/EMSH4P76.js +0 -20
- package/esm/__chunks/FFKFVMIE.js +0 -167
- package/esm/__chunks/FL7AILGH.js +0 -133
- package/esm/__chunks/FNXUONAV.js +0 -110
- package/esm/__chunks/G4NJHFFU.js +0 -320
- package/esm/__chunks/HJSXC6HP.js +0 -117
- package/esm/__chunks/IEOGAQYI.js +0 -46
- package/esm/__chunks/IZFGBYGE.js +0 -34
- package/esm/__chunks/J34UVKLA.js +0 -26
- package/esm/__chunks/JZPBBBIG.js +0 -74
- package/esm/__chunks/KWUJP5MG.js +0 -135
- package/esm/__chunks/M35URMT4.js +0 -313
- package/esm/__chunks/NF3M2L6C.js +0 -81
- package/esm/__chunks/O3CCA76Q.js +0 -22
- package/esm/__chunks/PNPPDYKC.js +0 -299
- package/esm/__chunks/QFXN4EHM.js +0 -393
- package/esm/__chunks/QKDDLIWD.js +0 -146
- package/esm/__chunks/QSE66AKY.js +0 -208
- package/esm/__chunks/QUF7PS4R.js +0 -18
- package/esm/__chunks/S7IJPJ4R.js +0 -126
- package/esm/__chunks/SD3E3EPH.js +0 -163
- package/esm/__chunks/SJXQJ7RS.js +0 -92
- package/esm/__chunks/SNCKIAOR.js +0 -0
- package/esm/__chunks/T3TTUHTW.js +0 -30
- package/esm/__chunks/TIOVE6HR.js +0 -0
- package/esm/__chunks/TXKMEIDQ.js +0 -0
- package/esm/__chunks/U7HAE2RF.js +0 -288
- package/esm/__chunks/UXWY7BYE.js +0 -63
- package/esm/__chunks/VKAKISRG.js +0 -192
- package/esm/__chunks/WD2YR6I7.js +0 -0
- package/esm/__chunks/WOZFZKFY.js +0 -0
- package/esm/__chunks/XI7GZDE2.js +0 -0
- package/esm/__chunks/XOUWDB3T.js +0 -249
- package/esm/__chunks/XQN2TA4S.js +0 -23
- package/esm/__chunks/XXK32TIM.js +0 -16
- package/esm/__chunks/YGWTVPZE.js +0 -538
- package/esm/__chunks/YRG7PT33.js +0 -127
- package/esm/__chunks/ZHKVJO2U.js +0 -47
- package/esm/__chunks/ZO55YUSY.js +0 -9
- package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +0 -28
- package/esm/commands/aws/iam/policies/sts-federation.js +0 -19
- package/esm/commands/aws/iam/policies/user-admins-deny-list.js +0 -183
- package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +0 -49
- package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +0 -64
- package/esm/commands/aws/iam/policies/user-admins-write-list.js +0 -125
|
@@ -1,37 +1,404 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_utils_exec_aws = require("../../utils/exec-aws.cjs");
|
|
3
|
+
require("./schema.cjs");
|
|
4
|
+
//#region src/commands/aws/route53/add-record/utils.js
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} HostedZone
|
|
7
|
+
* @property {string} id - Bare hosted zone ID (without /hostedzone/ prefix)
|
|
8
|
+
* @property {string} name - Zone name with trailing dot (e.g. mountaindev.com.)
|
|
9
|
+
* @property {boolean} privateZone
|
|
10
|
+
* @property {number} recordCount
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object} ResourceRecordSet
|
|
14
|
+
* @property {string} name
|
|
15
|
+
* @property {string} type
|
|
16
|
+
* @property {number | undefined} ttl
|
|
17
|
+
* @property {string[]} values
|
|
18
|
+
* @property {boolean} isAlias
|
|
19
|
+
* @property {any} [aliasTarget] - Raw AliasTarget block (present when isAlias)
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Strip the `/hostedzone/` prefix from a Route53 hosted zone Id.
|
|
23
|
+
* @param {string} rawId
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
function bareHostedZoneId(rawId) {
|
|
27
|
+
return rawId.replace(/^\/hostedzone\//, "");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Ensure a DNS name ends with a trailing dot (Route53 FQDN form).
|
|
31
|
+
* @param {string} name
|
|
32
|
+
* @returns {string}
|
|
33
|
+
*/
|
|
34
|
+
function withTrailingDot(name) {
|
|
35
|
+
const trimmed = name.trim();
|
|
36
|
+
if (trimmed === "") return trimmed;
|
|
37
|
+
return trimmed.endsWith(".") ? trimmed : `${trimmed}.`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Strip a trailing dot for display.
|
|
41
|
+
* @param {string} name
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
function withoutTrailingDot(name) {
|
|
45
|
+
return name.endsWith(".") ? name.slice(0, -1) : name;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* List hosted zones for the profile.
|
|
49
|
+
* @param {{ profile?: string; verbose?: boolean }} params
|
|
50
|
+
* @returns {HostedZone[]}
|
|
51
|
+
*/
|
|
52
|
+
function listHostedZones(params) {
|
|
53
|
+
const { profile, verbose } = params;
|
|
54
|
+
const data = require_commands_aws_utils_exec_aws.runAws({
|
|
55
|
+
profile,
|
|
56
|
+
args: ["route53", "list-hosted-zones"],
|
|
57
|
+
verbose
|
|
58
|
+
});
|
|
59
|
+
/** @type {HostedZone[]} */
|
|
60
|
+
const zones = [];
|
|
61
|
+
for (const zone of data.HostedZones ?? []) {
|
|
62
|
+
const id = bareHostedZoneId(String(zone.Id ?? ""));
|
|
63
|
+
const name = withTrailingDot(String(zone.Name ?? ""));
|
|
64
|
+
if (!id || !name) continue;
|
|
65
|
+
zones.push({
|
|
66
|
+
id,
|
|
67
|
+
name,
|
|
68
|
+
privateZone: Boolean(zone.Config?.PrivateZone),
|
|
69
|
+
recordCount: Number(zone.ResourceRecordSetCount ?? 0)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return zones.sort((a, b) => a.name.localeCompare(b.name));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Resolve a hosted zone from a name (mountaindev.com) or bare/prefixed ID.
|
|
76
|
+
* @param {{ zones: HostedZone[]; zoneInput: string }} params
|
|
77
|
+
* @returns {HostedZone | null}
|
|
78
|
+
*/
|
|
79
|
+
function findHostedZone(params) {
|
|
80
|
+
const { zones, zoneInput } = params;
|
|
81
|
+
const input = zoneInput.trim();
|
|
82
|
+
if (!input) return null;
|
|
83
|
+
const bareId = bareHostedZoneId(input);
|
|
84
|
+
const byId = zones.find((zone) => zone.id === bareId);
|
|
85
|
+
if (byId) return byId;
|
|
86
|
+
const normalized = withTrailingDot(input).toLowerCase();
|
|
87
|
+
const matches = zones.filter((zone) => zone.name.toLowerCase() === normalized);
|
|
88
|
+
if (matches.length === 1) return matches[0] ?? null;
|
|
89
|
+
if (matches.length > 1) return matches.find((zone) => !zone.privateZone) ?? matches[0] ?? null;
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Build a display label for a hosted zone in the picker.
|
|
94
|
+
* @param {HostedZone} zone
|
|
95
|
+
* @returns {string}
|
|
96
|
+
*/
|
|
97
|
+
function hostedZoneLabel(zone) {
|
|
98
|
+
const visibility = zone.privateZone ? "private" : "public";
|
|
99
|
+
return `${withoutTrailingDot(zone.name)} (${zone.id}, ${visibility}, ${zone.recordCount} records)`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Turn a relative or absolute name into a Route53 FQDN under the zone.
|
|
103
|
+
* Apex / "@" / empty → the zone apex.
|
|
104
|
+
* @param {{ nameInput: string; zoneName: string }} params
|
|
105
|
+
* @returns {string} FQDN with trailing dot
|
|
106
|
+
*/
|
|
107
|
+
function resolveRecordName(params) {
|
|
108
|
+
const { nameInput, zoneName } = params;
|
|
109
|
+
const zoneFqdn = withTrailingDot(zoneName);
|
|
110
|
+
const raw = nameInput.trim();
|
|
111
|
+
if (raw === "" || raw === "@") return zoneFqdn;
|
|
112
|
+
const asFqdn = withTrailingDot(raw);
|
|
113
|
+
const zoneLower = zoneFqdn.toLowerCase();
|
|
114
|
+
if (asFqdn.toLowerCase() === zoneLower) return zoneFqdn;
|
|
115
|
+
if (asFqdn.toLowerCase().endsWith(`.${zoneLower}`)) return asFqdn;
|
|
116
|
+
return withTrailingDot(`${raw.replace(/\.$/, "")}.${withoutTrailingDot(zoneFqdn)}`);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Fetch every resource record set at an exact name, across all types.
|
|
120
|
+
* Paginates when needed; Route53 list is ordered by name then type.
|
|
121
|
+
* @param {{
|
|
122
|
+
* profile?: string;
|
|
123
|
+
* hostedZoneId: string;
|
|
124
|
+
* name: string;
|
|
125
|
+
* verbose?: boolean;
|
|
126
|
+
* }} params
|
|
127
|
+
* @returns {ResourceRecordSet[]}
|
|
128
|
+
*/
|
|
129
|
+
function getRecordSetsAtName(params) {
|
|
130
|
+
const { profile, hostedZoneId, name, verbose } = params;
|
|
131
|
+
const targetName = withTrailingDot(name).toLowerCase();
|
|
132
|
+
let startRecordName = withTrailingDot(name);
|
|
133
|
+
/** @type {string | undefined} */
|
|
134
|
+
let startRecordType;
|
|
135
|
+
/** @type {string | undefined} */
|
|
136
|
+
let nextRecordIdentifier;
|
|
137
|
+
/** @type {ResourceRecordSet[]} */
|
|
138
|
+
const collected = [];
|
|
139
|
+
for (let page = 0; page < 20; page += 1) {
|
|
140
|
+
/** @type {string[]} */
|
|
141
|
+
const args = [
|
|
142
|
+
"route53",
|
|
143
|
+
"list-resource-record-sets",
|
|
144
|
+
"--hosted-zone-id",
|
|
145
|
+
hostedZoneId,
|
|
146
|
+
"--max-items",
|
|
147
|
+
"100"
|
|
148
|
+
];
|
|
149
|
+
if (startRecordName) args.push("--start-record-name", startRecordName);
|
|
150
|
+
if (startRecordType) args.push("--start-record-type", startRecordType);
|
|
151
|
+
if (nextRecordIdentifier) args.push("--start-record-identifier", nextRecordIdentifier);
|
|
152
|
+
const data = require_commands_aws_utils_exec_aws.runAws({
|
|
153
|
+
profile,
|
|
154
|
+
args,
|
|
155
|
+
verbose
|
|
156
|
+
});
|
|
157
|
+
const sets = data.ResourceRecordSets ?? [];
|
|
158
|
+
for (const set of sets) {
|
|
159
|
+
const setName = withTrailingDot(String(set.Name ?? "")).toLowerCase();
|
|
160
|
+
if (setName === targetName) {
|
|
161
|
+
collected.push(normalizeRecordSet(set));
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (setName > targetName) return collected;
|
|
165
|
+
}
|
|
166
|
+
if (!(data.IsTruncated === true)) return collected;
|
|
167
|
+
startRecordName = data.NextRecordName ? String(data.NextRecordName) : startRecordName;
|
|
168
|
+
startRecordType = data.NextRecordType ? String(data.NextRecordType) : void 0;
|
|
169
|
+
nextRecordIdentifier = data.NextRecordIdentifier ? String(data.NextRecordIdentifier) : void 0;
|
|
170
|
+
}
|
|
171
|
+
return collected;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Fetch a single resource record set by exact name + type, if it exists.
|
|
175
|
+
* @param {{
|
|
176
|
+
* profile?: string;
|
|
177
|
+
* hostedZoneId: string;
|
|
178
|
+
* name: string;
|
|
179
|
+
* type: string;
|
|
180
|
+
* verbose?: boolean;
|
|
181
|
+
* }} params
|
|
182
|
+
* @returns {ResourceRecordSet | null}
|
|
183
|
+
*/
|
|
184
|
+
function getResourceRecordSet(params) {
|
|
185
|
+
const { type, ...rest } = params;
|
|
186
|
+
const targetType = type.toUpperCase();
|
|
187
|
+
return getRecordSetsAtName(rest).find((set) => set.type === targetType) ?? null;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Route53 forbids a CNAME from coexisting with any other record type at the
|
|
191
|
+
* same name. Given the type about to be written and the record sets already at
|
|
192
|
+
* that name, return the sets that would conflict (empty when there is none).
|
|
193
|
+
* A same-type set is an overwrite, not a conflict.
|
|
194
|
+
* @param {{ existingSets: ResourceRecordSet[]; type: string }} params
|
|
195
|
+
* @returns {ResourceRecordSet[]}
|
|
196
|
+
*/
|
|
197
|
+
function findCnameConflicts(params) {
|
|
198
|
+
const { existingSets, type } = params;
|
|
199
|
+
const upperType = type.toUpperCase();
|
|
200
|
+
return existingSets.filter((set) => {
|
|
201
|
+
if (set.type === upperType) return false;
|
|
202
|
+
return upperType === "CNAME" || set.type === "CNAME";
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @param {any} set
|
|
207
|
+
* @returns {ResourceRecordSet}
|
|
208
|
+
*/
|
|
209
|
+
function normalizeRecordSet(set) {
|
|
210
|
+
const values = (set.ResourceRecords ?? []).map((record) => String(record.Value ?? ""));
|
|
211
|
+
return {
|
|
212
|
+
name: withTrailingDot(String(set.Name ?? "")),
|
|
213
|
+
type: String(set.Type ?? "").toUpperCase(),
|
|
214
|
+
ttl: typeof set.TTL === "number" ? set.TTL : void 0,
|
|
215
|
+
values,
|
|
216
|
+
isAlias: Boolean(set.AliasTarget),
|
|
217
|
+
aliasTarget: set.AliasTarget ?? void 0
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Format existing values for console display.
|
|
222
|
+
* @param {string[]} values
|
|
223
|
+
* @returns {string}
|
|
224
|
+
*/
|
|
225
|
+
function formatValues(values) {
|
|
226
|
+
if (values.length === 0) return "(none)";
|
|
227
|
+
if (values.length === 1) return values[0] ?? "(none)";
|
|
228
|
+
return values.map((value) => `\n - ${value}`).join("");
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Normalize a single record value for a given type (trailing dots, TXT quotes).
|
|
232
|
+
* @param {{ type: string; value: string }} params
|
|
233
|
+
* @returns {string}
|
|
234
|
+
*/
|
|
235
|
+
function normalizeRecordValue(params) {
|
|
236
|
+
const { type, value } = params;
|
|
237
|
+
const trimmed = value.trim();
|
|
238
|
+
if (type === "CNAME" || type === "NS" || type === "MX" || type === "SRV") {
|
|
239
|
+
if (type === "MX") {
|
|
240
|
+
const parts = trimmed.split(/\s+/);
|
|
241
|
+
if (parts.length >= 2) return `${parts[0]} ${withTrailingDot(parts.slice(1).join(" "))}`;
|
|
242
|
+
}
|
|
243
|
+
if (type === "SRV") {
|
|
244
|
+
const parts = trimmed.split(/\s+/);
|
|
245
|
+
if (parts.length >= 4) return `${parts.slice(0, 3).join(" ")} ${withTrailingDot(parts.slice(3).join(" "))}`;
|
|
246
|
+
}
|
|
247
|
+
return withTrailingDot(trimmed);
|
|
248
|
+
}
|
|
249
|
+
if (type === "TXT") {
|
|
250
|
+
if (trimmed.startsWith("\"") && trimmed.endsWith("\"") || trimmed.startsWith("'") && trimmed.endsWith("'")) return trimmed;
|
|
251
|
+
return `"${trimmed}"`;
|
|
252
|
+
}
|
|
253
|
+
return trimmed;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Decide how the new value relates to an existing RRSet.
|
|
257
|
+
* @param {{
|
|
258
|
+
* existing: ResourceRecordSet | null;
|
|
259
|
+
* newValue: string;
|
|
260
|
+
* mode?: "replace" | "append";
|
|
261
|
+
* }} params
|
|
262
|
+
* @returns {{
|
|
263
|
+
* action: "create" | "overwrite" | "append" | "noop";
|
|
264
|
+
* finalValues: string[];
|
|
265
|
+
* summary: string;
|
|
266
|
+
* }}
|
|
267
|
+
*/
|
|
268
|
+
function planRecordChange(params) {
|
|
269
|
+
const { existing, newValue, mode = "replace" } = params;
|
|
270
|
+
if (!existing) return {
|
|
271
|
+
action: "create",
|
|
272
|
+
finalValues: [newValue],
|
|
273
|
+
summary: "Adding a new record (nothing exists at this name + type)."
|
|
274
|
+
};
|
|
275
|
+
if (existing.isAlias) return {
|
|
276
|
+
action: "overwrite",
|
|
277
|
+
finalValues: [newValue],
|
|
278
|
+
summary: "Overwriting an existing ALIAS record with a standard record set."
|
|
279
|
+
};
|
|
280
|
+
const alreadyPresent = existing.values.some((value) => value === newValue || value === `"${newValue}"`);
|
|
281
|
+
if (alreadyPresent && mode !== "replace") return {
|
|
282
|
+
action: "noop",
|
|
283
|
+
finalValues: existing.values,
|
|
284
|
+
summary: "Record already has this value. Nothing to do."
|
|
285
|
+
};
|
|
286
|
+
if (alreadyPresent && mode === "replace" && existing.values.length === 1 && existing.values[0] === newValue) return {
|
|
287
|
+
action: "noop",
|
|
288
|
+
finalValues: existing.values,
|
|
289
|
+
summary: "Record already has exactly this value. Nothing to do."
|
|
290
|
+
};
|
|
291
|
+
if (mode === "append") return {
|
|
292
|
+
action: "append",
|
|
293
|
+
finalValues: [...existing.values, newValue],
|
|
294
|
+
summary: `Adding to the existing ${existing.type} record (${existing.values.length} value(s) → ${existing.values.length + 1}).`
|
|
295
|
+
};
|
|
296
|
+
return {
|
|
297
|
+
action: "overwrite",
|
|
298
|
+
finalValues: [newValue],
|
|
299
|
+
summary: existing.values.length === 1 ? `Overwriting existing value:\n ${existing.values[0]}\n → ${newValue}` : `Replacing ${existing.values.length} existing values with a single new value.`
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Submit a Route53 UPSERT for a simple (non-alias) resource record set.
|
|
304
|
+
* @param {{
|
|
305
|
+
* profile?: string;
|
|
306
|
+
* hostedZoneId: string;
|
|
307
|
+
* name: string;
|
|
308
|
+
* type: string;
|
|
309
|
+
* ttl: number;
|
|
310
|
+
* values: string[];
|
|
311
|
+
* verbose?: boolean;
|
|
312
|
+
* }} params
|
|
313
|
+
* @returns {any} ChangeInfo from Route53
|
|
314
|
+
*/
|
|
315
|
+
function upsertResourceRecordSet(params) {
|
|
316
|
+
const { profile, hostedZoneId, name, type, ttl, values, verbose } = params;
|
|
317
|
+
const changeBatch = {
|
|
318
|
+
Comment: `mtn aws route53 add-record: ${type} ${name}`,
|
|
319
|
+
Changes: [{
|
|
320
|
+
Action: "UPSERT",
|
|
321
|
+
ResourceRecordSet: {
|
|
322
|
+
Name: withTrailingDot(name),
|
|
323
|
+
Type: type,
|
|
324
|
+
TTL: ttl ?? 300,
|
|
325
|
+
ResourceRecords: values.map((value) => ({ Value: value }))
|
|
326
|
+
}
|
|
327
|
+
}]
|
|
328
|
+
};
|
|
329
|
+
const data = require_commands_aws_utils_exec_aws.runAws({
|
|
330
|
+
profile,
|
|
331
|
+
args: [
|
|
332
|
+
"route53",
|
|
333
|
+
"change-resource-record-sets",
|
|
334
|
+
"--hosted-zone-id",
|
|
335
|
+
hostedZoneId,
|
|
336
|
+
"--change-batch",
|
|
337
|
+
JSON.stringify(changeBatch)
|
|
338
|
+
],
|
|
339
|
+
verbose
|
|
340
|
+
});
|
|
341
|
+
return data.ChangeInfo ?? data;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Submit a Route53 DELETE for an existing resource record set. Route53 requires
|
|
345
|
+
* the record's exact current definition, so this is driven by the record set
|
|
346
|
+
* returned from {@link getResourceRecordSet} — alias records reuse their
|
|
347
|
+
* AliasTarget; standard records reuse their TTL + values.
|
|
348
|
+
* @param {{
|
|
349
|
+
* profile?: string;
|
|
350
|
+
* hostedZoneId: string;
|
|
351
|
+
* record: ResourceRecordSet;
|
|
352
|
+
* verbose?: boolean;
|
|
353
|
+
* }} params
|
|
354
|
+
* @returns {any} ChangeInfo from Route53
|
|
355
|
+
*/
|
|
356
|
+
function deleteResourceRecordSet(params) {
|
|
357
|
+
const { profile, hostedZoneId, record, verbose } = params;
|
|
358
|
+
/** @type {Record<string, any>} */
|
|
359
|
+
const resourceRecordSet = {
|
|
360
|
+
Name: withTrailingDot(record.name),
|
|
361
|
+
Type: record.type
|
|
362
|
+
};
|
|
363
|
+
if (record.isAlias && record.aliasTarget) resourceRecordSet.AliasTarget = record.aliasTarget;
|
|
364
|
+
else {
|
|
365
|
+
resourceRecordSet.TTL = record.ttl ?? 300;
|
|
366
|
+
resourceRecordSet.ResourceRecords = record.values.map((value) => ({ Value: value }));
|
|
367
|
+
}
|
|
368
|
+
const changeBatch = {
|
|
369
|
+
Comment: `mtn aws route53 remove-record: ${record.type} ${record.name}`,
|
|
370
|
+
Changes: [{
|
|
371
|
+
Action: "DELETE",
|
|
372
|
+
ResourceRecordSet: resourceRecordSet
|
|
373
|
+
}]
|
|
374
|
+
};
|
|
375
|
+
const data = require_commands_aws_utils_exec_aws.runAws({
|
|
376
|
+
profile,
|
|
377
|
+
args: [
|
|
378
|
+
"route53",
|
|
379
|
+
"change-resource-record-sets",
|
|
380
|
+
"--hosted-zone-id",
|
|
381
|
+
hostedZoneId,
|
|
382
|
+
"--change-batch",
|
|
383
|
+
JSON.stringify(changeBatch)
|
|
384
|
+
],
|
|
385
|
+
verbose
|
|
386
|
+
});
|
|
387
|
+
return data.ChangeInfo ?? data;
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
390
|
+
exports.bareHostedZoneId = bareHostedZoneId;
|
|
391
|
+
exports.deleteResourceRecordSet = deleteResourceRecordSet;
|
|
392
|
+
exports.findCnameConflicts = findCnameConflicts;
|
|
393
|
+
exports.findHostedZone = findHostedZone;
|
|
394
|
+
exports.formatValues = formatValues;
|
|
395
|
+
exports.getRecordSetsAtName = getRecordSetsAtName;
|
|
396
|
+
exports.getResourceRecordSet = getResourceRecordSet;
|
|
397
|
+
exports.hostedZoneLabel = hostedZoneLabel;
|
|
398
|
+
exports.listHostedZones = listHostedZones;
|
|
399
|
+
exports.normalizeRecordValue = normalizeRecordValue;
|
|
400
|
+
exports.planRecordChange = planRecordChange;
|
|
401
|
+
exports.resolveRecordName = resolveRecordName;
|
|
402
|
+
exports.upsertResourceRecordSet = upsertResourceRecordSet;
|
|
403
|
+
exports.withTrailingDot = withTrailingDot;
|
|
404
|
+
exports.withoutTrailingDot = withoutTrailingDot;
|
|
@@ -1,14 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require(
|
|
5
|
-
require(
|
|
6
|
-
require(
|
|
7
|
-
require(
|
|
8
|
-
require(
|
|
9
|
-
require(
|
|
10
|
-
|
|
11
|
-
require(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("../../../../__chunks/VH7oDXx4.cjs");
|
|
3
|
+
const require_commands_aws_utils_tty = require("../../utils/tty.cjs");
|
|
4
|
+
const require_commands_aws_utils_exec_aws = require("../../utils/exec-aws.cjs");
|
|
5
|
+
const require_commands_aws_utils_resolve_profile = require("../../utils/resolve-profile.cjs");
|
|
6
|
+
const require_commands_aws_route53_add_record_utils = require("../add-record/utils.cjs");
|
|
7
|
+
const require_commands_aws_route53_add_record_handler = require("../add-record/handler.cjs");
|
|
8
|
+
const require_commands_aws_route53_remove_record_schema = require("./schema.cjs");
|
|
9
|
+
let chalk = require("chalk");
|
|
10
|
+
chalk = require_rolldown_runtime.__toESM(chalk, 1);
|
|
11
|
+
let zod = require("zod");
|
|
12
|
+
//#region src/commands/aws/route53/remove-record/handler.js
|
|
13
|
+
/**
|
|
14
|
+
* `aws route53 remove-record` handler: interactively (or via flags) delete a
|
|
15
|
+
* Route53 resource record set, showing the record before it is removed.
|
|
16
|
+
* @param {unknown} options
|
|
17
|
+
*/
|
|
18
|
+
async function removeRecordCommand(options) {
|
|
19
|
+
try {
|
|
20
|
+
const { profile: profileOption, zone: zoneOption, type: typeOption, name: nameOption, yes, dryRun, verbose } = require_commands_aws_route53_remove_record_schema.removeRecordOptionsSchema.parse(options);
|
|
21
|
+
const profile = await require_commands_aws_utils_resolve_profile.resolveProfile({ profile: profileOption });
|
|
22
|
+
if (!profile) {
|
|
23
|
+
console.error(chalk.default.red("Error: pass --profile or set AWS_PROFILE."));
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
require_commands_aws_utils_exec_aws.requireCommands(["aws"]);
|
|
27
|
+
const identity = require_commands_aws_utils_exec_aws.getCallerIdentity({
|
|
28
|
+
profile,
|
|
29
|
+
verbose
|
|
30
|
+
});
|
|
31
|
+
console.log("Caller:");
|
|
32
|
+
console.log(` Account: ${identity.Account}`);
|
|
33
|
+
console.log(` Arn: ${identity.Arn}`);
|
|
34
|
+
console.log("");
|
|
35
|
+
const zone = await require_commands_aws_route53_add_record_handler.resolveHostedZone({
|
|
36
|
+
profile,
|
|
37
|
+
zoneOption,
|
|
38
|
+
verbose
|
|
39
|
+
});
|
|
40
|
+
console.log(`Hosted zone: ${require_commands_aws_route53_add_record_utils.hostedZoneLabel(zone)}`);
|
|
41
|
+
console.log("");
|
|
42
|
+
const type = await require_commands_aws_route53_add_record_handler.resolveRecordType(typeOption);
|
|
43
|
+
const name = await require_commands_aws_route53_add_record_handler.resolveName({
|
|
44
|
+
nameOption,
|
|
45
|
+
zoneName: zone.name
|
|
46
|
+
});
|
|
47
|
+
const existing = require_commands_aws_route53_add_record_utils.getResourceRecordSet({
|
|
48
|
+
profile,
|
|
49
|
+
hostedZoneId: zone.id,
|
|
50
|
+
name,
|
|
51
|
+
type,
|
|
52
|
+
verbose
|
|
53
|
+
});
|
|
54
|
+
if (!existing) {
|
|
55
|
+
console.log(chalk.default.yellow(`No ${type} record at ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}. Nothing to remove.`));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
console.log("Record to remove:");
|
|
59
|
+
console.log(` Name: ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}`);
|
|
60
|
+
console.log(` Type: ${type}`);
|
|
61
|
+
if (existing.isAlias) console.log(` Alias: ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(String(existing.aliasTarget?.DNSName ?? ""))}`);
|
|
62
|
+
else {
|
|
63
|
+
if (existing.ttl !== void 0) console.log(` TTL: ${existing.ttl}`);
|
|
64
|
+
console.log(` Value:${require_commands_aws_route53_add_record_utils.formatValues(existing.values)}`);
|
|
65
|
+
}
|
|
66
|
+
console.log("");
|
|
67
|
+
if (dryRun) {
|
|
68
|
+
console.log(chalk.default.cyan("Dry run — no changes made."));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!yes) {
|
|
72
|
+
if (!await require_commands_aws_utils_tty.promptYesNo({
|
|
73
|
+
message: `Delete this ${type} record?`,
|
|
74
|
+
defaultYes: false
|
|
75
|
+
})) {
|
|
76
|
+
console.log("Aborted.");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const changeInfo = require_commands_aws_route53_add_record_utils.deleteResourceRecordSet({
|
|
81
|
+
profile,
|
|
82
|
+
hostedZoneId: zone.id,
|
|
83
|
+
record: existing,
|
|
84
|
+
verbose
|
|
85
|
+
});
|
|
86
|
+
console.log("");
|
|
87
|
+
console.log(chalk.default.green(`Done. Deleted ${type} ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}.`));
|
|
88
|
+
if (changeInfo?.Id) {
|
|
89
|
+
console.log(` Change ID: ${changeInfo.Id}`);
|
|
90
|
+
console.log(` Status: ${changeInfo.Status ?? "PENDING"}`);
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (error instanceof zod.ZodError) {
|
|
94
|
+
console.error(chalk.default.red("\n❌ Invalid command options:"));
|
|
95
|
+
error.errors.forEach((err) => {
|
|
96
|
+
console.error(chalk.default.red(` ${err.path.join(".")}: ${err.message}`));
|
|
97
|
+
});
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
const verbose = options?.verbose || false;
|
|
101
|
+
console.error(chalk.default.red("\n❌ remove-record failed:"));
|
|
102
|
+
if (error instanceof require_commands_aws_utils_exec_aws.AwsCliError || error instanceof Error) {
|
|
103
|
+
console.error(chalk.default.red(` ${error.message}`));
|
|
104
|
+
if (verbose && error.stack) {
|
|
105
|
+
console.error(chalk.default.gray("\nStack trace:"));
|
|
106
|
+
console.error(chalk.default.gray(error.stack));
|
|
107
|
+
}
|
|
108
|
+
} else console.error(chalk.default.red(` ${String(error)}`));
|
|
109
|
+
console.error(chalk.default.yellow("\n💡 Use --verbose for detailed error information\n"));
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
exports.removeRecordCommand = removeRecordCommand;
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _LFDSHANPcjs = require('../../../../__chunks/LFDSHANP.cjs');
|
|
8
|
-
require('../../../../__chunks/WBOQ6AUN.cjs');
|
|
9
|
-
require('../../../../__chunks/B6XM5KSF.cjs');
|
|
10
|
-
require('../../../../__chunks/BLMSMR5E.cjs');
|
|
11
|
-
require('../../../../__chunks/R3GUC7O7.cjs');
|
|
12
|
-
require('../../../../__chunks/NT2XXAI6.cjs');
|
|
13
|
-
require('../../../../__chunks/WOYF2L6T.cjs');
|
|
14
|
-
require('../../../../__chunks/CMUD7LLN.cjs');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.removeRecordCommand = _2FSYDFUVcjs.removeRecordCommand; exports.removeRecordOptionsSchema = _LFDSHANPcjs.removeRecordOptionsSchema;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_route53_remove_record_schema = require("./schema.cjs");
|
|
3
|
+
const require_commands_aws_route53_remove_record_handler = require("./handler.cjs");
|
|
4
|
+
exports.removeRecordCommand = require_commands_aws_route53_remove_record_handler.removeRecordCommand;
|
|
5
|
+
exports.removeRecordOptionsSchema = require_commands_aws_route53_remove_record_schema.removeRecordOptionsSchema;
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_schema = require("../../schema.cjs");
|
|
3
|
+
const require_commands_aws_route53_add_record_schema = require("../add-record/schema.cjs");
|
|
4
|
+
let zod = require("zod");
|
|
5
|
+
//#region src/commands/aws/route53/remove-record/schema.js
|
|
6
|
+
/**
|
|
7
|
+
* Zod schema for `aws route53 remove-record` options.
|
|
8
|
+
*/
|
|
9
|
+
const removeRecordOptionsSchema = zod.z.object({
|
|
10
|
+
profile: require_commands_aws_schema.profileField,
|
|
11
|
+
zone: zod.z.string().optional().describe("Hosted zone name or ID (e.g. mountaindev.com or Z123…). Skips the zone picker when set."),
|
|
12
|
+
type: zod.z.string().optional().transform((value) => value === void 0 ? void 0 : value.toUpperCase()).refine((value) => value === void 0 || typeof value === "string" && require_commands_aws_route53_add_record_schema.RECORD_TYPES.includes(value), { message: `Record type must be one of: ${require_commands_aws_route53_add_record_schema.RECORD_TYPES.join(", ")}` }).describe(`DNS record type (${require_commands_aws_route53_add_record_schema.RECORD_TYPES.join(", ")})`),
|
|
13
|
+
name: zod.z.string().optional().describe("Record name relative to the zone (e.g. \"redline\") or a fully-qualified name"),
|
|
14
|
+
yes: zod.z.boolean().optional().default(false).describe("Skip the confirmation prompt"),
|
|
15
|
+
dryRun: zod.z.boolean().optional().default(false).describe("Preview the deletion without calling Route53"),
|
|
16
|
+
verbose: require_commands_aws_schema.verboseField
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {z.infer<typeof removeRecordOptionsSchema>} RemoveRecordOptions
|
|
20
|
+
*/
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.removeRecordOptionsSchema = removeRecordOptionsSchema;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
//#region src/commands/aws/schema.js
|
|
4
|
+
/**
|
|
5
|
+
* Shared Zod field for the AWS profile option.
|
|
6
|
+
*/
|
|
7
|
+
const profileField = zod.z.string().optional().describe("AWS profile (defaults to the AWS_PROFILE environment variable)");
|
|
8
|
+
/**
|
|
9
|
+
* Shared Zod field for the AWS region option.
|
|
10
|
+
*/
|
|
11
|
+
const regionField = zod.z.string().optional().describe("AWS region");
|
|
12
|
+
/**
|
|
13
|
+
* Shared Zod field for verbose logging.
|
|
14
|
+
*/
|
|
15
|
+
const verboseField = zod.z.boolean().optional().default(false).describe("Enable verbose logging for detailed output and error traces");
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.profileField = profileField;
|
|
18
|
+
exports.regionField = regionField;
|
|
19
|
+
exports.verboseField = verboseField;
|