bazis 0.97.8 → 0.97.9

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.
@@ -232,7 +232,7 @@ export class CodexAppServerClient implements CodexClient {
232
232
  if (method === "account/updated") this.modelCache = undefined;
233
233
  }, () => { this.clearLogin(); this.modelCache = undefined; });
234
234
  const initialized = await client.request("initialize", {
235
- clientInfo: { name: "bazis", title: "Bazis", version: "0.97.8" }, capabilities: { experimentalApi: true },
235
+ clientInfo: { name: "bazis", title: "Bazis", version: "0.97.9" }, capabilities: { experimentalApi: true },
236
236
  }, 15_000, signal);
237
237
  if (resolve(text(initialized.codexHome, 4096)) !== this.paths.home) throw new CodexError("PROTOCOL_ERROR");
238
238
  client.notify("initialized");
@@ -90,6 +90,19 @@ export function processConfiguration(): Configuration {
90
90
  }
91
91
  return new Configuration(values, origins);
92
92
  }
93
+ /**
94
+ * Why an environment variable name cannot be used for a key, or undefined.
95
+ * Aliases are read from the same BAZIS_* variables as the generated names,
96
+ * so they share the prefix.
97
+ */
98
+ function environmentNameProblem(name: string, claimed: ReadonlySet<string>): string | undefined {
99
+ if (!name.startsWith(ENV_PREFIX)) return `must start with ${ENV_PREFIX}: configuration reads only ${ENV_PREFIX}* variables (for example ${ENV_PREFIX}${name.replace(/^[^A-Za-z0-9]+/, "").toUpperCase() || "NAME"})`;
100
+ if (name.length === ENV_PREFIX.length) return `needs a name after ${ENV_PREFIX}`;
101
+ if (!/^[A-Z0-9_-]+$/.test(name)) return "may contain only A-Z, 0-9, _ and -";
102
+ if (claimed.has(name)) return "is already used by another key of this configuration";
103
+ return undefined;
104
+ }
105
+
93
106
  function isSecret(cell: Cell): cell is SecretSpec { return typeof cell === "object" && cell !== null && "__secret" in cell; }
94
107
  function isEnum(cell: Cell): cell is ConfigEnum { return typeof cell === "object" && cell !== null && "__enum" in cell; }
95
108
  function copyCell(cell: Cell): Cell {
@@ -127,7 +140,8 @@ export function defineConfig(prefixOrSchema: string | ConfigSchema<Defaults>, ma
127
140
  const alias = input.env?.[key];
128
141
  const env = [...new Set([`${ENV_PREFIX}${fullKey(key).replaceAll(".", "__").toUpperCase()}`, ...(typeof alias === "string" ? [alias] : alias ?? [])])];
129
142
  for (const name of env) {
130
- if (!name.startsWith(ENV_PREFIX) || name.length === ENV_PREFIX.length || !/^[A-Z0-9_-]+$/.test(name) || claimed.has(name)) throw new KernelError(`Invalid or duplicate configuration environment name: ${name}.`);
143
+ const problem = environmentNameProblem(name, claimed);
144
+ if (problem) throw new KernelError(`Configuration key "${fullKey(key)}": environment variable "${name}" ${problem}.`);
131
145
  claimed.add(name);
132
146
  }
133
147
  names.set(key, Object.freeze(env));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bazis",
3
- "version": "0.97.8",
3
+ "version": "0.97.9",
4
4
  "description": "Modular backend framework for Bun in TypeScript: DI wired by codegen, HTTP, a PostgreSQL ORM, JWT, WebSocket, agents and a CLI.",
5
5
  "license": "MIT",
6
6
  "author": "Alexander Alenin",