@travetto/web 7.0.0-rc.0 → 7.0.0-rc.1
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
|
@@ -108,7 +108,6 @@ export class ControllerRegistryAdapter implements RegistryAdapter<ControllerConf
|
|
|
108
108
|
allowsBody: false,
|
|
109
109
|
class: this.#cls,
|
|
110
110
|
filters: [],
|
|
111
|
-
endpoint: this.#cls.prototype[method],
|
|
112
111
|
methodName: method.toString(),
|
|
113
112
|
id: `${this.#cls.name}#${method.toString()}`,
|
|
114
113
|
parameters: [],
|
package/src/registry/types.ts
CHANGED
|
@@ -118,10 +118,6 @@ export interface EndpointConfig extends CoreConfig {
|
|
|
118
118
|
* The path of the endpoint
|
|
119
119
|
*/
|
|
120
120
|
path: string;
|
|
121
|
-
/**
|
|
122
|
-
* The function the endpoint will call
|
|
123
|
-
*/
|
|
124
|
-
endpoint: EndpointFunction;
|
|
125
121
|
/**
|
|
126
122
|
* The compiled and finalized handler
|
|
127
123
|
*/
|
package/src/util/endpoint.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { asConstructable, castTo, Class, Runtime, TypedObject } from '@travetto/runtime';
|
|
1
|
+
import { asConstructable, castKey, castTo, Class, Runtime, TypedObject } from '@travetto/runtime';
|
|
2
2
|
import { BindUtil, SchemaParameterConfig, SchemaRegistryIndex, SchemaValidator, ValidationResultError } from '@travetto/schema';
|
|
3
3
|
import { DependencyRegistryIndex } from '@travetto/di';
|
|
4
4
|
import { RetargettingProxy } from '@travetto/registry';
|
|
@@ -8,7 +8,7 @@ import { WebResponse } from '../types/response.ts';
|
|
|
8
8
|
import { WebInterceptor } from '../types/interceptor.ts';
|
|
9
9
|
import { WebRequest } from '../types/request.ts';
|
|
10
10
|
import { WEB_INTERCEPTOR_CATEGORIES } from '../types/core.ts';
|
|
11
|
-
import { EndpointConfig, ControllerConfig, EndpointParameterConfig } from '../registry/types.ts';
|
|
11
|
+
import { EndpointConfig, ControllerConfig, EndpointParameterConfig, EndpointFunction } from '../registry/types.ts';
|
|
12
12
|
import { ControllerRegistryIndex } from '../registry/registry-index.ts';
|
|
13
13
|
import { WebCommonUtil } from './common.ts';
|
|
14
14
|
|
|
@@ -177,7 +177,7 @@ export class EndpointUtil {
|
|
|
177
177
|
static async invokeEndpoint(endpoint: EndpointConfig, { request }: WebChainedContext): Promise<WebResponse> {
|
|
178
178
|
try {
|
|
179
179
|
const params = await this.extractParameters(endpoint, request);
|
|
180
|
-
const body = await endpoint.endpoint.apply(endpoint.instance, params);
|
|
180
|
+
const body = await castTo<EndpointFunction>(endpoint.instance![castKey(endpoint.methodName)]).apply(endpoint.instance, params);
|
|
181
181
|
const headers = endpoint.finalizedResponseHeaders;
|
|
182
182
|
let response: WebResponse;
|
|
183
183
|
if (body instanceof WebResponse) {
|