@webpieces/http-routing 0.2.32 → 0.2.34
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 +3 -3
- package/src/WebAppMeta.d.ts +4 -0
- package/src/WebAppMeta.js +5 -1
- package/src/WebAppMeta.js.map +1 -1
- package/src/WebpiecesConfig.d.ts +10 -0
- package/src/WebpiecesConfig.js +15 -0
- package/src/WebpiecesConfig.js.map +1 -0
- package/src/index.d.ts +2 -1
- package/src/index.js +6 -1
- 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.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "Decorator-based routing with auto-wiring for WebPieces",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@webpieces/http-api": "0.2.
|
|
25
|
-
"@webpieces/http-filters": "0.2.
|
|
24
|
+
"@webpieces/http-api": "0.2.34",
|
|
25
|
+
"@webpieces/http-filters": "0.2.34",
|
|
26
26
|
"inversify": "^7.10.4",
|
|
27
27
|
"minimatch": "^10.0.1"
|
|
28
28
|
}
|
package/src/WebAppMeta.d.ts
CHANGED
package/src/WebAppMeta.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FilterDefinition = exports.RouteDefinition = void 0;
|
|
3
|
+
exports.WEBAPP_META_TOKEN = exports.FilterDefinition = exports.RouteDefinition = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Definition of a single route.
|
|
6
6
|
*
|
|
@@ -34,4 +34,8 @@ class FilterDefinition {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.FilterDefinition = FilterDefinition;
|
|
37
|
+
/**
|
|
38
|
+
* DI token for WebAppMeta injection.
|
|
39
|
+
*/
|
|
40
|
+
exports.WEBAPP_META_TOKEN = Symbol.for('WebAppMeta');
|
|
37
41
|
//# sourceMappingURL=WebAppMeta.js.map
|
package/src/WebAppMeta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebAppMeta.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/WebAppMeta.ts"],"names":[],"mappings":";;;AAuBA;;;;;GAKG;AACH,MAAa,eAAe;IACxB,YACW,SAAwB,EACxB,eAAoB,EACpB,kBAA2B;QAF3B,cAAS,GAAT,SAAS,CAAe;QACxB,oBAAe,GAAf,eAAe,CAAK;QACpB,uBAAkB,GAAlB,kBAAkB,CAAS;IACnC,CAAC;CACP;AAND,0CAMC;AAED;;;;;;;;;GASG;AACH,MAAa,gBAAgB;IAWzB,YAAY,QAAgB,EAAE,WAAgB,EAAE,eAAuB;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,4BAA4B;IACzD,CAAC;CACJ;AAjBD,4CAiBC","sourcesContent":["import { ContainerModule } from 'inversify';\nimport {RouteMetadata} from \"@webpieces/http-api\";\n\n/**\n * Represents a route configuration that can be registered with the router.\n * Similar to Java WebPieces Routes interface.\n */\nexport interface Routes {\n /**\n * Configure routes using the provided RouteBuilder.\n */\n configure(routeBuilder: RouteBuilder): void;\n}\n\n/**\n * Builder for registering routes.\n * Will be implemented in http-server package.\n */\nexport interface RouteBuilder {\n addRoute(route: RouteDefinition): void;\n addFilter(filter: FilterDefinition): void;\n}\n\n/**\n * Definition of a single route.\n *\n * Generic type parameter TResult represents the return type of the route handler.\n * This provides type safety for the entire request/response cycle.\n */\nexport class RouteDefinition {\n constructor(\n public routeMeta: RouteMetadata,\n public controllerClass: any,\n public controllerFilepath?: string,\n ) {}\n}\n\n/**\n * Definition of a filter with priority.\n *\n * Use filepathPattern to scope filters to specific controllers:\n * - 'src/controllers/admin/**' + '/*.ts' - All admin controllers\n * - '**' + '/admin/**' - Any file in admin directories\n * - '**' + '/UserController.ts' - Specific controller file\n *\n * If filepathPattern is not specified, the filter matches all controllers.\n */\nexport class FilterDefinition {\n priority: number;\n filterClass: any;\n filter?: any; // Filter instance (set by RouteBuilder when resolving from DI)\n\n /**\n * Glob pattern to match controller file paths.\n * If not specified, defaults to matching all controllers.\n */\n filepathPattern: string;\n\n constructor(priority: number, filterClass: any, filepathPattern: string) {\n this.priority = priority;\n this.filterClass = filterClass;\n this.filepathPattern = filepathPattern;\n this.filter = undefined; // Set later by RouteBuilder\n }\n}\n\n\n/**\n * Main application metadata interface.\n * Similar to Java WebPieces WebAppMeta.\n *\n * This is the entry point that WebpiecesServer calls to configure your application.\n */\nexport interface WebAppMeta {\n /**\n * Returns the list of Inversify container modules for dependency injection.\n * Similar to getGuiceModules() in Java.\n */\n getDIModules(): ContainerModule[];\n\n /**\n * Returns the list of route configurations.\n * Similar to getRouteModules() in Java.\n */\n getRoutes(): Routes[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"WebAppMeta.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/WebAppMeta.ts"],"names":[],"mappings":";;;AAuBA;;;;;GAKG;AACH,MAAa,eAAe;IACxB,YACW,SAAwB,EACxB,eAAoB,EACpB,kBAA2B;QAF3B,cAAS,GAAT,SAAS,CAAe;QACxB,oBAAe,GAAf,eAAe,CAAK;QACpB,uBAAkB,GAAlB,kBAAkB,CAAS;IACnC,CAAC;CACP;AAND,0CAMC;AAED;;;;;;;;;GASG;AACH,MAAa,gBAAgB;IAWzB,YAAY,QAAgB,EAAE,WAAgB,EAAE,eAAuB;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,4BAA4B;IACzD,CAAC;CACJ;AAjBD,4CAiBC;AAuBD;;GAEG;AACU,QAAA,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import { ContainerModule } from 'inversify';\nimport {RouteMetadata} from \"@webpieces/http-api\";\n\n/**\n * Represents a route configuration that can be registered with the router.\n * Similar to Java WebPieces Routes interface.\n */\nexport interface Routes {\n /**\n * Configure routes using the provided RouteBuilder.\n */\n configure(routeBuilder: RouteBuilder): void;\n}\n\n/**\n * Builder for registering routes.\n * Will be implemented in http-server package.\n */\nexport interface RouteBuilder {\n addRoute(route: RouteDefinition): void;\n addFilter(filter: FilterDefinition): void;\n}\n\n/**\n * Definition of a single route.\n *\n * Generic type parameter TResult represents the return type of the route handler.\n * This provides type safety for the entire request/response cycle.\n */\nexport class RouteDefinition {\n constructor(\n public routeMeta: RouteMetadata,\n public controllerClass: any,\n public controllerFilepath?: string,\n ) {}\n}\n\n/**\n * Definition of a filter with priority.\n *\n * Use filepathPattern to scope filters to specific controllers:\n * - 'src/controllers/admin/**' + '/*.ts' - All admin controllers\n * - '**' + '/admin/**' - Any file in admin directories\n * - '**' + '/UserController.ts' - Specific controller file\n *\n * If filepathPattern is not specified, the filter matches all controllers.\n */\nexport class FilterDefinition {\n priority: number;\n filterClass: any;\n filter?: any; // Filter instance (set by RouteBuilder when resolving from DI)\n\n /**\n * Glob pattern to match controller file paths.\n * If not specified, defaults to matching all controllers.\n */\n filepathPattern: string;\n\n constructor(priority: number, filterClass: any, filepathPattern: string) {\n this.priority = priority;\n this.filterClass = filterClass;\n this.filepathPattern = filepathPattern;\n this.filter = undefined; // Set later by RouteBuilder\n }\n}\n\n\n/**\n * Main application metadata interface.\n * Similar to Java WebPieces WebAppMeta.\n *\n * This is the entry point that WebpiecesServer calls to configure your application.\n */\nexport interface WebAppMeta {\n /**\n * Returns the list of Inversify container modules for dependency injection.\n * Similar to getGuiceModules() in Java.\n */\n getDIModules(): ContainerModule[];\n\n /**\n * Returns the list of route configurations.\n * Similar to getRouteModules() in Java.\n */\n getRoutes(): Routes[];\n}\n\n/**\n * DI token for WebAppMeta injection.\n */\nexport const WEBAPP_META_TOKEN = Symbol.for('WebAppMeta');\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WEBPIECES_CONFIG_TOKEN = exports.WebpiecesConfig = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for WebPieces server.
|
|
6
|
+
* Per CLAUDE.md: Data-only structure = class
|
|
7
|
+
*/
|
|
8
|
+
class WebpiecesConfig {
|
|
9
|
+
}
|
|
10
|
+
exports.WebpiecesConfig = WebpiecesConfig;
|
|
11
|
+
/**
|
|
12
|
+
* DI token for WebpiecesConfig injection.
|
|
13
|
+
*/
|
|
14
|
+
exports.WEBPIECES_CONFIG_TOKEN = Symbol.for('WebpiecesConfig');
|
|
15
|
+
//# sourceMappingURL=WebpiecesConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpiecesConfig.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/WebpiecesConfig.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,eAAe;CAG3B;AAHD,0CAGC;AAED;;GAEG;AACU,QAAA,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["/**\n * Configuration for WebPieces server.\n * Per CLAUDE.md: Data-only structure = class\n */\nexport class WebpiecesConfig {\n // Empty for now - placeholder for future config options\n // CORS is auto-enabled for localhost:* → localhost:*\n}\n\n/**\n * DI token for WebpiecesConfig injection.\n */\nexport const WEBPIECES_CONFIG_TOKEN = Symbol.for('WebpiecesConfig');\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { ApiInterface, Get, Post, Put, Delete, Patch, Path, getRoutes, isApiInterface, RouteMetadata, METADATA_KEYS, ValidateImplementation, } from '@webpieces/http-api';
|
|
2
2
|
export { Controller, isController, provideSingleton, provideTransient, ROUTING_METADATA_KEYS, } from './decorators';
|
|
3
3
|
export { RESTApiRoutes, ClassType } from './RESTApiRoutes';
|
|
4
|
-
export { WebAppMeta, Routes, RouteBuilder, RouteDefinition, FilterDefinition, } from './WebAppMeta';
|
|
4
|
+
export { WebAppMeta, WEBAPP_META_TOKEN, Routes, RouteBuilder, RouteDefinition, FilterDefinition, } from './WebAppMeta';
|
|
5
5
|
export { MethodMeta } from './MethodMeta';
|
|
6
6
|
export { RouteHandler } from './RouteHandler';
|
|
7
7
|
export { RouteBuilderImpl, RouteHandlerWithMeta, FilterWithMeta, ExpressRouteHandler, } from './RouteBuilderImpl';
|
|
8
8
|
export { FilterMatcher, HttpFilter } from './FilterMatcher';
|
|
9
9
|
export { RequestContextReader } from './RequestContextReader';
|
|
10
|
+
export { WebpiecesConfig, WEBPIECES_CONFIG_TOKEN } from './WebpiecesConfig';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestContextReader = exports.FilterMatcher = exports.FilterWithMeta = exports.RouteHandlerWithMeta = exports.RouteBuilderImpl = exports.RouteHandler = exports.MethodMeta = exports.FilterDefinition = exports.RouteDefinition = exports.RESTApiRoutes = exports.ROUTING_METADATA_KEYS = exports.provideTransient = exports.provideSingleton = exports.isController = exports.Controller = exports.METADATA_KEYS = exports.RouteMetadata = exports.isApiInterface = exports.getRoutes = exports.Path = exports.Patch = exports.Delete = exports.Put = exports.Post = exports.Get = exports.ApiInterface = void 0;
|
|
3
|
+
exports.WEBPIECES_CONFIG_TOKEN = exports.WebpiecesConfig = exports.RequestContextReader = exports.FilterMatcher = exports.FilterWithMeta = exports.RouteHandlerWithMeta = exports.RouteBuilderImpl = exports.RouteHandler = exports.MethodMeta = exports.FilterDefinition = exports.RouteDefinition = exports.WEBAPP_META_TOKEN = exports.RESTApiRoutes = exports.ROUTING_METADATA_KEYS = exports.provideTransient = exports.provideSingleton = exports.isController = exports.Controller = exports.METADATA_KEYS = exports.RouteMetadata = exports.isApiInterface = exports.getRoutes = exports.Path = exports.Patch = exports.Delete = exports.Put = exports.Post = exports.Get = exports.ApiInterface = void 0;
|
|
4
4
|
// Re-export API decorators from http-api for convenience
|
|
5
5
|
var http_api_1 = require("@webpieces/http-api");
|
|
6
6
|
Object.defineProperty(exports, "ApiInterface", { enumerable: true, get: function () { return http_api_1.ApiInterface; } });
|
|
@@ -25,6 +25,7 @@ var RESTApiRoutes_1 = require("./RESTApiRoutes");
|
|
|
25
25
|
Object.defineProperty(exports, "RESTApiRoutes", { enumerable: true, get: function () { return RESTApiRoutes_1.RESTApiRoutes; } });
|
|
26
26
|
// Core routing types (moved from core-meta)
|
|
27
27
|
var WebAppMeta_1 = require("./WebAppMeta");
|
|
28
|
+
Object.defineProperty(exports, "WEBAPP_META_TOKEN", { enumerable: true, get: function () { return WebAppMeta_1.WEBAPP_META_TOKEN; } });
|
|
28
29
|
Object.defineProperty(exports, "RouteDefinition", { enumerable: true, get: function () { return WebAppMeta_1.RouteDefinition; } });
|
|
29
30
|
Object.defineProperty(exports, "FilterDefinition", { enumerable: true, get: function () { return WebAppMeta_1.FilterDefinition; } });
|
|
30
31
|
// Method metadata and route handler
|
|
@@ -43,4 +44,8 @@ Object.defineProperty(exports, "FilterMatcher", { enumerable: true, get: functio
|
|
|
43
44
|
// Context readers (Node.js only)
|
|
44
45
|
var RequestContextReader_1 = require("./RequestContextReader");
|
|
45
46
|
Object.defineProperty(exports, "RequestContextReader", { enumerable: true, get: function () { return RequestContextReader_1.RequestContextReader; } });
|
|
47
|
+
// Server configuration
|
|
48
|
+
var WebpiecesConfig_1 = require("./WebpiecesConfig");
|
|
49
|
+
Object.defineProperty(exports, "WebpiecesConfig", { enumerable: true, get: function () { return WebpiecesConfig_1.WebpiecesConfig; } });
|
|
50
|
+
Object.defineProperty(exports, "WEBPIECES_CONFIG_TOKEN", { enumerable: true, get: function () { return WebpiecesConfig_1.WEBPIECES_CONFIG_TOKEN; } });
|
|
46
51
|
//# sourceMappingURL=index.js.map
|
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,yDAAyD;AACzD,gDAa6B;AAZzB,wGAAA,YAAY,OAAA;AACZ,+FAAA,GAAG,OAAA;AACH,gGAAA,IAAI,OAAA;AACJ,+FAAA,GAAG,OAAA;AACH,kGAAA,MAAM,OAAA;AACN,iGAAA,KAAK,OAAA;AACL,gGAAA,IAAI,OAAA;AACJ,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AAIjB,+CAA+C;AAC/C,2CAMsB;AALlB,wGAAA,UAAU,OAAA;AACV,0GAAA,YAAY,OAAA;AACZ,8GAAA,gBAAgB,OAAA;AAChB,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA;AAGzB,iDAA2D;AAAlD,8GAAA,aAAa,OAAA;AAEtB,4CAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/index.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,gDAa6B;AAZzB,wGAAA,YAAY,OAAA;AACZ,+FAAA,GAAG,OAAA;AACH,gGAAA,IAAI,OAAA;AACJ,+FAAA,GAAG,OAAA;AACH,kGAAA,MAAM,OAAA;AACN,iGAAA,KAAK,OAAA;AACL,gGAAA,IAAI,OAAA;AACJ,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AAIjB,+CAA+C;AAC/C,2CAMsB;AALlB,wGAAA,UAAU,OAAA;AACV,0GAAA,YAAY,OAAA;AACZ,8GAAA,gBAAgB,OAAA;AAChB,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA;AAGzB,iDAA2D;AAAlD,8GAAA,aAAa,OAAA;AAEtB,4CAA4C;AAC5C,2CAOsB;AALlB,+GAAA,iBAAiB,OAAA;AAGjB,6GAAA,eAAe,OAAA;AACf,8GAAA,gBAAgB,OAAA;AAGpB,oCAAoC;AACpC,2CAA0C;AAAjC,wGAAA,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,iCAAiC;AACjC,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAE7B,uBAAuB;AACvB,qDAA4E;AAAnE,kHAAA,eAAe,OAAA;AAAE,yHAAA,sBAAsB,OAAA","sourcesContent":["// Re-export API decorators from http-api for convenience\nexport {\n ApiInterface,\n Get,\n Post,\n Put,\n Delete,\n Patch,\n Path,\n getRoutes,\n isApiInterface,\n RouteMetadata,\n METADATA_KEYS,\n ValidateImplementation,\n} from '@webpieces/http-api';\n\n// Server-side routing decorators and utilities\nexport {\n Controller,\n isController,\n provideSingleton,\n provideTransient,\n ROUTING_METADATA_KEYS,\n} from './decorators';\n\nexport { RESTApiRoutes, ClassType } from './RESTApiRoutes';\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 and route handler\nexport { MethodMeta } from './MethodMeta';\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)\nexport { RequestContextReader } from './RequestContextReader';\n\n// Server configuration\nexport { WebpiecesConfig, WEBPIECES_CONFIG_TOKEN } from './WebpiecesConfig';\n"]}
|