@palbase/backend 24.3.0 → 25.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/bin/palbase-backend.cjs +101 -60
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +17 -13
- package/dist/bin/palbase-backend.js.map +1 -1
- package/dist/{chunk-EIXCY4SS.js → chunk-43A3KGWL.js} +80 -49
- package/dist/chunk-43A3KGWL.js.map +1 -0
- package/dist/{chunk-ERDL5VAE.js → chunk-5CMLOAEF.js} +2 -2
- package/dist/chunk-OEQBHE2Z.js +825 -0
- package/dist/chunk-OEQBHE2Z.js.map +1 -0
- package/dist/{chunk-7Z6MGMXQ.js → chunk-XJ2RSHEU.js} +11 -5
- package/dist/chunk-XJ2RSHEU.js.map +1 -0
- package/dist/{chunk-UWSYTUGM.js → chunk-ZQRWW37O.js} +44 -1
- package/dist/chunk-ZQRWW37O.js.map +1 -0
- package/dist/db/env.cjs.map +1 -1
- package/dist/db/env.d.cts +29 -13
- package/dist/db/env.d.ts +29 -13
- package/dist/db/index.cjs +212 -111
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.d.cts +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +11 -1
- package/dist/engine/index.cjs +87 -50
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +2 -2
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.js +3 -3
- package/dist/{index-DEneI8Mn.d.ts → index-BF1f0DfA.d.ts} +5 -2
- package/dist/{index-C-ALG22n.d.cts → index-CoaDN9dL.d.cts} +5 -2
- package/dist/{index-BTMYod_l.d.ts → index-Ct1iiB4N.d.ts} +203 -61
- package/dist/{index-BLAbr9ZH.d.cts → index-CwaWRhyc.d.cts} +203 -61
- package/dist/index.cjs +550 -297
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +122 -20
- package/dist/index.d.ts +122 -20
- package/dist/index.js +164 -217
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs +100 -36
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.js +59 -2
- package/dist/openapi/index.js.map +1 -1
- package/docs/README.md +64 -31
- package/docs/endpoints.md +25 -28
- package/docs/llms-full.txt +399 -153
- package/docs/schema.md +272 -91
- package/docs/services.md +39 -4
- package/package.json +1 -1
- package/template/AGENTS.md +119 -314
- package/template/CLAUDE.md +13 -0
- package/template/controllers/notes.controller.ts +6 -13
- package/template/db/public.ts +38 -0
- package/template/models/notes/create.ts +38 -0
- package/template/package.json +6 -3
- package/template/services/note.service.test.ts +45 -0
- package/template/services/note.service.ts +2 -2
- package/dist/chunk-7Z6MGMXQ.js.map +0 -1
- package/dist/chunk-D5CQES25.js +0 -556
- package/dist/chunk-D5CQES25.js.map +0 -1
- package/dist/chunk-EIXCY4SS.js.map +0 -1
- package/dist/chunk-UWSYTUGM.js.map +0 -1
- package/template/db/schema.ts +0 -35
- /package/dist/{chunk-ERDL5VAE.js.map → chunk-5CMLOAEF.js.map} +0 -0
package/dist/openapi/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getErrorRegistry
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-5CMLOAEF.js";
|
|
4
4
|
import {
|
|
5
|
+
getRoom,
|
|
5
6
|
getRoutes,
|
|
6
7
|
isController,
|
|
7
8
|
resolveController,
|
|
8
9
|
resolveEffectiveAuth
|
|
9
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-ZQRWW37O.js";
|
|
10
11
|
import {
|
|
11
12
|
__commonJS,
|
|
12
13
|
__require,
|
|
@@ -5832,6 +5833,9 @@ var DEFAULT_IGNORE = [
|
|
|
5832
5833
|
"**/node_modules/**"
|
|
5833
5834
|
];
|
|
5834
5835
|
function flattenController(controller) {
|
|
5836
|
+
if (getRoom(controller) !== void 0 && !isController(controller)) {
|
|
5837
|
+
return [];
|
|
5838
|
+
}
|
|
5835
5839
|
const meta = resolveController(controller);
|
|
5836
5840
|
const controllerName = deriveControllerName(controller.name);
|
|
5837
5841
|
const routes = getRoutes(controller);
|
|
@@ -6161,6 +6165,44 @@ function isRefinedSchema(schema) {
|
|
|
6161
6165
|
if (!typeName) return false;
|
|
6162
6166
|
return typeName === "ZodEffects" || typeName === "ZodPreprocess" || typeName === "ZodTransform";
|
|
6163
6167
|
}
|
|
6168
|
+
function firstUntypedField(schema) {
|
|
6169
|
+
const shape = schema?.shape;
|
|
6170
|
+
if (!shape) return void 0;
|
|
6171
|
+
for (const [field, sub] of Object.entries(shape)) {
|
|
6172
|
+
const kind = sub?._def?.typeName;
|
|
6173
|
+
if (kind === "ZodUnknown" || kind === "ZodAny") return field;
|
|
6174
|
+
}
|
|
6175
|
+
return void 0;
|
|
6176
|
+
}
|
|
6177
|
+
function assertRoomFieldsTyped(pattern, room) {
|
|
6178
|
+
for (const [event, schema] of Object.entries(room.events)) {
|
|
6179
|
+
const field = firstUntypedField(schema);
|
|
6180
|
+
if (field !== void 0) {
|
|
6181
|
+
throw new Error(
|
|
6182
|
+
`@Room("${pattern}") event "${event}" has an untyped field "${field}". An untyped payload makes every generated client opaque \u2014 declare its shape.`
|
|
6183
|
+
);
|
|
6184
|
+
}
|
|
6185
|
+
}
|
|
6186
|
+
for (const [message, meta] of Object.entries(room.messages)) {
|
|
6187
|
+
const field = firstUntypedField(meta.schema);
|
|
6188
|
+
if (field !== void 0) {
|
|
6189
|
+
throw new Error(
|
|
6190
|
+
`@Room("${pattern}") message "${message}" has an untyped field "${field}". Inbound payloads reach the server \u2014 declare the shape so it can be validated.`
|
|
6191
|
+
);
|
|
6192
|
+
}
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6195
|
+
function roomExtension(room, register) {
|
|
6196
|
+
const events = {};
|
|
6197
|
+
for (const [name, schema] of Object.entries(room.events)) {
|
|
6198
|
+
events[name] = { $ref: register(name, schema) };
|
|
6199
|
+
}
|
|
6200
|
+
const messages = {};
|
|
6201
|
+
for (const [name, meta] of Object.entries(room.messages)) {
|
|
6202
|
+
messages[name] = { $ref: register(name, meta.schema) };
|
|
6203
|
+
}
|
|
6204
|
+
return { events, messages, graceMs: room.graceMs };
|
|
6205
|
+
}
|
|
6164
6206
|
|
|
6165
6207
|
// src/openapi/aggregate.ts
|
|
6166
6208
|
extendZodWithOpenApi2(z2);
|
|
@@ -6186,6 +6228,18 @@ async function aggregateOpenAPI(projectRoot, options = {}) {
|
|
|
6186
6228
|
registerControllerRoute(registry, route);
|
|
6187
6229
|
}
|
|
6188
6230
|
const generator = new OpenApiGeneratorV312(registry.definitions);
|
|
6231
|
+
const roomExt = {};
|
|
6232
|
+
for (const lc of loadedControllers) {
|
|
6233
|
+
const room = getRoom(lc.controller);
|
|
6234
|
+
if (room === void 0) continue;
|
|
6235
|
+
assertRoomFieldsTyped(room.pattern, room);
|
|
6236
|
+
const slug = room.pattern.replace(/[^A-Za-z0-9]+/g, "_").replace(/^_|_$/g, "");
|
|
6237
|
+
roomExt[room.pattern] = roomExtension(room, (name, schema) => {
|
|
6238
|
+
const componentName = `Room_${slug}_${name}`;
|
|
6239
|
+
registry.register(componentName, schema);
|
|
6240
|
+
return `#/components/schemas/${componentName}`;
|
|
6241
|
+
});
|
|
6242
|
+
}
|
|
6189
6243
|
const document = generator.generateDocument({
|
|
6190
6244
|
openapi: "3.2.0",
|
|
6191
6245
|
info: {
|
|
@@ -6194,6 +6248,9 @@ async function aggregateOpenAPI(projectRoot, options = {}) {
|
|
|
6194
6248
|
description: "Auto-generated from class controllers (@Controller/@Get/@Post + @Body/@QueryParams/@Param) Zod schemas + method return types at deploy time. Do not edit by hand."
|
|
6195
6249
|
}
|
|
6196
6250
|
});
|
|
6251
|
+
if (Object.keys(roomExt).length > 0) {
|
|
6252
|
+
document["x-palbase-room"] = roomExt;
|
|
6253
|
+
}
|
|
6197
6254
|
return {
|
|
6198
6255
|
document,
|
|
6199
6256
|
endpointCount: controllerRoutes.length,
|