@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.
Files changed (264) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/cjs/__chunks/VH7oDXx4.cjs +28 -0
  3. package/cjs/commands/aws/ec2/allow-ip/handler.cjs +261 -12
  4. package/cjs/commands/aws/ec2/allow-ip/index.cjs +25 -55
  5. package/cjs/commands/aws/ec2/allow-ip/schema.cjs +33 -13
  6. package/cjs/commands/aws/ec2/allow-ip/utils.cjs +379 -39
  7. package/cjs/commands/aws/iam/admin-group.cjs +111 -15
  8. package/cjs/commands/aws/iam/break-glass/handler.cjs +127 -12
  9. package/cjs/commands/aws/iam/break-glass/index.cjs +7 -19
  10. package/cjs/commands/aws/iam/break-glass/schema.cjs +21 -12
  11. package/cjs/commands/aws/iam/check-admin/handler.cjs +89 -10
  12. package/cjs/commands/aws/iam/check-admin/index.cjs +7 -17
  13. package/cjs/commands/aws/iam/check-admin/schema.cjs +19 -12
  14. package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
  15. package/cjs/commands/aws/iam/policies/sts-federation.json +11 -0
  16. package/cjs/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
  17. package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
  18. package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
  19. package/cjs/commands/aws/iam/policies/user-admins-write-list.json +117 -0
  20. package/cjs/commands/aws/iam/remove-admin/handler.cjs +120 -11
  21. package/cjs/commands/aws/iam/remove-admin/index.cjs +7 -18
  22. package/cjs/commands/aws/iam/remove-admin/schema.cjs +22 -12
  23. package/cjs/commands/aws/iam/setup-acl/handler.cjs +227 -14
  24. package/cjs/commands/aws/iam/setup-acl/index.cjs +13 -33
  25. package/cjs/commands/aws/iam/setup-acl/schema.cjs +19 -7
  26. package/cjs/commands/aws/iam/setup-acl/utils.cjs +305 -20
  27. package/cjs/commands/aws/iam/users/handler.cjs +59 -12
  28. package/cjs/commands/aws/iam/users/index.cjs +18 -41
  29. package/cjs/commands/aws/iam/users/schema.cjs +17 -7
  30. package/cjs/commands/aws/iam/users/utils.cjs +454 -30
  31. package/cjs/commands/aws/index.cjs +223 -229
  32. package/cjs/commands/aws/route53/add-record/handler.cjs +264 -18
  33. package/cjs/commands/aws/route53/add-record/index.cjs +26 -57
  34. package/cjs/commands/aws/route53/add-record/schema.cjs +43 -11
  35. package/cjs/commands/aws/route53/add-record/utils.cjs +404 -37
  36. package/cjs/commands/aws/route53/remove-record/handler.cjs +114 -14
  37. package/cjs/commands/aws/route53/remove-record/index.cjs +5 -18
  38. package/cjs/commands/aws/route53/remove-record/schema.cjs +22 -8
  39. package/cjs/commands/aws/schema.cjs +19 -10
  40. package/cjs/commands/aws/ses/send-email/handler.cjs +73 -12
  41. package/cjs/commands/aws/ses/send-email/index.cjs +9 -23
  42. package/cjs/commands/aws/ses/send-email/schema.cjs +24 -7
  43. package/cjs/commands/aws/ses/send-email/utils.cjs +87 -11
  44. package/cjs/commands/aws/ses/smtp-password.cjs +72 -10
  45. package/cjs/commands/aws/utils/exec-aws.cjs +145 -16
  46. package/cjs/commands/aws/utils/resolve-policy-path.cjs +15 -6
  47. package/cjs/commands/aws/utils/resolve-profile.cjs +93 -11
  48. package/cjs/commands/aws/utils/tty.cjs +54 -10
  49. package/cjs/commands/db/create-readonly-user/handler.cjs +254 -11
  50. package/cjs/commands/db/create-readonly-user/index.cjs +18 -40
  51. package/cjs/commands/db/create-readonly-user/mysql.cjs +102 -9
  52. package/cjs/commands/db/create-readonly-user/postgres.cjs +209 -9
  53. package/cjs/commands/db/create-readonly-user/schema.cjs +39 -12
  54. package/cjs/commands/db/create-readonly-user/utils.cjs +160 -22
  55. package/cjs/commands/db/index.cjs +46 -44
  56. package/cjs/commands/doppler/handler.cjs +95 -11
  57. package/cjs/commands/doppler/index.cjs +33 -68
  58. package/cjs/commands/doppler/schema.cjs +130 -14
  59. package/cjs/commands/doppler/set-secret.cjs +378 -19
  60. package/cjs/commands/doppler/utils/exec.cjs +106 -12
  61. package/cjs/commands/doppler/utils.cjs +412 -34
  62. package/cjs/commands/icons/handler.cjs +82 -8
  63. package/cjs/commands/icons/index.cjs +15 -31
  64. package/cjs/commands/icons/schema.cjs +101 -13
  65. package/cjs/commands/icons/utils.cjs +131 -13
  66. package/cjs/commands/index.cjs +54 -161
  67. package/cjs/commands/schema.cjs +25 -8
  68. package/cjs/index.cjs +3 -4
  69. package/esm/commands/aws/ec2/allow-ip/handler.js +258 -12
  70. package/esm/commands/aws/ec2/allow-ip/index.js +4 -55
  71. package/esm/commands/aws/ec2/allow-ip/schema.js +29 -13
  72. package/esm/commands/aws/ec2/allow-ip/utils.js +363 -39
  73. package/esm/commands/aws/iam/admin-group.js +104 -15
  74. package/esm/commands/aws/iam/break-glass/handler.js +124 -12
  75. package/esm/commands/aws/iam/break-glass/index.js +4 -19
  76. package/esm/commands/aws/iam/break-glass/schema.js +19 -12
  77. package/esm/commands/aws/iam/check-admin/handler.js +86 -10
  78. package/esm/commands/aws/iam/check-admin/index.js +4 -17
  79. package/esm/commands/aws/iam/check-admin/schema.js +17 -12
  80. package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
  81. package/esm/commands/aws/iam/policies/sts-federation.json +11 -0
  82. package/esm/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
  83. package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
  84. package/esm/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
  85. package/esm/commands/aws/iam/policies/user-admins-write-list.json +117 -0
  86. package/esm/commands/aws/iam/remove-admin/handler.js +117 -11
  87. package/esm/commands/aws/iam/remove-admin/index.js +4 -18
  88. package/esm/commands/aws/iam/remove-admin/schema.js +20 -12
  89. package/esm/commands/aws/iam/setup-acl/handler.js +224 -14
  90. package/esm/commands/aws/iam/setup-acl/index.js +4 -33
  91. package/esm/commands/aws/iam/setup-acl/schema.js +18 -7
  92. package/esm/commands/aws/iam/setup-acl/utils.js +298 -20
  93. package/esm/commands/aws/iam/users/handler.js +56 -12
  94. package/esm/commands/aws/iam/users/index.js +4 -41
  95. package/esm/commands/aws/iam/users/schema.js +16 -7
  96. package/esm/commands/aws/iam/users/utils.js +440 -30
  97. package/esm/commands/aws/index.js +142 -229
  98. package/esm/commands/aws/route53/add-record/handler.js +258 -18
  99. package/esm/commands/aws/route53/add-record/index.js +4 -57
  100. package/esm/commands/aws/route53/add-record/schema.js +40 -11
  101. package/esm/commands/aws/route53/add-record/utils.js +389 -37
  102. package/esm/commands/aws/route53/remove-record/handler.js +111 -14
  103. package/esm/commands/aws/route53/remove-record/index.js +3 -18
  104. package/esm/commands/aws/route53/remove-record/schema.js +21 -8
  105. package/esm/commands/aws/schema.js +16 -10
  106. package/esm/commands/aws/ses/send-email/handler.js +70 -12
  107. package/esm/commands/aws/ses/send-email/index.js +4 -23
  108. package/esm/commands/aws/ses/send-email/schema.js +23 -7
  109. package/esm/commands/aws/ses/send-email/utils.js +84 -11
  110. package/esm/commands/aws/ses/smtp-password.js +69 -10
  111. package/esm/commands/aws/utils/exec-aws.js +136 -15
  112. package/esm/commands/aws/utils/resolve-policy-path.js +14 -6
  113. package/esm/commands/aws/utils/resolve-profile.js +88 -11
  114. package/esm/commands/aws/utils/tty.js +51 -10
  115. package/esm/commands/db/create-readonly-user/handler.js +251 -11
  116. package/esm/commands/db/create-readonly-user/index.js +4 -40
  117. package/esm/commands/db/create-readonly-user/mysql.js +98 -9
  118. package/esm/commands/db/create-readonly-user/postgres.js +205 -9
  119. package/esm/commands/db/create-readonly-user/schema.js +35 -12
  120. package/esm/commands/db/create-readonly-user/utils.js +151 -22
  121. package/esm/commands/db/index.js +31 -44
  122. package/esm/commands/doppler/handler.js +92 -11
  123. package/esm/commands/doppler/index.js +6 -68
  124. package/esm/commands/doppler/schema.js +125 -15
  125. package/esm/commands/doppler/set-secret.js +370 -19
  126. package/esm/commands/doppler/utils/exec.js +100 -12
  127. package/esm/commands/doppler/utils.js +396 -34
  128. package/esm/commands/icons/handler.js +79 -8
  129. package/esm/commands/icons/index.js +4 -31
  130. package/esm/commands/icons/schema.js +97 -15
  131. package/esm/commands/icons/utils.js +125 -13
  132. package/esm/commands/index.js +47 -155
  133. package/esm/commands/schema.js +22 -7
  134. package/esm/index.js +3 -4
  135. package/package.json +5 -2
  136. package/vitest.config.ts +11 -0
  137. package/cjs/__chunks/2FSYDFUV.cjs +0 -146
  138. package/cjs/__chunks/3A5ZYU5M.cjs +0 -105
  139. package/cjs/__chunks/3BY5Y4W7.cjs +0 -1
  140. package/cjs/__chunks/3NOHGUCF.cjs +0 -9
  141. package/cjs/__chunks/3T2LXW7J.cjs +0 -387
  142. package/cjs/__chunks/4SFWHCB3.cjs +0 -133
  143. package/cjs/__chunks/4XT5JEAS.cjs +0 -1
  144. package/cjs/__chunks/AZEB4H4I.cjs +0 -208
  145. package/cjs/__chunks/B2KFW7T7.cjs +0 -1
  146. package/cjs/__chunks/B5ENMOCD.cjs +0 -288
  147. package/cjs/__chunks/B6XM5KSF.cjs +0 -338
  148. package/cjs/__chunks/BDU2UCE5.cjs +0 -1
  149. package/cjs/__chunks/BLMSMR5E.cjs +0 -46
  150. package/cjs/__chunks/CMUD7LLN.cjs +0 -47
  151. package/cjs/__chunks/DTQ2LB3I.cjs +0 -49
  152. package/cjs/__chunks/FM5MVRQF.cjs +0 -23
  153. package/cjs/__chunks/FRHST54J.cjs +0 -135
  154. package/cjs/__chunks/FU4VP2LN.cjs +0 -1
  155. package/cjs/__chunks/G5K4PVIL.cjs +0 -26
  156. package/cjs/__chunks/GU3R54MK.cjs +0 -127
  157. package/cjs/__chunks/GUL36IFZ.cjs +0 -61
  158. package/cjs/__chunks/GZMTNK5N.cjs +0 -1
  159. package/cjs/__chunks/H74JSDBU.cjs +0 -30
  160. package/cjs/__chunks/INFOPAHN.cjs +0 -117
  161. package/cjs/__chunks/J36P6UNE.cjs +0 -75
  162. package/cjs/__chunks/JB7T7PKQ.cjs +0 -538
  163. package/cjs/__chunks/JSL2JDMW.cjs +0 -1
  164. package/cjs/__chunks/K4QNHRTP.cjs +0 -163
  165. package/cjs/__chunks/KU76LC42.cjs +0 -192
  166. package/cjs/__chunks/LFDSHANP.cjs +0 -34
  167. package/cjs/__chunks/LHE24ECK.cjs +0 -192
  168. package/cjs/__chunks/LIKQ3SI4.cjs +0 -1
  169. package/cjs/__chunks/LXDF5QVZ.cjs +0 -313
  170. package/cjs/__chunks/LXOOJR2R.cjs +0 -74
  171. package/cjs/__chunks/N5MXFOQZ.cjs +0 -167
  172. package/cjs/__chunks/N7D56LPP.cjs +0 -25
  173. package/cjs/__chunks/NFXQNOQH.cjs +0 -393
  174. package/cjs/__chunks/NIMXXHJQ.cjs +0 -92
  175. package/cjs/__chunks/NLKJIUEX.cjs +0 -126
  176. package/cjs/__chunks/NT2XXAI6.cjs +0 -89
  177. package/cjs/__chunks/NWZGFHKH.cjs +0 -121
  178. package/cjs/__chunks/R3GUC7O7.cjs +0 -110
  179. package/cjs/__chunks/RPVAXPJ4.cjs +0 -1
  180. package/cjs/__chunks/S3LVCWPN.cjs +0 -23
  181. package/cjs/__chunks/SBBNW2BF.cjs +0 -249
  182. package/cjs/__chunks/T2A7TN4F.cjs +0 -81
  183. package/cjs/__chunks/TKNNDDIB.cjs +0 -97
  184. package/cjs/__chunks/TNSRDJPR.cjs +0 -1
  185. package/cjs/__chunks/UWHPE2GI.cjs +0 -20
  186. package/cjs/__chunks/W6K7BV74.cjs +0 -1
  187. package/cjs/__chunks/WBOQ6AUN.cjs +0 -320
  188. package/cjs/__chunks/WHGN5PZI.cjs +0 -299
  189. package/cjs/__chunks/WOYF2L6T.cjs +0 -11
  190. package/cjs/__chunks/X26XY2N6.cjs +0 -18
  191. package/cjs/__chunks/XMKOKRXZ.cjs +0 -16
  192. package/cjs/__chunks/XTJPQ3EX.cjs +0 -1
  193. package/cjs/__chunks/YRHFKTW2.cjs +0 -63
  194. package/cjs/__chunks/ZMDIOZPT.cjs +0 -22
  195. package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.cjs +0 -28
  196. package/cjs/commands/aws/iam/policies/sts-federation.cjs +0 -19
  197. package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +0 -183
  198. package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +0 -49
  199. package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +0 -64
  200. package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +0 -125
  201. package/esm/__chunks/2FTTEFEK.js +0 -97
  202. package/esm/__chunks/33UYMUQD.js +0 -338
  203. package/esm/__chunks/3BKWTHLJ.js +0 -25
  204. package/esm/__chunks/3HE4BEJX.js +0 -105
  205. package/esm/__chunks/3QLI5BDL.js +0 -387
  206. package/esm/__chunks/5GIUAFXL.js +0 -89
  207. package/esm/__chunks/5ZBVGSOK.js +0 -0
  208. package/esm/__chunks/6G4PXXKF.js +0 -75
  209. package/esm/__chunks/73BJG53F.js +0 -11
  210. package/esm/__chunks/7VF4Q43Q.js +0 -0
  211. package/esm/__chunks/AEDEAYF5.js +0 -0
  212. package/esm/__chunks/AZCP3SFJ.js +0 -0
  213. package/esm/__chunks/B2DVQ2UL.js +0 -61
  214. package/esm/__chunks/CVQVHLW5.js +0 -0
  215. package/esm/__chunks/D62SPZXC.js +0 -0
  216. package/esm/__chunks/DLEJ25GZ.js +0 -121
  217. package/esm/__chunks/DMYFNF54.js +0 -192
  218. package/esm/__chunks/DNFTUMGD.js +0 -23
  219. package/esm/__chunks/DVKD6YSR.js +0 -49
  220. package/esm/__chunks/EMSH4P76.js +0 -20
  221. package/esm/__chunks/FFKFVMIE.js +0 -167
  222. package/esm/__chunks/FL7AILGH.js +0 -133
  223. package/esm/__chunks/FNXUONAV.js +0 -110
  224. package/esm/__chunks/G4NJHFFU.js +0 -320
  225. package/esm/__chunks/HJSXC6HP.js +0 -117
  226. package/esm/__chunks/IEOGAQYI.js +0 -46
  227. package/esm/__chunks/IZFGBYGE.js +0 -34
  228. package/esm/__chunks/J34UVKLA.js +0 -26
  229. package/esm/__chunks/JZPBBBIG.js +0 -74
  230. package/esm/__chunks/KWUJP5MG.js +0 -135
  231. package/esm/__chunks/M35URMT4.js +0 -313
  232. package/esm/__chunks/NF3M2L6C.js +0 -81
  233. package/esm/__chunks/O3CCA76Q.js +0 -22
  234. package/esm/__chunks/PNPPDYKC.js +0 -299
  235. package/esm/__chunks/QFXN4EHM.js +0 -393
  236. package/esm/__chunks/QKDDLIWD.js +0 -146
  237. package/esm/__chunks/QSE66AKY.js +0 -208
  238. package/esm/__chunks/QUF7PS4R.js +0 -18
  239. package/esm/__chunks/S7IJPJ4R.js +0 -126
  240. package/esm/__chunks/SD3E3EPH.js +0 -163
  241. package/esm/__chunks/SJXQJ7RS.js +0 -92
  242. package/esm/__chunks/SNCKIAOR.js +0 -0
  243. package/esm/__chunks/T3TTUHTW.js +0 -30
  244. package/esm/__chunks/TIOVE6HR.js +0 -0
  245. package/esm/__chunks/TXKMEIDQ.js +0 -0
  246. package/esm/__chunks/U7HAE2RF.js +0 -288
  247. package/esm/__chunks/UXWY7BYE.js +0 -63
  248. package/esm/__chunks/VKAKISRG.js +0 -192
  249. package/esm/__chunks/WD2YR6I7.js +0 -0
  250. package/esm/__chunks/WOZFZKFY.js +0 -0
  251. package/esm/__chunks/XI7GZDE2.js +0 -0
  252. package/esm/__chunks/XOUWDB3T.js +0 -249
  253. package/esm/__chunks/XQN2TA4S.js +0 -23
  254. package/esm/__chunks/XXK32TIM.js +0 -16
  255. package/esm/__chunks/YGWTVPZE.js +0 -538
  256. package/esm/__chunks/YRG7PT33.js +0 -127
  257. package/esm/__chunks/ZHKVJO2U.js +0 -47
  258. package/esm/__chunks/ZO55YUSY.js +0 -9
  259. package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +0 -28
  260. package/esm/commands/aws/iam/policies/sts-federation.js +0 -19
  261. package/esm/commands/aws/iam/policies/user-admins-deny-list.js +0 -183
  262. package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +0 -49
  263. package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +0 -64
  264. package/esm/commands/aws/iam/policies/user-admins-write-list.js +0 -125
