@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,18 +1,264 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require(
|
|
8
|
-
require(
|
|
9
|
-
|
|
10
|
-
require(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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_schema = require("./schema.cjs");
|
|
7
|
+
const require_commands_aws_route53_add_record_utils = require("./utils.cjs");
|
|
8
|
+
let chalk = require("chalk");
|
|
9
|
+
chalk = require_rolldown_runtime.__toESM(chalk, 1);
|
|
10
|
+
let zod = require("zod");
|
|
11
|
+
//#region src/commands/aws/route53/add-record/handler.js
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the hosted zone: from --zone, or interactive picker.
|
|
14
|
+
* @param {{
|
|
15
|
+
* profile?: string;
|
|
16
|
+
* zoneOption?: string;
|
|
17
|
+
* verbose: boolean;
|
|
18
|
+
* }} params
|
|
19
|
+
* @returns {Promise<import("./utils.js").HostedZone>}
|
|
20
|
+
*/
|
|
21
|
+
async function resolveHostedZone(params) {
|
|
22
|
+
const { profile, zoneOption, verbose } = params;
|
|
23
|
+
const zones = require_commands_aws_route53_add_record_utils.listHostedZones({
|
|
24
|
+
profile,
|
|
25
|
+
verbose
|
|
26
|
+
});
|
|
27
|
+
if (zones.length === 0) throw new Error("No Route53 hosted zones found for this profile.");
|
|
28
|
+
if (zoneOption) {
|
|
29
|
+
const match = require_commands_aws_route53_add_record_utils.findHostedZone({
|
|
30
|
+
zones,
|
|
31
|
+
zoneInput: zoneOption
|
|
32
|
+
});
|
|
33
|
+
if (!match) throw new Error(`No hosted zone matching "${zoneOption}". Available: ${zones.map((z) => require_commands_aws_route53_add_record_utils.withoutTrailingDot(z.name)).join(", ")}`);
|
|
34
|
+
return match;
|
|
35
|
+
}
|
|
36
|
+
const chosen = zones[await require_commands_aws_utils_tty.promptChoice({
|
|
37
|
+
message: "Choose a hosted zone:",
|
|
38
|
+
options: zones.map((zone) => require_commands_aws_route53_add_record_utils.hostedZoneLabel(zone))
|
|
39
|
+
})];
|
|
40
|
+
if (!chosen) throw new Error("No hosted zone selected");
|
|
41
|
+
return chosen;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolve record type from --type or interactive picker.
|
|
45
|
+
* @param {string | undefined} typeOption
|
|
46
|
+
* @returns {Promise<string>}
|
|
47
|
+
*/
|
|
48
|
+
async function resolveRecordType(typeOption) {
|
|
49
|
+
if (typeOption) return typeOption.toUpperCase();
|
|
50
|
+
const index = await require_commands_aws_utils_tty.promptChoice({
|
|
51
|
+
message: "Choose a record type:",
|
|
52
|
+
options: require_commands_aws_route53_add_record_schema.RECORD_TYPES
|
|
53
|
+
});
|
|
54
|
+
const chosen = require_commands_aws_route53_add_record_schema.RECORD_TYPES[index];
|
|
55
|
+
if (!chosen) throw new Error("No record type selected");
|
|
56
|
+
return chosen;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolve record name from --name or prompt.
|
|
60
|
+
* @param {{ nameOption?: string; zoneName: string }} params
|
|
61
|
+
* @returns {Promise<string>} FQDN with trailing dot
|
|
62
|
+
*/
|
|
63
|
+
async function resolveName(params) {
|
|
64
|
+
const { nameOption, zoneName } = params;
|
|
65
|
+
let input = nameOption;
|
|
66
|
+
if (!input) input = await require_commands_aws_utils_tty.prompt(`Record name (relative to ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(zoneName)}, or FQDN; @ for apex): `);
|
|
67
|
+
if (!input) throw new Error("Record name is required");
|
|
68
|
+
return require_commands_aws_route53_add_record_utils.resolveRecordName({
|
|
69
|
+
nameInput: input,
|
|
70
|
+
zoneName
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Resolve record value from --value or prompt.
|
|
75
|
+
* @param {{ valueOption?: string; type: string }} params
|
|
76
|
+
* @returns {Promise<string>}
|
|
77
|
+
*/
|
|
78
|
+
async function resolveValue(params) {
|
|
79
|
+
const { valueOption, type } = params;
|
|
80
|
+
let input = valueOption;
|
|
81
|
+
if (!input) input = await require_commands_aws_utils_tty.prompt(`Record value${type === "CNAME" ? " (e.g. target.example.com.)" : type === "TXT" ? " (quotes added if omitted)" : ""}: `);
|
|
82
|
+
if (!input) throw new Error("Record value is required");
|
|
83
|
+
return require_commands_aws_route53_add_record_utils.normalizeRecordValue({
|
|
84
|
+
type,
|
|
85
|
+
value: input
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* When an existing multi-value set is present, ask replace vs append
|
|
90
|
+
* (single-value types default to replace).
|
|
91
|
+
* @param {{
|
|
92
|
+
* existing: import("./utils.js").ResourceRecordSet;
|
|
93
|
+
* type: string;
|
|
94
|
+
* }} params
|
|
95
|
+
* @returns {Promise<"replace" | "append">}
|
|
96
|
+
*/
|
|
97
|
+
async function resolveChangeMode(params) {
|
|
98
|
+
const { existing, type } = params;
|
|
99
|
+
if (type === "CNAME" || existing.values.length <= 1) return "replace";
|
|
100
|
+
console.log("");
|
|
101
|
+
console.log(chalk.default.yellow(`Existing ${type} record has ${existing.values.length} values:${require_commands_aws_route53_add_record_utils.formatValues(existing.values)}`));
|
|
102
|
+
return await require_commands_aws_utils_tty.promptYesNo({
|
|
103
|
+
message: "Add to the existing values instead of replacing them?",
|
|
104
|
+
defaultYes: false
|
|
105
|
+
}) ? "append" : "replace";
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* `aws route53 add-record` handler: interactively (or via flags) create or
|
|
109
|
+
* update a Route53 resource record set, showing whether the change adds or
|
|
110
|
+
* overwrites.
|
|
111
|
+
* @param {unknown} options
|
|
112
|
+
*/
|
|
113
|
+
async function addRecordCommand(options) {
|
|
114
|
+
try {
|
|
115
|
+
const { profile: profileOption, zone: zoneOption, type: typeOption, name: nameOption, value: valueOption, ttl: ttlOption, yes, dryRun, verbose } = require_commands_aws_route53_add_record_schema.addRecordOptionsSchema.parse(options);
|
|
116
|
+
const profile = await require_commands_aws_utils_resolve_profile.resolveProfile({ profile: profileOption });
|
|
117
|
+
if (!profile) {
|
|
118
|
+
console.error(chalk.default.red("Error: pass --profile or set AWS_PROFILE."));
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
require_commands_aws_utils_exec_aws.requireCommands(["aws"]);
|
|
122
|
+
const identity = require_commands_aws_utils_exec_aws.getCallerIdentity({
|
|
123
|
+
profile,
|
|
124
|
+
verbose
|
|
125
|
+
});
|
|
126
|
+
console.log("Caller:");
|
|
127
|
+
console.log(` Account: ${identity.Account}`);
|
|
128
|
+
console.log(` Arn: ${identity.Arn}`);
|
|
129
|
+
console.log("");
|
|
130
|
+
const zone = await resolveHostedZone({
|
|
131
|
+
profile,
|
|
132
|
+
zoneOption,
|
|
133
|
+
verbose
|
|
134
|
+
});
|
|
135
|
+
console.log(`Hosted zone: ${require_commands_aws_route53_add_record_utils.hostedZoneLabel(zone)}`);
|
|
136
|
+
console.log("");
|
|
137
|
+
const type = await resolveRecordType(typeOption);
|
|
138
|
+
const name = await resolveName({
|
|
139
|
+
nameOption,
|
|
140
|
+
zoneName: zone.name
|
|
141
|
+
});
|
|
142
|
+
const value = await resolveValue({
|
|
143
|
+
valueOption,
|
|
144
|
+
type
|
|
145
|
+
});
|
|
146
|
+
const ttl = ttlOption ?? 300;
|
|
147
|
+
console.log("");
|
|
148
|
+
console.log("Proposed record:");
|
|
149
|
+
console.log(` Name: ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}`);
|
|
150
|
+
console.log(` Type: ${type}`);
|
|
151
|
+
console.log(` TTL: ${ttl}`);
|
|
152
|
+
console.log(` Value: ${value}`);
|
|
153
|
+
console.log("");
|
|
154
|
+
const existingSets = require_commands_aws_route53_add_record_utils.getRecordSetsAtName({
|
|
155
|
+
profile,
|
|
156
|
+
hostedZoneId: zone.id,
|
|
157
|
+
name,
|
|
158
|
+
verbose
|
|
159
|
+
});
|
|
160
|
+
const existing = existingSets.find((set) => set.type === type) ?? null;
|
|
161
|
+
const conflicts = require_commands_aws_route53_add_record_utils.findCnameConflicts({
|
|
162
|
+
existingSets,
|
|
163
|
+
type
|
|
164
|
+
});
|
|
165
|
+
if (conflicts.length > 0) {
|
|
166
|
+
console.error(chalk.default.red(`❌ Conflict: cannot add a ${type} record at ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}.`));
|
|
167
|
+
console.error("");
|
|
168
|
+
console.error(chalk.default.yellow("Route53 does not allow a CNAME and any other record type to coexist at the same name. Conflicting record(s) already exist:"));
|
|
169
|
+
for (const conflict of conflicts) console.error(` ${conflict.type} ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(conflict.name)}${require_commands_aws_route53_add_record_utils.formatValues(conflict.isAlias ? ["(alias)"] : conflict.values)}`);
|
|
170
|
+
console.error("");
|
|
171
|
+
console.error(chalk.default.yellow("Remove the conflicting record, then re-create the one you wanted:"));
|
|
172
|
+
const zoneName = require_commands_aws_route53_add_record_utils.withoutTrailingDot(zone.name);
|
|
173
|
+
const displayName = require_commands_aws_route53_add_record_utils.withoutTrailingDot(name);
|
|
174
|
+
const quotedValue = /^[A-Za-z0-9._:@/-]+$/.test(value) ? value : `"${value}"`;
|
|
175
|
+
const ttlFlag = ttl === 300 ? "" : ` --ttl ${ttl}`;
|
|
176
|
+
let step = 1;
|
|
177
|
+
for (const conflict of conflicts) console.error(chalk.default.cyan(` ${step++}. mtn aws route53 remove-record -z ${zoneName} -t ${conflict.type} -n ${displayName}`));
|
|
178
|
+
console.error(chalk.default.cyan(` ${step}. mtn aws route53 add-record -z ${zoneName} -t ${type} -n ${displayName} --value ${quotedValue}${ttlFlag}`));
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
if (existing?.isAlias) {
|
|
182
|
+
console.log(chalk.default.yellow("An ALIAS record already exists at this name + type. Continuing will replace it with a standard record set."));
|
|
183
|
+
console.log("");
|
|
184
|
+
} else if (existing) {
|
|
185
|
+
console.log(chalk.default.yellow(`Existing ${type} record at ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}:${require_commands_aws_route53_add_record_utils.formatValues(existing.values)}`));
|
|
186
|
+
if (existing.ttl !== void 0) console.log(` TTL: ${existing.ttl}`);
|
|
187
|
+
console.log("");
|
|
188
|
+
} else {
|
|
189
|
+
console.log(chalk.default.green(`No existing ${type} record at ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}.`));
|
|
190
|
+
console.log("");
|
|
191
|
+
}
|
|
192
|
+
/** @type {"replace" | "append"} */
|
|
193
|
+
let mode = "replace";
|
|
194
|
+
if (existing && !existing.isAlias && existing.values.length > 0) mode = await resolveChangeMode({
|
|
195
|
+
existing,
|
|
196
|
+
type
|
|
197
|
+
});
|
|
198
|
+
const plan = require_commands_aws_route53_add_record_utils.planRecordChange({
|
|
199
|
+
existing,
|
|
200
|
+
newValue: value,
|
|
201
|
+
mode
|
|
202
|
+
});
|
|
203
|
+
console.log(plan.summary);
|
|
204
|
+
console.log("");
|
|
205
|
+
if (plan.action === "noop") return;
|
|
206
|
+
if (plan.action === "overwrite" || plan.action === "append") {
|
|
207
|
+
console.log("Final values that will be written:");
|
|
208
|
+
for (const finalValue of plan.finalValues) console.log(` - ${finalValue}`);
|
|
209
|
+
console.log("");
|
|
210
|
+
}
|
|
211
|
+
if (dryRun) {
|
|
212
|
+
console.log(chalk.default.cyan("Dry run — no changes made."));
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (!yes) {
|
|
216
|
+
if (!await require_commands_aws_utils_tty.promptYesNo({
|
|
217
|
+
message: plan.action === "create" ? "Create this record?" : plan.action === "append" ? "Add this value to the existing record?" : "Overwrite the existing record?",
|
|
218
|
+
defaultYes: false
|
|
219
|
+
})) {
|
|
220
|
+
console.log("Aborted.");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const changeInfo = require_commands_aws_route53_add_record_utils.upsertResourceRecordSet({
|
|
225
|
+
profile,
|
|
226
|
+
hostedZoneId: zone.id,
|
|
227
|
+
name,
|
|
228
|
+
type,
|
|
229
|
+
ttl: existing?.ttl ?? ttl,
|
|
230
|
+
values: plan.finalValues,
|
|
231
|
+
verbose
|
|
232
|
+
});
|
|
233
|
+
console.log("");
|
|
234
|
+
console.log(chalk.default.green(`Done. ${plan.action === "create" ? "Created" : plan.action === "append" ? "Updated (appended)" : "Updated (overwrote)"} ${type} ${require_commands_aws_route53_add_record_utils.withoutTrailingDot(name)}.`));
|
|
235
|
+
if (changeInfo?.Id) {
|
|
236
|
+
console.log(` Change ID: ${changeInfo.Id}`);
|
|
237
|
+
console.log(` Status: ${changeInfo.Status ?? "PENDING"}`);
|
|
238
|
+
}
|
|
239
|
+
} catch (error) {
|
|
240
|
+
if (error instanceof zod.ZodError) {
|
|
241
|
+
console.error(chalk.default.red("\n❌ Invalid command options:"));
|
|
242
|
+
error.errors.forEach((err) => {
|
|
243
|
+
console.error(chalk.default.red(` ${err.path.join(".")}: ${err.message}`));
|
|
244
|
+
});
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
const verbose = options?.verbose || false;
|
|
248
|
+
console.error(chalk.default.red("\n❌ add-record failed:"));
|
|
249
|
+
if (error instanceof require_commands_aws_utils_exec_aws.AwsCliError || error instanceof Error) {
|
|
250
|
+
console.error(chalk.default.red(` ${error.message}`));
|
|
251
|
+
if (verbose && error.stack) {
|
|
252
|
+
console.error(chalk.default.gray("\nStack trace:"));
|
|
253
|
+
console.error(chalk.default.gray(error.stack));
|
|
254
|
+
}
|
|
255
|
+
} else console.error(chalk.default.red(` ${String(error)}`));
|
|
256
|
+
console.error(chalk.default.yellow("\n💡 Use --verbose for detailed error information\n"));
|
|
257
|
+
process.exit(1);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
exports.addRecordCommand = addRecordCommand;
|
|
262
|
+
exports.resolveHostedZone = resolveHostedZone;
|
|
263
|
+
exports.resolveName = resolveName;
|
|
264
|
+
exports.resolveRecordType = resolveRecordType;
|
|
@@ -1,57 +1,26 @@
|
|
|
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
|
-
var _BLMSMR5Ecjs = require('../../../../__chunks/BLMSMR5E.cjs');
|
|
30
|
-
require('../../../../__chunks/R3GUC7O7.cjs');
|
|
31
|
-
require('../../../../__chunks/NT2XXAI6.cjs');
|
|
32
|
-
require('../../../../__chunks/WOYF2L6T.cjs');
|
|
33
|
-
require('../../../../__chunks/CMUD7LLN.cjs');
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
exports.DEFAULT_TTL = _BLMSMR5Ecjs.DEFAULT_TTL; exports.RECORD_TYPES = _BLMSMR5Ecjs.RECORD_TYPES; exports.addRecordCommand = _WBOQ6AUNcjs.addRecordCommand; exports.addRecordOptionsSchema = _BLMSMR5Ecjs.addRecordOptionsSchema; exports.bareHostedZoneId = _B6XM5KSFcjs.bareHostedZoneId; exports.deleteResourceRecordSet = _B6XM5KSFcjs.deleteResourceRecordSet; exports.findCnameConflicts = _B6XM5KSFcjs.findCnameConflicts; exports.findHostedZone = _B6XM5KSFcjs.findHostedZone; exports.formatValues = _B6XM5KSFcjs.formatValues; exports.getRecordSetsAtName = _B6XM5KSFcjs.getRecordSetsAtName; exports.getResourceRecordSet = _B6XM5KSFcjs.getResourceRecordSet; exports.hostedZoneLabel = _B6XM5KSFcjs.hostedZoneLabel; exports.listHostedZones = _B6XM5KSFcjs.listHostedZones; exports.normalizeRecordValue = _B6XM5KSFcjs.normalizeRecordValue; exports.planRecordChange = _B6XM5KSFcjs.planRecordChange; exports.resolveHostedZone = _WBOQ6AUNcjs.resolveHostedZone; exports.resolveName = _WBOQ6AUNcjs.resolveName; exports.resolveRecordName = _B6XM5KSFcjs.resolveRecordName; exports.resolveRecordType = _WBOQ6AUNcjs.resolveRecordType; exports.upsertResourceRecordSet = _B6XM5KSFcjs.upsertResourceRecordSet; exports.withTrailingDot = _B6XM5KSFcjs.withTrailingDot; exports.withoutTrailingDot = _B6XM5KSFcjs.withoutTrailingDot;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_route53_add_record_schema = require("./schema.cjs");
|
|
3
|
+
const require_commands_aws_route53_add_record_utils = require("./utils.cjs");
|
|
4
|
+
const require_commands_aws_route53_add_record_handler = require("./handler.cjs");
|
|
5
|
+
exports.DEFAULT_TTL = require_commands_aws_route53_add_record_schema.DEFAULT_TTL;
|
|
6
|
+
exports.RECORD_TYPES = require_commands_aws_route53_add_record_schema.RECORD_TYPES;
|
|
7
|
+
exports.addRecordCommand = require_commands_aws_route53_add_record_handler.addRecordCommand;
|
|
8
|
+
exports.addRecordOptionsSchema = require_commands_aws_route53_add_record_schema.addRecordOptionsSchema;
|
|
9
|
+
exports.bareHostedZoneId = require_commands_aws_route53_add_record_utils.bareHostedZoneId;
|
|
10
|
+
exports.deleteResourceRecordSet = require_commands_aws_route53_add_record_utils.deleteResourceRecordSet;
|
|
11
|
+
exports.findCnameConflicts = require_commands_aws_route53_add_record_utils.findCnameConflicts;
|
|
12
|
+
exports.findHostedZone = require_commands_aws_route53_add_record_utils.findHostedZone;
|
|
13
|
+
exports.formatValues = require_commands_aws_route53_add_record_utils.formatValues;
|
|
14
|
+
exports.getRecordSetsAtName = require_commands_aws_route53_add_record_utils.getRecordSetsAtName;
|
|
15
|
+
exports.getResourceRecordSet = require_commands_aws_route53_add_record_utils.getResourceRecordSet;
|
|
16
|
+
exports.hostedZoneLabel = require_commands_aws_route53_add_record_utils.hostedZoneLabel;
|
|
17
|
+
exports.listHostedZones = require_commands_aws_route53_add_record_utils.listHostedZones;
|
|
18
|
+
exports.normalizeRecordValue = require_commands_aws_route53_add_record_utils.normalizeRecordValue;
|
|
19
|
+
exports.planRecordChange = require_commands_aws_route53_add_record_utils.planRecordChange;
|
|
20
|
+
exports.resolveHostedZone = require_commands_aws_route53_add_record_handler.resolveHostedZone;
|
|
21
|
+
exports.resolveName = require_commands_aws_route53_add_record_handler.resolveName;
|
|
22
|
+
exports.resolveRecordName = require_commands_aws_route53_add_record_utils.resolveRecordName;
|
|
23
|
+
exports.resolveRecordType = require_commands_aws_route53_add_record_handler.resolveRecordType;
|
|
24
|
+
exports.upsertResourceRecordSet = require_commands_aws_route53_add_record_utils.upsertResourceRecordSet;
|
|
25
|
+
exports.withTrailingDot = require_commands_aws_route53_add_record_utils.withTrailingDot;
|
|
26
|
+
exports.withoutTrailingDot = require_commands_aws_route53_add_record_utils.withoutTrailingDot;
|
|
@@ -1,11 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_schema = require("../../schema.cjs");
|
|
3
|
+
let zod = require("zod");
|
|
4
|
+
//#region src/commands/aws/route53/add-record/schema.js
|
|
5
|
+
/**
|
|
6
|
+
* Common Route53 record types offered in the interactive picker.
|
|
7
|
+
* Alias records are not supported by this command.
|
|
8
|
+
*/
|
|
9
|
+
const RECORD_TYPES = [
|
|
10
|
+
"A",
|
|
11
|
+
"AAAA",
|
|
12
|
+
"CNAME",
|
|
13
|
+
"TXT",
|
|
14
|
+
"MX",
|
|
15
|
+
"NS",
|
|
16
|
+
"SRV",
|
|
17
|
+
"CAA"
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Default TTL (seconds) when creating or replacing a record set.
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_TTL = 300;
|
|
23
|
+
/**
|
|
24
|
+
* Zod schema for `aws route53 add-record` options.
|
|
25
|
+
*/
|
|
26
|
+
const addRecordOptionsSchema = zod.z.object({
|
|
27
|
+
profile: require_commands_aws_schema.profileField,
|
|
28
|
+
zone: zod.z.string().optional().describe("Hosted zone name or ID (e.g. mountaindev.com or Z123…). Skips the zone picker when set."),
|
|
29
|
+
type: zod.z.string().optional().transform((value) => value === void 0 ? void 0 : value.toUpperCase()).refine((value) => value === void 0 || typeof value === "string" && RECORD_TYPES.includes(value), { message: `Record type must be one of: ${RECORD_TYPES.join(", ")}` }).describe(`DNS record type (${RECORD_TYPES.join(", ")})`),
|
|
30
|
+
name: zod.z.string().optional().describe("Record name relative to the zone (e.g. \"redline\") or a fully-qualified name"),
|
|
31
|
+
value: zod.z.string().optional().describe("Record value (e.g. a CNAME target or A address)"),
|
|
32
|
+
ttl: zod.z.number().int().positive().optional().describe(`TTL in seconds (default: 300)`),
|
|
33
|
+
yes: zod.z.boolean().optional().default(false).describe("Skip the confirmation prompt"),
|
|
34
|
+
dryRun: zod.z.boolean().optional().default(false).describe("Preview the change without calling Route53"),
|
|
35
|
+
verbose: require_commands_aws_schema.verboseField
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* @typedef {z.infer<typeof addRecordOptionsSchema>} AddRecordOptions
|
|
39
|
+
*/
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.DEFAULT_TTL = DEFAULT_TTL;
|
|
42
|
+
exports.RECORD_TYPES = RECORD_TYPES;
|
|
43
|
+
exports.addRecordOptionsSchema = addRecordOptionsSchema;
|