@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.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { ZodTypeAny } from 'zod';
|
|
3
|
-
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-
|
|
4
|
-
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig } from '../registry-
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-CcQ1a36a.cjs';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-1X-skBNu.cjs';
|
|
5
5
|
import '../stack.cjs';
|
|
6
6
|
|
|
7
7
|
/** A controller class (constructor). Kept loose — the only contract is that it
|
|
@@ -39,7 +39,8 @@ interface FlatRoute {
|
|
|
39
39
|
* (MembersController → "members"). "" when the derivation is empty — the
|
|
40
40
|
* operationId then falls back to the flat verb-prefixed form. */
|
|
41
41
|
controllerName: string;
|
|
42
|
-
/** Resolved auth: route option ?? controller default ??
|
|
42
|
+
/** Resolved auth: route option ?? controller default ?? application default
|
|
43
|
+
* ?? true (secure) — the cascade lives in `resolveEffectiveAuth`. */
|
|
43
44
|
effectiveAuth: AuthSpec;
|
|
44
45
|
/** All parameter metas for this route (ordered by index). */
|
|
45
46
|
params: ParamMeta[];
|
|
@@ -58,6 +59,9 @@ interface FlatRoute {
|
|
|
58
59
|
* presence MARKS this as an upload route through openapi + codegen (the bytes
|
|
59
60
|
* go client→storage; the method body is the completion handler). */
|
|
60
61
|
uploadConfig?: UploadConfig;
|
|
62
|
+
/** Present ONLY on `@Sse` routes — the marker the converter turns into
|
|
63
|
+
* `x-palbase-sse`. */
|
|
64
|
+
sseConfig?: SseConfig;
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
67
|
* Flatten a `@Controller` class into its route entries. The full path is
|
|
@@ -65,7 +69,8 @@ interface FlatRoute {
|
|
|
65
69
|
* `<controllerName>.<fnName>` id (PlacesController.importNearby →
|
|
66
70
|
* places.importNearby) — matching the Go runtime (extract_meta.js derives the
|
|
67
71
|
* namespace from the class name; generator.go joins). Effective auth resolves
|
|
68
|
-
* the cascade (route ?? controller default ??
|
|
72
|
+
* the cascade (route ?? controller default ?? application default ??
|
|
73
|
+
* secure-by-default) through the one resolver the route table asks too.
|
|
69
74
|
*/
|
|
70
75
|
declare function flattenController(controller: ControllerClass): FlatRoute[];
|
|
71
76
|
/** The operationId for a route — exposed so callers (convert/aggregate)
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { ZodTypeAny } from 'zod';
|
|
3
|
-
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-
|
|
4
|
-
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig } from '../registry-
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-0_DGBajf.js';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-CEod_5sz.js';
|
|
5
5
|
import '../stack.js';
|
|
6
6
|
|
|
7
7
|
/** A controller class (constructor). Kept loose — the only contract is that it
|
|
@@ -39,7 +39,8 @@ interface FlatRoute {
|
|
|
39
39
|
* (MembersController → "members"). "" when the derivation is empty — the
|
|
40
40
|
* operationId then falls back to the flat verb-prefixed form. */
|
|
41
41
|
controllerName: string;
|
|
42
|
-
/** Resolved auth: route option ?? controller default ??
|
|
42
|
+
/** Resolved auth: route option ?? controller default ?? application default
|
|
43
|
+
* ?? true (secure) — the cascade lives in `resolveEffectiveAuth`. */
|
|
43
44
|
effectiveAuth: AuthSpec;
|
|
44
45
|
/** All parameter metas for this route (ordered by index). */
|
|
45
46
|
params: ParamMeta[];
|
|
@@ -58,6 +59,9 @@ interface FlatRoute {
|
|
|
58
59
|
* presence MARKS this as an upload route through openapi + codegen (the bytes
|
|
59
60
|
* go client→storage; the method body is the completion handler). */
|
|
60
61
|
uploadConfig?: UploadConfig;
|
|
62
|
+
/** Present ONLY on `@Sse` routes — the marker the converter turns into
|
|
63
|
+
* `x-palbase-sse`. */
|
|
64
|
+
sseConfig?: SseConfig;
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
67
|
* Flatten a `@Controller` class into its route entries. The full path is
|
|
@@ -65,7 +69,8 @@ interface FlatRoute {
|
|
|
65
69
|
* `<controllerName>.<fnName>` id (PlacesController.importNearby →
|
|
66
70
|
* places.importNearby) — matching the Go runtime (extract_meta.js derives the
|
|
67
71
|
* namespace from the class name; generator.go joins). Effective auth resolves
|
|
68
|
-
* the cascade (route ?? controller default ??
|
|
72
|
+
* the cascade (route ?? controller default ?? application default ??
|
|
73
|
+
* secure-by-default) through the one resolver the route table asks too.
|
|
69
74
|
*/
|
|
70
75
|
declare function flattenController(controller: ControllerClass): FlatRoute[];
|
|
71
76
|
/** The operationId for a route — exposed so callers (convert/aggregate)
|
package/dist/openapi/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getErrorRegistry
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-T5IOSOE5.js";
|
|
4
4
|
import {
|
|
5
|
+
getRoutes,
|
|
5
6
|
isController,
|
|
6
|
-
resolveController
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
getRoutes
|
|
10
|
-
} from "../chunk-OMRTHM4X.js";
|
|
7
|
+
resolveController,
|
|
8
|
+
resolveEffectiveAuth
|
|
9
|
+
} from "../chunk-H3JAISUY.js";
|
|
11
10
|
import {
|
|
12
11
|
__commonJS,
|
|
13
12
|
__require,
|
|
@@ -5836,10 +5835,24 @@ function flattenController(controller) {
|
|
|
5836
5835
|
const meta = resolveController(controller);
|
|
5837
5836
|
const controllerName = deriveControllerName(controller.name);
|
|
5838
5837
|
const routes = getRoutes(controller);
|
|
5838
|
+
const kindsByMethod = /* @__PURE__ */ new Map();
|
|
5839
|
+
for (const route of routes) {
|
|
5840
|
+
const seen = kindsByMethod.get(route.fnName) ?? { sse: false, upload: false };
|
|
5841
|
+
if (route.options.sseConfig !== void 0) seen.sse = true;
|
|
5842
|
+
if (route.options.uploadConfig !== void 0) seen.upload = true;
|
|
5843
|
+
kindsByMethod.set(route.fnName, seen);
|
|
5844
|
+
}
|
|
5845
|
+
for (const [fnName, seen] of kindsByMethod) {
|
|
5846
|
+
if (seen.sse && seen.upload) {
|
|
5847
|
+
throw new Error(
|
|
5848
|
+
`${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.`
|
|
5849
|
+
);
|
|
5850
|
+
}
|
|
5851
|
+
}
|
|
5839
5852
|
const out = [];
|
|
5840
5853
|
for (const route of routes) {
|
|
5841
5854
|
const fullPath = joinControllerPath(meta.basePath, route.subpath);
|
|
5842
|
-
const effectiveAuth = route.options.auth
|
|
5855
|
+
const effectiveAuth = resolveEffectiveAuth(route.options.auth, meta.defaultAuth);
|
|
5843
5856
|
const inputSchemas = {};
|
|
5844
5857
|
const pathParams = [];
|
|
5845
5858
|
for (const p of route.params) {
|
|
@@ -5876,7 +5889,8 @@ function flattenController(controller) {
|
|
|
5876
5889
|
...route.returnSchema !== void 0 ? { returnSchema: route.returnSchema } : {},
|
|
5877
5890
|
...route.options.rateLimit !== void 0 ? { rateLimit: route.options.rateLimit } : {},
|
|
5878
5891
|
...allThrows.length > 0 ? { throws: allThrows } : {},
|
|
5879
|
-
...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {}
|
|
5892
|
+
...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {},
|
|
5893
|
+
...route.options.sseConfig !== void 0 ? { sseConfig: route.options.sseConfig } : {}
|
|
5880
5894
|
});
|
|
5881
5895
|
}
|
|
5882
5896
|
return out;
|
|
@@ -5974,7 +5988,8 @@ function registerControllerRoute(registry, route) {
|
|
|
5974
5988
|
returnSchema: route.returnSchema,
|
|
5975
5989
|
effectiveAuth: route.effectiveAuth,
|
|
5976
5990
|
throws: route.throws,
|
|
5977
|
-
...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {}
|
|
5991
|
+
...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {},
|
|
5992
|
+
...route.sseConfig !== void 0 ? { sseConfig: route.sseConfig } : {}
|
|
5978
5993
|
});
|
|
5979
5994
|
}
|
|
5980
5995
|
function registerOperation(registry, op) {
|
|
@@ -5995,7 +6010,11 @@ function registerOperation(registry, op) {
|
|
|
5995
6010
|
description: "Success",
|
|
5996
6011
|
content: {
|
|
5997
6012
|
"application/json": {
|
|
5998
|
-
|
|
6013
|
+
// A streaming operation's response is ONE FRAME, and its schema is the
|
|
6014
|
+
// declared frame — not the handler's return type, which is void. Without
|
|
6015
|
+
// this the document describes an untyped response and every generated
|
|
6016
|
+
// client is opaque (measured live: the contract gate refuses the deploy).
|
|
6017
|
+
schema: op.sseConfig !== void 0 ? op.sseConfig.frame : op.returnSchema !== void 0 ? op.returnSchema : z.unknown()
|
|
5999
6018
|
}
|
|
6000
6019
|
}
|
|
6001
6020
|
},
|
|
@@ -6042,7 +6061,12 @@ function registerOperation(registry, op) {
|
|
|
6042
6061
|
bucket: op.uploadConfig.bucket,
|
|
6043
6062
|
pathTemplate: op.uploadConfig.pathTemplate
|
|
6044
6063
|
}
|
|
6045
|
-
} : {}
|
|
6064
|
+
} : {},
|
|
6065
|
+
// Without this extension the document describes a streaming route as a
|
|
6066
|
+
// plain POST, and every client generated from it reads the body ONCE
|
|
6067
|
+
// instead of iterating frames — a generated client that compiles, runs and
|
|
6068
|
+
// is simply wrong. Same failure class as the upload extension above.
|
|
6069
|
+
...op.sseConfig !== void 0 ? { "x-palbase-sse": {} } : {}
|
|
6046
6070
|
});
|
|
6047
6071
|
}
|
|
6048
6072
|
function resolveThrows(throws) {
|