@@ -1,393 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _JB7T7PKQcjs = require('./JB7T7PKQ.cjs');
4
-
5
-
6
-
7
-
8
- var _CMUD7LLNcjs = require('./CMUD7LLN.cjs');
9
-
10
- // src/commands/doppler/set-secret.js
11
- var _child_process = require('child_process');
12
- var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
13
- function listProjects(params = {}) {
14
- const { verbose = false, limit = 500 } = params;
15
- const projects = [];
16
- let page = 1;
17
- while (projects.length < limit) {
18
- const batch = _JB7T7PKQcjs.execDoppler.call(void 0,
19
- ["projects", "--json", "--page", String(page), "--number", "100"],
20
- "json",
21
- true,
22
- verbose
23
- );
24
- if (!Array.isArray(batch) || batch.length === 0) {
25
- break;
26
- }
27
- for (const raw of batch) {
28
- projects.push({
29
- id: String(_nullishCoalesce(_nullishCoalesce(raw.id, () => ( raw.name)), () => ( ""))),
30
- name: String(_nullishCoalesce(_nullishCoalesce(raw.name, () => ( raw.id)), () => ( ""))),
31
- description: raw.description ? String(raw.description) : ""
32
- });
33
- }
34
- if (batch.length < 100) {
35
- break;
36
- }
37
- page += 1;
38
- }
39
- return projects.filter((project) => project.name).sort((a, b) => a.name.localeCompare(b.name));
40
- }
41
- function listEnvironments(params) {
42
- const { project, verbose = false } = params;
43
- const data = _JB7T7PKQcjs.execDoppler.call(void 0,
44
- ["environments", "--json", "--project", project],
45
- "json",
46
- true,
47
- verbose
48
- );
49
- if (!Array.isArray(data)) {
50
- return [];
51
- }
52
- return data.map((raw) => ({
53
- id: String(_nullishCoalesce(raw.id, () => ( ""))),
54
- name: String(_nullishCoalesce(_nullishCoalesce(raw.name, () => ( raw.id)), () => ( "")))
55
- })).filter((env) => env.id).sort((a, b) => a.id.localeCompare(b.id));
56
- }
57
- function listConfigs(params) {
58
- const { project, environment, verbose = false } = params;
59
- const args = ["configs", "--json", "--project", project];
60
- if (environment) {
61
- args.push("--environment", environment);
62
- }
63
- const data = _JB7T7PKQcjs.execDoppler.call(void 0, args, "json", true, verbose);
64
- if (!Array.isArray(data)) {
65
- return [];
66
- }
67
- return data.map((raw) => ({
68
- name: String(_nullishCoalesce(raw.name, () => ( ""))),
69
- environment: String(_nullishCoalesce(raw.environment, () => ( ""))),
70
- root: Boolean(raw.root)
71
- })).filter((config) => config.name).sort((a, b) => a.name.localeCompare(b.name));
72
- }
73
- function getSecret(params) {
74
- const { project, config, name, verbose = false } = params;
75
- try {
76
- const data = _JB7T7PKQcjs.execDoppler.call(void 0,
77
- [
78
- "secrets",
79
- "get",
80
- name,
81
- "--project",
82
- project,
83
- "--config",
84
- config,
85
- "--plain",
86
- "--raw"
87
- ],
88
- "string",
89
- true,
90
- verbose
91
- );
92
- if (typeof data !== "string") {
93
- return null;
94
- }
95
- const value = data.replace(/\n$/, "");
96
- return value.length > 0 ? value : "";
97
- } catch (e) {
98
- return null;
99
- }
100
- }
101
- function setSecret(params) {
102
- const { project, config, name, value, verbose = false } = params;
103
- const args = [
104
- "secrets",
105
- "set",
106
- name,
107
- "--project",
108
- project,
109
- "--config",
110
- config,
111
- "--no-interactive"
112
- ];
113
- if (verbose) {
114
- console.log(
115
- _chalk2.default.gray(
116
- ` Executing: doppler ${args.join(" ")} <stdin value (${value.length} chars)>`
117
- )
118
- );
119
- }
120
- const result = _child_process.spawnSync.call(void 0, "doppler", args, {
121
- encoding: "utf-8",
122
- input: value
123
- });
124
- if (result.error) {
125
- throw new Error(result.error.message);
126
- }
127
- if (result.status !== 0) {
128
- const stderr = (result.stderr || result.stdout || "").trim();
129
- throw new Error(stderr || `doppler secrets set failed for ${name}`);
130
- }
131
- }
132
- async function resolveProject(params) {
133
- const { projects, projectOption } = params;
134
- if (projectOption) {
135
- const match = projects.find(
136
- (project) => project.name === projectOption || project.id === projectOption
137
- );
138
- if (!match) {
139
- throw new Error(
140
- `Project "${projectOption}" not found. Available examples: ${projects.slice(0, 8).map((project) => project.name).join(", ")}`
141
- );
142
- }
143
- return match.name;
144
- }
145
- if (projects.length === 0) {
146
- throw new Error("No Doppler projects found for this account.");
147
- }
148
- let candidates = projects;
149
- if (projects.length > 30) {
150
- const filter = await _CMUD7LLNcjs.prompt.call(void 0,
151
- ` Filter projects (${projects.length} total, Enter for all): `
152
- );
153
- if (filter) {
154
- const lower = filter.toLowerCase();
155
- candidates = projects.filter(
156
- (project) => project.name.toLowerCase().includes(lower) || project.id.toLowerCase().includes(lower)
157
- );
158
- if (candidates.length === 0) {
159
- throw new Error(`No projects matched "${filter}".`);
160
- }
161
- }
162
- }
163
- const maxShown = 50;
164
- const shown = candidates.slice(0, maxShown);
165
- if (candidates.length > maxShown) {
166
- console.log(
167
- _chalk2.default.yellow(
168
- ` Showing first ${maxShown} of ${candidates.length} matches \u2014 refine with a filter next time.`
169
- )
170
- );
171
- }
172
- const index = await _CMUD7LLNcjs.promptChoice.call(void 0, {
173
- message: "Choose a Doppler project:",
174
- options: shown.map(
175
- (project) => project.description ? `${project.name} \u2014 ${project.description}` : project.name
176
- )
177
- });
178
- const chosen = shown[index];
179
- if (!chosen) {
180
- throw new Error("No project selected");
181
- }
182
- return chosen.name;
183
- }
184
- async function resolveEnvironment(params) {
185
- const { environments, environmentOption } = params;
186
- if (environmentOption) {
187
- const normalized = environmentOption.trim().toLowerCase();
188
- if (normalized === "all" || normalized === "*") {
189
- return "all";
190
- }
191
- const match = environments.find(
192
- (env) => env.id.toLowerCase() === normalized || env.name.toLowerCase() === normalized
193
- );
194
- if (!match) {
195
- throw new Error(
196
- `Environment "${environmentOption}" not found. Available: ${environments.map((env) => env.id).join(", ")}`
197
- );
198
- }
199
- return match.id;
200
- }
201
- if (environments.length === 0) {
202
- return "all";
203
- }
204
- const options = [
205
- ...environments.map((env) => `${env.id} (${env.name})`),
206
- "all environments"
207
- ];
208
- const index = await _CMUD7LLNcjs.promptChoice.call(void 0, {
209
- message: "Choose an environment:",
210
- options
211
- });
212
- if (index === options.length - 1) {
213
- return "all";
214
- }
215
- const chosen = environments[index];
216
- if (!chosen) {
217
- throw new Error("No environment selected");
218
- }
219
- return chosen.id;
220
- }
221
- async function resolveConfigs(params) {
222
- const { configs, configOption, environment } = params;
223
- const scoped = environment === "all" ? configs : configs.filter((config) => config.environment === environment);
224
- if (scoped.length === 0) {
225
- throw new Error(
226
- environment === "all" ? "No configs found in this project." : `No configs found for environment "${environment}".`
227
- );
228
- }
229
- if (configOption) {
230
- const normalized = configOption.trim().toLowerCase();
231
- if (normalized === "all" || normalized === "*") {
232
- return scoped.map((config) => config.name);
233
- }
234
- const requested = configOption.split(",").map((value) => value.trim());
235
- const names = new Set(scoped.map((config) => config.name));
236
- const missing = requested.filter((name) => !names.has(name));
237
- if (missing.length > 0) {
238
- throw new Error(
239
- `Config(s) not found: ${missing.join(", ")}. Available: ${[
240
- ...names
241
- ].join(", ")}`
242
- );
243
- }
244
- return requested;
245
- }
246
- if (scoped.length === 1) {
247
- const only = scoped[0];
248
- if (!only) {
249
- throw new Error("No config selected");
250
- }
251
- console.log(` Config: ${only.name}`);
252
- return [only.name];
253
- }
254
- const options = [
255
- ...scoped.map(
256
- (config) => config.root ? `${config.name} (root, env: ${config.environment})` : `${config.name} (env: ${config.environment})`
257
- ),
258
- `all configs listed (${scoped.length})`
259
- ];
260
- const index = await _CMUD7LLNcjs.promptChoice.call(void 0, {
261
- message: "Choose a config:",
262
- options
263
- });
264
- if (index === options.length - 1) {
265
- return scoped.map((config) => config.name);
266
- }
267
- const chosen = scoped[index];
268
- if (!chosen) {
269
- throw new Error("No config selected");
270
- }
271
- return [chosen.name];
272
- }
273
- async function resolveSecretName(nameOption) {
274
- if (nameOption) {
275
- return nameOption;
276
- }
277
- const raw = await _CMUD7LLNcjs.prompt.call(void 0, " Secret name (e.g. DATABASE_URL): ");
278
- if (!raw) {
279
- throw new Error("Secret name is required");
280
- }
281
- if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(raw)) {
282
- throw new Error(
283
- "Secret name must be a valid env var identifier (letters, numbers, underscore)"
284
- );
285
- }
286
- return raw;
287
- }
288
- async function resolveSecretValue(valueOption) {
289
- if (valueOption !== void 0) {
290
- return valueOption;
291
- }
292
- const raw = await _CMUD7LLNcjs.prompt.call(void 0, " Secret value: ");
293
- if (raw === "") {
294
- const confirmEmpty = await _CMUD7LLNcjs.promptYesNo.call(void 0, {
295
- message: " Set an empty value?",
296
- defaultYes: false
297
- });
298
- if (!confirmEmpty) {
299
- throw new Error("Secret value is required");
300
- }
301
- }
302
- return raw;
303
- }
304
- async function setSecretInteractive(options) {
305
- const {
306
- project: projectOption,
307
- environment: environmentOption,
308
- config: configOption,
309
- name: nameOption,
310
- value: valueOption,
311
- yes = false,
312
- verbose = false
313
- } = options;
314
- console.log(_chalk2.default.blue("\nSet Doppler secret"));
315
- console.log("");
316
- const projects = listProjects({ verbose });
317
- const project = await resolveProject({ projects, projectOption });
318
- console.log(`Project: ${project}`);
319
- console.log("");
320
- const environments = listEnvironments({ project, verbose });
321
- const environment = await resolveEnvironment({
322
- environments,
323
- environmentOption
324
- });
325
- console.log(
326
- environment === "all" ? "Environment: all" : `Environment: ${environment}`
327
- );
328
- console.log("");
329
- const configs = listConfigs({
330
- project,
331
- environment: environment === "all" ? void 0 : environment,
332
- verbose
333
- });
334
- const targetConfigs = await resolveConfigs({
335
- configs,
336
- configOption,
337
- environment
338
- });
339
- console.log(`Config(s): ${targetConfigs.join(", ")}`);
340
- console.log("");
341
- const name = await resolveSecretName(nameOption);
342
- const value = await resolveSecretValue(valueOption);
343
- const existingByConfig = [];
344
- for (const config of targetConfigs) {
345
- const existing = getSecret({ project, config, name, verbose });
346
- existingByConfig.push({ config, existing });
347
- }
348
- const overwrites = existingByConfig.filter(
349
- (entry) => entry.existing !== null
350
- );
351
- console.log("");
352
- console.log("Plan:");
353
- console.log(` Project: ${project}`);
354
- console.log(` Configs: ${targetConfigs.join(", ")}`);
355
- console.log(` Name: ${name}`);
356
- console.log(
357
- ` Value: ${value.length === 0 ? "(empty)" : `(${value.length} chars)`}`
358
- );
359
- if (overwrites.length > 0) {
360
- console.log(
361
- _chalk2.default.yellow(
362
- ` Overwrite: ${overwrites.length} config(s) already have this secret (${overwrites.map((entry) => entry.config).join(", ")})`
363
- )
364
- );
365
- } else {
366
- console.log(_chalk2.default.green(" Overwrite: none (new secret on all targets)"));
367
- }
368
- console.log("");
369
- if (!yes) {
370
- const confirmed = await _CMUD7LLNcjs.promptYesNo.call(void 0, {
371
- message: overwrites.length > 0 ? "Overwrite / set this secret?" : "Set this secret?",
372
- defaultYes: false
373
- });
374
- if (!confirmed) {
375
- console.log("Aborted.");
376
- return;
377
- }
378
- console.log("");
379
- }
380
- for (const config of targetConfigs) {
381
- setSecret({ project, config, name, value, verbose });
382
- console.log(_chalk2.default.green(` \u2713 set ${name} on ${project}/${config}`));
383
- }
384
- }
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
- exports.listProjects = listProjects; exports.listEnvironments = listEnvironments; exports.listConfigs = listConfigs; exports.getSecret = getSecret; exports.setSecret = setSecret; exports.setSecretInteractive = setSecretInteractive;
@@ -1,92 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/commands/doppler/utils/exec.js
2
- var _child_process = require('child_process');
3
- var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
4
- function exec(command, options = {}) {
5
- const {
6
- stdoutParser = "string",
7
- throwOnError = true,
8
- verbosity = "default",
9
- stdio: userStdio,
10
- ...execSyncOptions
11
- } = options;
12
- try {
13
- if (verbosity === "verbose") {
14
- console.log(_chalk2.default.gray(` Executing: ${command}`));
15
- }
16
- let stdio;
17
- if (userStdio) {
18
- stdio = userStdio;
19
- } else if (verbosity === "verbose") {
20
- stdio = "inherit";
21
- } else if (verbosity === "silent") {
22
- stdio = "pipe";
23
- } else {
24
- stdio = ["pipe", "pipe", "pipe"];
25
- }
26
- const result = (
27
- /** @type {string} */
28
- _child_process.execSync.call(void 0, command, {
29
- encoding: "utf-8",
30
- stdio,
31
- ...execSyncOptions
32
- })
33
- );
34
- if (stdio === "inherit") {
35
- return stdoutParser === "string" ? "" : void 0;
36
- }
37
- if (!result || typeof result === "string" && !result.trim()) {
38
- return stdoutParser === "string" ? "" : void 0;
39
- }
40
- switch (stdoutParser) {
41
- case "json": {
42
- try {
43
- return JSON.parse(result);
44
- } catch (parseError) {
45
- if (throwOnError) {
46
- throw new Error(
47
- `Failed to parse JSON output: ${parseError.message}`
48
- );
49
- }
50
- return void 0;
51
- }
52
- }
53
- case "number": {
54
- const num = parseFloat(result.trim());
55
- if (isNaN(num)) {
56
- if (throwOnError) {
57
- throw new Error(`Failed to parse number from output: ${result}`);
58
- }
59
- return void 0;
60
- }
61
- return num;
62
- }
63
- case "string":
64
- default:
65
- return result;
66
- }
67
- } catch (error) {
68
- if (!throwOnError) {
69
- return void 0;
70
- }
71
- if (error.stderr) {
72
- throw new Error(error.stderr.toString());
73
- }
74
- throw error;
75
- }
76
- }
77
- function execString(command, options = {}) {
78
- return exec(command, { ...options, stdoutParser: "string" });
79
- }
80
- function execJson(command, options = {}) {
81
- return exec(command, { ...options, stdoutParser: "json" });
82
- }
83
- function execNumber(command, options = {}) {
84
- return exec(command, { ...options, stdoutParser: "number" });
85
- }
86
-
87
-
88
-
89
-
90
-
91
-
92
- exports.exec = exec; exports.execString = execString; exports.execJson = execJson; exports.execNumber = execNumber;
@@ -1,126 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _X26XY2N6cjs = require('./X26XY2N6.cjs');
4
-
5
-
6
-
7
-
8
- var _T2A7TN4Fcjs = require('./T2A7TN4F.cjs');
9
-
10
-
11
- var _R3GUC7O7cjs = require('./R3GUC7O7.cjs');
12
-
13
- // src/commands/aws/iam/check-admin/handler.js
14
- var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
15
- var _zod = require('zod');
16
- async function checkAdminCommand(options) {
17
- try {
18
- const { profile, all, verbose } = _X26XY2N6cjs.checkAdminOptionsSchema.parse(options);
19
- _R3GUC7O7cjs.requireCommands.call(void 0, ["aws"]);
20
- const needsVault = all || !(_nullishCoalesce(profile, () => ( process.env.AWS_PROFILE)));
21
- if (needsVault) {
22
- _R3GUC7O7cjs.requireCommands.call(void 0, ["aws-vault"]);
23
- }
24
- let profiles;
25
- try {
26
- profiles = _T2A7TN4Fcjs.resolveAdminScanProfiles.call(void 0, { profile, all });
27
- } catch (resolveError) {
28
- if (resolveError instanceof Error && resolveError.message === "No aws-vault profiles with credentials found.") {
29
- console.error(_chalk2.default.red(resolveError.message));
30
- process.exit(1);
31
- }
32
- throw resolveError;
33
- }
34
- console.log(
35
- _chalk2.default.blue(
36
- `
37
- ==> Checking ${profiles.length} profile(s) for ${_T2A7TN4Fcjs.ADMIN_GROUP_NAME}
38
- `
39
- )
40
- );
41
- let ok = 0;
42
- let alert = 0;
43
- let skip = 0;
44
- for (const candidate of profiles) {
45
- const scan = _T2A7TN4Fcjs.resolveProfileScan.call(void 0, { profile: candidate, verbose });
46
- if (!scan) {
47
- skip += 1;
48
- continue;
49
- }
50
- if (scan.users.length === 0) {
51
- console.log(
52
- _chalk2.default.green(
53
- `OK ${candidate} (${scan.accountId}) \u2014 ${_T2A7TN4Fcjs.ADMIN_GROUP_NAME}: 0 users`
54
- )
55
- );
56
- ok += 1;
57
- } else {
58
- console.log(
59
- _chalk2.default.red(
60
- `ALERT ${candidate} (${scan.accountId}) \u2014 ${_T2A7TN4Fcjs.ADMIN_GROUP_NAME}: ${scan.users.length} user(s): ${scan.users.join(", ")}`
61
- )
62
- );
63
- alert += 1;
64
- }
65
- }
66
- console.log(_chalk2.default.blue("\n==> Summary"));
67
- console.log(` Profiles scanned: ${profiles.length}`);
68
- console.log(` OK (empty group): ${ok}`);
69
- console.log(` ALERT (has users): ${alert}`);
70
- console.log(` Skipped (silent): ${skip}`);
71
- if (alert > 0) {
72
- console.log(
73
- _chalk2.default.red(
74
- `
75
- Remove users from ${_T2A7TN4Fcjs.ADMIN_GROUP_NAME} when break-glass access is no longer needed.`
76
- )
77
- );
78
- process.exit(1);
79
- }
80
- if (ok === 0) {
81
- console.log(
82
- _chalk2.default.yellow(
83
- `
84
- No profiles returned IAM access for ${_T2A7TN4Fcjs.ADMIN_GROUP_NAME}.`
85
- )
86
- );
87
- console.log(
88
- _chalk2.default.yellow(
89
- " Use a profile with iam:GetGroup (e.g. md-*-iam-admin) or run with --verbose."
90
- )
91
- );
92
- }
93
- } catch (error) {
94
- if (error instanceof _zod.ZodError) {
95
- console.error(_chalk2.default.red("\n\u274C Invalid command options:"));
96
- error.errors.forEach((err) => {
97
- console.error(_chalk2.default.red(` ${err.path.join(".")}: ${err.message}`));
98
- });
99
- process.exit(1);
100
- }
101
- const verbose = (
102
- /** @type {any} */
103
- _optionalChain([options, 'optionalAccess', _ => _.verbose]) || false
104
- );
105
- console.error(_chalk2.default.red("\n\u274C check-admin failed:"));
106
- if (error instanceof Error) {
107
- console.error(_chalk2.default.red(` ${error.message}`));
108
- if (verbose && error.stack) {
109
- console.error(_chalk2.default.gray("\nStack trace:"));
110
- console.error(_chalk2.default.gray(error.stack));
111
- }
112
- } else {
113
- console.error(_chalk2.default.red(` ${String(error)}`));
114
- }
115
- console.error(
116
- _chalk2.default.yellow(
117
- "\n\u{1F4A1} Requires the AWS CLI, and aws-vault when scanning multiple profiles.\n"
118
- )
119
- );
120
- process.exit(1);
121
- }
122
- }
123
-
124
-
125
-
126
- exports.checkAdminCommand = checkAdminCommand;
@@ -1,89 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
- var _CMUD7LLNcjs = require('./CMUD7LLN.cjs');
5
-
6
- // src/commands/aws/utils/resolve-profile.js
7
- var _fs = require('fs');
8
- var _os = require('os');
9
- var _path = require('path');
10
- var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
11
- var MAX_LISTED = 30;
12
- function listConfigProfiles() {
13
- const configPath = _nullishCoalesce(process.env.AWS_CONFIG_FILE, () => ( _path.join.call(void 0, _os.homedir.call(void 0, ), ".aws", "config")));
14
- let contents;
15
- try {
16
- contents = _fs.readFileSync.call(void 0, configPath, "utf-8");
17
- } catch (e) {
18
- return [];
19
- }
20
- const profiles = [];
21
- const profileRe = /^\[profile\s+(.+?)\]$/;
22
- for (const rawLine of contents.split("\n")) {
23
- const line = rawLine.trim();
24
- const match = profileRe.exec(line);
25
- if (_optionalChain([match, 'optionalAccess', _ => _[1]])) {
26
- profiles.push(match[1].trim());
27
- } else if (line === "[default]") {
28
- profiles.push("default");
29
- }
30
- }
31
- return profiles;
32
- }
33
- async function pickProfileInteractive(profiles) {
34
- for (; ; ) {
35
- const filter = (await _CMUD7LLNcjs.prompt.call(void 0, _chalk2.default.cyan("Filter profiles (substring, Enter for all): "))).trim().toLowerCase();
36
- const matches = filter ? profiles.filter((name) => name.toLowerCase().includes(filter)) : profiles;
37
- if (matches.length === 0) {
38
- console.log(_chalk2.default.yellow(` No profiles match "${filter}". Try again.`));
39
- continue;
40
- }
41
- if (matches.length === 1) {
42
- const only = _nullishCoalesce(matches[0], () => ( ""));
43
- console.log(_chalk2.default.green(` \u2192 ${only}`));
44
- return only;
45
- }
46
- if (matches.length > MAX_LISTED) {
47
- console.log(
48
- _chalk2.default.yellow(
49
- ` ${matches.length} profiles match \u2014 narrow the filter (over ${MAX_LISTED} to list).`
50
- )
51
- );
52
- continue;
53
- }
54
- const index = await _CMUD7LLNcjs.promptChoice.call(void 0, {
55
- message: _chalk2.default.cyan("Select a profile:"),
56
- options: matches
57
- });
58
- return _nullishCoalesce(matches[index], () => ( ""));
59
- }
60
- }
61
- async function resolveProfile(params) {
62
- const explicit = _nullishCoalesce(params.profile, () => ( process.env.AWS_PROFILE));
63
- if (explicit) {
64
- return explicit;
65
- }
66
- const interactive = _nullishCoalesce(params.interactive, () => ( Boolean(process.stdin.isTTY)));
67
- if (!interactive) {
68
- return void 0;
69
- }
70
- const profiles = listConfigProfiles();
71
- if (profiles.length === 0) {
72
- return void 0;
73
- }
74
- console.log(
75
- _chalk2.default.yellow(
76
- "\nNo AWS profile selected (--profile and AWS_PROFILE are unset)."
77
- )
78
- );
79
- const chosen = await pickProfileInteractive(profiles);
80
- console.log(_chalk2.default.gray(`Using profile "${chosen}" for this command.
81
- `));
82
- return chosen;
83
- }
84
-
85
-
86
-
87
-
88
-
89
- exports.listConfigProfiles = listConfigProfiles; exports.pickProfileInteractive = pickProfileInteractive; exports.resolveProfile = resolveProfile;