@palbase/backend 36.0.2 → 37.0.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/openapi/index.cjs +14 -12
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.js +14 -12
- package/dist/openapi/index.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/llms-full.txt +1 -1
- package/package.json +1 -1
- package/stager/return_types.js +9 -4
- package/template/package.json +1 -1
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`
|
|
85
|
+
> and will not compile against `@palbase/backend` 37.
|
|
86
86
|
|
|
87
87
|
### Complete CRUD example (copy-pasteable, compiles)
|
|
88
88
|
|
package/docs/llms-full.txt
CHANGED
|
@@ -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`
|
|
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
package/stager/return_types.js
CHANGED
|
@@ -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>`
|
|
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:
|
|
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
|
-
|
|
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)
|
|
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
|