bazis 0.96.2 → 0.96.4
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/README.md
CHANGED
|
@@ -40,7 +40,7 @@ bunx bazis dev # GET http://127.0.0.1:3000/health
|
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
42
|
bun add bazis # or a fixed version: bun add bazis@0.96.2
|
|
43
|
-
bun add -d typescript @types/bun
|
|
43
|
+
bun add -d typescript@^6 @types/bun # TypeScript 7 is not supported yet
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Then take `tsconfig.json`, `bazis.config.json` and `src/index.ts` from a
|
package/cli/generateProject.ts
CHANGED
|
@@ -149,7 +149,7 @@ function buildProjectFiles(name: string, dependency: string, frameworkMode: Fram
|
|
|
149
149
|
"start": `./bin/${name}`,
|
|
150
150
|
},
|
|
151
151
|
dependencies: { bazis: dependency },
|
|
152
|
-
devDependencies: { "@types/bun": "1.4.0", typescript: "^
|
|
152
|
+
devDependencies: { "@types/bun": "1.4.0", typescript: "^6" },
|
|
153
153
|
};
|
|
154
154
|
const tsconfig = {
|
|
155
155
|
compilerOptions: {
|
package/core/http/README.md
CHANGED
|
@@ -52,7 +52,7 @@ Instead there are ASP.NET-style conventions that codegen infers from the signatu
|
|
|
52
52
|
|
|
53
53
|
| Method parameter | Binding |
|
|
54
54
|
|---|---|
|
|
55
|
-
| the name matches
|
|
55
|
+
| the name matches a route parameter: `:name` in the method or `@Controller` template, or a wildcard `*name` (a bare `*` is `rest`) | the route value (converted by the constraint/type) |
|
|
56
56
|
| a DTO class from the application sources | the request body + `@Validator` validation (errors -> 400) |
|
|
57
57
|
| `HttpContext` / `Request` / `ResponseBuilder` | context / raw request / response builder |
|
|
58
58
|
| a primitive (`string`/`number`/`boolean` or inferred from the default) | a query parameter; `?` and a default -> optional |
|
|
@@ -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.96.
|
|
235
|
+
clientInfo: { name: "bazis", title: "Bazis", version: "0.96.4" }, 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");
|
|
@@ -29,7 +29,11 @@ export class Environment {
|
|
|
29
29
|
// A missing deployment setting must fail closed. Development is always an
|
|
30
30
|
// explicit choice made by the dev scripts, never an accidental production
|
|
31
31
|
// fallback.
|
|
32
|
-
|
|
32
|
+
// Read through an alias: `bun build` replaces the literal
|
|
33
|
+
// `process.env.NODE_ENV` with "development" at bundle time, which would bake
|
|
34
|
+
// development mode into every compiled binary.
|
|
35
|
+
const env = process.env;
|
|
36
|
+
const raw = env.BAZIS_ENV ?? env.NODE_ENV ?? "production";
|
|
33
37
|
const name = parseEnvironmentName(raw);
|
|
34
38
|
return new Environment(name, debugOverride ?? name !== "production");
|
|
35
39
|
}
|
|
@@ -1009,22 +1009,31 @@ function hasDecorator(node: ts.HasDecorators, name: string): boolean {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
|
|
1011
1011
|
/** Route parameter names from all route decorators of a method (":id(int)" -> "id"). */
|
|
1012
|
+
/**
|
|
1013
|
+
* Route parameter names of an action: the `@Controller` prefix and the method
|
|
1014
|
+
* template, parsed like `Routing/template.ts` (`:name`, `:name(int)`, `*name`,
|
|
1015
|
+
* and a bare `*` named `rest`).
|
|
1016
|
+
*/
|
|
1012
1017
|
function routeParamNames(method: ts.MethodDeclaration): Set<string> {
|
|
1013
1018
|
const names = new Set<string>();
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1019
|
+
const templates: string[] = [];
|
|
1020
|
+
const owner = method.parent;
|
|
1021
|
+
const sources: readonly [readonly ts.Decorator[], (name: string) => boolean][] = [
|
|
1022
|
+
[ts.isClassDeclaration(owner) ? ts.getDecorators(owner) ?? [] : [], (name) => name === "Controller"],
|
|
1023
|
+
[ts.getDecorators(method) ?? [], (name) => ROUTE_DECORATORS.has(name)],
|
|
1024
|
+
];
|
|
1025
|
+
for (const [decorators, accepts] of sources) {
|
|
1026
|
+
for (const decorator of decorators) {
|
|
1027
|
+
const info = decoratorCall(decorator);
|
|
1028
|
+
const firstArg = info?.call?.arguments[0];
|
|
1029
|
+
if (info && accepts(info.name) && firstArg && ts.isStringLiteralLike(firstArg)) templates.push(firstArg.text);
|
|
1022
1030
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1031
|
+
}
|
|
1032
|
+
for (const template of templates) {
|
|
1033
|
+
for (const segment of template.split("/")) {
|
|
1034
|
+
const param = /^:([A-Za-z_][A-Za-z0-9_]*)/.exec(segment);
|
|
1035
|
+
if (param) names.add(param[1] as string);
|
|
1036
|
+
else if (segment.startsWith("*")) names.add(segment.length > 1 ? segment.slice(1) : "rest");
|
|
1028
1037
|
}
|
|
1029
1038
|
}
|
|
1030
1039
|
return names;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bazis",
|
|
3
|
-
"version": "0.96.
|
|
3
|
+
"version": "0.96.4",
|
|
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",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"bun": ">=1.4.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"typescript": "^5.9.3"
|
|
74
|
+
"typescript": "^5.9.3 || ^6.0.0"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public",
|