@jaypie/constructs 1.2.49 → 1.2.50

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/esm/index.js CHANGED
@@ -945,12 +945,16 @@ function exportEnvName$1(name, env = process.env) {
945
945
  }
946
946
  class JaypieEnvSecret extends Construct {
947
947
  constructor(scope, idOrEnvKey, props) {
948
- // Check if idOrEnvKey should be treated as envKey:
949
- // - No props provided OR props.envKey is not set
950
- // - AND idOrEnvKey exists as a non-empty string in process.env
948
+ // Shorthand detection: treat idOrEnvKey as envKey when envKey prop is
949
+ // not set and idOrEnvKey either looks like a SCREAMING_SNAKE_CASE env
950
+ // var name or is already present in process.env. Convention-based
951
+ // detection ensures missing env vars still go through envKey validation
952
+ // instead of silently creating an empty secret.
953
+ const looksLikeEnvKey = /^[A-Z][A-Z0-9_]*$/.test(idOrEnvKey);
951
954
  const treatAsEnvKey = (!props || props.envKey === undefined) &&
952
- typeof process.env[idOrEnvKey] === "string" &&
953
- process.env[idOrEnvKey] !== "";
955
+ (looksLikeEnvKey ||
956
+ (typeof process.env[idOrEnvKey] === "string" &&
957
+ process.env[idOrEnvKey] !== ""));
954
958
  const id = treatAsEnvKey ? `EnvSecret_${idOrEnvKey}` : idOrEnvKey;
955
959
  super(scope, id);
956
960
  const { consumer = checkEnvIsConsumer$1(), envKey: envKeyProp, export: exportParam, generateSecretString, provider = checkEnvIsProvider$1(), removalPolicy, roleTag, vendorTag, value, } = props || {};