fauna-shell
Advanced tools
Comparing version 1.2.0-beta8 to 1.2.0-beta9
@@ -160,3 +160,2 @@ "use strict"; | ||
: undefined; | ||
(_c = this.projectConfig) === null || _c === void 0 ? void 0 : _c.validate(this.rootConfig); | ||
const urlFlag = root_config_1.Endpoint.getURLFromFlags(this.flags); | ||
@@ -190,3 +189,3 @@ if (urlFlag !== undefined) { | ||
// `default` key in the root config. | ||
const endpointName = (_f = (_d = this.flags.strOpt("endpoint")) !== null && _d !== void 0 ? _d : (_e = this.stack) === null || _e === void 0 ? void 0 : _e.endpoint) !== null && _f !== void 0 ? _f : this.rootConfig.defaultEndpoint; | ||
const endpointName = (_e = (_c = this.flags.strOpt("endpoint")) !== null && _c !== void 0 ? _c : (_d = this.stack) === null || _d === void 0 ? void 0 : _d.endpoint) !== null && _e !== void 0 ? _e : this.rootConfig.defaultEndpoint; | ||
const secretFlag = this.flags.strOpt("secret"); | ||
@@ -198,3 +197,9 @@ this.secretFlag = | ||
} | ||
if (endpointName === undefined) { | ||
// There are 2 scenarios where we want to execute the first if block: | ||
// 1. no endpoint name is set | ||
// 2. In a CI/CD environment where a secret is set but there is no | ||
// root config. In this scenario endpoints may be set by the project | ||
// configuration but won't exist in their pipeline workspace. | ||
if (endpointName === undefined || | ||
(secretFlag !== undefined && this.rootConfig.isEmpty())) { | ||
// This is a dummy secret. `--secret` must be set in this case, which | ||
@@ -210,2 +215,3 @@ // `validate` enforces. | ||
else { | ||
(_f = this.projectConfig) === null || _f === void 0 ? void 0 : _f.validate(this.rootConfig); | ||
this.endpoint = this.rootConfig.endpoints[endpointName]; | ||
@@ -212,0 +218,0 @@ if (this.endpoint === undefined) { |
@@ -10,2 +10,3 @@ import { Config, EndpointConfig } from "."; | ||
constructor(config: Config); | ||
isEmpty(): boolean; | ||
/** | ||
@@ -31,3 +32,3 @@ * If there is an endpoint object in the config, and it has a | ||
url?: string | undefined; | ||
secret: Secret; | ||
secret: string; | ||
}; | ||
@@ -83,4 +84,4 @@ }; | ||
url?: string | undefined; | ||
secret: Secret; | ||
secret: string; | ||
}; | ||
} |
@@ -51,2 +51,5 @@ "use strict"; | ||
} | ||
isEmpty() { | ||
return Object.keys(this.endpoints).length === 0; | ||
} | ||
/** | ||
@@ -138,3 +141,3 @@ * If there is an endpoint object in the config, and it has a | ||
return { | ||
secret: this.secret, | ||
secret: this.secret.key, | ||
...(this.url !== "https://db.fauna.com" ? { url: this.url } : {}), | ||
@@ -141,0 +144,0 @@ ...(this.graphqlHost !== "graphql.fauna.com" |
{ | ||
"version": "1.2.0-beta8", | ||
"version": "1.2.0-beta9", | ||
"commands": { | ||
@@ -4,0 +4,0 @@ "cloud-login": { |
{ | ||
"name": "fauna-shell", | ||
"description": "faunadb shell", | ||
"version": "1.2.0-beta8", | ||
"version": "1.2.0-beta9", | ||
"author": "Fauna", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -204,4 +204,2 @@ // Manages ~/.fauna-shell | ||
this.projectConfig?.validate(this.rootConfig); | ||
const urlFlag = Endpoint.getURLFromFlags(this.flags); | ||
@@ -254,3 +252,11 @@ if (urlFlag !== undefined) { | ||
if (endpointName === undefined) { | ||
// There are 2 scenarios where we want to execute the first if block: | ||
// 1. no endpoint name is set | ||
// 2. In a CI/CD environment where a secret is set but there is no | ||
// root config. In this scenario endpoints may be set by the project | ||
// configuration but won't exist in their pipeline workspace. | ||
if ( | ||
endpointName === undefined || | ||
(secretFlag !== undefined && this.rootConfig.isEmpty()) | ||
) { | ||
// This is a dummy secret. `--secret` must be set in this case, which | ||
@@ -265,2 +271,3 @@ // `validate` enforces. | ||
} else { | ||
this.projectConfig?.validate(this.rootConfig); | ||
this.endpoint = this.rootConfig.endpoints[endpointName]; | ||
@@ -267,0 +274,0 @@ if (this.endpoint === undefined) { |
@@ -62,2 +62,6 @@ import { Config, EndpointConfig, InvalidConfigError } from "."; | ||
isEmpty(): boolean { | ||
return Object.keys(this.endpoints).length === 0; | ||
} | ||
/** | ||
@@ -220,3 +224,3 @@ * If there is an endpoint object in the config, and it has a | ||
return { | ||
secret: this.secret, | ||
secret: this.secret.key, | ||
...(this.url !== "https://db.fauna.com" ? { url: this.url } : {}), | ||
@@ -223,0 +227,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
437366
10792