@palbase/backend 36.0.2 → 37.0.1

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/docs/README.md CHANGED
@@ -82,7 +82,7 @@ service the controllers call.
82
82
 
83
83
  > **Never** emit `defineController`, `defineHandler`, `defineEndpoint`, `route.get(...)`,
84
84
  > `req.input`, `req.params`, or `req.errors` — those are the removed legacy model
85
- > and will not compile against `@palbase/backend` 36.
85
+ > and will not compile against `@palbase/backend` 37.
86
86
 
87
87
  ### Complete CRUD example (copy-pasteable, compiles)
88
88
 
@@ -90,7 +90,7 @@ service the controllers call.
90
90
 
91
91
  > **Never** emit `defineController`, `defineHandler`, `defineEndpoint`, `route.get(...)`,
92
92
  > `req.input`, `req.params`, or `req.errors` — those are the removed legacy model
93
- > and will not compile against `@palbase/backend` 36.
93
+ > and will not compile against `@palbase/backend` 37.
94
94
 
95
95
  ### Complete CRUD example (copy-pasteable, compiles)
96
96
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palbase/backend",
3
- "version": "36.0.2",
3
+ "version": "37.0.1",
4
4
  "description": "Palbase Backend SDK — class controllers (@Controller/@Get/@Post + @Body/@QueryParams/@Param), error classes, schema DSL",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -113,7 +113,10 @@
113
113
  "@palbase/core": "^2.4.0"
114
114
  },
115
115
  "publishConfig": {
116
- "access": "public"
116
+ "access": "public",
117
+ "executableFiles": [
118
+ "./template/scripts/test.sh"
119
+ ]
117
120
  },
118
121
  "bin": {
119
122
  "palbase-backend": "./dist/bin/palbase-backend.js"
@@ -18,7 +18,7 @@
18
18
  * foo(): Promise<TodoSchema> → schema = TodoSchema
19
19
  * foo(): Promise<TodoSchema[]> → schema = z.array(TodoSchema)
20
20
  * foo(): TodoSchema / TodoSchema[] → (Promise optional)
21
- * - `void` / `Promise<void>` / no annotation no 200 body (allowed)
21
+ * - `void` / `Promise<void>` explicit z.void() binding, bodyless 204
22
22
  * - anything else (inline object, union, intersection, a type with no
23
23
  * same-named exported zod) → HARD error naming <Controller>.<method>.
24
24
  *
@@ -76,7 +76,7 @@ const RETURN_BUFFER_SYMBOL_KEY = 'palbase.backend.returnBuffer';
76
76
  * @param {string} sourceText the controller's .ts source
77
77
  * @param {string} fileLabel path/name for error messages
78
78
  * @returns {{ className: string, methods: Array<{ fnName, typeName, isArray }>, imports: Record<string,string> }}
79
- * - methods: only routes that HAVE a resolvable named return type (void/none omitted)
79
+ * - methods: named schemas or expressions, including explicit no-body schemas
80
80
  * - imports: local-binding-name → module-specifier (for the injector's import)
81
81
  * Throws ReturnTypeError on an un-resolvable/disallowed return type.
82
82
  */
@@ -251,7 +251,7 @@ function readReturnTypes(sourceText, fileLabel, inferReturn) {
251
251
  if (!m.type) {
252
252
  if (inferReturn) {
253
253
  const expression = inferReturn(fileLabel, className, fnName);
254
- if (expression !== null) methods.push({ fnName, expression });
254
+ methods.push({ fnName, expression: expression ?? 'z.void()' });
255
255
  continue;
256
256
  }
257
257
  throw err(
@@ -261,7 +261,12 @@ function readReturnTypes(sourceText, fileLabel, inferReturn) {
261
261
  );
262
262
  }
263
263
  const resolved = resolveType(m.type, fnName);
264
- if (!resolved) continue; // explicit void/Promise<void> — no 200 body, allowed
264
+ if (!resolved) {
265
+ // Absence of a binding means unknown, not no content. Keep the written
266
+ // contract so OpenAPI can emit 204 and the runtime can reject a body.
267
+ methods.push({ fnName, expression: 'z.void()' });
268
+ continue;
269
+ }
265
270
 
266
271
  const { typeName, isArray } = resolved;
267
272
  // The schema name must be an imported (or locally-defined) value. If it's
@@ -9,7 +9,7 @@
9
9
  "typecheck": "tsc --noEmit"
10
10
  },
11
11
  "dependencies": {
12
- "@palbase/backend": "^36.0.0",
12
+ "@palbase/backend": "^37.0.0",
13
13
  "reflect-metadata": "^0.2.2"
14
14
  },
15
15
  "engines": {
File without changes