@palbase/backend 17.3.0 → 18.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 +1848 -0
- package/dist/bin/palbase-backend.cjs.map +1 -0
- package/dist/bin/palbase-backend.d.cts +1 -0
- package/dist/bin/palbase-backend.d.ts +1 -0
- package/dist/bin/palbase-backend.js +168 -0
- package/dist/bin/palbase-backend.js.map +1 -0
- package/dist/chunk-7D4SUZUM.js +38 -0
- package/dist/chunk-7D4SUZUM.js.map +1 -0
- package/dist/chunk-N32VDWKH.js +172 -0
- package/dist/chunk-N32VDWKH.js.map +1 -0
- package/dist/chunk-POYAFBLF.js +189 -0
- package/dist/chunk-POYAFBLF.js.map +1 -0
- package/dist/chunk-QMVK4X3V.js +200 -0
- package/dist/chunk-QMVK4X3V.js.map +1 -0
- package/dist/chunk-SSGAMC26.js +342 -0
- package/dist/chunk-SSGAMC26.js.map +1 -0
- package/dist/chunk-VYH4U7ZQ.js +1138 -0
- package/dist/chunk-VYH4U7ZQ.js.map +1 -0
- package/dist/{chunk-IBIME7N2.js → chunk-W5ODXPY3.js} +2 -321
- package/dist/chunk-W5ODXPY3.js.map +1 -0
- package/dist/chunk-YL4C5NRY.js +90 -0
- package/dist/chunk-YL4C5NRY.js.map +1 -0
- package/dist/db/env.cjs.map +1 -1
- package/dist/db/env.d.cts +21 -1
- package/dist/db/env.d.ts +21 -1
- package/dist/db/index.cjs +15 -0
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.d.cts +2 -1
- package/dist/db/index.d.ts +2 -1
- package/dist/db/index.js +9 -6
- package/dist/{index-J1tnAnFj.d.ts → endpoint-B0LpZixz.d.cts} +124 -667
- package/dist/{index-D6mRh4yq.d.cts → endpoint-B0LpZixz.d.ts} +124 -667
- package/dist/engine/index.cjs +1797 -0
- package/dist/engine/index.cjs.map +1 -0
- package/dist/engine/index.d.cts +7 -0
- package/dist/engine/index.d.ts +7 -0
- package/dist/engine/index.js +43 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/index-B46CGNvx.d.cts +839 -0
- package/dist/index-BGSCWlUa.d.cts +674 -0
- package/dist/index-DZDUMth5.d.ts +839 -0
- package/dist/index-g-EzitI-.d.ts +674 -0
- package/dist/index.cjs +1046 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +290 -532
- package/dist/index.d.ts +290 -532
- package/dist/index.js +999 -509
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs +6464 -0
- package/dist/openapi/index.cjs.map +1 -0
- package/dist/openapi/index.d.cts +170 -0
- package/dist/openapi/index.d.ts +170 -0
- package/dist/openapi/index.js +6248 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/registry-3BLYv4si.d.ts +338 -0
- package/dist/registry-Cw0YEYCg.d.cts +338 -0
- package/dist/test/index.js +2 -0
- package/dist/test/index.js.map +1 -1
- package/docs/database.md +16 -3
- package/docs/llms-full.txt +16 -3
- package/package.json +43 -13
- package/stager/package.json +4 -0
- package/stager/return_types.js +338 -0
- package/stager/stage.js +78 -0
- package/stager/throw_analysis.js +726 -0
- package/template/AGENTS.md +261 -0
- package/template/config/secrets.ts +24 -0
- package/template/controllers/health.controller.ts +30 -0
- package/template/db/schema.ts +35 -0
- package/template/package.json +18 -0
- package/template/tsconfig.json +30 -0
- package/LICENSE +0 -21
- package/dist/chunk-IBIME7N2.js.map +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
|
+
import { ZodTypeAny } from 'zod';
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-B0LpZixz.cjs';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig } from '../registry-Cw0YEYCg.cjs';
|
|
5
|
+
|
|
6
|
+
/** A controller class (constructor). Kept loose — the only contract is that it
|
|
7
|
+
* is a `@Controller`-decorated class, asserted via {@link isController}. */
|
|
8
|
+
type ControllerClass = abstract new (...args: never[]) => object;
|
|
9
|
+
/** A controller module loaded from a `controllers/*.controller.ts` file. */
|
|
10
|
+
interface LoadedController {
|
|
11
|
+
/** Path relative to projectRoot, posix-normalised. */
|
|
12
|
+
relativePath: string;
|
|
13
|
+
/** The default-exported `@Controller` class. */
|
|
14
|
+
controller: ControllerClass;
|
|
15
|
+
}
|
|
16
|
+
/** The zod schemas one route declares, split by request source. Each is present
|
|
17
|
+
* only when the matching parameter decorator (`@Body`/`@QueryParams`/`@Headers`) is. */
|
|
18
|
+
interface RouteInputSchemas {
|
|
19
|
+
body?: ZodTypeAny;
|
|
20
|
+
query?: ZodTypeAny;
|
|
21
|
+
/** A single `params` schema, when one is declared (currently only via
|
|
22
|
+
* individual `@Param("id")` decorators — collected into `pathParams`). */
|
|
23
|
+
params?: ZodTypeAny;
|
|
24
|
+
headers?: ZodTypeAny;
|
|
25
|
+
}
|
|
26
|
+
/** One flattened route: the HTTP verb, the FULL path (basePath + subpath), the
|
|
27
|
+
* dotted operationId inputs (controllerName + fnName), the resolved effective
|
|
28
|
+
* auth, the per-source input schemas, the named path params, the return
|
|
29
|
+
* schema, and the rate limit. */
|
|
30
|
+
interface FlatRoute {
|
|
31
|
+
method: string;
|
|
32
|
+
/** basePath + subpath, collapsed (the full route path). */
|
|
33
|
+
fullPath: string;
|
|
34
|
+
/** The controller method name — the method-name half of the dotted
|
|
35
|
+
* operationId `<controllerName>.<fnName>`; also the worker dispatch key. */
|
|
36
|
+
fnName: string;
|
|
37
|
+
/** The dotted-operationId namespace derived from the controller CLASS name
|
|
38
|
+
* (MembersController → "members"). "" when the derivation is empty — the
|
|
39
|
+
* operationId then falls back to the flat verb-prefixed form. */
|
|
40
|
+
controllerName: string;
|
|
41
|
+
/** Resolved auth: route option ?? controller default ?? true (secure). */
|
|
42
|
+
effectiveAuth: AuthSpec;
|
|
43
|
+
/** All parameter metas for this route (ordered by index). */
|
|
44
|
+
params: ParamMeta[];
|
|
45
|
+
/** zod schemas split by request source (body/query/params/headers). */
|
|
46
|
+
inputSchemas: RouteInputSchemas;
|
|
47
|
+
/** Named path params (`@Param("id")` → `"id"`), in declaration order. */
|
|
48
|
+
pathParams: string[];
|
|
49
|
+
/** The response zod schema (named by the method's return type), if any. */
|
|
50
|
+
returnSchema?: ZodTypeAny;
|
|
51
|
+
/** Per-route rate limit, if declared. */
|
|
52
|
+
rateLimit?: RateLimitConfig;
|
|
53
|
+
/** Inferred throw descriptors (recordThrows — the stager's throw analysis),
|
|
54
|
+
* if any. Resolved against the error registry at emission time. */
|
|
55
|
+
throws?: ThrowDescriptor[];
|
|
56
|
+
/** Direct-storage upload config — present ONLY on `@Upload` routes. Its
|
|
57
|
+
* presence MARKS this as an upload route through openapi + codegen (the bytes
|
|
58
|
+
* go client→storage; the method body is the completion handler). */
|
|
59
|
+
uploadConfig?: UploadConfig;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Flatten a `@Controller` class into its route entries. The full path is
|
|
63
|
+
* `basePath + subpath`; the operationId is the DOTTED
|
|
64
|
+
* `<controllerName>.<fnName>` id (PlacesController.importNearby →
|
|
65
|
+
* places.importNearby) — matching the Go runtime (extract_meta.js derives the
|
|
66
|
+
* namespace from the class name; generator.go joins). Effective auth resolves
|
|
67
|
+
* the cascade (route ?? controller default ?? secure-by-default).
|
|
68
|
+
*/
|
|
69
|
+
declare function flattenController(controller: ControllerClass): FlatRoute[];
|
|
70
|
+
/** The operationId for a route — exposed so callers (convert/aggregate)
|
|
71
|
+
* derive it consistently. Dotted `<controllerName>.<fnName>` (members.getUser)
|
|
72
|
+
* when the namespace is derivable; flat verb-prefixed fallback otherwise —
|
|
73
|
+
* byte-for-byte identical to the Go runtime's operationID() in
|
|
74
|
+
* `internal/openapi/generator.go`. */
|
|
75
|
+
declare function operationIdFor(route: FlatRoute): string;
|
|
76
|
+
/** Discover controller files under projectRoot (sorted, deterministic). */
|
|
77
|
+
declare function discoverControllerFiles(projectRoot: string): Promise<string[]>;
|
|
78
|
+
/** Error thrown when a controller module fails to import or does not
|
|
79
|
+
* default-export a `@Controller` class. */
|
|
80
|
+
declare class ControllerLoadError extends Error {
|
|
81
|
+
readonly relativePath: string;
|
|
82
|
+
readonly cause?: unknown | undefined;
|
|
83
|
+
constructor(relativePath: string, message: string, cause?: unknown | undefined);
|
|
84
|
+
}
|
|
85
|
+
/** Load every discovered controller module, returning its `@Controller` class. */
|
|
86
|
+
declare function loadControllers(absolutePaths: string[], projectRoot: string, options?: {
|
|
87
|
+
timeoutMs?: number;
|
|
88
|
+
}): Promise<LoadedController[]>;
|
|
89
|
+
|
|
90
|
+
interface AggregateOptions {
|
|
91
|
+
/** Pre-loaded controllers (test-only — bypass dynamic import). When
|
|
92
|
+
* provided, controller discovery is skipped. */
|
|
93
|
+
loadedControllers?: LoadedController[];
|
|
94
|
+
/** Document version stamped onto the spec. Defaults to `0.0.0`. */
|
|
95
|
+
version?: string;
|
|
96
|
+
/** OpenAPI `info.title`. Defaults to `Palbase Backend`. */
|
|
97
|
+
title?: string;
|
|
98
|
+
/** Per-controller import timeout. */
|
|
99
|
+
timeoutMs?: number;
|
|
100
|
+
}
|
|
101
|
+
interface AggregateResult {
|
|
102
|
+
/** Final OpenAPI 3.2 document, ready to JSON.stringify. */
|
|
103
|
+
document: ReturnType<OpenApiGeneratorV31["generateDocument"]>;
|
|
104
|
+
/** Number of routes registered. */
|
|
105
|
+
endpointCount: number;
|
|
106
|
+
/** Set of operationIds (handy for collision-detection tests). */
|
|
107
|
+
operationIds: string[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Run the full pipeline: discover controllers → load → flatten → convert →
|
|
111
|
+
* emit.
|
|
112
|
+
*
|
|
113
|
+
* Throws a ControllerLoadError on a single bad file. Throws a plain Error if
|
|
114
|
+
* two routes derive the same operationId — collisions are caught after sort()
|
|
115
|
+
* so the error message is deterministic.
|
|
116
|
+
*/
|
|
117
|
+
declare function aggregateOpenAPI(projectRoot: string, options?: AggregateOptions): Promise<AggregateResult>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Derive the dotted-operationId NAMESPACE from a controller CLASS name: strip
|
|
121
|
+
* ONE trailing "Controller" suffix (case-sensitive), then lower-case the first
|
|
122
|
+
* letter. MembersController → "members", UserProfileController →
|
|
123
|
+
* "userProfile", Members → "members". Returns "" when the derivation is empty
|
|
124
|
+
* (a class named exactly "Controller", or an anonymous class) — callers then
|
|
125
|
+
* fall back to the flat verb-prefixed id. Byte-for-byte identical to
|
|
126
|
+
* `deriveControllerName` in the Go runtime's extract_meta.js.
|
|
127
|
+
*/
|
|
128
|
+
declare function deriveControllerName(className: string): string;
|
|
129
|
+
/**
|
|
130
|
+
* Derive the FLAT, verb-prefixed FALLBACK operationId for a route from its
|
|
131
|
+
* HTTP method + FULL path — used only when the dotted
|
|
132
|
+
* `<controllerName>.<fnName>` id cannot be derived (empty controllerName).
|
|
133
|
+
* Byte-for-byte identical to the Go runtime's `flatOperationID(method, path)`
|
|
134
|
+
* in `internal/openapi/generator.go`:
|
|
135
|
+
*
|
|
136
|
+
* lower(method) + Capitalize(seg) for each path segment,
|
|
137
|
+
* with `{param}` → `ByParam`.
|
|
138
|
+
*
|
|
139
|
+
* Examples: (POST, /places/import) → "postPlacesImport";
|
|
140
|
+
* (GET, /todos/{id}) → "getTodosById".
|
|
141
|
+
*/
|
|
142
|
+
declare function deriveControllerOperationId(method: string, fullPath: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* Join a controller `basePath` with a route `subpath` into the full route path.
|
|
145
|
+
* Collapses duplicate slashes and a trailing `/` so `("/places", "/")` →
|
|
146
|
+
* `/places` and `("/", "/")` → `/`.
|
|
147
|
+
*/
|
|
148
|
+
declare function joinControllerPath(basePath: string, subpath: string): string;
|
|
149
|
+
|
|
150
|
+
declare const ERROR_ENVELOPE_REF = "PalbaseErrorEnvelope";
|
|
151
|
+
/** OpenAPI security-scheme name for the bearer token every authed route uses. */
|
|
152
|
+
declare const BEARER_SCHEME = "PalbaseBearer";
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* True when the effective auth requires a token. The cascade is resolved by the
|
|
156
|
+
* caller (route ?? controller default ?? true) into a single `AuthSpec`; this
|
|
157
|
+
* collapses it to a boolean.
|
|
158
|
+
*
|
|
159
|
+
* | AuthSpec | required |
|
|
160
|
+
* |------------------------|----------|
|
|
161
|
+
* | `true` | true |
|
|
162
|
+
* | `false` | false |
|
|
163
|
+
* | `{ required: true }` | true |
|
|
164
|
+
* | `{ required: false }` | false |
|
|
165
|
+
* | `{ role: "admin" }` | true |
|
|
166
|
+
* | `{}` | true |
|
|
167
|
+
*/
|
|
168
|
+
declare function isAuthEffectivelyRequired(auth: AuthSpec): boolean;
|
|
169
|
+
|
|
170
|
+
export { type AggregateOptions, type AggregateResult, BEARER_SCHEME, type ControllerClass, ControllerLoadError, ERROR_ENVELOPE_REF, type FlatRoute, type LoadedController, type RouteInputSchemas, aggregateOpenAPI, deriveControllerName, deriveControllerOperationId, discoverControllerFiles, flattenController, isAuthEffectivelyRequired, joinControllerPath, loadControllers, operationIdFor };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
|
+
import { ZodTypeAny } from 'zod';
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-B0LpZixz.js';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig } from '../registry-3BLYv4si.js';
|
|
5
|
+
|
|
6
|
+
/** A controller class (constructor). Kept loose — the only contract is that it
|
|
7
|
+
* is a `@Controller`-decorated class, asserted via {@link isController}. */
|
|
8
|
+
type ControllerClass = abstract new (...args: never[]) => object;
|
|
9
|
+
/** A controller module loaded from a `controllers/*.controller.ts` file. */
|
|
10
|
+
interface LoadedController {
|
|
11
|
+
/** Path relative to projectRoot, posix-normalised. */
|
|
12
|
+
relativePath: string;
|
|
13
|
+
/** The default-exported `@Controller` class. */
|
|
14
|
+
controller: ControllerClass;
|
|
15
|
+
}
|
|
16
|
+
/** The zod schemas one route declares, split by request source. Each is present
|
|
17
|
+
* only when the matching parameter decorator (`@Body`/`@QueryParams`/`@Headers`) is. */
|
|
18
|
+
interface RouteInputSchemas {
|
|
19
|
+
body?: ZodTypeAny;
|
|
20
|
+
query?: ZodTypeAny;
|
|
21
|
+
/** A single `params` schema, when one is declared (currently only via
|
|
22
|
+
* individual `@Param("id")` decorators — collected into `pathParams`). */
|
|
23
|
+
params?: ZodTypeAny;
|
|
24
|
+
headers?: ZodTypeAny;
|
|
25
|
+
}
|
|
26
|
+
/** One flattened route: the HTTP verb, the FULL path (basePath + subpath), the
|
|
27
|
+
* dotted operationId inputs (controllerName + fnName), the resolved effective
|
|
28
|
+
* auth, the per-source input schemas, the named path params, the return
|
|
29
|
+
* schema, and the rate limit. */
|
|
30
|
+
interface FlatRoute {
|
|
31
|
+
method: string;
|
|
32
|
+
/** basePath + subpath, collapsed (the full route path). */
|
|
33
|
+
fullPath: string;
|
|
34
|
+
/** The controller method name — the method-name half of the dotted
|
|
35
|
+
* operationId `<controllerName>.<fnName>`; also the worker dispatch key. */
|
|
36
|
+
fnName: string;
|
|
37
|
+
/** The dotted-operationId namespace derived from the controller CLASS name
|
|
38
|
+
* (MembersController → "members"). "" when the derivation is empty — the
|
|
39
|
+
* operationId then falls back to the flat verb-prefixed form. */
|
|
40
|
+
controllerName: string;
|
|
41
|
+
/** Resolved auth: route option ?? controller default ?? true (secure). */
|
|
42
|
+
effectiveAuth: AuthSpec;
|
|
43
|
+
/** All parameter metas for this route (ordered by index). */
|
|
44
|
+
params: ParamMeta[];
|
|
45
|
+
/** zod schemas split by request source (body/query/params/headers). */
|
|
46
|
+
inputSchemas: RouteInputSchemas;
|
|
47
|
+
/** Named path params (`@Param("id")` → `"id"`), in declaration order. */
|
|
48
|
+
pathParams: string[];
|
|
49
|
+
/** The response zod schema (named by the method's return type), if any. */
|
|
50
|
+
returnSchema?: ZodTypeAny;
|
|
51
|
+
/** Per-route rate limit, if declared. */
|
|
52
|
+
rateLimit?: RateLimitConfig;
|
|
53
|
+
/** Inferred throw descriptors (recordThrows — the stager's throw analysis),
|
|
54
|
+
* if any. Resolved against the error registry at emission time. */
|
|
55
|
+
throws?: ThrowDescriptor[];
|
|
56
|
+
/** Direct-storage upload config — present ONLY on `@Upload` routes. Its
|
|
57
|
+
* presence MARKS this as an upload route through openapi + codegen (the bytes
|
|
58
|
+
* go client→storage; the method body is the completion handler). */
|
|
59
|
+
uploadConfig?: UploadConfig;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Flatten a `@Controller` class into its route entries. The full path is
|
|
63
|
+
* `basePath + subpath`; the operationId is the DOTTED
|
|
64
|
+
* `<controllerName>.<fnName>` id (PlacesController.importNearby →
|
|
65
|
+
* places.importNearby) — matching the Go runtime (extract_meta.js derives the
|
|
66
|
+
* namespace from the class name; generator.go joins). Effective auth resolves
|
|
67
|
+
* the cascade (route ?? controller default ?? secure-by-default).
|
|
68
|
+
*/
|
|
69
|
+
declare function flattenController(controller: ControllerClass): FlatRoute[];
|
|
70
|
+
/** The operationId for a route — exposed so callers (convert/aggregate)
|
|
71
|
+
* derive it consistently. Dotted `<controllerName>.<fnName>` (members.getUser)
|
|
72
|
+
* when the namespace is derivable; flat verb-prefixed fallback otherwise —
|
|
73
|
+
* byte-for-byte identical to the Go runtime's operationID() in
|
|
74
|
+
* `internal/openapi/generator.go`. */
|
|
75
|
+
declare function operationIdFor(route: FlatRoute): string;
|
|
76
|
+
/** Discover controller files under projectRoot (sorted, deterministic). */
|
|
77
|
+
declare function discoverControllerFiles(projectRoot: string): Promise<string[]>;
|
|
78
|
+
/** Error thrown when a controller module fails to import or does not
|
|
79
|
+
* default-export a `@Controller` class. */
|
|
80
|
+
declare class ControllerLoadError extends Error {
|
|
81
|
+
readonly relativePath: string;
|
|
82
|
+
readonly cause?: unknown | undefined;
|
|
83
|
+
constructor(relativePath: string, message: string, cause?: unknown | undefined);
|
|
84
|
+
}
|
|
85
|
+
/** Load every discovered controller module, returning its `@Controller` class. */
|
|
86
|
+
declare function loadControllers(absolutePaths: string[], projectRoot: string, options?: {
|
|
87
|
+
timeoutMs?: number;
|
|
88
|
+
}): Promise<LoadedController[]>;
|
|
89
|
+
|
|
90
|
+
interface AggregateOptions {
|
|
91
|
+
/** Pre-loaded controllers (test-only — bypass dynamic import). When
|
|
92
|
+
* provided, controller discovery is skipped. */
|
|
93
|
+
loadedControllers?: LoadedController[];
|
|
94
|
+
/** Document version stamped onto the spec. Defaults to `0.0.0`. */
|
|
95
|
+
version?: string;
|
|
96
|
+
/** OpenAPI `info.title`. Defaults to `Palbase Backend`. */
|
|
97
|
+
title?: string;
|
|
98
|
+
/** Per-controller import timeout. */
|
|
99
|
+
timeoutMs?: number;
|
|
100
|
+
}
|
|
101
|
+
interface AggregateResult {
|
|
102
|
+
/** Final OpenAPI 3.2 document, ready to JSON.stringify. */
|
|
103
|
+
document: ReturnType<OpenApiGeneratorV31["generateDocument"]>;
|
|
104
|
+
/** Number of routes registered. */
|
|
105
|
+
endpointCount: number;
|
|
106
|
+
/** Set of operationIds (handy for collision-detection tests). */
|
|
107
|
+
operationIds: string[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Run the full pipeline: discover controllers → load → flatten → convert →
|
|
111
|
+
* emit.
|
|
112
|
+
*
|
|
113
|
+
* Throws a ControllerLoadError on a single bad file. Throws a plain Error if
|
|
114
|
+
* two routes derive the same operationId — collisions are caught after sort()
|
|
115
|
+
* so the error message is deterministic.
|
|
116
|
+
*/
|
|
117
|
+
declare function aggregateOpenAPI(projectRoot: string, options?: AggregateOptions): Promise<AggregateResult>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Derive the dotted-operationId NAMESPACE from a controller CLASS name: strip
|
|
121
|
+
* ONE trailing "Controller" suffix (case-sensitive), then lower-case the first
|
|
122
|
+
* letter. MembersController → "members", UserProfileController →
|
|
123
|
+
* "userProfile", Members → "members". Returns "" when the derivation is empty
|
|
124
|
+
* (a class named exactly "Controller", or an anonymous class) — callers then
|
|
125
|
+
* fall back to the flat verb-prefixed id. Byte-for-byte identical to
|
|
126
|
+
* `deriveControllerName` in the Go runtime's extract_meta.js.
|
|
127
|
+
*/
|
|
128
|
+
declare function deriveControllerName(className: string): string;
|
|
129
|
+
/**
|
|
130
|
+
* Derive the FLAT, verb-prefixed FALLBACK operationId for a route from its
|
|
131
|
+
* HTTP method + FULL path — used only when the dotted
|
|
132
|
+
* `<controllerName>.<fnName>` id cannot be derived (empty controllerName).
|
|
133
|
+
* Byte-for-byte identical to the Go runtime's `flatOperationID(method, path)`
|
|
134
|
+
* in `internal/openapi/generator.go`:
|
|
135
|
+
*
|
|
136
|
+
* lower(method) + Capitalize(seg) for each path segment,
|
|
137
|
+
* with `{param}` → `ByParam`.
|
|
138
|
+
*
|
|
139
|
+
* Examples: (POST, /places/import) → "postPlacesImport";
|
|
140
|
+
* (GET, /todos/{id}) → "getTodosById".
|
|
141
|
+
*/
|
|
142
|
+
declare function deriveControllerOperationId(method: string, fullPath: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* Join a controller `basePath` with a route `subpath` into the full route path.
|
|
145
|
+
* Collapses duplicate slashes and a trailing `/` so `("/places", "/")` →
|
|
146
|
+
* `/places` and `("/", "/")` → `/`.
|
|
147
|
+
*/
|
|
148
|
+
declare function joinControllerPath(basePath: string, subpath: string): string;
|
|
149
|
+
|
|
150
|
+
declare const ERROR_ENVELOPE_REF = "PalbaseErrorEnvelope";
|
|
151
|
+
/** OpenAPI security-scheme name for the bearer token every authed route uses. */
|
|
152
|
+
declare const BEARER_SCHEME = "PalbaseBearer";
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* True when the effective auth requires a token. The cascade is resolved by the
|
|
156
|
+
* caller (route ?? controller default ?? true) into a single `AuthSpec`; this
|
|
157
|
+
* collapses it to a boolean.
|
|
158
|
+
*
|
|
159
|
+
* | AuthSpec | required |
|
|
160
|
+
* |------------------------|----------|
|
|
161
|
+
* | `true` | true |
|
|
162
|
+
* | `false` | false |
|
|
163
|
+
* | `{ required: true }` | true |
|
|
164
|
+
* | `{ required: false }` | false |
|
|
165
|
+
* | `{ role: "admin" }` | true |
|
|
166
|
+
* | `{}` | true |
|
|
167
|
+
*/
|
|
168
|
+
declare function isAuthEffectivelyRequired(auth: AuthSpec): boolean;
|
|
169
|
+
|
|
170
|
+
export { type AggregateOptions, type AggregateResult, BEARER_SCHEME, type ControllerClass, ControllerLoadError, ERROR_ENVELOPE_REF, type FlatRoute, type LoadedController, type RouteInputSchemas, aggregateOpenAPI, deriveControllerName, deriveControllerOperationId, discoverControllerFiles, flattenController, isAuthEffectivelyRequired, joinControllerPath, loadControllers, operationIdFor };
|