@dragonmastery/tamer 0.35.4 → 0.36.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/dist/tamer.mjs CHANGED
@@ -5751,6 +5751,7 @@ const REF_RE = /\$\{tamer:([a-z0-9_]+):([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\}/g;
5751
5751
  * least one reference is present (used for cheap pre-checks).
5752
5752
  */
5753
5753
  function stringHasReference(s) {
5754
+ if (s.includes("${tamer:env}")) return true;
5754
5755
  REF_RE.lastIndex = 0;
5755
5756
  return REF_RE.test(s);
5756
5757
  }
@@ -5758,9 +5759,14 @@ function stringHasReference(s) {
5758
5759
  * Resolve every `${tamer:...}` reference in `value`. Replacement preserves
5759
5760
  * surrounding text for partial-string interpolation. `fieldPath` is included
5760
5761
  * in any thrown {@link TamerReferenceError} for actionable diagnostics.
5762
+ *
5763
+ * Built-in scalar references (no state lookup needed):
5764
+ * `${tamer:env}` → the current env name (e.g. `"dev"`, `"pr-1234"`)
5761
5765
  */
5762
5766
  function resolveReferencesInString(value, ctx, fieldPath) {
5763
- if (!stringHasReference(value)) return value;
5767
+ let result = value;
5768
+ if (result.includes("${tamer:env}")) result = result.split("${tamer:env}").join(ctx.env);
5769
+ if (!stringHasReference(result)) return result;
5764
5770
  return value.replace(REF_RE, (match, kind, logicalName, field) => {
5765
5771
  try {
5766
5772
  return lookupReference(kind, logicalName, field, ctx, fieldPath);
@@ -6029,7 +6035,11 @@ function mergedWorkerConfigForEnv(workerConfig, env, tenant) {
6029
6035
  ...envOverride,
6030
6036
  vars: mergeVars(workerConfig.vars, envOverride.vars)
6031
6037
  };
6032
- }
6038
+ } else if (isEphemeralEnv(env, tenant) && workerConfig.env?.dev) merged = {
6039
+ ...merged,
6040
+ ...workerConfig.env.dev,
6041
+ vars: mergeVars(workerConfig.vars, workerConfig.env.dev.vars)
6042
+ };
6033
6043
  const mv = merged.vars;
6034
6044
  if (mv && Object.prototype.hasOwnProperty.call(mv, "BRANCH_SUFFIX")) merged = {
6035
6045
  ...merged,