@webpieces/http-routing 0.3.271 → 0.3.273
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/package.json +4 -4
- package/src/decorators.d.ts +5 -30
- package/src/decorators.js +5 -38
- package/src/decorators.js.map +1 -1
- package/src/index.d.ts +2 -2
- package/src/index.js +4 -2
- package/src/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/http-routing",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.273",
|
|
4
4
|
"description": "Decorator-based routing with auto-wiring for WebPieces",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@webpieces/core-context": "0.3.
|
|
25
|
-
"@webpieces/core-util": "0.3.
|
|
26
|
-
"@webpieces/http-filters": "0.3.
|
|
24
|
+
"@webpieces/core-context": "0.3.273",
|
|
25
|
+
"@webpieces/core-util": "0.3.273",
|
|
26
|
+
"@webpieces/http-filters": "0.3.273",
|
|
27
27
|
"inversify": "7.10.4",
|
|
28
28
|
"minimatch": "10.0.1"
|
|
29
29
|
}
|
package/src/decorators.d.ts
CHANGED
|
@@ -2,40 +2,15 @@ import 'reflect-metadata';
|
|
|
2
2
|
/**
|
|
3
3
|
* Metadata keys for server-side routing.
|
|
4
4
|
* These are specific to the routing package (server-side only).
|
|
5
|
+
*
|
|
6
|
+
* NOTE: @DocumentDesign (and its DOCUMENT_DESIGN metadata key) moved to
|
|
7
|
+
* @webpieces/core-util — it is a design-root marker for ANY project kind
|
|
8
|
+
* (browser + Node), not server-only. http-routing re-exports it in index.ts
|
|
9
|
+
* for back-compat.
|
|
5
10
|
*/
|
|
6
11
|
export declare const ROUTING_METADATA_KEYS: {
|
|
7
|
-
DOCUMENT_DESIGN: string;
|
|
8
12
|
SOURCE_FILEPATH: string;
|
|
9
13
|
};
|
|
10
|
-
/**
|
|
11
|
-
* @DocumentDesign decorator — marks a class as a DI-design ROOT: the top-of-DAG class whose
|
|
12
|
-
* dependency-injection tree the design-doc generator walks and renders into that project's
|
|
13
|
-
* `design.json` / `design.md` / `design.html`.
|
|
14
|
-
*
|
|
15
|
-
* It is the single marker for every kind of design root — server controllers (the class an
|
|
16
|
-
* `ApiRoutingFactory(Api, Controller)` binds) and library implementation classes (the top class a
|
|
17
|
-
* `role:designed-lib` project exports and binds in its `ContainerModule`). A `role:designed-lib`
|
|
18
|
-
* project is REQUIRED to have at least one `@DocumentDesign` class — otherwise the DI-graph
|
|
19
|
-
* generator has no root and fails.
|
|
20
|
-
*
|
|
21
|
-
* This is a pure marker read STATICALLY by the DI-graph analyzer (by decorator name); nothing reads
|
|
22
|
-
* its runtime metadata. Routing does NOT depend on it — routes are wired explicitly by
|
|
23
|
-
* `ApiRoutingFactory(Api, Controller)`, which reads `@ApiPath`/`@Endpoint` off the API class and
|
|
24
|
-
* `@SourceFile` off the controller. The metadata below exists only for symmetry/debuggability.
|
|
25
|
-
*
|
|
26
|
-
* Usage:
|
|
27
|
-
* ```typescript
|
|
28
|
-
* @DocumentDesign()
|
|
29
|
-
* @injectable()
|
|
30
|
-
* export class SaveController extends SaveApi { ... }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function DocumentDesign(): ClassDecorator;
|
|
34
|
-
/**
|
|
35
|
-
* Helper function to check if a class is marked as a DI-design root.
|
|
36
|
-
* Server/library side only.
|
|
37
|
-
*/
|
|
38
|
-
export declare function isDocumentDesign(designClass: object): boolean;
|
|
39
14
|
/**
|
|
40
15
|
* SourceFile decorator to explicitly set the source filepath for a controller.
|
|
41
16
|
* This is used by filter matching to determine which filters apply to the controller.
|
package/src/decorators.js
CHANGED
|
@@ -1,53 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ROUTING_METADATA_KEYS = void 0;
|
|
4
|
-
exports.DocumentDesign = DocumentDesign;
|
|
5
|
-
exports.isDocumentDesign = isDocumentDesign;
|
|
6
4
|
exports.SourceFile = SourceFile;
|
|
7
5
|
require("reflect-metadata");
|
|
8
6
|
/**
|
|
9
7
|
* Metadata keys for server-side routing.
|
|
10
8
|
* These are specific to the routing package (server-side only).
|
|
9
|
+
*
|
|
10
|
+
* NOTE: @DocumentDesign (and its DOCUMENT_DESIGN metadata key) moved to
|
|
11
|
+
* @webpieces/core-util — it is a design-root marker for ANY project kind
|
|
12
|
+
* (browser + Node), not server-only. http-routing re-exports it in index.ts
|
|
13
|
+
* for back-compat.
|
|
11
14
|
*/
|
|
12
15
|
exports.ROUTING_METADATA_KEYS = {
|
|
13
|
-
DOCUMENT_DESIGN: 'webpieces:document-design',
|
|
14
16
|
SOURCE_FILEPATH: 'webpieces:source-filepath',
|
|
15
17
|
};
|
|
16
|
-
/**
|
|
17
|
-
* @DocumentDesign decorator — marks a class as a DI-design ROOT: the top-of-DAG class whose
|
|
18
|
-
* dependency-injection tree the design-doc generator walks and renders into that project's
|
|
19
|
-
* `design.json` / `design.md` / `design.html`.
|
|
20
|
-
*
|
|
21
|
-
* It is the single marker for every kind of design root — server controllers (the class an
|
|
22
|
-
* `ApiRoutingFactory(Api, Controller)` binds) and library implementation classes (the top class a
|
|
23
|
-
* `role:designed-lib` project exports and binds in its `ContainerModule`). A `role:designed-lib`
|
|
24
|
-
* project is REQUIRED to have at least one `@DocumentDesign` class — otherwise the DI-graph
|
|
25
|
-
* generator has no root and fails.
|
|
26
|
-
*
|
|
27
|
-
* This is a pure marker read STATICALLY by the DI-graph analyzer (by decorator name); nothing reads
|
|
28
|
-
* its runtime metadata. Routing does NOT depend on it — routes are wired explicitly by
|
|
29
|
-
* `ApiRoutingFactory(Api, Controller)`, which reads `@ApiPath`/`@Endpoint` off the API class and
|
|
30
|
-
* `@SourceFile` off the controller. The metadata below exists only for symmetry/debuggability.
|
|
31
|
-
*
|
|
32
|
-
* Usage:
|
|
33
|
-
* ```typescript
|
|
34
|
-
* @DocumentDesign()
|
|
35
|
-
* @injectable()
|
|
36
|
-
* export class SaveController extends SaveApi { ... }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
function DocumentDesign() {
|
|
40
|
-
return (target) => {
|
|
41
|
-
Reflect.defineMetadata(exports.ROUTING_METADATA_KEYS.DOCUMENT_DESIGN, true, target);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Helper function to check if a class is marked as a DI-design root.
|
|
46
|
-
* Server/library side only.
|
|
47
|
-
*/
|
|
48
|
-
function isDocumentDesign(designClass) {
|
|
49
|
-
return Reflect.getMetadata(exports.ROUTING_METADATA_KEYS.DOCUMENT_DESIGN, designClass) === true;
|
|
50
|
-
}
|
|
51
18
|
/**
|
|
52
19
|
* SourceFile decorator to explicitly set the source filepath for a controller.
|
|
53
20
|
* This is used by filter matching to determine which filters apply to the controller.
|
package/src/decorators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/decorators.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/decorators.ts"],"names":[],"mappings":";;;AA4BA,gCAIC;AAhCD,4BAA0B;AAE1B;;;;;;;;GAQG;AACU,QAAA,qBAAqB,GAAG;IACjC,eAAe,EAAE,2BAA2B;CAC/C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CAAC,QAAgB;IACvC,OAAO,CAAC,MAAW,EAAE,EAAE;QACnB,OAAO,CAAC,cAAc,CAAC,6BAAqB,CAAC,eAAe,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACpF,CAAC,CAAC;AACN,CAAC;AAED,0EAA0E;AAC1E,6EAA6E;AAC7E,0CAA0C","sourcesContent":["import 'reflect-metadata';\n\n/**\n * Metadata keys for server-side routing.\n * These are specific to the routing package (server-side only).\n *\n * NOTE: @DocumentDesign (and its DOCUMENT_DESIGN metadata key) moved to\n * @webpieces/core-util — it is a design-root marker for ANY project kind\n * (browser + Node), not server-only. http-routing re-exports it in index.ts\n * for back-compat.\n */\nexport const ROUTING_METADATA_KEYS = {\n SOURCE_FILEPATH: 'webpieces:source-filepath',\n};\n\n/**\n * SourceFile decorator to explicitly set the source filepath for a controller.\n * This is used by filter matching to determine which filters apply to the controller.\n *\n * If not specified, the system will use a heuristic based on the controller's name.\n *\n * Usage:\n * @SourceFile('src/controllers/admin/UserController.ts')\n * @DocumentDesign()\n * export class UserController { ... }\n *\n * @param filepath - The source filepath of the controller\n */\nexport function SourceFile(filepath: string): ClassDecorator {\n return (target: any) => {\n Reflect.defineMetadata(ROUTING_METADATA_KEYS.SOURCE_FILEPATH, filepath, target);\n };\n}\n\n// NOTE: provideSingleton / provideSingletonAs / provideTransient moved to\n// @webpieces/core-context (the shared DI seam). http-routing re-exports them\n// from there in index.ts for back-compat.\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { ApiPath, Endpoint, Authentication, AuthenticationConfig, Public, AuthJwt, AuthOidc, AuthSharedSecret, Rpc, PubSub, Queue, getApiPath, getEndpoints, isApiPath, getAuthMeta, getAuthMode, assertEveryEndpointHasAuthMode, getApiKind, assertApiKind, assertPubSubConventions, getQueueName, AuthMeta, RouteMetadata, METADATA_KEYS, ValidateImplementation, } from '@webpieces/core-util';
|
|
1
|
+
export { ApiPath, Endpoint, Authentication, AuthenticationConfig, Public, AuthJwt, AuthOidc, AuthSharedSecret, Rpc, PubSub, Queue, getApiPath, getEndpoints, isApiPath, getAuthMeta, getAuthMode, assertEveryEndpointHasAuthMode, getApiKind, assertApiKind, assertPubSubConventions, getQueueName, AuthMeta, RouteMetadata, METADATA_KEYS, ValidateImplementation, DocumentDesign, isDocumentDesign, } from '@webpieces/core-util';
|
|
2
2
|
export type { AuthMode, ApiKind } from '@webpieces/core-util';
|
|
3
|
-
export {
|
|
3
|
+
export { SourceFile, ROUTING_METADATA_KEYS, } from './decorators';
|
|
4
4
|
export { provideSingleton, provideSingletonAs, provideTransient } from '@webpieces/core-context';
|
|
5
5
|
export { ApiRoutingFactory, ClassType } from './ApiRoutingFactory';
|
|
6
6
|
export { WebAppMeta, WEBAPP_META_TOKEN, Routes, RouteBuilder, RouteDefinition, FilterDefinition, } from './WebAppMeta';
|
package/src/index.js
CHANGED
|
@@ -27,10 +27,12 @@ Object.defineProperty(exports, "getQueueName", { enumerable: true, get: function
|
|
|
27
27
|
Object.defineProperty(exports, "AuthMeta", { enumerable: true, get: function () { return core_util_1.AuthMeta; } });
|
|
28
28
|
Object.defineProperty(exports, "RouteMetadata", { enumerable: true, get: function () { return core_util_1.RouteMetadata; } });
|
|
29
29
|
Object.defineProperty(exports, "METADATA_KEYS", { enumerable: true, get: function () { return core_util_1.METADATA_KEYS; } });
|
|
30
|
+
// @DocumentDesign moved to core-util (design-root marker, browser + Node);
|
|
31
|
+
// re-exported here for back-compat.
|
|
32
|
+
Object.defineProperty(exports, "DocumentDesign", { enumerable: true, get: function () { return core_util_1.DocumentDesign; } });
|
|
33
|
+
Object.defineProperty(exports, "isDocumentDesign", { enumerable: true, get: function () { return core_util_1.isDocumentDesign; } });
|
|
30
34
|
// Server-side routing decorators and utilities
|
|
31
35
|
var decorators_1 = require("./decorators");
|
|
32
|
-
Object.defineProperty(exports, "DocumentDesign", { enumerable: true, get: function () { return decorators_1.DocumentDesign; } });
|
|
33
|
-
Object.defineProperty(exports, "isDocumentDesign", { enumerable: true, get: function () { return decorators_1.isDocumentDesign; } });
|
|
34
36
|
Object.defineProperty(exports, "SourceFile", { enumerable: true, get: function () { return decorators_1.SourceFile; } });
|
|
35
37
|
Object.defineProperty(exports, "ROUTING_METADATA_KEYS", { enumerable: true, get: function () { return decorators_1.ROUTING_METADATA_KEYS; } });
|
|
36
38
|
// DI provider decorators moved to core-context; re-exported here for back-compat
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAC1D,kDA8B8B;AA7B1B,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,iHAAA,oBAAoB,OAAA;AACpB,mGAAA,MAAM,OAAA;AACN,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,6GAAA,gBAAgB,OAAA;AAChB,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,kGAAA,KAAK,OAAA;AACL,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,sGAAA,SAAS,OAAA;AACT,wGAAA,WAAW,OAAA;AACX,wGAAA,WAAW,OAAA;AACX,2HAAA,8BAA8B,OAAA;AAC9B,uGAAA,UAAU,OAAA;AACV,0GAAA,aAAa,OAAA;AACb,oHAAA,uBAAuB,OAAA;AACvB,yGAAA,YAAY,OAAA;AACZ,qGAAA,QAAQ,OAAA;AACR,0GAAA,aAAa,OAAA;AACb,0GAAA,aAAa,OAAA;AAEb,2EAA2E;AAC3E,oCAAoC;AACpC,2GAAA,cAAc,OAAA;AACd,6GAAA,gBAAgB,OAAA;AAIpB,+CAA+C;AAC/C,2CAGsB;AAFlB,wGAAA,UAAU,OAAA;AACV,mHAAA,qBAAqB,OAAA;AAGzB,iFAAiF;AACjF,wDAAiG;AAAxF,gHAAA,gBAAgB,OAAA;AAAE,kHAAA,kBAAkB,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAE/D,yDAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAE1B,4CAA4C;AAC5C,2CAOsB;AALlB,+GAAA,iBAAiB,OAAA;AAGjB,6GAAA,eAAe,OAAA;AACf,8GAAA,gBAAgB,OAAA;AAGpB,qFAAqF;AACrF,wDAAqD;AAA5C,0GAAA,UAAU,OAAA;AACnB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,+BAA+B;AAC/B,uDAK4B;AAJxB,oHAAA,gBAAgB,OAAA;AAChB,wHAAA,oBAAoB,OAAA;AACpB,kHAAA,cAAc,OAAA;AAIlB,kBAAkB;AAClB,iDAA4D;AAAnD,8GAAA,aAAa,OAAA;AAEtB,oFAAoF;AACpF,wDAA+D;AAAtD,oHAAA,oBAAoB,OAAA;AAE7B,uBAAuB;AACvB,qDAA4E;AAAnE,kHAAA,eAAe,OAAA;AAAE,yHAAA,sBAAsB,OAAA","sourcesContent":["// Re-export API decorators from core-util for convenience\nexport {\n ApiPath,\n Endpoint,\n Authentication,\n AuthenticationConfig,\n Public,\n AuthJwt,\n AuthOidc,\n AuthSharedSecret,\n Rpc,\n PubSub,\n Queue,\n getApiPath,\n getEndpoints,\n isApiPath,\n getAuthMeta,\n getAuthMode,\n assertEveryEndpointHasAuthMode,\n getApiKind,\n assertApiKind,\n assertPubSubConventions,\n getQueueName,\n AuthMeta,\n RouteMetadata,\n METADATA_KEYS,\n ValidateImplementation,\n // @DocumentDesign moved to core-util (design-root marker, browser + Node);\n // re-exported here for back-compat.\n DocumentDesign,\n isDocumentDesign,\n} from '@webpieces/core-util';\nexport type { AuthMode, ApiKind } from '@webpieces/core-util';\n\n// Server-side routing decorators and utilities\nexport {\n SourceFile,\n ROUTING_METADATA_KEYS,\n} from './decorators';\n\n// DI provider decorators moved to core-context; re-exported here for back-compat\nexport { provideSingleton, provideSingletonAs, provideTransient } from '@webpieces/core-context';\n\nexport { ApiRoutingFactory, ClassType } from './ApiRoutingFactory';\n\n// Core routing types (moved from core-meta)\nexport {\n WebAppMeta,\n WEBAPP_META_TOKEN,\n Routes,\n RouteBuilder,\n RouteDefinition,\n FilterDefinition,\n} from './WebAppMeta';\n\n// Method metadata (moved to http-filters) re-exported for back-compat; route handler\nexport { MethodMeta } from '@webpieces/http-filters';\nexport { RouteHandler } from './RouteHandler';\n\n// Route builder implementation\nexport {\n RouteBuilderImpl,\n RouteHandlerWithMeta,\n FilterWithMeta,\n ExpressRouteHandler,\n} from './RouteBuilderImpl';\n\n// Filter matching\nexport { FilterMatcher, HttpFilter } from './FilterMatcher';\n\n// Context readers (Node.js only) moved to core-context; re-exported for back-compat\nexport { RequestContextReader } from '@webpieces/core-context';\n\n// Server configuration\nexport { WebpiecesConfig, WEBPIECES_CONFIG_TOKEN } from './WebpiecesConfig';\n"]}
|