@earthlink/dotvault 0.14.0 → 0.14.2
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/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55,7 +55,7 @@ var AuthExpiredError = class extends EnvSyncError {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
var InvalidCredentialsError = class extends EnvSyncError {
|
|
58
|
-
constructor(msg = "Invalid email or password.") {
|
|
58
|
+
constructor(msg = "Invalid email or password. If you joined via an invite link and have not set a password yet, set one at https://app.dotvault.io/forgot-password, then run `dotvault login` again.") {
|
|
59
59
|
super("INVALID_CREDENTIALS", msg, 3);
|
|
60
60
|
this.name = "InvalidCredentialsError";
|
|
61
61
|
}
|
|
@@ -757,22 +757,24 @@ async function globalDropCommand(opts) {
|
|
|
757
757
|
);
|
|
758
758
|
}
|
|
759
759
|
async function resolve2(opts) {
|
|
760
|
+
if (opts.project !== void 0) {
|
|
761
|
+
const http2 = opts.http ?? createHttpClient(await resolveApiUrl(opts.cwd));
|
|
762
|
+
const authedFetch2 = await buildAuthedFetch(http2);
|
|
763
|
+
return { http: http2, project: opts.project, authedFetch: authedFetch2 };
|
|
764
|
+
}
|
|
760
765
|
const cfg = await loadProjectConfig(opts.cwd);
|
|
761
|
-
const project = opts.project ?? cfg.name;
|
|
762
766
|
const http = opts.http ?? createHttpClient(cfg.proxy.apiUrl);
|
|
763
767
|
const authedFetch = await buildAuthedFetch(http);
|
|
764
|
-
return { http, project, authedFetch };
|
|
768
|
+
return { http, project: cfg.name, authedFetch };
|
|
765
769
|
}
|
|
766
770
|
async function resolvePool(opts) {
|
|
767
|
-
const
|
|
768
|
-
const http = opts.http ?? createHttpClient(cfg.proxy.apiUrl);
|
|
771
|
+
const http = opts.http ?? createHttpClient(await resolveApiUrl(opts.cwd));
|
|
769
772
|
const authedFetch = await buildAuthedFetch(http);
|
|
770
773
|
return { http, orgId: opts.orgId, authedFetch };
|
|
771
774
|
}
|
|
772
775
|
async function resolvePoolWithEnv(opts) {
|
|
773
|
-
const cfg = await loadProjectConfig(opts.cwd);
|
|
774
776
|
const env = opts.env ?? GLOBAL_ALL_ENV;
|
|
775
|
-
const http = opts.http ?? createHttpClient(
|
|
777
|
+
const http = opts.http ?? createHttpClient(await resolveApiUrl(opts.cwd));
|
|
776
778
|
const authedFetch = await buildAuthedFetch(http);
|
|
777
779
|
return { http, orgId: opts.orgId, env, authedFetch };
|
|
778
780
|
}
|
|
@@ -1630,8 +1632,7 @@ async function fileExists(path) {
|
|
|
1630
1632
|
|
|
1631
1633
|
// src/commands/project.ts
|
|
1632
1634
|
async function projectCreateCommand(opts) {
|
|
1633
|
-
const
|
|
1634
|
-
const http = createHttpClient(cfg.proxy.apiUrl);
|
|
1635
|
+
const http = createHttpClient(await resolveApiUrl(opts.cwd));
|
|
1635
1636
|
const body = {
|
|
1636
1637
|
name: opts.name,
|
|
1637
1638
|
...opts.orgId !== void 0 ? { owning_org_id: opts.orgId } : {}
|
|
@@ -1665,14 +1666,12 @@ async function buildAuthedFetch4(http) {
|
|
|
1665
1666
|
|
|
1666
1667
|
// src/commands/token.ts
|
|
1667
1668
|
async function tokenListCommand(opts) {
|
|
1668
|
-
const
|
|
1669
|
-
const http = createHttpClient(cfg.proxy.apiUrl);
|
|
1669
|
+
const http = createHttpClient(await resolveApiUrl(opts.cwd));
|
|
1670
1670
|
const authedFetch = await buildAuthedFetch5(http);
|
|
1671
1671
|
return authedFetch((bearer) => http.adminTokensList(bearer, { orgId: opts.orgId }));
|
|
1672
1672
|
}
|
|
1673
1673
|
async function tokenCreateCommand(opts) {
|
|
1674
|
-
const
|
|
1675
|
-
const http = createHttpClient(cfg.proxy.apiUrl);
|
|
1674
|
+
const http = createHttpClient(await resolveApiUrl(opts.cwd));
|
|
1676
1675
|
const authedFetch = await buildAuthedFetch5(http);
|
|
1677
1676
|
const body = {
|
|
1678
1677
|
name: opts.name,
|
|
@@ -1683,8 +1682,7 @@ async function tokenCreateCommand(opts) {
|
|
|
1683
1682
|
return authedFetch((bearer) => http.adminTokensCreate(bearer, { orgId: opts.orgId }, body));
|
|
1684
1683
|
}
|
|
1685
1684
|
async function tokenRevokeCommand(opts) {
|
|
1686
|
-
const
|
|
1687
|
-
const http = createHttpClient(cfg.proxy.apiUrl);
|
|
1685
|
+
const http = createHttpClient(await resolveApiUrl(opts.cwd));
|
|
1688
1686
|
const authedFetch = await buildAuthedFetch5(http);
|
|
1689
1687
|
await authedFetch(
|
|
1690
1688
|
(bearer) => http.adminTokensRevoke(bearer, { orgId: opts.orgId, tokenId: opts.tokenId })
|
|
@@ -1799,7 +1797,10 @@ Example:
|
|
|
1799
1797
|
`
|
|
1800
1798
|
Example:
|
|
1801
1799
|
$ dotvault login # prompts for email + password
|
|
1802
|
-
$ dotvault login -e you@dotvault.io
|
|
1800
|
+
$ dotvault login -e you@dotvault.io
|
|
1801
|
+
|
|
1802
|
+
Invited via a link? The invite is passwordless \u2014 before your first
|
|
1803
|
+
\`dotvault login\`, set a password at https://app.dotvault.io/forgot-password.`
|
|
1803
1804
|
).action(async (opts) => {
|
|
1804
1805
|
const result = await loginCommand({ email: opts.email });
|
|
1805
1806
|
const expiresIn = Math.max(0, result.expiresAt - Math.floor(Date.now() / 1e3));
|