@velajs/vela 1.10.0 → 1.13.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/CHANGELOG.md +157 -0
- package/dist/application.d.ts +25 -0
- package/dist/application.js +103 -2
- package/dist/container/container.d.ts +46 -1
- package/dist/container/container.js +156 -13
- package/dist/container/disposable.js +1 -1
- package/dist/container/types.d.ts +27 -0
- package/dist/cors/cors.module.d.ts +5 -5
- package/dist/cors/cors.module.js +26 -25
- package/dist/discovery/discoverable.decorator.d.ts +38 -0
- package/dist/discovery/discoverable.decorator.js +42 -0
- package/dist/discovery/discovery.service.d.ts +102 -0
- package/dist/discovery/discovery.service.js +177 -0
- package/dist/discovery/index.d.ts +2 -0
- package/dist/discovery/index.js +2 -0
- package/dist/entrypoint/entrypoint.registry.d.ts +42 -0
- package/dist/entrypoint/entrypoint.registry.js +112 -0
- package/dist/entrypoint/entrypoint.types.d.ts +41 -0
- package/dist/entrypoint/entrypoint.types.js +3 -0
- package/dist/entrypoint/execution-context.d.ts +15 -0
- package/dist/entrypoint/execution-context.js +21 -0
- package/dist/entrypoint/execution-scope.d.ts +21 -0
- package/dist/entrypoint/execution-scope.js +28 -0
- package/dist/entrypoint/index.d.ts +4 -0
- package/dist/entrypoint/index.js +4 -0
- package/dist/event-emitter/event-emitter.module.js +1 -0
- package/dist/event-emitter/event-emitter.subscriber.d.ts +3 -3
- package/dist/event-emitter/event-emitter.subscriber.js +12 -29
- package/dist/factory/adapter.d.ts +36 -0
- package/dist/factory/adapter.js +18 -0
- package/dist/factory/bootstrap.js +14 -2
- package/dist/factory.d.ts +11 -1
- package/dist/factory.js +23 -2
- package/dist/http/handler-executor.js +22 -19
- package/dist/http/route-contributor.d.ts +68 -0
- package/dist/http/route-contributor.js +22 -0
- package/dist/http/route.manager.js +33 -19
- package/dist/i18n/i18n.module.js +9 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.js +9 -2
- package/dist/internal.d.ts +0 -2
- package/dist/internal.js +0 -7
- package/dist/module/configurable-module.builder.d.ts +12 -0
- package/dist/module/configurable-module.builder.js +21 -114
- package/dist/module/decorators.js +4 -2
- package/dist/module/define-module.d.ts +112 -0
- package/dist/module/define-module.js +232 -0
- package/dist/module/index.d.ts +3 -1
- package/dist/module/index.js +3 -1
- package/dist/module/lazy-modules.d.ts +82 -0
- package/dist/module/lazy-modules.js +231 -0
- package/dist/module/lazy-provider.d.ts +65 -0
- package/dist/module/lazy-provider.js +111 -0
- package/dist/module/module-loader.d.ts +21 -0
- package/dist/module/module-loader.js +99 -24
- package/dist/openapi/document.js +16 -15
- package/dist/pipeline/component.manager.d.ts +15 -9
- package/dist/pipeline/component.manager.js +32 -46
- package/dist/pipeline/index.d.ts +2 -0
- package/dist/pipeline/index.js +1 -0
- package/dist/pipeline/pipeline-runner.d.ts +31 -0
- package/dist/pipeline/pipeline-runner.js +40 -0
- package/dist/registry/metadata.registry.d.ts +9 -3
- package/dist/registry/metadata.registry.js +55 -25
- package/dist/registry/types.d.ts +10 -0
- package/dist/schedule/schedule.module.d.ts +5 -0
- package/dist/schedule/schedule.module.js +21 -8
- package/dist/schedule/schedule.registry.d.ts +3 -3
- package/dist/schedule/schedule.registry.js +23 -44
- package/dist/schedule-node/schedule-node.module.d.ts +5 -0
- package/dist/schedule-node/schedule-node.module.js +20 -10
- package/dist/seeder/seeder.module.d.ts +8 -10
- package/dist/seeder/seeder.module.js +19 -15
- package/dist/websocket/index.d.ts +1 -1
- package/dist/websocket/index.js +1 -1
- package/dist/websocket/websocket.module.d.ts +20 -3
- package/dist/websocket/websocket.module.js +50 -39
- package/dist/websocket/websocket.tokens.d.ts +2 -1
- package/dist/websocket/websocket.tokens.js +3 -2
- package/dist/websocket/ws-dispatcher.d.ts +21 -9
- package/dist/websocket/ws-dispatcher.js +44 -38
- package/dist/websocket-node/register-gateways.js +3 -3
- package/package.json +1 -1
- package/dist/http/crud-bridge.d.ts +0 -90
- package/dist/http/crud-bridge.js +0 -25
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { Hono } from 'hono';
|
|
2
|
-
import type { Type } from '../container/types';
|
|
3
|
-
import type { CanActivate } from '../pipeline/types';
|
|
4
|
-
import type { OpenApiPathItem } from '../openapi/types';
|
|
5
|
-
/**
|
|
6
|
-
* Context passed to {@link CrudBridge.buildRoutes} when mounting CRUD
|
|
7
|
-
* sub-applications for a `@Crud()`-decorated controller.
|
|
8
|
-
*
|
|
9
|
-
* The bridge receives the framework's already-resolved view of the world so
|
|
10
|
-
* it can produce identical routing behavior to a hand-written controller:
|
|
11
|
-
* the same global prefix is prepended to every path, the same global guard
|
|
12
|
-
* instances run before any generated handler, and the same path-joining
|
|
13
|
-
* helper composes URL segments without double slashes.
|
|
14
|
-
*/
|
|
15
|
-
export interface CrudBridgeRouteContext {
|
|
16
|
-
/** Application-wide path prefix (e.g. `/api`), already normalized. */
|
|
17
|
-
globalPrefix: string;
|
|
18
|
-
/** Global guard instances, pre-resolved from the root container. */
|
|
19
|
-
globalGuards: CanActivate[];
|
|
20
|
-
/** Path joiner used by the framework — handles slash normalization. */
|
|
21
|
-
joinPaths: (...parts: string[]) => string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Context passed to {@link CrudBridge.buildOpenApiPaths} when contributing
|
|
25
|
-
* OpenAPI path items for a `@Crud()`-decorated controller.
|
|
26
|
-
*
|
|
27
|
-
* The bridge is responsible for producing fully-qualified path keys that
|
|
28
|
-
* match the routes it actually mounts at request time. The framework supplies
|
|
29
|
-
* the prefixes so the bridge does not have to re-derive them.
|
|
30
|
-
*/
|
|
31
|
-
export interface CrudBridgeOpenApiContext {
|
|
32
|
-
/** Application-wide path prefix (e.g. `/api`), already normalized. */
|
|
33
|
-
globalPrefix: string;
|
|
34
|
-
/** Controller-level prefix as registered with `@Controller(...)`. */
|
|
35
|
-
controllerPrefix: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Contract between `@velajs/vela` and a CRUD route generator (typically
|
|
39
|
-
* `@velajs/crud`). The bridge inverts the previous dynamic-import pattern,
|
|
40
|
-
* which was incompatible with Cloudflare Workers because esbuild leaves
|
|
41
|
-
* `await import(variable)` calls as runtime imports the Workers loader
|
|
42
|
-
* cannot resolve.
|
|
43
|
-
*
|
|
44
|
-
* A consumer registers an implementation once via {@link registerCrudBridge}
|
|
45
|
-
* — usually as a side effect of importing `@velajs/crud` — and the framework
|
|
46
|
-
* delegates both route building (at bootstrap) and OpenAPI generation
|
|
47
|
-
* (at document creation) to it.
|
|
48
|
-
*/
|
|
49
|
-
export interface CrudBridge {
|
|
50
|
-
/**
|
|
51
|
-
* Mount the CRUD sub-app for a controller with `vela:crud` metadata.
|
|
52
|
-
*
|
|
53
|
-
* Called during {@link RouteManager.build} after all `@Get`/`@Post`/etc.
|
|
54
|
-
* routes have been registered. The bridge is expected to attach generated
|
|
55
|
-
* routes (list, read, create, update, delete, …) onto the supplied Hono
|
|
56
|
-
* app under `ctx.globalPrefix + prefix`.
|
|
57
|
-
*/
|
|
58
|
-
buildRoutes(app: Hono, controller: Type, prefix: string, crudConfig: unknown, ctx: CrudBridgeRouteContext): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Contribute OpenAPI path items for a `@Crud()`-decorated controller.
|
|
61
|
-
*
|
|
62
|
-
* Called once per CRUD controller from `createOpenApiDocument` after the
|
|
63
|
-
* standard `@Get`/`@Post`/etc. paths have been collected. The returned
|
|
64
|
-
* record maps full OpenAPI path strings (e.g. `/api/users/{id}`) to path
|
|
65
|
-
* items, and is merged into the document — entries already present from
|
|
66
|
-
* hand-written handlers are preserved verb-by-verb.
|
|
67
|
-
*/
|
|
68
|
-
buildOpenApiPaths(controller: Type, crudConfig: unknown, ctx: CrudBridgeOpenApiContext): Record<string, OpenApiPathItem>;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Register a {@link CrudBridge} implementation. Intended to be called once at
|
|
72
|
-
* import time by the CRUD package; subsequent calls overwrite the previous
|
|
73
|
-
* registration (last-writer-wins). This is deliberate so test harnesses can
|
|
74
|
-
* swap in mocks without a teardown step on the global state.
|
|
75
|
-
*/
|
|
76
|
-
export declare function registerCrudBridge(bridge: CrudBridge): void;
|
|
77
|
-
/**
|
|
78
|
-
* Return the currently registered {@link CrudBridge}, or `undefined` if no
|
|
79
|
-
* bridge has been registered. Consumers using `@Crud()` without a registered
|
|
80
|
-
* bridge will receive a clear install-it error from the framework at build
|
|
81
|
-
* time — see `RouteManager.build`.
|
|
82
|
-
*/
|
|
83
|
-
export declare function getCrudBridge(): CrudBridge | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* Reset the global bridge registration. Test-only — not exported from
|
|
86
|
-
* `@velajs/vela/internal`. Use this in `beforeEach` to keep cases isolated.
|
|
87
|
-
*
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
export declare function _resetCrudBridge(): void;
|
package/dist/http/crud-bridge.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
let registered;
|
|
2
|
-
/**
|
|
3
|
-
* Register a {@link CrudBridge} implementation. Intended to be called once at
|
|
4
|
-
* import time by the CRUD package; subsequent calls overwrite the previous
|
|
5
|
-
* registration (last-writer-wins). This is deliberate so test harnesses can
|
|
6
|
-
* swap in mocks without a teardown step on the global state.
|
|
7
|
-
*/ export function registerCrudBridge(bridge) {
|
|
8
|
-
registered = bridge;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Return the currently registered {@link CrudBridge}, or `undefined` if no
|
|
12
|
-
* bridge has been registered. Consumers using `@Crud()` without a registered
|
|
13
|
-
* bridge will receive a clear install-it error from the framework at build
|
|
14
|
-
* time — see `RouteManager.build`.
|
|
15
|
-
*/ export function getCrudBridge() {
|
|
16
|
-
return registered;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Reset the global bridge registration. Test-only — not exported from
|
|
20
|
-
* `@velajs/vela/internal`. Use this in `beforeEach` to keep cases isolated.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/ export function _resetCrudBridge() {
|
|
24
|
-
registered = undefined;
|
|
25
|
-
}
|