@mtndev/cli 1.1.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 +91 -0
- package/cjs/__chunks/VH7oDXx4.cjs +28 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.cjs +261 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/cjs/commands/aws/ec2/allow-ip/index.cjs +25 -0
- package/cjs/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.cjs +33 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.cjs +379 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/cjs/commands/aws/iam/admin-group.cjs +111 -0
- package/cjs/commands/aws/iam/admin-group.d.ts +55 -0
- package/cjs/commands/aws/iam/break-glass/handler.cjs +127 -0
- package/cjs/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/cjs/commands/aws/iam/break-glass/index.cjs +7 -0
- package/cjs/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/cjs/commands/aws/iam/break-glass/schema.cjs +21 -0
- package/cjs/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/cjs/commands/aws/iam/check-admin/handler.cjs +89 -0
- package/cjs/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/check-admin/index.cjs +7 -0
- package/cjs/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/check-admin/schema.cjs +19 -0
- package/cjs/commands/aws/iam/check-admin/schema.d.ts +19 -0
- 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 -0
- package/cjs/commands/aws/iam/remove-admin/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/remove-admin/index.cjs +7 -0
- package/cjs/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/remove-admin/schema.cjs +22 -0
- package/cjs/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/cjs/commands/aws/iam/setup-acl/handler.cjs +227 -0
- package/cjs/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/setup-acl/index.cjs +13 -0
- package/cjs/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/cjs/commands/aws/iam/setup-acl/schema.cjs +19 -0
- package/cjs/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/cjs/commands/aws/iam/setup-acl/utils.cjs +305 -0
- package/cjs/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/cjs/commands/aws/iam/users/handler.cjs +59 -0
- package/cjs/commands/aws/iam/users/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/users/index.cjs +18 -0
- package/cjs/commands/aws/iam/users/index.d.ts +3 -0
- package/cjs/commands/aws/iam/users/schema.cjs +17 -0
- package/cjs/commands/aws/iam/users/schema.d.ts +18 -0
- package/cjs/commands/aws/iam/users/utils.cjs +454 -0
- package/cjs/commands/aws/iam/users/utils.d.ts +119 -0
- package/cjs/commands/aws/index.cjs +223 -0
- package/cjs/commands/aws/index.d.ts +14 -0
- package/cjs/commands/aws/route53/add-record/handler.cjs +264 -0
- package/cjs/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/cjs/commands/aws/route53/add-record/index.cjs +26 -0
- package/cjs/commands/aws/route53/add-record/index.d.ts +3 -0
- package/cjs/commands/aws/route53/add-record/schema.cjs +43 -0
- package/cjs/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/cjs/commands/aws/route53/add-record/utils.cjs +404 -0
- package/cjs/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/cjs/commands/aws/route53/remove-record/handler.cjs +114 -0
- package/cjs/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/cjs/commands/aws/route53/remove-record/index.cjs +5 -0
- package/cjs/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/cjs/commands/aws/route53/remove-record/schema.cjs +22 -0
- package/cjs/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/cjs/commands/aws/schema.cjs +19 -0
- package/cjs/commands/aws/schema.d.ts +13 -0
- package/cjs/commands/aws/ses/send-email/handler.cjs +73 -0
- package/cjs/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/cjs/commands/aws/ses/send-email/index.cjs +9 -0
- package/cjs/commands/aws/ses/send-email/index.d.ts +3 -0
- package/cjs/commands/aws/ses/send-email/schema.cjs +24 -0
- package/cjs/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/cjs/commands/aws/ses/send-email/utils.cjs +87 -0
- package/cjs/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/cjs/commands/aws/ses/smtp-password.cjs +72 -0
- package/cjs/commands/aws/ses/smtp-password.d.ts +21 -0
- package/cjs/commands/aws/utils/exec-aws.cjs +145 -0
- package/cjs/commands/aws/utils/exec-aws.d.ts +79 -0
- package/cjs/commands/aws/utils/resolve-policy-path.cjs +15 -0
- package/cjs/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/cjs/commands/aws/utils/resolve-profile.cjs +93 -0
- package/cjs/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/cjs/commands/aws/utils/tty.cjs +54 -0
- package/cjs/commands/aws/utils/tty.d.ts +24 -0
- package/cjs/commands/db/create-readonly-user/handler.cjs +254 -0
- package/cjs/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/cjs/commands/db/create-readonly-user/index.cjs +18 -0
- package/cjs/commands/db/create-readonly-user/index.d.ts +3 -0
- package/cjs/commands/db/create-readonly-user/mysql.cjs +102 -0
- package/cjs/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/cjs/commands/db/create-readonly-user/postgres.cjs +209 -0
- package/cjs/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/cjs/commands/db/create-readonly-user/schema.cjs +39 -0
- package/cjs/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/cjs/commands/db/create-readonly-user/utils.cjs +160 -0
- package/cjs/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/cjs/commands/db/index.cjs +46 -0
- package/cjs/commands/db/index.d.ts +6 -0
- package/cjs/commands/doppler/handler.cjs +95 -9
- package/cjs/commands/doppler/index.cjs +33 -41
- package/cjs/commands/doppler/index.d.ts +1 -0
- package/cjs/commands/doppler/schema.cjs +130 -6
- package/cjs/commands/doppler/schema.d.ts +233 -17
- package/cjs/commands/doppler/set-secret.cjs +378 -0
- package/cjs/commands/doppler/set-secret.d.ts +113 -0
- package/cjs/commands/doppler/utils/exec.cjs +106 -12
- package/cjs/commands/doppler/utils.cjs +412 -30
- package/cjs/commands/doppler/utils.d.ts +32 -8
- 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/schema.d.ts +1 -1
- package/cjs/commands/icons/utils.cjs +131 -13
- package/cjs/commands/index.cjs +54 -82
- package/cjs/commands/schema.cjs +25 -8
- package/cjs/index.cjs +3 -4
- package/esm/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/esm/commands/aws/ec2/allow-ip/handler.js +258 -0
- package/esm/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/esm/commands/aws/ec2/allow-ip/index.js +4 -0
- package/esm/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/esm/commands/aws/ec2/allow-ip/schema.js +29 -0
- package/esm/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/esm/commands/aws/ec2/allow-ip/utils.js +363 -0
- package/esm/commands/aws/iam/admin-group.d.ts +55 -0
- package/esm/commands/aws/iam/admin-group.js +104 -0
- package/esm/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/esm/commands/aws/iam/break-glass/handler.js +124 -0
- package/esm/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/esm/commands/aws/iam/break-glass/index.js +4 -0
- package/esm/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/esm/commands/aws/iam/break-glass/schema.js +19 -0
- package/esm/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/esm/commands/aws/iam/check-admin/handler.js +86 -0
- package/esm/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/check-admin/index.js +4 -0
- package/esm/commands/aws/iam/check-admin/schema.d.ts +19 -0
- package/esm/commands/aws/iam/check-admin/schema.js +17 -0
- 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.d.ts +6 -0
- package/esm/commands/aws/iam/remove-admin/handler.js +117 -0
- package/esm/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/remove-admin/index.js +4 -0
- package/esm/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/esm/commands/aws/iam/remove-admin/schema.js +20 -0
- package/esm/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/esm/commands/aws/iam/setup-acl/handler.js +224 -0
- package/esm/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/esm/commands/aws/iam/setup-acl/index.js +4 -0
- package/esm/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/esm/commands/aws/iam/setup-acl/schema.js +18 -0
- package/esm/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/esm/commands/aws/iam/setup-acl/utils.js +298 -0
- package/esm/commands/aws/iam/users/handler.d.ts +5 -0
- package/esm/commands/aws/iam/users/handler.js +56 -0
- package/esm/commands/aws/iam/users/index.d.ts +3 -0
- package/esm/commands/aws/iam/users/index.js +4 -0
- package/esm/commands/aws/iam/users/schema.d.ts +18 -0
- package/esm/commands/aws/iam/users/schema.js +16 -0
- package/esm/commands/aws/iam/users/utils.d.ts +119 -0
- package/esm/commands/aws/iam/users/utils.js +440 -0
- package/esm/commands/aws/index.d.ts +14 -0
- package/esm/commands/aws/index.js +142 -0
- package/esm/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/esm/commands/aws/route53/add-record/handler.js +258 -0
- package/esm/commands/aws/route53/add-record/index.d.ts +3 -0
- package/esm/commands/aws/route53/add-record/index.js +4 -0
- package/esm/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/esm/commands/aws/route53/add-record/schema.js +40 -0
- package/esm/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/esm/commands/aws/route53/add-record/utils.js +389 -0
- package/esm/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/esm/commands/aws/route53/remove-record/handler.js +111 -0
- package/esm/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/esm/commands/aws/route53/remove-record/index.js +3 -0
- package/esm/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/esm/commands/aws/route53/remove-record/schema.js +21 -0
- package/esm/commands/aws/schema.d.ts +13 -0
- package/esm/commands/aws/schema.js +16 -0
- package/esm/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/esm/commands/aws/ses/send-email/handler.js +70 -0
- package/esm/commands/aws/ses/send-email/index.d.ts +3 -0
- package/esm/commands/aws/ses/send-email/index.js +4 -0
- package/esm/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/esm/commands/aws/ses/send-email/schema.js +23 -0
- package/esm/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/esm/commands/aws/ses/send-email/utils.js +84 -0
- package/esm/commands/aws/ses/smtp-password.d.ts +21 -0
- package/esm/commands/aws/ses/smtp-password.js +69 -0
- package/esm/commands/aws/utils/exec-aws.d.ts +79 -0
- package/esm/commands/aws/utils/exec-aws.js +137 -0
- package/esm/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/esm/commands/aws/utils/resolve-policy-path.js +14 -0
- package/esm/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/esm/commands/aws/utils/resolve-profile.js +88 -0
- package/esm/commands/aws/utils/tty.d.ts +24 -0
- package/esm/commands/aws/utils/tty.js +51 -0
- package/esm/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/esm/commands/db/create-readonly-user/handler.js +251 -0
- package/esm/commands/db/create-readonly-user/index.d.ts +3 -0
- package/esm/commands/db/create-readonly-user/index.js +4 -0
- package/esm/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/esm/commands/db/create-readonly-user/mysql.js +98 -0
- package/esm/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/esm/commands/db/create-readonly-user/postgres.js +205 -0
- package/esm/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/esm/commands/db/create-readonly-user/schema.js +35 -0
- package/esm/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/esm/commands/db/create-readonly-user/utils.js +151 -0
- package/esm/commands/db/index.d.ts +6 -0
- package/esm/commands/db/index.js +31 -0
- package/esm/commands/doppler/handler.js +92 -9
- package/esm/commands/doppler/index.d.ts +1 -0
- package/esm/commands/doppler/index.js +6 -41
- package/esm/commands/doppler/schema.d.ts +233 -17
- package/esm/commands/doppler/schema.js +125 -7
- package/esm/commands/doppler/set-secret.d.ts +113 -0
- package/esm/commands/doppler/set-secret.js +370 -0
- package/esm/commands/doppler/utils/exec.js +100 -12
- package/esm/commands/doppler/utils.d.ts +32 -8
- package/esm/commands/doppler/utils.js +396 -30
- package/esm/commands/icons/handler.js +79 -8
- package/esm/commands/icons/index.js +4 -31
- package/esm/commands/icons/schema.d.ts +1 -1
- package/esm/commands/icons/schema.js +97 -15
- package/esm/commands/icons/utils.js +125 -13
- package/esm/commands/index.js +49 -78
- package/esm/commands/schema.js +22 -7
- package/esm/index.js +3 -4
- package/package.json +12 -2
- package/vitest.config.ts +11 -0
- package/cjs/__chunks/4GFJUCSP.cjs +0 -52
- package/cjs/__chunks/4SFWHCB3.cjs +0 -133
- package/cjs/__chunks/B2KFW7T7.cjs +0 -1
- package/cjs/__chunks/EMMC33QA.cjs +0 -401
- package/cjs/__chunks/INFOPAHN.cjs +0 -117
- package/cjs/__chunks/J36P6UNE.cjs +0 -75
- package/cjs/__chunks/NIMXXHJQ.cjs +0 -92
- package/cjs/__chunks/NSRFG4DF.cjs +0 -100
- package/cjs/__chunks/WNJ3ZYLI.cjs +0 -1
- package/cjs/__chunks/ZMDIOZPT.cjs +0 -22
- package/esm/__chunks/46HGXFME.js +0 -0
- package/esm/__chunks/6G4PXXKF.js +0 -75
- package/esm/__chunks/6L5RNR7G.js +0 -100
- package/esm/__chunks/FL7AILGH.js +0 -133
- package/esm/__chunks/HJSXC6HP.js +0 -117
- package/esm/__chunks/O262GK4B.js +0 -401
- package/esm/__chunks/O3CCA76Q.js +0 -22
- package/esm/__chunks/SJXQJ7RS.js +0 -92
- package/esm/__chunks/SNCKIAOR.js +0 -0
- package/esm/__chunks/X3R5PSWH.js +0 -52
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
//#region src/commands/db/create-readonly-user/schema.js
|
|
4
|
+
/**
|
|
5
|
+
* Supported database engines.
|
|
6
|
+
* @type {readonly ["postgres", "mysql"]}
|
|
7
|
+
*/
|
|
8
|
+
const ENGINES = ["postgres", "mysql"];
|
|
9
|
+
/**
|
|
10
|
+
* Zod schema for `db create-readonly-user` options.
|
|
11
|
+
*/
|
|
12
|
+
const createReadonlyUserOptionsSchema = zod.z.object({
|
|
13
|
+
engine: zod.z.enum(["postgres", "mysql"]).optional().describe("Database engine (postgres or mysql); inferred from --url when omitted"),
|
|
14
|
+
url: zod.z.string().optional().describe("Admin connection URL (postgres://… or mysql://…). Defaults to DATABASE_URL / MYSQL_URL / POSTGRES_URL."),
|
|
15
|
+
database: zod.z.string().optional().describe("Target database name, or \"all\" for every non-system database"),
|
|
16
|
+
username: zod.z.string().optional().describe("Read-only username to create (default: readonly)"),
|
|
17
|
+
password: zod.z.string().optional().describe("Password for the new user (generated when omitted)"),
|
|
18
|
+
hostPattern: zod.z.string().optional().describe("MySQL user host pattern (default: %)"),
|
|
19
|
+
ssl: zod.z.boolean().optional().describe("Force SSL on/off. Default: off for localhost, on (loose) for remote hosts."),
|
|
20
|
+
yes: zod.z.boolean().optional().default(false).describe("Skip the confirmation prompt"),
|
|
21
|
+
dryRun: zod.z.boolean().optional().default(false).describe("Print the SQL plan without applying it"),
|
|
22
|
+
verbose: zod.z.boolean().optional().default(false).describe("Enable verbose logging")
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {z.infer<typeof createReadonlyUserOptionsSchema>} CreateReadonlyUserOptions
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Default username when none is provided.
|
|
29
|
+
*/
|
|
30
|
+
const DEFAULT_READONLY_USERNAME = "readonly";
|
|
31
|
+
/**
|
|
32
|
+
* Default MySQL host pattern (any client host).
|
|
33
|
+
*/
|
|
34
|
+
const DEFAULT_MYSQL_HOST_PATTERN = "%";
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.DEFAULT_MYSQL_HOST_PATTERN = DEFAULT_MYSQL_HOST_PATTERN;
|
|
37
|
+
exports.DEFAULT_READONLY_USERNAME = DEFAULT_READONLY_USERNAME;
|
|
38
|
+
exports.ENGINES = ENGINES;
|
|
39
|
+
exports.createReadonlyUserOptionsSchema = createReadonlyUserOptionsSchema;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported database engines.
|
|
3
|
+
* @type {readonly ["postgres", "mysql"]}
|
|
4
|
+
*/
|
|
5
|
+
export const ENGINES: readonly ["postgres", "mysql"];
|
|
6
|
+
/**
|
|
7
|
+
* Zod schema for `db create-readonly-user` options.
|
|
8
|
+
*/
|
|
9
|
+
export const createReadonlyUserOptionsSchema: z.ZodObject<{
|
|
10
|
+
engine: z.ZodOptional<z.ZodEnum<["postgres", "mysql"]>>;
|
|
11
|
+
url: z.ZodOptional<z.ZodString>;
|
|
12
|
+
database: z.ZodOptional<z.ZodString>;
|
|
13
|
+
username: z.ZodOptional<z.ZodString>;
|
|
14
|
+
password: z.ZodOptional<z.ZodString>;
|
|
15
|
+
hostPattern: z.ZodOptional<z.ZodString>;
|
|
16
|
+
ssl: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
yes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
|
+
dryRun: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
19
|
+
verbose: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
verbose: boolean;
|
|
22
|
+
yes: boolean;
|
|
23
|
+
dryRun: boolean;
|
|
24
|
+
username?: string | undefined;
|
|
25
|
+
url?: string | undefined;
|
|
26
|
+
engine?: "postgres" | "mysql" | undefined;
|
|
27
|
+
password?: string | undefined;
|
|
28
|
+
database?: string | undefined;
|
|
29
|
+
ssl?: boolean | undefined;
|
|
30
|
+
hostPattern?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
verbose?: boolean | undefined;
|
|
33
|
+
yes?: boolean | undefined;
|
|
34
|
+
dryRun?: boolean | undefined;
|
|
35
|
+
username?: string | undefined;
|
|
36
|
+
url?: string | undefined;
|
|
37
|
+
engine?: "postgres" | "mysql" | undefined;
|
|
38
|
+
password?: string | undefined;
|
|
39
|
+
database?: string | undefined;
|
|
40
|
+
ssl?: boolean | undefined;
|
|
41
|
+
hostPattern?: string | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {z.infer<typeof createReadonlyUserOptionsSchema>} CreateReadonlyUserOptions
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Default username when none is provided.
|
|
48
|
+
*/
|
|
49
|
+
export const DEFAULT_READONLY_USERNAME: "readonly";
|
|
50
|
+
/**
|
|
51
|
+
* Default MySQL host pattern (any client host).
|
|
52
|
+
*/
|
|
53
|
+
export const DEFAULT_MYSQL_HOST_PATTERN: "%";
|
|
54
|
+
export type CreateReadonlyUserOptions = z.infer<typeof createReadonlyUserOptionsSchema>;
|
|
55
|
+
import { z } from "zod";
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let crypto = require("crypto");
|
|
3
|
+
//#region src/commands/db/create-readonly-user/utils.js
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {"postgres" | "mysql"} Engine
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} ConnectionConfig
|
|
9
|
+
* @property {Engine} engine
|
|
10
|
+
* @property {string} host
|
|
11
|
+
* @property {number} port
|
|
12
|
+
* @property {string} user
|
|
13
|
+
* @property {string} password
|
|
14
|
+
* @property {string} database
|
|
15
|
+
* @property {boolean | object} ssl
|
|
16
|
+
* @property {string} [url]
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Generate a URL-safe random password.
|
|
20
|
+
* @param {{ length?: number }} [params]
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
function generatePassword(params = {}) {
|
|
24
|
+
const { length = 24 } = params;
|
|
25
|
+
const alphabet = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%^&*";
|
|
26
|
+
const bytes = (0, crypto.randomBytes)(length);
|
|
27
|
+
let result = "";
|
|
28
|
+
for (let i = 0; i < length; i += 1) {
|
|
29
|
+
const byte = bytes[i] ?? 0;
|
|
30
|
+
result += alphabet[byte % 65];
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Detect engine from a connection URL scheme.
|
|
36
|
+
* @param {string} url
|
|
37
|
+
* @returns {Engine | null}
|
|
38
|
+
*/
|
|
39
|
+
function detectEngineFromUrl(url) {
|
|
40
|
+
const trimmed = url.trim().toLowerCase();
|
|
41
|
+
if (trimmed.startsWith("postgres://") || trimmed.startsWith("postgresql://")) return "postgres";
|
|
42
|
+
if (trimmed.startsWith("mysql://") || trimmed.startsWith("mysql2://")) return "mysql";
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve an admin URL from flags / common env vars.
|
|
47
|
+
* @param {{ url?: string; engine?: Engine }} params
|
|
48
|
+
* @returns {string | null}
|
|
49
|
+
*/
|
|
50
|
+
function resolveAdminUrl(params) {
|
|
51
|
+
const { url, engine } = params;
|
|
52
|
+
if (url) return url;
|
|
53
|
+
if (engine === "mysql") return process.env.MYSQL_URL ?? process.env.DATABASE_URL ?? process.env.MYSQL_DATABASE_URL ?? null;
|
|
54
|
+
if (engine === "postgres") return process.env.DATABASE_URL ?? process.env.POSTGRES_URL ?? process.env.POSTGRESQL_URL ?? null;
|
|
55
|
+
return process.env.DATABASE_URL ?? process.env.POSTGRES_URL ?? process.env.POSTGRESQL_URL ?? process.env.MYSQL_URL ?? process.env.MYSQL_DATABASE_URL ?? null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Decide SSL settings: remote hosts get loose SSL by default (RDS-friendly).
|
|
59
|
+
* @param {{ host: string; sslOption?: boolean }} params
|
|
60
|
+
* @returns {boolean | object}
|
|
61
|
+
*/
|
|
62
|
+
function resolveSsl(params) {
|
|
63
|
+
const { host, sslOption } = params;
|
|
64
|
+
if (sslOption === true) return { rejectUnauthorized: false };
|
|
65
|
+
if (sslOption === false) return false;
|
|
66
|
+
if (host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "0.0.0.0") return false;
|
|
67
|
+
return { rejectUnauthorized: false };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Parse a postgres/mysql connection URL into a config object.
|
|
71
|
+
* @param {{ url: string; engine?: Engine; sslOption?: boolean }} params
|
|
72
|
+
* @returns {ConnectionConfig}
|
|
73
|
+
*/
|
|
74
|
+
function parseConnectionUrl(params) {
|
|
75
|
+
const { url, engine: engineOption, sslOption } = params;
|
|
76
|
+
const engine = engineOption ?? detectEngineFromUrl(url);
|
|
77
|
+
if (!engine) throw new Error(`Could not detect engine from URL. Pass --engine postgres|mysql. URL starts with: ${url.slice(0, 24)}…`);
|
|
78
|
+
let parsed;
|
|
79
|
+
try {
|
|
80
|
+
parsed = new URL(url);
|
|
81
|
+
} catch {
|
|
82
|
+
throw new Error(`Invalid connection URL: ${url}`);
|
|
83
|
+
}
|
|
84
|
+
const defaultPort = engine === "postgres" ? 5432 : 3306;
|
|
85
|
+
const port = parsed.port ? Number.parseInt(parsed.port, 10) : defaultPort;
|
|
86
|
+
const database = decodeURIComponent(parsed.pathname.replace(/^\//, "")) || (engine === "postgres" ? "postgres" : "");
|
|
87
|
+
const host = parsed.hostname || "localhost";
|
|
88
|
+
const user = decodeURIComponent(parsed.username || "");
|
|
89
|
+
const password = decodeURIComponent(parsed.password || "");
|
|
90
|
+
if (!user) throw new Error("Connection URL is missing a username");
|
|
91
|
+
return {
|
|
92
|
+
engine,
|
|
93
|
+
host,
|
|
94
|
+
port: Number.isFinite(port) ? port : defaultPort,
|
|
95
|
+
user,
|
|
96
|
+
password,
|
|
97
|
+
database,
|
|
98
|
+
ssl: resolveSsl({
|
|
99
|
+
host,
|
|
100
|
+
sslOption
|
|
101
|
+
}),
|
|
102
|
+
url
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Build a client connection URL for the new read-only user.
|
|
107
|
+
* @param {{
|
|
108
|
+
* engine: Engine;
|
|
109
|
+
* host: string;
|
|
110
|
+
* port: number;
|
|
111
|
+
* username: string;
|
|
112
|
+
* password: string;
|
|
113
|
+
* database: string;
|
|
114
|
+
* }} params
|
|
115
|
+
* @returns {string}
|
|
116
|
+
*/
|
|
117
|
+
function buildReadonlyUrl(params) {
|
|
118
|
+
const { engine, host, port, username, password, database } = params;
|
|
119
|
+
return `${engine === "postgres" ? "postgresql" : "mysql"}://${`${encodeURIComponent(username)}:${encodeURIComponent(password)}`}@${host}:${port}${database ? `/${encodeURIComponent(database)}` : "/"}`;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Quote an identifier for the given engine (not for string literals).
|
|
123
|
+
* @param {{ engine: Engine; name: string }} params
|
|
124
|
+
* @returns {string}
|
|
125
|
+
*/
|
|
126
|
+
function quoteIdent(params) {
|
|
127
|
+
const { engine, name } = params;
|
|
128
|
+
if (engine === "postgres") return `"${name.replace(/"/g, "\"\"")}"`;
|
|
129
|
+
return `\`${name.replace(/`/g, "``")}\``;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Escape a string literal for SQL (single-quote doubling).
|
|
133
|
+
* Prefer parameterized queries when the driver supports them for DDL.
|
|
134
|
+
* @param {string} value
|
|
135
|
+
* @returns {string}
|
|
136
|
+
*/
|
|
137
|
+
function quoteLiteral(value) {
|
|
138
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* System / template databases to skip when granting "all".
|
|
142
|
+
* @param {{ engine: Engine; name: string }} params
|
|
143
|
+
* @returns {boolean}
|
|
144
|
+
*/
|
|
145
|
+
function isSystemDatabase(params) {
|
|
146
|
+
const { engine, name } = params;
|
|
147
|
+
const lower = name.toLowerCase();
|
|
148
|
+
if (engine === "postgres") return lower === "template0" || lower === "template1" || lower === "rdsadmin" || lower === "cloudsqladmin";
|
|
149
|
+
return lower === "information_schema" || lower === "performance_schema" || lower === "mysql" || lower === "sys" || lower === "innodb" || lower === "#mysql50#lost+found";
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
exports.buildReadonlyUrl = buildReadonlyUrl;
|
|
153
|
+
exports.detectEngineFromUrl = detectEngineFromUrl;
|
|
154
|
+
exports.generatePassword = generatePassword;
|
|
155
|
+
exports.isSystemDatabase = isSystemDatabase;
|
|
156
|
+
exports.parseConnectionUrl = parseConnectionUrl;
|
|
157
|
+
exports.quoteIdent = quoteIdent;
|
|
158
|
+
exports.quoteLiteral = quoteLiteral;
|
|
159
|
+
exports.resolveAdminUrl = resolveAdminUrl;
|
|
160
|
+
exports.resolveSsl = resolveSsl;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {"postgres" | "mysql"} Engine
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} ConnectionConfig
|
|
6
|
+
* @property {Engine} engine
|
|
7
|
+
* @property {string} host
|
|
8
|
+
* @property {number} port
|
|
9
|
+
* @property {string} user
|
|
10
|
+
* @property {string} password
|
|
11
|
+
* @property {string} database
|
|
12
|
+
* @property {boolean | object} ssl
|
|
13
|
+
* @property {string} [url]
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Generate a URL-safe random password.
|
|
17
|
+
* @param {{ length?: number }} [params]
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
20
|
+
export function generatePassword(params?: {
|
|
21
|
+
length?: number;
|
|
22
|
+
}): string;
|
|
23
|
+
/**
|
|
24
|
+
* Detect engine from a connection URL scheme.
|
|
25
|
+
* @param {string} url
|
|
26
|
+
* @returns {Engine | null}
|
|
27
|
+
*/
|
|
28
|
+
export function detectEngineFromUrl(url: string): Engine | null;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve an admin URL from flags / common env vars.
|
|
31
|
+
* @param {{ url?: string; engine?: Engine }} params
|
|
32
|
+
* @returns {string | null}
|
|
33
|
+
*/
|
|
34
|
+
export function resolveAdminUrl(params: {
|
|
35
|
+
url?: string;
|
|
36
|
+
engine?: Engine;
|
|
37
|
+
}): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Decide SSL settings: remote hosts get loose SSL by default (RDS-friendly).
|
|
40
|
+
* @param {{ host: string; sslOption?: boolean }} params
|
|
41
|
+
* @returns {boolean | object}
|
|
42
|
+
*/
|
|
43
|
+
export function resolveSsl(params: {
|
|
44
|
+
host: string;
|
|
45
|
+
sslOption?: boolean;
|
|
46
|
+
}): boolean | object;
|
|
47
|
+
/**
|
|
48
|
+
* Parse a postgres/mysql connection URL into a config object.
|
|
49
|
+
* @param {{ url: string; engine?: Engine; sslOption?: boolean }} params
|
|
50
|
+
* @returns {ConnectionConfig}
|
|
51
|
+
*/
|
|
52
|
+
export function parseConnectionUrl(params: {
|
|
53
|
+
url: string;
|
|
54
|
+
engine?: Engine;
|
|
55
|
+
sslOption?: boolean;
|
|
56
|
+
}): ConnectionConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Build a client connection URL for the new read-only user.
|
|
59
|
+
* @param {{
|
|
60
|
+
* engine: Engine;
|
|
61
|
+
* host: string;
|
|
62
|
+
* port: number;
|
|
63
|
+
* username: string;
|
|
64
|
+
* password: string;
|
|
65
|
+
* database: string;
|
|
66
|
+
* }} params
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
export function buildReadonlyUrl(params: {
|
|
70
|
+
engine: Engine;
|
|
71
|
+
host: string;
|
|
72
|
+
port: number;
|
|
73
|
+
username: string;
|
|
74
|
+
password: string;
|
|
75
|
+
database: string;
|
|
76
|
+
}): string;
|
|
77
|
+
/**
|
|
78
|
+
* Quote an identifier for the given engine (not for string literals).
|
|
79
|
+
* @param {{ engine: Engine; name: string }} params
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
export function quoteIdent(params: {
|
|
83
|
+
engine: Engine;
|
|
84
|
+
name: string;
|
|
85
|
+
}): string;
|
|
86
|
+
/**
|
|
87
|
+
* Escape a string literal for SQL (single-quote doubling).
|
|
88
|
+
* Prefer parameterized queries when the driver supports them for DDL.
|
|
89
|
+
* @param {string} value
|
|
90
|
+
* @returns {string}
|
|
91
|
+
*/
|
|
92
|
+
export function quoteLiteral(value: string): string;
|
|
93
|
+
/**
|
|
94
|
+
* System / template databases to skip when granting "all".
|
|
95
|
+
* @param {{ engine: Engine; name: string }} params
|
|
96
|
+
* @returns {boolean}
|
|
97
|
+
*/
|
|
98
|
+
export function isSystemDatabase(params: {
|
|
99
|
+
engine: Engine;
|
|
100
|
+
name: string;
|
|
101
|
+
}): boolean;
|
|
102
|
+
export type Engine = "postgres" | "mysql";
|
|
103
|
+
export type ConnectionConfig = {
|
|
104
|
+
engine: Engine;
|
|
105
|
+
host: string;
|
|
106
|
+
port: number;
|
|
107
|
+
user: string;
|
|
108
|
+
password: string;
|
|
109
|
+
database: string;
|
|
110
|
+
ssl: boolean | object;
|
|
111
|
+
url?: string | undefined;
|
|
112
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_db_create_readonly_user_utils = require("./create-readonly-user/utils.cjs");
|
|
3
|
+
const require_commands_db_create_readonly_user_schema = require("./create-readonly-user/schema.cjs");
|
|
4
|
+
const require_commands_db_create_readonly_user_handler = require("./create-readonly-user/handler.cjs");
|
|
5
|
+
require("./create-readonly-user/index.cjs");
|
|
6
|
+
//#region src/commands/db/index.js
|
|
7
|
+
/**
|
|
8
|
+
* Register the `db` command group and its subcommands on the root program.
|
|
9
|
+
* @param {import('commander').Command} program
|
|
10
|
+
*/
|
|
11
|
+
function registerDbCommands(program) {
|
|
12
|
+
program.command("db").summary("Database operational commands").description("Database operational helpers (MySQL and Postgres)").command("create-readonly-user").summary("Create a read-only database user").description("Create (or update) a read-only database user on MySQL or Postgres. Interactively pick a single database or all databases, then print a connection URL.").option("-e, --engine <engine>", "Database engine: postgres or mysql (inferred from --url when omitted)").option("-u, --url <url>", "Admin connection URL (defaults to DATABASE_URL / MYSQL_URL / POSTGRES_URL)").option("-d, --database <name>", "Target database name, or \"all\" for every non-system database").option("--username <name>", "Read-only username to create (default: readonly)").option("--password <password>", "Password for the new user (generated when omitted)").option("--host-pattern <pattern>", "MySQL user host pattern (default: %)").option("--ssl", "Force SSL on (loose verify — useful for RDS)").option("--no-ssl", "Force SSL off").option("-y, --yes", "Skip the confirmation prompt").option("--dry-run", "Print the SQL plan without applying it").option("-v, --verbose", "Enable verbose logging").action(async (options) => {
|
|
13
|
+
/** @type {boolean | undefined} */
|
|
14
|
+
let ssl;
|
|
15
|
+
if (options.ssl === true) ssl = true;
|
|
16
|
+
else if (options.noSsl === true) ssl = false;
|
|
17
|
+
await require_commands_db_create_readonly_user_handler.createReadonlyUserCommand({
|
|
18
|
+
engine: options.engine,
|
|
19
|
+
url: options.url,
|
|
20
|
+
database: options.database,
|
|
21
|
+
username: options.username,
|
|
22
|
+
password: options.password,
|
|
23
|
+
hostPattern: options.hostPattern,
|
|
24
|
+
ssl,
|
|
25
|
+
yes: options.yes ?? false,
|
|
26
|
+
dryRun: options.dryRun ?? false,
|
|
27
|
+
verbose: options.verbose ?? false
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.DEFAULT_MYSQL_HOST_PATTERN = require_commands_db_create_readonly_user_schema.DEFAULT_MYSQL_HOST_PATTERN;
|
|
33
|
+
exports.DEFAULT_READONLY_USERNAME = require_commands_db_create_readonly_user_schema.DEFAULT_READONLY_USERNAME;
|
|
34
|
+
exports.ENGINES = require_commands_db_create_readonly_user_schema.ENGINES;
|
|
35
|
+
exports.buildReadonlyUrl = require_commands_db_create_readonly_user_utils.buildReadonlyUrl;
|
|
36
|
+
exports.createReadonlyUserCommand = require_commands_db_create_readonly_user_handler.createReadonlyUserCommand;
|
|
37
|
+
exports.createReadonlyUserOptionsSchema = require_commands_db_create_readonly_user_schema.createReadonlyUserOptionsSchema;
|
|
38
|
+
exports.detectEngineFromUrl = require_commands_db_create_readonly_user_utils.detectEngineFromUrl;
|
|
39
|
+
exports.generatePassword = require_commands_db_create_readonly_user_utils.generatePassword;
|
|
40
|
+
exports.isSystemDatabase = require_commands_db_create_readonly_user_utils.isSystemDatabase;
|
|
41
|
+
exports.parseConnectionUrl = require_commands_db_create_readonly_user_utils.parseConnectionUrl;
|
|
42
|
+
exports.quoteIdent = require_commands_db_create_readonly_user_utils.quoteIdent;
|
|
43
|
+
exports.quoteLiteral = require_commands_db_create_readonly_user_utils.quoteLiteral;
|
|
44
|
+
exports.registerDbCommands = registerDbCommands;
|
|
45
|
+
exports.resolveAdminUrl = require_commands_db_create_readonly_user_utils.resolveAdminUrl;
|
|
46
|
+
exports.resolveSsl = require_commands_db_create_readonly_user_utils.resolveSsl;
|
|
@@ -1,9 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require(
|
|
5
|
-
require(
|
|
6
|
-
require(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("../../__chunks/VH7oDXx4.cjs");
|
|
3
|
+
const require_commands_doppler_schema = require("./schema.cjs");
|
|
4
|
+
const require_commands_doppler_utils = require("./utils.cjs");
|
|
5
|
+
const require_commands_doppler_set_secret = require("./set-secret.cjs");
|
|
6
|
+
let chalk = require("chalk");
|
|
7
|
+
chalk = require_rolldown_runtime.__toESM(chalk, 1);
|
|
8
|
+
let zod = require("zod");
|
|
9
|
+
//#region src/commands/doppler/handler.js
|
|
10
|
+
/**
|
|
11
|
+
* Main doppler command handler
|
|
12
|
+
* @param {unknown} options - Command options (will be validated)
|
|
13
|
+
*/
|
|
14
|
+
async function dopplerCommand(options) {
|
|
15
|
+
try {
|
|
16
|
+
const rawOptions = options ?? {};
|
|
17
|
+
if (rawOptions.help || !rawOptions.action) {
|
|
18
|
+
console.log(chalk.default.bold(`\nUsage: @mtndev/cli doppler [options] <action>`));
|
|
19
|
+
console.log(require_commands_doppler_schema.dopplerCommandMetadata.description);
|
|
20
|
+
console.log(chalk.default.bold("\nOptions:"));
|
|
21
|
+
Object.entries(require_commands_doppler_schema.dopplerCommandMetadata.options).forEach(([key, optionMeta]) => {
|
|
22
|
+
const meta = optionMeta;
|
|
23
|
+
const alias = meta?.alias ? chalk.default.cyan(`, -${meta.alias}`) : "";
|
|
24
|
+
const defaultValue = meta?.default ?? false;
|
|
25
|
+
console.log(chalk.default.cyan(` --${key}`) + alias + ` ${meta.description} (default: ${defaultValue})`);
|
|
26
|
+
});
|
|
27
|
+
console.log("");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const validatedOptions = require_commands_doppler_schema.dopplerCommandOptionsSchema.parse(options);
|
|
31
|
+
const { action, verbose } = validatedOptions;
|
|
32
|
+
if (action === "set") require_commands_doppler_utils.checkDopplerAuth(verbose);
|
|
33
|
+
else require_commands_doppler_utils.checkDependencies(verbose);
|
|
34
|
+
if (action === "download") {
|
|
35
|
+
const { environments } = validatedOptions;
|
|
36
|
+
await require_commands_doppler_utils.downloadConfigs({
|
|
37
|
+
environments,
|
|
38
|
+
verbose
|
|
39
|
+
});
|
|
40
|
+
} else if (action === "upload") {
|
|
41
|
+
const { environments } = validatedOptions;
|
|
42
|
+
await require_commands_doppler_utils.uploadConfigs({
|
|
43
|
+
environments,
|
|
44
|
+
verbose
|
|
45
|
+
});
|
|
46
|
+
} else if (action === "clone") {
|
|
47
|
+
const { from, to, force, environments } = validatedOptions;
|
|
48
|
+
await require_commands_doppler_utils.cloneProject({
|
|
49
|
+
from,
|
|
50
|
+
to,
|
|
51
|
+
environments,
|
|
52
|
+
force,
|
|
53
|
+
verbose
|
|
54
|
+
});
|
|
55
|
+
} else if (action === "set") {
|
|
56
|
+
const { project, environment, config, name, value, yes } = validatedOptions;
|
|
57
|
+
await require_commands_doppler_set_secret.setSecretInteractive({
|
|
58
|
+
project,
|
|
59
|
+
environment,
|
|
60
|
+
config,
|
|
61
|
+
name,
|
|
62
|
+
value,
|
|
63
|
+
yes,
|
|
64
|
+
verbose
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
console.log(chalk.default.green(`\n✅ Doppler ${action} completed successfully!`));
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (error instanceof zod.ZodError) {
|
|
70
|
+
console.error(chalk.default.red(`\n❌ Invalid command options:`));
|
|
71
|
+
error.errors.forEach((err) => {
|
|
72
|
+
console.error(chalk.default.red(` ${err.path.join(".")}: ${err.message}`));
|
|
73
|
+
});
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
const action = options?.action || "operation";
|
|
77
|
+
const verbose = options?.verbose || false;
|
|
78
|
+
console.error(chalk.default.red(`\n❌ Doppler ${action} failed:`));
|
|
79
|
+
if (error instanceof Error) {
|
|
80
|
+
console.error(chalk.default.red(` ${error.message}`));
|
|
81
|
+
if (verbose && error.stack) {
|
|
82
|
+
console.error(chalk.default.gray("\nStack trace:"));
|
|
83
|
+
console.error(chalk.default.gray(error.stack));
|
|
84
|
+
}
|
|
85
|
+
} else console.error(chalk.default.red(` ${String(error)}`));
|
|
86
|
+
console.error(chalk.default.yellow("\n💡 Troubleshooting tips:"));
|
|
87
|
+
console.error(chalk.default.yellow(" • Ensure Doppler CLI is installed (brew install dopplerhq/cli/doppler)"));
|
|
88
|
+
console.error(chalk.default.yellow(" • Make sure you're logged in (doppler login)"));
|
|
89
|
+
console.error(chalk.default.yellow(" • Verify project is configured (doppler setup)"));
|
|
90
|
+
console.error(chalk.default.yellow(" • Use --verbose for detailed error information\n"));
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
exports.dopplerCommand = dopplerCommand;
|
|
@@ -1,41 +1,33 @@
|
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
exports.checkDependencies = _EMMC33QAcjs.checkDependencies; exports.createDiff = _EMMC33QAcjs.createDiff; exports.dopplerCommand = _NSRFG4DFcjs.dopplerCommand; exports.dopplerCommandMetadata = _4GFJUCSPcjs.dopplerCommandMetadata; exports.dopplerCommandOptionsSchema = _4GFJUCSPcjs.dopplerCommandOptionsSchema; exports.downloadConfigs = _EMMC33QAcjs.downloadConfigs; exports.exec = _NIMXXHJQcjs.exec; exports.execDoppler = _EMMC33QAcjs.execDoppler; exports.execJson = _NIMXXHJQcjs.execJson; exports.execNumber = _NIMXXHJQcjs.execNumber; exports.execString = _NIMXXHJQcjs.execString; exports.getConfigs = _EMMC33QAcjs.getConfigs; exports.normalizeEscapeSequences = _EMMC33QAcjs.normalizeEscapeSequences; exports.promptConfirmation = _EMMC33QAcjs.promptConfirmation; exports.uploadConfigs = _EMMC33QAcjs.uploadConfigs;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_doppler_utils_exec = require("./utils/exec.cjs");
|
|
3
|
+
const require_commands_doppler_schema = require("./schema.cjs");
|
|
4
|
+
const require_commands_doppler_utils = require("./utils.cjs");
|
|
5
|
+
const require_commands_doppler_set_secret = require("./set-secret.cjs");
|
|
6
|
+
const require_commands_doppler_handler = require("./handler.cjs");
|
|
7
|
+
exports.checkDependencies = require_commands_doppler_utils.checkDependencies;
|
|
8
|
+
exports.checkDopplerAuth = require_commands_doppler_utils.checkDopplerAuth;
|
|
9
|
+
exports.cloneProject = require_commands_doppler_utils.cloneProject;
|
|
10
|
+
exports.createDiff = require_commands_doppler_utils.createDiff;
|
|
11
|
+
exports.dopplerCloneSchema = require_commands_doppler_schema.dopplerCloneSchema;
|
|
12
|
+
exports.dopplerCommand = require_commands_doppler_handler.dopplerCommand;
|
|
13
|
+
exports.dopplerCommandMetadata = require_commands_doppler_schema.dopplerCommandMetadata;
|
|
14
|
+
exports.dopplerCommandOptionsSchema = require_commands_doppler_schema.dopplerCommandOptionsSchema;
|
|
15
|
+
exports.dopplerDownloadSchema = require_commands_doppler_schema.dopplerDownloadSchema;
|
|
16
|
+
exports.dopplerSetSchema = require_commands_doppler_schema.dopplerSetSchema;
|
|
17
|
+
exports.dopplerUploadSchema = require_commands_doppler_schema.dopplerUploadSchema;
|
|
18
|
+
exports.downloadConfigs = require_commands_doppler_utils.downloadConfigs;
|
|
19
|
+
exports.exec = require_commands_doppler_utils_exec.exec;
|
|
20
|
+
exports.execDoppler = require_commands_doppler_utils.execDoppler;
|
|
21
|
+
exports.execJson = require_commands_doppler_utils_exec.execJson;
|
|
22
|
+
exports.execNumber = require_commands_doppler_utils_exec.execNumber;
|
|
23
|
+
exports.execString = require_commands_doppler_utils_exec.execString;
|
|
24
|
+
exports.getConfigs = require_commands_doppler_utils.getConfigs;
|
|
25
|
+
exports.getSecret = require_commands_doppler_set_secret.getSecret;
|
|
26
|
+
exports.listConfigs = require_commands_doppler_set_secret.listConfigs;
|
|
27
|
+
exports.listEnvironments = require_commands_doppler_set_secret.listEnvironments;
|
|
28
|
+
exports.listProjects = require_commands_doppler_set_secret.listProjects;
|
|
29
|
+
exports.normalizeEscapeSequences = require_commands_doppler_utils.normalizeEscapeSequences;
|
|
30
|
+
exports.promptConfirmation = require_commands_doppler_utils.promptConfirmation;
|
|
31
|
+
exports.setSecret = require_commands_doppler_set_secret.setSecret;
|
|
32
|
+
exports.setSecretInteractive = require_commands_doppler_set_secret.setSecretInteractive;
|
|
33
|
+
exports.uploadConfigs = require_commands_doppler_utils.uploadConfigs;
|