@webpieces/core-meta 0.2.7 → 0.2.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/core-meta",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Core metadata interfaces for WebPieces framework",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -1 +1 @@
1
- {"version":3,"file":"WebAppMeta.js","sourceRoot":"","sources":["../../../../../packages/core/core-meta/src/WebAppMeta.ts"],"names":[],"mappings":";;;AAkEA;;;;;;;;;;;;GAYG;AACH,MAAsB,YAAY;CAOjC;AAPD,oCAOC"}
1
+ {"version":3,"file":"WebAppMeta.js","sourceRoot":"","sources":["../../../../../packages/core/core-meta/src/WebAppMeta.ts"],"names":[],"mappings":";;;AAkEA;;;;;;;;;;;;GAYG;AACH,MAAsB,YAAY;CAOjC;AAPD,oCAOC","sourcesContent":["import { ContainerModule, Container } from 'inversify';\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-routing package.\n */\nexport interface RouteBuilder {\n addRoute<TResult = unknown>(route: RouteDefinition<TResult>): 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 interface RouteDefinition<TResult = unknown> {\n method: string;\n path: string;\n handler: RouteHandler<TResult>;\n}\n\n/**\n * Definition of a filter with priority.\n */\nexport interface FilterDefinition {\n priority: number;\n filterClass: any;\n packageRegex?: RegExp;\n}\n\n/**\n * Request data passed to route handlers.\n */\nexport interface RouteRequest {\n body?: any;\n query?: Record<string, any>;\n params?: Record<string, any>;\n headers?: Record<string, any>;\n}\n\n/**\n * Context passed to route handlers.\n * Contains DI container, request data, and extracted parameters.\n */\nexport interface RouteContext {\n /** DI container for resolving dependencies */\n container: Container;\n /** Extracted parameters (e.g., from request body, path params) */\n params: any[];\n /** Original request data */\n request?: RouteRequest;\n}\n\n/**\n * Handler class for routes.\n * Takes a RouteContext and returns the controller method result.\n *\n * Generic type parameter TResult represents the return type of the controller method.\n * Example: RouteHandler<SaveResponse> for a method that returns Promise<SaveResponse>\n *\n * Using unknown as default instead of any forces type safety - consumers must\n * handle the result appropriately rather than assuming any type.\n *\n * This is a class instead of a function type to make it easier to trace\n * who is calling what in the debugger/IDE.\n */\nexport abstract class RouteHandler<TResult = unknown> {\n /**\n * Execute the route handler.\n * @param context - The route context containing DI container, params, and request\n * @returns Promise of the controller method result\n */\n abstract execute(context: RouteContext): Promise<TResult>;\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"]}
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-meta/src/index.ts"],"names":[],"mappings":";;;AAAA,2CASsB;AAHpB,0GAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-meta/src/index.ts"],"names":[],"mappings":";;;AAAA,2CASsB;AAHpB,0GAAA,YAAY,OAAA","sourcesContent":["export {\n WebAppMeta,\n Routes,\n RouteBuilder,\n RouteDefinition,\n FilterDefinition,\n RouteHandler,\n RouteContext,\n RouteRequest,\n} from './WebAppMeta';\n"]}