@getpara/cli 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -0
- package/dist/api/client.d.ts +49 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +247 -0
- package/dist/api/errors.d.ts +9 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +29 -0
- package/dist/api/types.d.ts +155 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +58 -0
- package/dist/auth/polling-flow.d.ts +7 -0
- package/dist/auth/polling-flow.d.ts.map +1 -0
- package/dist/auth/polling-flow.js +94 -0
- package/dist/auth/session-manager.d.ts +7 -0
- package/dist/auth/session-manager.d.ts.map +1 -0
- package/dist/auth/session-manager.js +42 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +151 -0
- package/dist/commands/auth/index.d.ts +3 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/auth/index.js +18 -0
- package/dist/commands/auth/login.d.ts +3 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +70 -0
- package/dist/commands/auth/logout.d.ts +3 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +45 -0
- package/dist/commands/auth/status.d.ts +3 -0
- package/dist/commands/auth/status.d.ts.map +1 -0
- package/dist/commands/auth/status.js +54 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +122 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +587 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +67 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +45 -0
- package/dist/commands/keys/archive.d.ts +3 -0
- package/dist/commands/keys/archive.d.ts.map +1 -0
- package/dist/commands/keys/archive.js +49 -0
- package/dist/commands/keys/config/branding.d.ts +23 -0
- package/dist/commands/keys/config/branding.d.ts.map +1 -0
- package/dist/commands/keys/config/branding.js +246 -0
- package/dist/commands/keys/config/categories.d.ts +15 -0
- package/dist/commands/keys/config/categories.d.ts.map +1 -0
- package/dist/commands/keys/config/categories.js +67 -0
- package/dist/commands/keys/config/index.d.ts +3 -0
- package/dist/commands/keys/config/index.d.ts.map +1 -0
- package/dist/commands/keys/config/index.js +56 -0
- package/dist/commands/keys/config/ramps.d.ts +18 -0
- package/dist/commands/keys/config/ramps.d.ts.map +1 -0
- package/dist/commands/keys/config/ramps.js +185 -0
- package/dist/commands/keys/config/security.d.ts +15 -0
- package/dist/commands/keys/config/security.d.ts.map +1 -0
- package/dist/commands/keys/config/security.js +212 -0
- package/dist/commands/keys/config/setup.d.ts +16 -0
- package/dist/commands/keys/config/setup.d.ts.map +1 -0
- package/dist/commands/keys/config/setup.js +235 -0
- package/dist/commands/keys/config/webhooks.d.ts +18 -0
- package/dist/commands/keys/config/webhooks.d.ts.map +1 -0
- package/dist/commands/keys/config/webhooks.js +279 -0
- package/dist/commands/keys/create.d.ts +3 -0
- package/dist/commands/keys/create.d.ts.map +1 -0
- package/dist/commands/keys/create.js +64 -0
- package/dist/commands/keys/get.d.ts +3 -0
- package/dist/commands/keys/get.d.ts.map +1 -0
- package/dist/commands/keys/get.js +91 -0
- package/dist/commands/keys/index.d.ts +3 -0
- package/dist/commands/keys/index.d.ts.map +1 -0
- package/dist/commands/keys/index.js +22 -0
- package/dist/commands/keys/list.d.ts +3 -0
- package/dist/commands/keys/list.d.ts.map +1 -0
- package/dist/commands/keys/list.js +66 -0
- package/dist/commands/keys/rotate.d.ts +3 -0
- package/dist/commands/keys/rotate.d.ts.map +1 -0
- package/dist/commands/keys/rotate.js +59 -0
- package/dist/commands/orgs/index.d.ts +3 -0
- package/dist/commands/orgs/index.d.ts.map +1 -0
- package/dist/commands/orgs/index.js +15 -0
- package/dist/commands/orgs/list.d.ts +3 -0
- package/dist/commands/orgs/list.d.ts.map +1 -0
- package/dist/commands/orgs/list.js +53 -0
- package/dist/commands/orgs/switch.d.ts +3 -0
- package/dist/commands/orgs/switch.d.ts.map +1 -0
- package/dist/commands/orgs/switch.js +61 -0
- package/dist/commands/projects/archive.d.ts +3 -0
- package/dist/commands/projects/archive.d.ts.map +1 -0
- package/dist/commands/projects/archive.js +51 -0
- package/dist/commands/projects/create.d.ts +3 -0
- package/dist/commands/projects/create.d.ts.map +1 -0
- package/dist/commands/projects/create.js +48 -0
- package/dist/commands/projects/index.d.ts +3 -0
- package/dist/commands/projects/index.d.ts.map +1 -0
- package/dist/commands/projects/index.js +25 -0
- package/dist/commands/projects/list.d.ts +3 -0
- package/dist/commands/projects/list.d.ts.map +1 -0
- package/dist/commands/projects/list.js +52 -0
- package/dist/commands/projects/restore.d.ts +3 -0
- package/dist/commands/projects/restore.d.ts.map +1 -0
- package/dist/commands/projects/restore.js +36 -0
- package/dist/commands/projects/switch.d.ts +3 -0
- package/dist/commands/projects/switch.d.ts.map +1 -0
- package/dist/commands/projects/switch.js +57 -0
- package/dist/commands/projects/update.d.ts +3 -0
- package/dist/commands/projects/update.d.ts.map +1 -0
- package/dist/commands/projects/update.js +67 -0
- package/dist/commands/whoami.d.ts +3 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +61 -0
- package/dist/config/config-manager.d.ts +3 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +32 -0
- package/dist/config/config-store.d.ts +10 -0
- package/dist/config/config-store.d.ts.map +1 -0
- package/dist/config/config-store.js +37 -0
- package/dist/config/credential-store.d.ts +12 -0
- package/dist/config/credential-store.d.ts.map +1 -0
- package/dist/config/credential-store.js +94 -0
- package/dist/config/paths.d.ts +5 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +29 -0
- package/dist/config/project-config.d.ts +8 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +41 -0
- package/dist/core/constants.d.ts +27 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +60 -0
- package/dist/core/error-handler.d.ts +24 -0
- package/dist/core/error-handler.d.ts.map +1 -0
- package/dist/core/error-handler.js +83 -0
- package/dist/core/types.d.ts +21 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +0 -0
- package/dist/core/update-check.d.ts +6 -0
- package/dist/core/update-check.d.ts.map +1 -0
- package/dist/core/update-check.js +78 -0
- package/dist/diagnostics/checks/chain-dependencies.d.ts +2 -0
- package/dist/diagnostics/checks/chain-dependencies.d.ts.map +1 -0
- package/dist/diagnostics/checks/chain-dependencies.js +130 -0
- package/dist/diagnostics/checks/css-import.d.ts +2 -0
- package/dist/diagnostics/checks/css-import.d.ts.map +1 -0
- package/dist/diagnostics/checks/css-import.js +57 -0
- package/dist/diagnostics/checks/deprecated-packages.d.ts +2 -0
- package/dist/diagnostics/checks/deprecated-packages.d.ts.map +1 -0
- package/dist/diagnostics/checks/deprecated-packages.js +93 -0
- package/dist/diagnostics/checks/env-api-key.d.ts +2 -0
- package/dist/diagnostics/checks/env-api-key.d.ts.map +1 -0
- package/dist/diagnostics/checks/env-api-key.js +75 -0
- package/dist/diagnostics/checks/env-var-prefix.d.ts +2 -0
- package/dist/diagnostics/checks/env-var-prefix.d.ts.map +1 -0
- package/dist/diagnostics/checks/env-var-prefix.js +52 -0
- package/dist/diagnostics/checks/index.d.ts +13 -0
- package/dist/diagnostics/checks/index.d.ts.map +1 -0
- package/dist/diagnostics/checks/index.js +32 -0
- package/dist/diagnostics/checks/para-provider.d.ts +2 -0
- package/dist/diagnostics/checks/para-provider.d.ts.map +1 -0
- package/dist/diagnostics/checks/para-provider.js +42 -0
- package/dist/diagnostics/checks/query-client.d.ts +2 -0
- package/dist/diagnostics/checks/query-client.d.ts.map +1 -0
- package/dist/diagnostics/checks/query-client.js +58 -0
- package/dist/diagnostics/checks/use-client-directive.d.ts +2 -0
- package/dist/diagnostics/checks/use-client-directive.d.ts.map +1 -0
- package/dist/diagnostics/checks/use-client-directive.js +81 -0
- package/dist/diagnostics/checks/version-consistency.d.ts +2 -0
- package/dist/diagnostics/checks/version-consistency.d.ts.map +1 -0
- package/dist/diagnostics/checks/version-consistency.js +93 -0
- package/dist/diagnostics/context.d.ts +3 -0
- package/dist/diagnostics/context.d.ts.map +1 -0
- package/dist/diagnostics/context.js +56 -0
- package/dist/diagnostics/detectors/framework.d.ts +5 -0
- package/dist/diagnostics/detectors/framework.d.ts.map +1 -0
- package/dist/diagnostics/detectors/framework.js +73 -0
- package/dist/diagnostics/detectors/package-manager.d.ts +3 -0
- package/dist/diagnostics/detectors/package-manager.d.ts.map +1 -0
- package/dist/diagnostics/detectors/package-manager.js +17 -0
- package/dist/diagnostics/detectors/sdk.d.ts +7 -0
- package/dist/diagnostics/detectors/sdk.d.ts.map +1 -0
- package/dist/diagnostics/detectors/sdk.js +48 -0
- package/dist/diagnostics/runner.d.ts +3 -0
- package/dist/diagnostics/runner.d.ts.map +1 -0
- package/dist/diagnostics/runner.js +44 -0
- package/dist/diagnostics/types.d.ts +70 -0
- package/dist/diagnostics/types.d.ts.map +1 -0
- package/dist/diagnostics/types.js +14 -0
- package/dist/diagnostics/utils/code-search.d.ts +10 -0
- package/dist/diagnostics/utils/code-search.d.ts.map +1 -0
- package/dist/diagnostics/utils/code-search.js +98 -0
- package/dist/diagnostics/utils/file-system.d.ts +7 -0
- package/dist/diagnostics/utils/file-system.d.ts.map +1 -0
- package/dist/diagnostics/utils/file-system.js +72 -0
- package/dist/diagnostics/utils/package-json.d.ts +12 -0
- package/dist/diagnostics/utils/package-json.d.ts.map +1 -0
- package/dist/diagnostics/utils/package-json.js +51 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/output/formatter.d.ts +25 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +76 -0
- package/dist/output/mask.d.ts +2 -0
- package/dist/output/mask.d.ts.map +1 -0
- package/dist/output/mask.js +15 -0
- package/dist/output/prompts.d.ts +25 -0
- package/dist/output/prompts.d.ts.map +1 -0
- package/dist/output/prompts.js +86 -0
- package/dist/output/spinner.d.ts +6 -0
- package/dist/output/spinner.d.ts.map +1 -0
- package/dist/output/spinner.js +7 -0
- package/dist/output/table.d.ts +9 -0
- package/dist/output/table.d.ts.map +1 -0
- package/dist/output/table.js +21 -0
- package/dist/scaffolding/scaffolder.d.ts +3 -0
- package/dist/scaffolding/scaffolder.d.ts.map +1 -0
- package/dist/scaffolding/scaffolder.js +78 -0
- package/dist/scaffolding/strategies/expo-template.d.ts +16 -0
- package/dist/scaffolding/strategies/expo-template.d.ts.map +1 -0
- package/dist/scaffolding/strategies/expo-template.js +160 -0
- package/dist/scaffolding/strategies/index.d.ts +5 -0
- package/dist/scaffolding/strategies/index.d.ts.map +1 -0
- package/dist/scaffolding/strategies/index.js +25 -0
- package/dist/scaffolding/strategies/nextjs-template.d.ts +12 -0
- package/dist/scaffolding/strategies/nextjs-template.d.ts.map +1 -0
- package/dist/scaffolding/strategies/nextjs-template.js +122 -0
- package/dist/scaffolding/template-renderer.d.ts +11 -0
- package/dist/scaffolding/template-renderer.d.ts.map +1 -0
- package/dist/scaffolding/template-renderer.js +99 -0
- package/dist/scaffolding/types.d.ts +69 -0
- package/dist/scaffolding/types.d.ts.map +1 -0
- package/dist/scaffolding/types.js +21 -0
- package/dist/scaffolding/utils/detect-package-manager.d.ts +23 -0
- package/dist/scaffolding/utils/detect-package-manager.d.ts.map +1 -0
- package/dist/scaffolding/utils/detect-package-manager.js +57 -0
- package/dist/scaffolding/utils/fs.d.ts +11 -0
- package/dist/scaffolding/utils/fs.d.ts.map +1 -0
- package/dist/scaffolding/utils/fs.js +45 -0
- package/dist/scaffolding/utils/resolve-para-version.d.ts +7 -0
- package/dist/scaffolding/utils/resolve-para-version.d.ts.map +1 -0
- package/dist/scaffolding/utils/resolve-para-version.js +21 -0
- package/dist/validation/auth-methods.d.ts +14 -0
- package/dist/validation/auth-methods.d.ts.map +1 -0
- package/dist/validation/auth-methods.js +23 -0
- package/dist/validation/cidr.d.ts +11 -0
- package/dist/validation/cidr.d.ts.map +1 -0
- package/dist/validation/cidr.js +35 -0
- package/dist/validation/hex-color.d.ts +7 -0
- package/dist/validation/hex-color.d.ts.map +1 -0
- package/dist/validation/hex-color.js +10 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +49 -0
- package/dist/validation/native-passkey.d.ts +31 -0
- package/dist/validation/native-passkey.d.ts.map +1 -0
- package/dist/validation/native-passkey.js +45 -0
- package/dist/validation/session-length.d.ts +18 -0
- package/dist/validation/session-length.d.ts.map +1 -0
- package/dist/validation/session-length.js +30 -0
- package/dist/validation/url.d.ts +26 -0
- package/dist/validation/url.d.ts.map +1 -0
- package/dist/validation/url.js +50 -0
- package/dist/validation/wallet-types.d.ts +14 -0
- package/dist/validation/wallet-types.d.ts.map +1 -0
- package/dist/validation/wallet-types.js +22 -0
- package/dist/validation/webhook.d.ts +4 -0
- package/dist/validation/webhook.d.ts.map +1 -0
- package/dist/validation/webhook.js +33 -0
- package/package.json +60 -0
- package/templates/expo/_env.example +3 -0
- package/templates/expo/_gitignore +48 -0
- package/templates/expo/_yarnrc.yml +1 -0
- package/templates/expo/app/(auth)/_layout.tsx +12 -0
- package/templates/expo/app/(auth)/index.tsx.template +86 -0
- package/templates/expo/app/(tabs)/_layout.tsx +16 -0
- package/templates/expo/app/(tabs)/index.tsx +112 -0
- package/templates/expo/app/(tabs)/send.tsx +111 -0
- package/templates/expo/app/_layout.tsx +17 -0
- package/templates/expo/app/index.tsx +22 -0
- package/templates/expo/app.json.template +32 -0
- package/templates/expo/assets/adaptive-icon.png +0 -0
- package/templates/expo/assets/favicon.png +0 -0
- package/templates/expo/assets/icon.png +0 -0
- package/templates/expo/assets/splash.png +0 -0
- package/templates/expo/babel.config.cjs +12 -0
- package/templates/expo/components/features/AuthForm.tsx.template +138 -0
- package/templates/expo/components/features/OAuthButtons.tsx.template +27 -0
- package/templates/expo/components/features/index.ts.template +4 -0
- package/templates/expo/components/ui/Button.tsx +58 -0
- package/templates/expo/components/ui/Card.tsx +11 -0
- package/templates/expo/components/ui/Divider.tsx +19 -0
- package/templates/expo/components/ui/Input.tsx +23 -0
- package/templates/expo/components/ui/WalletCard.tsx +44 -0
- package/templates/expo/components/ui/index.ts +5 -0
- package/templates/expo/eslint.config.cjs +15 -0
- package/templates/expo/global.css +3 -0
- package/templates/expo/hooks/useOneClickLogin.ts.template +161 -0
- package/templates/expo/hooks/useViemClient.ts +118 -0
- package/templates/expo/hooks/useWallets.ts +52 -0
- package/templates/expo/index.js +2 -0
- package/templates/expo/lib/auth.ts +54 -0
- package/templates/expo/lib/constants.ts.template +2 -0
- package/templates/expo/lib/para.ts +14 -0
- package/templates/expo/metro.config.cjs +14 -0
- package/templates/expo/nativewind-env.d.ts +2 -0
- package/templates/expo/prettier.config.cjs +10 -0
- package/templates/expo/providers/ParaProvider.tsx +140 -0
- package/templates/expo/tailwind.config.cjs +23 -0
- package/templates/expo/tsconfig.json +11 -0
- package/templates/expo/types/index.ts +28 -0
- package/templates/nextjs/README.md +69 -0
- package/templates/nextjs/_env.example +8 -0
- package/templates/nextjs/_gitignore +36 -0
- package/templates/nextjs/_yarnrc.yml +1 -0
- package/templates/nextjs/eslint.config.mjs +10 -0
- package/templates/nextjs/next.config.ts +5 -0
- package/templates/nextjs/postcss.config.mjs +7 -0
- package/templates/nextjs/public/para.svg +3 -0
- package/templates/nextjs/src/app/layout.tsx +30 -0
- package/templates/nextjs/src/app/page.tsx +40 -0
- package/templates/nextjs/src/components/ParaProvider.tsx +116 -0
- package/templates/nextjs/src/components/layout/Header.tsx +44 -0
- package/templates/nextjs/src/components/ui/ConnectCard.tsx +24 -0
- package/templates/nextjs/src/components/ui/SignMessage.tsx +53 -0
- package/templates/nextjs/src/components/ui/WalletInfo.tsx +22 -0
- package/templates/nextjs/src/hooks/useSignHelloWorld.ts +23 -0
- package/templates/nextjs/src/styles/globals.css +1 -0
- package/templates/nextjs/tsconfig.json +27 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../cli.js";
|
|
2
|
+
import { writeProjectConfig } from "../config/project-config.js";
|
|
3
|
+
import { select } from "../output/prompts.js";
|
|
4
|
+
import { resolveConfig } from "../config/config-manager.js";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { getProjectConfigPath } from "../config/paths.js";
|
|
7
|
+
function registerInitCommand(program) {
|
|
8
|
+
program.command("init").description("Create a .pararc configuration file in the current project").option("--force", "Overwrite existing .pararc").addHelpText(
|
|
9
|
+
"after",
|
|
10
|
+
helpText(`Examples:
|
|
11
|
+
$ para init Saves your org, project, and environment to .pararc
|
|
12
|
+
$ para init --force Overwrite an existing .pararc
|
|
13
|
+
|
|
14
|
+
The .pararc file pins org, project, and environment to this directory,
|
|
15
|
+
overriding global "para config" defaults. Useful when you work across
|
|
16
|
+
multiple projects so each repo automatically uses the right context.`)
|
|
17
|
+
).action(async (cmdOpts, cmd) => {
|
|
18
|
+
const opts = await getGlobalOptions(cmd);
|
|
19
|
+
const formatter = createFormatter(opts);
|
|
20
|
+
const cwd = process.cwd();
|
|
21
|
+
const configPath = getProjectConfigPath(cwd);
|
|
22
|
+
if (existsSync(configPath) && !cmdOpts.force) {
|
|
23
|
+
formatter.warn(".pararc already exists. Use --force to overwrite.");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const config = await resolveConfig(opts, cwd);
|
|
27
|
+
const environment = opts.noInput ? opts.environment : await select("Select default environment:", [
|
|
28
|
+
{ value: "BETA", label: "Beta (default)" },
|
|
29
|
+
{ value: "PROD", label: "Production" },
|
|
30
|
+
{ value: "SANDBOX", label: "Sandbox (internal testing)" },
|
|
31
|
+
{ value: "DEV", label: "Development (local)" }
|
|
32
|
+
]);
|
|
33
|
+
await writeProjectConfig(cwd, {
|
|
34
|
+
environment,
|
|
35
|
+
organizationId: config.organizationId,
|
|
36
|
+
projectId: config.projectId
|
|
37
|
+
});
|
|
38
|
+
formatter.json({ environment, organizationId: config.organizationId, projectId: config.projectId });
|
|
39
|
+
formatter.success(`Created .pararc in ${cwd}`);
|
|
40
|
+
formatter.flush();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
registerInitCommand
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../../src/commands/keys/archive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkDhE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
import { confirm } from "../../output/prompts.js";
|
|
7
|
+
function registerKeysArchiveCommand(parent) {
|
|
8
|
+
parent.command("archive").description("Archive (revoke) an API key").argument("<key-id>", "API key ID to archive").option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
9
|
+
"after",
|
|
10
|
+
helpText(`Examples:
|
|
11
|
+
$ para keys archive abc-123 Revoke a key (asks for confirmation)
|
|
12
|
+
$ para keys archive abc-123 -y Skip confirmation (for scripts)
|
|
13
|
+
|
|
14
|
+
This is irreversible \u2014 the archived key stops working immediately.
|
|
15
|
+
Use "para keys list --include-archived" to see archived keys.`)
|
|
16
|
+
).action(async (keyId, cmdOpts, cmd) => {
|
|
17
|
+
const opts = await getGlobalOptions(cmd);
|
|
18
|
+
const formatter = createFormatter(opts);
|
|
19
|
+
const config = await resolveConfig(opts);
|
|
20
|
+
const session = await ensureAuthenticated(config.environment);
|
|
21
|
+
if (!config.organizationId || !config.projectId) {
|
|
22
|
+
throw new CliError(
|
|
23
|
+
"Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
if (!cmdOpts.yes) {
|
|
27
|
+
const confirmed = await confirm("Are you sure you want to archive this API key? It will stop working immediately.");
|
|
28
|
+
if (!confirmed) {
|
|
29
|
+
formatter.info("Archive cancelled.");
|
|
30
|
+
formatter.flush();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const client = new ParaApiClient({
|
|
35
|
+
environment: config.environment,
|
|
36
|
+
sessionId: session.sessionId
|
|
37
|
+
});
|
|
38
|
+
await client.deleteApiKey(config.organizationId, config.projectId, config.environment, keyId);
|
|
39
|
+
if (opts.json) {
|
|
40
|
+
formatter.json({ id: keyId, archived: true });
|
|
41
|
+
} else {
|
|
42
|
+
formatter.success(`Archived API key ${keyId}`);
|
|
43
|
+
}
|
|
44
|
+
formatter.flush();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
registerKeysArchiveCommand
|
|
49
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { ParaApiClient } from '../../../api/client.js';
|
|
3
|
+
import type { ApiKey } from '../../../api/types.js';
|
|
4
|
+
import type { OutputFormatter } from '../../../output/formatter.js';
|
|
5
|
+
interface BrandingFlags {
|
|
6
|
+
foregroundColor?: string;
|
|
7
|
+
fgColor?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
bgColor?: string;
|
|
10
|
+
accentColor?: string;
|
|
11
|
+
font?: string;
|
|
12
|
+
homepageUrl?: string;
|
|
13
|
+
twitterUrl?: string;
|
|
14
|
+
linkedinUrl?: string;
|
|
15
|
+
githubUrl?: string;
|
|
16
|
+
verifyUrl?: string;
|
|
17
|
+
emailWelcome?: boolean;
|
|
18
|
+
emailBackupKit?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function registerBrandingConfigCommand(parent: Command): void;
|
|
21
|
+
export declare function runBrandingAction(client: ParaApiClient, orgId: string, projectId: string, environment: string, keyId: string, currentKey: ApiKey, formatter: OutputFormatter, flags?: BrandingFlags): Promise<void>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=branding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../../../src/commands/keys/config/branding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAWpE,UAAU,aAAa;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAiEnE;AAmBD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,eAAe,EAC1B,KAAK,CAAC,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC,CAyMf"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../../api/client.js";
|
|
5
|
+
import { CliError } from "../../../core/error-handler.js";
|
|
6
|
+
import { Font } from "../../../api/types.js";
|
|
7
|
+
import { text, select, confirm, p } from "../../../output/prompts.js";
|
|
8
|
+
import { resolveKeyId } from "./categories.js";
|
|
9
|
+
import {
|
|
10
|
+
validateHexColor,
|
|
11
|
+
validateHttpsUrl,
|
|
12
|
+
validateTwitterUrl,
|
|
13
|
+
validateLinkedinUrl,
|
|
14
|
+
validateGithubUrl
|
|
15
|
+
} from "../../../validation/index.js";
|
|
16
|
+
function registerBrandingConfigCommand(parent) {
|
|
17
|
+
parent.command("branding").description("Configure branding settings for an API key").argument("[key-id]", "API key ID (prompted if not given)").option("--foreground-color <hex>", "Foreground color (#RGB or #RRGGBB)").option("--fg-color <hex>", "Foreground color (alias)").option("--background-color <hex>", "Background color (#RGB or #RRGGBB)").option("--bg-color <hex>", "Background color (alias)").option("--accent-color <hex>", "Accent color (#RGB or #RRGGBB)").option("--font <font>", `Font name (${Object.values(Font).join(", ")})`).option("--homepage-url <url>", "Homepage URL (HTTPS)").option("--twitter-url <url>", "Twitter/X profile URL").option("--linkedin-url <url>", "LinkedIn company URL").option("--github-url <url>", "GitHub URL").option("--verify-url <url>", "Verification email URL (HTTPS)").option("--email-welcome", "Enable welcome email").option("--no-email-welcome", "Disable welcome email").option("--email-backup-kit", "Enable backup kit email").option("--no-email-backup-kit", "Disable backup kit email").addHelpText(
|
|
18
|
+
"after",
|
|
19
|
+
helpText(`Examples:
|
|
20
|
+
$ para keys config branding Interactive branding settings
|
|
21
|
+
$ para keys config branding --fg-color "#333" --bg-color "#fff" Set colors
|
|
22
|
+
$ para keys config branding --font "Helvetica" Set font
|
|
23
|
+
$ para keys config branding --homepage-url "https://example.com" Set homepage
|
|
24
|
+
$ para keys config branding --no-email-welcome Disable welcome email`)
|
|
25
|
+
).action(async (keyIdArg, cmdOpts, cmd) => {
|
|
26
|
+
const opts = await getGlobalOptions(cmd);
|
|
27
|
+
const formatter = createFormatter(opts);
|
|
28
|
+
const config = await resolveConfig(opts);
|
|
29
|
+
const session = await ensureAuthenticated(config.environment);
|
|
30
|
+
if (!config.organizationId || !config.projectId) {
|
|
31
|
+
throw new CliError(
|
|
32
|
+
"Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const client = new ParaApiClient({
|
|
36
|
+
environment: config.environment,
|
|
37
|
+
sessionId: session.sessionId
|
|
38
|
+
});
|
|
39
|
+
const { keyId, key } = await resolveKeyId(
|
|
40
|
+
client,
|
|
41
|
+
config.organizationId,
|
|
42
|
+
config.projectId,
|
|
43
|
+
config.environment,
|
|
44
|
+
keyIdArg
|
|
45
|
+
);
|
|
46
|
+
await runBrandingAction(
|
|
47
|
+
client,
|
|
48
|
+
config.organizationId,
|
|
49
|
+
config.projectId,
|
|
50
|
+
config.environment,
|
|
51
|
+
keyId,
|
|
52
|
+
key,
|
|
53
|
+
formatter,
|
|
54
|
+
cmdOpts
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function hasAnyFlag(flags) {
|
|
59
|
+
if (!flags) return false;
|
|
60
|
+
return Object.keys(flags).some((k) => flags[k] !== void 0);
|
|
61
|
+
}
|
|
62
|
+
function resolveColor(primary, alias) {
|
|
63
|
+
return primary ?? alias;
|
|
64
|
+
}
|
|
65
|
+
function validateFont(value) {
|
|
66
|
+
const validFonts = Object.values(Font);
|
|
67
|
+
if (!validFonts.includes(value)) {
|
|
68
|
+
return `Invalid font: "${value}". Valid options: ${validFonts.join(", ")}`;
|
|
69
|
+
}
|
|
70
|
+
return void 0;
|
|
71
|
+
}
|
|
72
|
+
async function runBrandingAction(client, orgId, projectId, environment, keyId, currentKey, formatter, flags) {
|
|
73
|
+
const updates = {};
|
|
74
|
+
const isInteractive = !hasAnyFlag(flags);
|
|
75
|
+
const fgFlag = resolveColor(flags?.foregroundColor, flags?.fgColor);
|
|
76
|
+
const bgFlag = resolveColor(flags?.backgroundColor, flags?.bgColor);
|
|
77
|
+
if (fgFlag !== void 0) {
|
|
78
|
+
const err = validateHexColor(fgFlag);
|
|
79
|
+
if (err) throw new CliError(`Foreground color: ${err}`);
|
|
80
|
+
updates.foregroundColor = fgFlag;
|
|
81
|
+
}
|
|
82
|
+
if (bgFlag !== void 0) {
|
|
83
|
+
const err = validateHexColor(bgFlag);
|
|
84
|
+
if (err) throw new CliError(`Background color: ${err}`);
|
|
85
|
+
updates.backgroundColor = bgFlag;
|
|
86
|
+
}
|
|
87
|
+
if (flags?.accentColor !== void 0) {
|
|
88
|
+
const err = validateHexColor(flags.accentColor);
|
|
89
|
+
if (err) throw new CliError(`Accent color: ${err}`);
|
|
90
|
+
updates.accentColor = flags.accentColor;
|
|
91
|
+
}
|
|
92
|
+
if (isInteractive) {
|
|
93
|
+
const section = await select("Branding section:", [
|
|
94
|
+
{ value: "colors", label: "Colors & theme" },
|
|
95
|
+
{ value: "font", label: "Font" },
|
|
96
|
+
{ value: "social", label: "Social links" },
|
|
97
|
+
{ value: "email", label: "Email settings" },
|
|
98
|
+
{ value: "all", label: "All settings" }
|
|
99
|
+
]);
|
|
100
|
+
if (section === "colors" || section === "all") {
|
|
101
|
+
p.log.info(
|
|
102
|
+
`Current colors \u2014 fg: ${currentKey.foregroundColor ?? "(default)"}, bg: ${currentKey.backgroundColor ?? "(default)"}, accent: ${currentKey.accentColor ?? "(default)"}`
|
|
103
|
+
);
|
|
104
|
+
const fg = await text("Foreground color (empty to skip):", {
|
|
105
|
+
placeholder: "#333333",
|
|
106
|
+
initialValue: currentKey.foregroundColor ?? "",
|
|
107
|
+
validate: (v) => {
|
|
108
|
+
if (v.trim()) return validateHexColor(v.trim());
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (fg.trim()) updates.foregroundColor = fg.trim();
|
|
112
|
+
const bg = await text("Background color (empty to skip):", {
|
|
113
|
+
placeholder: "#ffffff",
|
|
114
|
+
initialValue: currentKey.backgroundColor ?? "",
|
|
115
|
+
validate: (v) => {
|
|
116
|
+
if (v.trim()) return validateHexColor(v.trim());
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
if (bg.trim()) updates.backgroundColor = bg.trim();
|
|
120
|
+
const accent = await text("Accent color (empty to skip):", {
|
|
121
|
+
placeholder: "#0066ff",
|
|
122
|
+
initialValue: currentKey.accentColor ?? "",
|
|
123
|
+
validate: (v) => {
|
|
124
|
+
if (v.trim()) return validateHexColor(v.trim());
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
if (accent.trim()) updates.accentColor = accent.trim();
|
|
128
|
+
}
|
|
129
|
+
if (section === "font" || section === "all") {
|
|
130
|
+
p.log.info(`Current font: ${currentKey.font ?? "(default)"}`);
|
|
131
|
+
const fontValues = Object.values(Font);
|
|
132
|
+
const fontChoice = await select("Font:", [
|
|
133
|
+
...fontValues.map((f) => ({ value: f, label: f })),
|
|
134
|
+
{ value: "__skip__", label: "Skip (keep current)" }
|
|
135
|
+
]);
|
|
136
|
+
if (fontChoice !== "__skip__") {
|
|
137
|
+
updates.font = fontChoice;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (section === "social" || section === "all") {
|
|
141
|
+
p.log.info(
|
|
142
|
+
`Current links \u2014 homepage: ${currentKey.homepageUrl ?? "(none)"}, twitter: ${currentKey.twitterUrl ?? "(none)"}, linkedin: ${currentKey.linkedinUrl ?? "(none)"}, github: ${currentKey.githubUrl ?? "(none)"}`
|
|
143
|
+
);
|
|
144
|
+
const homepage = await text("Homepage URL (empty to skip):", {
|
|
145
|
+
placeholder: "https://example.com",
|
|
146
|
+
initialValue: currentKey.homepageUrl ?? "",
|
|
147
|
+
validate: (v) => {
|
|
148
|
+
if (v.trim()) return validateHttpsUrl(v.trim());
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
if (homepage.trim()) updates.homepageUrl = homepage.trim();
|
|
152
|
+
const twitter = await text("Twitter/X URL (empty to skip):", {
|
|
153
|
+
placeholder: "https://twitter.com/username",
|
|
154
|
+
initialValue: currentKey.twitterUrl ?? "",
|
|
155
|
+
validate: (v) => {
|
|
156
|
+
if (v.trim()) return validateTwitterUrl(v.trim());
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
if (twitter.trim()) updates.twitterUrl = twitter.trim();
|
|
160
|
+
const linkedin = await text("LinkedIn URL (empty to skip):", {
|
|
161
|
+
placeholder: "https://linkedin.com/company/name",
|
|
162
|
+
initialValue: currentKey.linkedinUrl ?? "",
|
|
163
|
+
validate: (v) => {
|
|
164
|
+
if (v.trim()) return validateLinkedinUrl(v.trim());
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
if (linkedin.trim()) updates.linkedinUrl = linkedin.trim();
|
|
168
|
+
const github = await text("GitHub URL (empty to skip):", {
|
|
169
|
+
placeholder: "https://github.com/org",
|
|
170
|
+
initialValue: currentKey.githubUrl ?? "",
|
|
171
|
+
validate: (v) => {
|
|
172
|
+
if (v.trim()) return validateGithubUrl(v.trim());
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
if (github.trim()) updates.githubUrl = github.trim();
|
|
176
|
+
}
|
|
177
|
+
if (section === "email" || section === "all") {
|
|
178
|
+
p.log.info(
|
|
179
|
+
`Current email settings \u2014 welcome: ${currentKey.emailWelcome ? "on" : "off"}, backup kit: ${currentKey.emailBackupKit ? "on" : "off"}`
|
|
180
|
+
);
|
|
181
|
+
p.log.info(`Verification URL: ${currentKey.verifyUrl ?? "(none)"}`);
|
|
182
|
+
const verifyUrl = await text("Verification email URL (empty to skip):", {
|
|
183
|
+
placeholder: "https://example.com/verify",
|
|
184
|
+
initialValue: currentKey.verifyUrl ?? "",
|
|
185
|
+
validate: (v) => {
|
|
186
|
+
if (v.trim()) return validateHttpsUrl(v.trim());
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
if (verifyUrl.trim()) updates.verifyUrl = verifyUrl.trim();
|
|
190
|
+
const welcome = await confirm("Enable welcome email?");
|
|
191
|
+
updates.emailWelcome = welcome;
|
|
192
|
+
const backupKit = await confirm("Enable backup kit email?");
|
|
193
|
+
updates.emailBackupKit = backupKit;
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
if (flags?.font !== void 0) {
|
|
197
|
+
const err = validateFont(flags.font);
|
|
198
|
+
if (err) throw new CliError(err);
|
|
199
|
+
updates.font = flags.font;
|
|
200
|
+
}
|
|
201
|
+
if (flags?.homepageUrl !== void 0) {
|
|
202
|
+
const err = validateHttpsUrl(flags.homepageUrl);
|
|
203
|
+
if (err) throw new CliError(`Homepage URL: ${err}`);
|
|
204
|
+
updates.homepageUrl = flags.homepageUrl;
|
|
205
|
+
}
|
|
206
|
+
if (flags?.twitterUrl !== void 0) {
|
|
207
|
+
const err = validateTwitterUrl(flags.twitterUrl);
|
|
208
|
+
if (err) throw new CliError(`Twitter URL: ${err}`);
|
|
209
|
+
updates.twitterUrl = flags.twitterUrl;
|
|
210
|
+
}
|
|
211
|
+
if (flags?.linkedinUrl !== void 0) {
|
|
212
|
+
const err = validateLinkedinUrl(flags.linkedinUrl);
|
|
213
|
+
if (err) throw new CliError(`LinkedIn URL: ${err}`);
|
|
214
|
+
updates.linkedinUrl = flags.linkedinUrl;
|
|
215
|
+
}
|
|
216
|
+
if (flags?.githubUrl !== void 0) {
|
|
217
|
+
const err = validateGithubUrl(flags.githubUrl);
|
|
218
|
+
if (err) throw new CliError(`GitHub URL: ${err}`);
|
|
219
|
+
updates.githubUrl = flags.githubUrl;
|
|
220
|
+
}
|
|
221
|
+
if (flags?.verifyUrl !== void 0) {
|
|
222
|
+
const err = validateHttpsUrl(flags.verifyUrl);
|
|
223
|
+
if (err) throw new CliError(`Verify URL: ${err}`);
|
|
224
|
+
updates.verifyUrl = flags.verifyUrl;
|
|
225
|
+
}
|
|
226
|
+
if (flags?.emailWelcome !== void 0) {
|
|
227
|
+
updates.emailWelcome = flags.emailWelcome;
|
|
228
|
+
}
|
|
229
|
+
if (flags?.emailBackupKit !== void 0) {
|
|
230
|
+
updates.emailBackupKit = flags.emailBackupKit;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (Object.keys(updates).length === 0) {
|
|
234
|
+
formatter.info("No changes made.");
|
|
235
|
+
formatter.flush();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
await client.updateApiKey(orgId, projectId, environment, keyId, updates);
|
|
239
|
+
formatter.json({ keyId, updated: updates });
|
|
240
|
+
formatter.success("Updated branding settings.");
|
|
241
|
+
formatter.flush();
|
|
242
|
+
}
|
|
243
|
+
export {
|
|
244
|
+
registerBrandingConfigCommand,
|
|
245
|
+
runBrandingAction
|
|
246
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ParaApiClient } from '../../../api/client.js';
|
|
2
|
+
import type { ApiKey } from '../../../api/types.js';
|
|
3
|
+
import type { OutputFormatter } from '../../../output/formatter.js';
|
|
4
|
+
export interface CategoryDef {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
hint: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const CATEGORIES: CategoryDef[];
|
|
10
|
+
export declare function resolveKeyId(client: ParaApiClient, orgId: string, projectId: string, environment: string, keyIdArg?: string): Promise<{
|
|
11
|
+
keyId: string;
|
|
12
|
+
key: ApiKey;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function runInteractiveMenu(client: ParaApiClient, orgId: string, projectId: string, environment: string, keyId: string, key: ApiKey, formatter: OutputFormatter): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../../../src/commands/keys/config/categories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,UAAU,EAAE,WAAW,EAMnC,CAAC;AAIF,wBAAsB,YAAY,CAChC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CA8BzC;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,eAAe,GACzB,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { select } from "../../../output/prompts.js";
|
|
2
|
+
import { CliError } from "../../../core/error-handler.js";
|
|
3
|
+
import { maskSecret } from "../../../output/mask.js";
|
|
4
|
+
import { p } from "../../../output/prompts.js";
|
|
5
|
+
const CATEGORIES = [
|
|
6
|
+
{ value: "security", label: "Security", hint: "Origins, auth methods, session, popups, IP allowlist" },
|
|
7
|
+
{ value: "branding", label: "Branding", hint: "Colors, theme, font, social links, email config" },
|
|
8
|
+
{ value: "setup", label: "Setup / Networks", hint: "Wallet types, cosmos prefix, native passkeys" },
|
|
9
|
+
{ value: "ramps", label: "On/Off Ramps", hint: "Buy, receive, withdraw toggles, providers" },
|
|
10
|
+
{ value: "webhooks", label: "Webhooks", hint: "URL, events, test, rotate secret" }
|
|
11
|
+
];
|
|
12
|
+
const EXIT_VALUE = "__exit__";
|
|
13
|
+
async function resolveKeyId(client, orgId, projectId, environment, keyIdArg) {
|
|
14
|
+
if (keyIdArg) {
|
|
15
|
+
const key2 = await client.getApiKey(orgId, projectId, environment, keyIdArg);
|
|
16
|
+
return { keyId: keyIdArg, key: key2 };
|
|
17
|
+
}
|
|
18
|
+
const keys = await client.getApiKeys(orgId, projectId, environment);
|
|
19
|
+
const active = keys.filter((k) => !k.archived);
|
|
20
|
+
if (active.length === 0) {
|
|
21
|
+
throw new CliError("No API keys found. Run `para keys create` first.");
|
|
22
|
+
}
|
|
23
|
+
if (active.length === 1) {
|
|
24
|
+
p.log.info(`Using key ${active[0].displayName || active[0].name} (${maskSecret(active[0].apiKey)})`);
|
|
25
|
+
return { keyId: active[0].id, key: active[0] };
|
|
26
|
+
}
|
|
27
|
+
const selected = await select(
|
|
28
|
+
"Select API key:",
|
|
29
|
+
active.map((k) => ({
|
|
30
|
+
value: k.id,
|
|
31
|
+
label: k.displayName || k.name,
|
|
32
|
+
hint: maskSecret(k.apiKey)
|
|
33
|
+
}))
|
|
34
|
+
);
|
|
35
|
+
const key = active.find((k) => k.id === selected);
|
|
36
|
+
if (!key) throw new CliError("Selected API key no longer exists. Please try again.");
|
|
37
|
+
return { keyId: selected, key };
|
|
38
|
+
}
|
|
39
|
+
async function runInteractiveMenu(client, orgId, projectId, environment, keyId, key, formatter) {
|
|
40
|
+
const { runSecurityAction } = await import("./security.js");
|
|
41
|
+
const { runBrandingAction } = await import("./branding.js");
|
|
42
|
+
const { runSetupAction } = await import("./setup.js");
|
|
43
|
+
const { runRampsAction } = await import("./ramps.js");
|
|
44
|
+
const { runWebhooksAction } = await import("./webhooks.js");
|
|
45
|
+
let currentKey = key;
|
|
46
|
+
while (true) {
|
|
47
|
+
const category = await select("Configure:", [
|
|
48
|
+
...CATEGORIES.map((c) => ({ value: c.value, label: c.label, hint: c.hint })),
|
|
49
|
+
{ value: EXIT_VALUE, label: "Done", hint: "Exit configuration" }
|
|
50
|
+
]);
|
|
51
|
+
if (category === EXIT_VALUE) break;
|
|
52
|
+
const actionMap = {
|
|
53
|
+
security: () => runSecurityAction(client, orgId, projectId, environment, keyId, currentKey, formatter),
|
|
54
|
+
branding: () => runBrandingAction(client, orgId, projectId, environment, keyId, currentKey, formatter),
|
|
55
|
+
setup: () => runSetupAction(client, orgId, projectId, environment, keyId, currentKey, formatter),
|
|
56
|
+
ramps: () => runRampsAction(client, orgId, projectId, environment, keyId, currentKey, formatter),
|
|
57
|
+
webhooks: () => runWebhooksAction(client, orgId, projectId, environment, keyId, currentKey, formatter)
|
|
58
|
+
};
|
|
59
|
+
await actionMap[category]();
|
|
60
|
+
currentKey = await client.getApiKey(orgId, projectId, environment, keyId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
CATEGORIES,
|
|
65
|
+
resolveKeyId,
|
|
66
|
+
runInteractiveMenu
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/keys/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAmD/D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../../api/client.js";
|
|
5
|
+
import { CliError } from "../../../core/error-handler.js";
|
|
6
|
+
import { resolveKeyId, runInteractiveMenu } from "./categories.js";
|
|
7
|
+
import { registerSecurityConfigCommand } from "./security.js";
|
|
8
|
+
import { registerBrandingConfigCommand } from "./branding.js";
|
|
9
|
+
import { registerSetupConfigCommand } from "./setup.js";
|
|
10
|
+
import { registerRampsConfigCommand } from "./ramps.js";
|
|
11
|
+
import { registerWebhooksConfigCommand } from "./webhooks.js";
|
|
12
|
+
function registerKeysConfigCommand(parent) {
|
|
13
|
+
const config = parent.command("config").description("Configure API key settings").argument("[key-id]", "API key ID (prompted if not given)").addHelpText(
|
|
14
|
+
"after",
|
|
15
|
+
helpText(`Examples:
|
|
16
|
+
$ para keys config Interactive category menu for the active key
|
|
17
|
+
$ para keys config abc-123 Interactive menu for a specific key
|
|
18
|
+
$ para keys config security Jump directly to security settings
|
|
19
|
+
$ para keys config branding Jump directly to branding settings
|
|
20
|
+
|
|
21
|
+
Categories: security, branding, setup, ramps, webhooks
|
|
22
|
+
|
|
23
|
+
Each category also accepts flags for non-interactive use:
|
|
24
|
+
$ para keys config security --origins "https://example.com" --auth-methods "PASSKEY,PIN"`)
|
|
25
|
+
).action(async (keyIdArg, _cmdOpts, cmd) => {
|
|
26
|
+
const opts = await getGlobalOptions(cmd);
|
|
27
|
+
const formatter = createFormatter(opts);
|
|
28
|
+
const config2 = await resolveConfig(opts);
|
|
29
|
+
const session = await ensureAuthenticated(config2.environment);
|
|
30
|
+
if (!config2.organizationId || !config2.projectId) {
|
|
31
|
+
throw new CliError(
|
|
32
|
+
"Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const client = new ParaApiClient({
|
|
36
|
+
environment: config2.environment,
|
|
37
|
+
sessionId: session.sessionId
|
|
38
|
+
});
|
|
39
|
+
const { keyId, key } = await resolveKeyId(
|
|
40
|
+
client,
|
|
41
|
+
config2.organizationId,
|
|
42
|
+
config2.projectId,
|
|
43
|
+
config2.environment,
|
|
44
|
+
keyIdArg
|
|
45
|
+
);
|
|
46
|
+
await runInteractiveMenu(client, config2.organizationId, config2.projectId, config2.environment, keyId, key, formatter);
|
|
47
|
+
});
|
|
48
|
+
registerSecurityConfigCommand(config);
|
|
49
|
+
registerBrandingConfigCommand(config);
|
|
50
|
+
registerSetupConfigCommand(config);
|
|
51
|
+
registerRampsConfigCommand(config);
|
|
52
|
+
registerWebhooksConfigCommand(config);
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
registerKeysConfigCommand
|
|
56
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { ParaApiClient } from '../../../api/client.js';
|
|
3
|
+
import type { ApiKey } from '../../../api/types.js';
|
|
4
|
+
import type { OutputFormatter } from '../../../output/formatter.js';
|
|
5
|
+
interface RampsFlags {
|
|
6
|
+
buyEnabled?: boolean;
|
|
7
|
+
receiveEnabled?: boolean;
|
|
8
|
+
withdrawEnabled?: boolean;
|
|
9
|
+
providers?: string;
|
|
10
|
+
rampApiKey?: string;
|
|
11
|
+
defaultBuyAmount?: string;
|
|
12
|
+
defaultOnRampAsset?: string;
|
|
13
|
+
defaultOnRampNetwork?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function registerRampsConfigCommand(parent: Command): void;
|
|
16
|
+
export declare function runRampsAction(client: ParaApiClient, orgId: string, projectId: string, environment: string, keyId: string, currentKey: ApiKey, formatter: OutputFormatter, flags?: RampsFlags): Promise<void>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=ramps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ramps.d.ts","sourceRoot":"","sources":["../../../../src/commands/keys/config/ramps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQpE,UAAU,UAAU;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAyBD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA4DhE;AAOD,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,eAAe,EAC1B,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,IAAI,CAAC,CAkIf"}
|