New:Socket for Asana Is Now Available.Learn more
Get Started

dropthis

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dropthis - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+51
-2
dist/cli.cjs

@@ -478,2 +478,46 @@ #!/usr/bin/env node

// src/commands/login.ts
var prompts = __toESM(require("@clack/prompts"), 1);
async function runLoginInteractive(deps) {
prompts.intro("dropthis login");
const email = await prompts.text({
message: "Email address",
validate: (v) => v?.includes("@") ? void 0 : "Enter a valid email"
});
if (prompts.isCancel(email)) {
prompts.cancel("Login cancelled.");
return { exitCode: 0 };
}
const requestResult = await deps.client.auth.requestEmailOtp({ email });
if (requestResult.error) {
prompts.cancel(requestResult.error.message);
return { exitCode: exitCodeFor("api_error") };
}
const otp = await prompts.text({
message: "Paste the code from your email"
});
if (prompts.isCancel(otp)) {
prompts.cancel("Login cancelled.");
return { exitCode: 0 };
}
const session = await deps.client.auth.verifyEmailOtp({ email, code: otp });
if (session.error) {
prompts.cancel(session.error.message);
return { exitCode: exitCodeFor("api_error") };
}
const apiKey = await deps.client.apiKeys.create({ label: "CLI" });
if (apiKey.error) {
prompts.cancel(apiKey.error.message);
return { exitCode: exitCodeFor("api_error") };
}
await deps.store.save({
apiKey: apiKey.data.key,
keyId: apiKey.data.id,
keyLast4: apiKey.data.keyLast4,
accountId: apiKey.data.accountId ?? session.data.accountId,
email,
storage: "secure"
});
prompts.outro("Logged in successfully.");
return { exitCode: 0 };
}
async function runLoginRequest(input, deps) {

@@ -1057,3 +1101,3 @@ const result = await deps.client.auth.requestEmailOtp({

const store = options.store ?? new MemoryCredentialStore();
program.name("dropthis").description("Publish anything online and get a URL back.").version("0.1.1");
program.name("dropthis").description("Publish anything online and get a URL back.").version("0.1.2");
program.option("--api-key <key>", "Override API key for this invocation");

@@ -1065,3 +1109,8 @@ program.option("--api-url <url>", "Override API base URL");

async (commandOptions) => {
if (!commandOptions.email || !commandOptions.otp) return;
if (!commandOptions.email || !commandOptions.otp) {
const deps2 = await commandDeps(program, options, store, commandOptions);
const result2 = await runLoginInteractive(deps2);
process.exitCode = result2.exitCode;
return;
}
const deps = await commandDeps(program, options, store, commandOptions);

@@ -1068,0 +1117,0 @@ const result = await runLoginVerify(

+1
-1
{
"name": "dropthis",
"version": "0.1.1",
"version": "0.1.2",
"description": "Official CLI for Dropthis.",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is too big to display