@palbase/backend 23.0.0 → 24.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 +695 -61
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +4 -5
- package/dist/bin/palbase-backend.js.map +1 -1
- package/dist/{chunk-FSGSB42K.js → chunk-7Z6MGMXQ.js} +64 -4
- package/dist/chunk-7Z6MGMXQ.js.map +1 -0
- package/dist/{chunk-OMRTHM4X.js → chunk-H3JAISUY.js} +136 -1
- package/dist/chunk-H3JAISUY.js.map +1 -0
- package/dist/{chunk-REZU6UKT.js → chunk-NXDH6VQJ.js} +549 -42
- package/dist/chunk-NXDH6VQJ.js.map +1 -0
- package/dist/{chunk-W5ODXPY3.js → chunk-P2Q27SGP.js} +32 -3
- package/dist/chunk-P2Q27SGP.js.map +1 -0
- package/dist/{chunk-ZC6Q2BRD.js → chunk-T5IOSOE5.js} +7 -2
- package/dist/chunk-T5IOSOE5.js.map +1 -0
- package/dist/{chunk-HAF67F2H.js → chunk-ZUGY7RGS.js} +86 -3
- package/dist/chunk-ZUGY7RGS.js.map +1 -0
- package/dist/db/index.cjs +115 -3
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.d.cts +2 -2
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.js +2 -2
- package/dist/{endpoint-BavvbW4P.d.ts → endpoint-0_DGBajf.d.ts} +168 -9
- package/dist/{endpoint-i8TTCohk.d.cts → endpoint-CcQ1a36a.d.cts} +168 -9
- package/dist/engine/index.cjs +684 -48
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +4 -4
- package/dist/engine/index.d.ts +4 -4
- package/dist/engine/index.js +4 -4
- package/dist/{index-B3jmmItD.d.ts → index-CJiJU9ux.d.ts} +209 -36
- package/dist/{index-Bmvx1EvJ.d.cts → index-D-4-PNuQ.d.cts} +209 -36
- package/dist/{index-B7YBEG5w.d.ts → index-D17r-MKb.d.ts} +177 -7
- package/dist/{index-E7OscPJT.d.cts → index-DRFxf07H.d.cts} +177 -7
- package/dist/index.cjs +269 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -12
- package/dist/index.d.ts +54 -12
- package/dist/index.js +54 -11
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs +45 -5
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +9 -4
- package/dist/openapi/index.d.ts +9 -4
- package/dist/openapi/index.js +35 -11
- package/dist/openapi/index.js.map +1 -1
- package/dist/{registry-C3H2uPeZ.d.cts → registry-1X-skBNu.d.cts} +101 -7
- package/dist/{registry-DY3d9l1k.d.ts → registry-CEod_5sz.d.ts} +101 -7
- package/dist/test/index.cjs +509 -9
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.d.cts +35 -3
- package/dist/test/index.d.ts +35 -3
- package/dist/test/index.js +507 -8
- package/dist/test/index.js.map +1 -1
- package/docs/README.md +4 -4
- package/docs/database.md +115 -11
- package/docs/getting-started.md +5 -4
- package/docs/llms-full.txt +385 -89
- package/docs/migrations.md +81 -59
- package/docs/schema.md +82 -2
- package/docs/services.md +98 -9
- package/package.json +3 -2
- package/stager/return_types.js +23 -0
- package/template/AGENTS.md +121 -41
- package/template/controllers/notes.controller.ts +64 -0
- package/template/package.json +1 -1
- package/template/services/note.service.ts +74 -0
- package/template/tsconfig.json +11 -1
- package/dist/chunk-FSGSB42K.js.map +0 -1
- package/dist/chunk-HAF67F2H.js.map +0 -1
- package/dist/chunk-OMRTHM4X.js.map +0 -1
- package/dist/chunk-REZU6UKT.js.map +0 -1
- package/dist/chunk-W5ODXPY3.js.map +0 -1
- package/dist/chunk-Y5HXVUMP.js +0 -90
- package/dist/chunk-Y5HXVUMP.js.map +0 -1
- package/dist/chunk-ZC6Q2BRD.js.map +0 -1
package/dist/openapi/index.cjs
CHANGED
|
@@ -5869,6 +5869,11 @@ function getErrorRegistry() {
|
|
|
5869
5869
|
["forbidden", 403, "Forbidden"],
|
|
5870
5870
|
["not_found", 404, "NotFound"],
|
|
5871
5871
|
["conflict", 409, "Conflict"],
|
|
5872
|
+
// The engine's own 23505 conversion (engine/db.ts) throws this, and an
|
|
5873
|
+
// author may too. Registered like every other built-in so the spec
|
|
5874
|
+
// emitter resolves it — an unregistered code is SKIPPED silently there
|
|
5875
|
+
// (openapi/convert.ts) and would degrade to the client's `.other` case.
|
|
5876
|
+
["unique_violation", 409, "UniqueViolation"],
|
|
5872
5877
|
["too_many_requests", 429, "TooManyRequests"]
|
|
5873
5878
|
]) {
|
|
5874
5879
|
const dataSchema = BUILTIN_DATA_SCHEMAS[code];
|
|
@@ -5948,6 +5953,16 @@ function getRoutes(ctor) {
|
|
|
5948
5953
|
|
|
5949
5954
|
// src/decorators/controller.ts
|
|
5950
5955
|
var CONTROLLER_META = /* @__PURE__ */ Symbol.for("palbase.backend.controllerMeta");
|
|
5956
|
+
var APP_DEFAULT_AUTH = /* @__PURE__ */ Symbol.for("palbase.backend.appDefaultAuth");
|
|
5957
|
+
function appAuthSlot() {
|
|
5958
|
+
return globalThis;
|
|
5959
|
+
}
|
|
5960
|
+
function getDefaultAuth() {
|
|
5961
|
+
return appAuthSlot()[APP_DEFAULT_AUTH];
|
|
5962
|
+
}
|
|
5963
|
+
function resolveEffectiveAuth(routeAuth, controllerAuth) {
|
|
5964
|
+
return routeAuth ?? controllerAuth ?? getDefaultAuth() ?? true;
|
|
5965
|
+
}
|
|
5951
5966
|
function isController(value) {
|
|
5952
5967
|
if (typeof value !== "function" && (typeof value !== "object" || value === null)) {
|
|
5953
5968
|
return false;
|
|
@@ -6014,10 +6029,24 @@ function flattenController(controller) {
|
|
|
6014
6029
|
const meta = resolveController(controller);
|
|
6015
6030
|
const controllerName = deriveControllerName(controller.name);
|
|
6016
6031
|
const routes = getRoutes(controller);
|
|
6032
|
+
const kindsByMethod = /* @__PURE__ */ new Map();
|
|
6033
|
+
for (const route of routes) {
|
|
6034
|
+
const seen = kindsByMethod.get(route.fnName) ?? { sse: false, upload: false };
|
|
6035
|
+
if (route.options.sseConfig !== void 0) seen.sse = true;
|
|
6036
|
+
if (route.options.uploadConfig !== void 0) seen.upload = true;
|
|
6037
|
+
kindsByMethod.set(route.fnName, seen);
|
|
6038
|
+
}
|
|
6039
|
+
for (const [fnName, seen] of kindsByMethod) {
|
|
6040
|
+
if (seen.sse && seen.upload) {
|
|
6041
|
+
throw new Error(
|
|
6042
|
+
`${controller.name}.${fnName} declares BOTH @Sse and @Upload. One method cannot be both a streaming response and an upload completion handler \u2014 the two describe the same handler twice and the second one read silently wins. Split them into two methods.`
|
|
6043
|
+
);
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6017
6046
|
const out = [];
|
|
6018
6047
|
for (const route of routes) {
|
|
6019
6048
|
const fullPath = joinControllerPath(meta.basePath, route.subpath);
|
|
6020
|
-
const effectiveAuth = route.options.auth
|
|
6049
|
+
const effectiveAuth = resolveEffectiveAuth(route.options.auth, meta.defaultAuth);
|
|
6021
6050
|
const inputSchemas = {};
|
|
6022
6051
|
const pathParams = [];
|
|
6023
6052
|
for (const p of route.params) {
|
|
@@ -6054,7 +6083,8 @@ function flattenController(controller) {
|
|
|
6054
6083
|
...route.returnSchema !== void 0 ? { returnSchema: route.returnSchema } : {},
|
|
6055
6084
|
...route.options.rateLimit !== void 0 ? { rateLimit: route.options.rateLimit } : {},
|
|
6056
6085
|
...allThrows.length > 0 ? { throws: allThrows } : {},
|
|
6057
|
-
...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {}
|
|
6086
|
+
...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {},
|
|
6087
|
+
...route.options.sseConfig !== void 0 ? { sseConfig: route.options.sseConfig } : {}
|
|
6058
6088
|
});
|
|
6059
6089
|
}
|
|
6060
6090
|
return out;
|
|
@@ -6152,7 +6182,8 @@ function registerControllerRoute(registry, route) {
|
|
|
6152
6182
|
returnSchema: route.returnSchema,
|
|
6153
6183
|
effectiveAuth: route.effectiveAuth,
|
|
6154
6184
|
throws: route.throws,
|
|
6155
|
-
...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {}
|
|
6185
|
+
...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {},
|
|
6186
|
+
...route.sseConfig !== void 0 ? { sseConfig: route.sseConfig } : {}
|
|
6156
6187
|
});
|
|
6157
6188
|
}
|
|
6158
6189
|
function registerOperation(registry, op) {
|
|
@@ -6173,7 +6204,11 @@ function registerOperation(registry, op) {
|
|
|
6173
6204
|
description: "Success",
|
|
6174
6205
|
content: {
|
|
6175
6206
|
"application/json": {
|
|
6176
|
-
|
|
6207
|
+
// A streaming operation's response is ONE FRAME, and its schema is the
|
|
6208
|
+
// declared frame — not the handler's return type, which is void. Without
|
|
6209
|
+
// this the document describes an untyped response and every generated
|
|
6210
|
+
// client is opaque (measured live: the contract gate refuses the deploy).
|
|
6211
|
+
schema: op.sseConfig !== void 0 ? op.sseConfig.frame : op.returnSchema !== void 0 ? op.returnSchema : import_zod2.z.unknown()
|
|
6177
6212
|
}
|
|
6178
6213
|
}
|
|
6179
6214
|
},
|
|
@@ -6220,7 +6255,12 @@ function registerOperation(registry, op) {
|
|
|
6220
6255
|
bucket: op.uploadConfig.bucket,
|
|
6221
6256
|
pathTemplate: op.uploadConfig.pathTemplate
|
|
6222
6257
|
}
|
|
6223
|
-
} : {}
|
|
6258
|
+
} : {},
|
|
6259
|
+
// Without this extension the document describes a streaming route as a
|
|
6260
|
+
// plain POST, and every client generated from it reads the body ONCE
|
|
6261
|
+
// instead of iterating frames — a generated client that compiles, runs and
|
|
6262
|
+
// is simply wrong. Same failure class as the upload extension above.
|
|
6263
|
+
...op.sseConfig !== void 0 ? { "x-palbase-sse": {} } : {}
|
|
6224
6264
|
});
|
|
6225
6265
|
}
|
|
6226
6266
|
function resolveThrows(throws) {
|