@travetto/web 7.0.4 → 7.0.5
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/README.md +9 -9
- package/package.json +10 -10
- package/src/context.ts +2 -2
- package/src/decorator/common.ts +3 -3
- package/src/decorator/controller.ts +1 -1
- package/src/decorator/endpoint.ts +3 -3
- package/src/decorator/param.ts +2 -2
- package/src/interceptor/accept.ts +5 -5
- package/src/interceptor/body.ts +5 -5
- package/src/interceptor/cache-control.ts +4 -4
- package/src/interceptor/compress.ts +4 -4
- package/src/interceptor/context.ts +5 -5
- package/src/interceptor/cookie.ts +8 -8
- package/src/interceptor/cors.ts +5 -5
- package/src/interceptor/decompress.ts +6 -6
- package/src/interceptor/etag.ts +4 -4
- package/src/interceptor/logging.ts +4 -4
- package/src/interceptor/respond.ts +4 -4
- package/src/interceptor/trust-proxy.ts +4 -4
- package/src/registry/registry-adapter.ts +4 -4
- package/src/registry/registry-index.ts +5 -5
- package/src/registry/types.ts +4 -4
- package/src/registry/visitor.ts +2 -2
- package/src/router/base.ts +4 -4
- package/src/router/standard.ts +2 -2
- package/src/types/dispatch.ts +2 -2
- package/src/types/error.ts +1 -1
- package/src/types/filter.ts +2 -2
- package/src/types/headers.ts +1 -1
- package/src/types/interceptor.ts +2 -2
- package/src/types/message.ts +2 -2
- package/src/types/request.ts +1 -1
- package/src/util/body.ts +2 -2
- package/src/util/common.ts +3 -3
- package/src/util/cookie.ts +1 -1
- package/src/util/endpoint.ts +6 -6
- package/src/util/header.ts +2 -2
- package/src/util/keygrip.ts +3 -3
- package/support/test/dispatch-util.ts +3 -3
- package/support/test/dispatcher.ts +1 -1
- package/support/test/suite/base.ts +6 -6
- package/support/test/suite/controller.ts +2 -2
- package/support/test/suite/schema.ts +2 -2
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ export class BaseWebMessage<B = unknown, C = unknown> implements WebMessage<B, C
|
|
|
36
36
|
|
|
37
37
|
**Code: Request Shape**
|
|
38
38
|
```typescript
|
|
39
|
-
import { HttpMethod, HttpProtocol } from './core.ts';
|
|
39
|
+
import type { HttpMethod, HttpProtocol } from './core.ts';
|
|
40
40
|
import { BaseWebMessage } from './message.ts';
|
|
41
41
|
|
|
42
42
|
export interface WebConnection {
|
|
@@ -170,10 +170,10 @@ Each [@Param](https://github.com/travetto/travetto/tree/main/module/web/src/deco
|
|
|
170
170
|
|
|
171
171
|
**Code: Full-fledged Controller with Endpoints**
|
|
172
172
|
```typescript
|
|
173
|
-
import { Get, Controller, Post, QueryParam, WebRequest, ContextParam } from '@travetto/web';
|
|
173
|
+
import { Get, Controller, Post, QueryParam, type WebRequest, ContextParam } from '@travetto/web';
|
|
174
174
|
import { Integer, Min } from '@travetto/schema';
|
|
175
175
|
|
|
176
|
-
import { MockService } from './mock.ts';
|
|
176
|
+
import type { MockService } from './mock.ts';
|
|
177
177
|
|
|
178
178
|
@Controller('/simple')
|
|
179
179
|
export class Simple {
|
|
@@ -227,7 +227,7 @@ In addition to endpoint parameters (i.e. user-provided inputs), there may also b
|
|
|
227
227
|
|
|
228
228
|
**Code: Example ContextParam usage**
|
|
229
229
|
```typescript
|
|
230
|
-
import { CacheControl, ContextParam, Controller, Get, WebRequest, WebResponse } from '@travetto/web';
|
|
230
|
+
import { CacheControl, ContextParam, Controller, Get, type WebRequest, WebResponse } from '@travetto/web';
|
|
231
231
|
|
|
232
232
|
@Controller('/context')
|
|
233
233
|
class ContextController {
|
|
@@ -341,7 +341,7 @@ class UserController {
|
|
|
341
341
|
|
|
342
342
|
**Code: A Simple Interceptor**
|
|
343
343
|
```typescript
|
|
344
|
-
import { WebChainedContext, WebInterceptor, WebInterceptorCategory, WebInterceptorContext } from '@travetto/web';
|
|
344
|
+
import type { WebChainedContext, WebInterceptor, WebInterceptorCategory, WebInterceptorContext } from '@travetto/web';
|
|
345
345
|
import { Injectable } from '@travetto/di';
|
|
346
346
|
|
|
347
347
|
@Injectable()
|
|
@@ -683,7 +683,7 @@ Additionally it may be desirable to create a custom interceptor. Interceptors c
|
|
|
683
683
|
|
|
684
684
|
**Code: Defining a new Interceptor**
|
|
685
685
|
```typescript
|
|
686
|
-
import { WebChainedContext, WebInterceptor, WebInterceptorCategory } from '@travetto/web';
|
|
686
|
+
import type { WebChainedContext, WebInterceptor, WebInterceptorCategory } from '@travetto/web';
|
|
687
687
|
import { Injectable } from '@travetto/di';
|
|
688
688
|
|
|
689
689
|
class Appender {
|
|
@@ -716,7 +716,7 @@ When running an interceptor, if you chose to skip calling `ctx.next()`, you will
|
|
|
716
716
|
|
|
717
717
|
**Code: Defining a fully controlled Interceptor**
|
|
718
718
|
```typescript
|
|
719
|
-
import { WebInterceptor, WebInterceptorCategory, WebChainedContext, WebError } from '@travetto/web';
|
|
719
|
+
import { type WebInterceptor, type WebInterceptorCategory, type WebChainedContext, WebError } from '@travetto/web';
|
|
720
720
|
import { Injectable } from '@travetto/di';
|
|
721
721
|
|
|
722
722
|
@Injectable()
|
|
@@ -758,8 +758,8 @@ export class CookieJar {
|
|
|
758
758
|
**Code: Sample Cookie Usage**
|
|
759
759
|
```typescript
|
|
760
760
|
import {
|
|
761
|
-
Controller, Get, QueryParam, WebRequest, ContextParam,
|
|
762
|
-
WebResponse, CookieJar, CookieGetOptions, CookieSetOptions
|
|
761
|
+
Controller, Get, QueryParam, type WebRequest, ContextParam,
|
|
762
|
+
WebResponse, type CookieJar, type CookieGetOptions, type CookieSetOptions
|
|
763
763
|
} from '@travetto/web';
|
|
764
764
|
|
|
765
765
|
@Controller('/simple')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/web",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Declarative support for creating Web Applications",
|
|
6
6
|
"keywords": [
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"directory": "module/web"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^7.0.
|
|
30
|
-
"@travetto/context": "^7.0.
|
|
31
|
-
"@travetto/di": "^7.0.
|
|
32
|
-
"@travetto/registry": "^7.0.
|
|
33
|
-
"@travetto/runtime": "^7.0.
|
|
34
|
-
"@travetto/schema": "^7.0.
|
|
29
|
+
"@travetto/config": "^7.0.5",
|
|
30
|
+
"@travetto/context": "^7.0.5",
|
|
31
|
+
"@travetto/di": "^7.0.5",
|
|
32
|
+
"@travetto/registry": "^7.0.5",
|
|
33
|
+
"@travetto/runtime": "^7.0.4",
|
|
34
|
+
"@travetto/schema": "^7.0.5",
|
|
35
35
|
"find-my-way": "^9.4.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@travetto/cli": "^7.0.
|
|
39
|
-
"@travetto/test": "^7.0.
|
|
40
|
-
"@travetto/transformer": "^7.0.
|
|
38
|
+
"@travetto/cli": "^7.0.6",
|
|
39
|
+
"@travetto/test": "^7.0.5",
|
|
40
|
+
"@travetto/transformer": "^7.0.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
43
43
|
"@travetto/transformer": {
|
package/src/context.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AsyncContextValue, AsyncContext } from '@travetto/context';
|
|
1
|
+
import { AsyncContextValue, type AsyncContext } from '@travetto/context';
|
|
2
2
|
import { Inject, Injectable } from '@travetto/di';
|
|
3
|
-
import { AppError, castTo, Class } from '@travetto/runtime';
|
|
3
|
+
import { AppError, castTo, type Class } from '@travetto/runtime';
|
|
4
4
|
|
|
5
5
|
import { WebRequest } from './types/request.ts';
|
|
6
6
|
|
package/src/decorator/common.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Class, ClassInstance, getClass, RetainPrimitiveFields, TimeSpan, TimeUtil } from '@travetto/runtime';
|
|
1
|
+
import { type Class, type ClassInstance, getClass, type RetainPrimitiveFields, type TimeSpan, TimeUtil } from '@travetto/runtime';
|
|
2
2
|
|
|
3
3
|
import { ControllerRegistryIndex } from '../registry/registry-index.ts';
|
|
4
|
-
import { EndpointConfig, ControllerConfig, EndpointDecorator, EndpointFunctionDescriptor } from '../registry/types.ts';
|
|
4
|
+
import type { EndpointConfig, ControllerConfig, EndpointDecorator, EndpointFunctionDescriptor } from '../registry/types.ts';
|
|
5
5
|
import { AcceptInterceptor } from '../interceptor/accept.ts';
|
|
6
|
-
import { WebInterceptor } from '../types/interceptor.ts';
|
|
6
|
+
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
7
7
|
|
|
8
8
|
function isClass(target: unknown, property: unknown,): target is Class<unknown> {
|
|
9
9
|
return !property;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ClassInstance, getClass } from '@travetto/runtime';
|
|
1
|
+
import { type ClassInstance, getClass } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { EndpointConfig, EndpointFunctionDescriptor } from '../registry/types.ts';
|
|
4
|
-
import { HTTP_METHODS, HttpMethod } from '../types/core.ts';
|
|
3
|
+
import type { EndpointConfig, EndpointFunctionDescriptor } from '../registry/types.ts';
|
|
4
|
+
import { HTTP_METHODS, type HttpMethod } from '../types/core.ts';
|
|
5
5
|
import { ControllerRegistryIndex } from '../registry/registry-index.ts';
|
|
6
6
|
|
|
7
7
|
type EndpointFunctionDecorator = <T>(instance: T, property: string, descriptor: EndpointFunctionDescriptor) => EndpointFunctionDescriptor;
|
package/src/decorator/param.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ClassInstance, getClass } from '@travetto/runtime';
|
|
1
|
+
import { type ClassInstance, getClass } from '@travetto/runtime';
|
|
2
2
|
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
3
3
|
|
|
4
4
|
import { ControllerRegistryIndex } from '../registry/registry-index.ts';
|
|
5
|
-
import { EndpointParameterConfig, EndpointParamLocation } from '../registry/types.ts';
|
|
5
|
+
import type { EndpointParameterConfig, EndpointParamLocation } from '../registry/types.ts';
|
|
6
6
|
|
|
7
7
|
type ParamDecorator = (instance: ClassInstance, property: string, idx: number) => void;
|
|
8
8
|
|
|
@@ -4,11 +4,11 @@ import { Ignore } from '@travetto/schema';
|
|
|
4
4
|
|
|
5
5
|
import { WebCommonUtil } from '../util/common.ts';
|
|
6
6
|
|
|
7
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
8
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
9
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
10
|
-
import { WebResponse } from '../types/response.ts';
|
|
11
|
-
import { WebRequest } from '../types/request.ts';
|
|
7
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
8
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
9
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
10
|
+
import type { WebResponse } from '../types/response.ts';
|
|
11
|
+
import type { WebRequest } from '../types/request.ts';
|
|
12
12
|
import { WebError } from '../types/error.ts';
|
|
13
13
|
|
|
14
14
|
@Config('web.accept')
|
package/src/interceptor/body.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { Config } from '@travetto/config';
|
|
|
3
3
|
import { toConcrete } from '@travetto/runtime';
|
|
4
4
|
import { Ignore } from '@travetto/schema';
|
|
5
5
|
|
|
6
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
7
|
-
import { WebResponse } from '../types/response.ts';
|
|
8
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
9
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
6
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
7
|
+
import type { WebResponse } from '../types/response.ts';
|
|
8
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
9
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
10
10
|
|
|
11
11
|
import { WebBodyUtil } from '../util/body.ts';
|
|
12
|
-
import { ByteSizeInput, WebCommonUtil } from '../util/common.ts';
|
|
12
|
+
import { type ByteSizeInput, WebCommonUtil } from '../util/common.ts';
|
|
13
13
|
|
|
14
14
|
import { AcceptInterceptor } from './accept.ts';
|
|
15
15
|
import { DecompressInterceptor } from './decompress.ts';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Injectable, Inject } from '@travetto/di';
|
|
2
2
|
import { Config } from '@travetto/config';
|
|
3
3
|
|
|
4
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
5
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
6
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
-
import { WebResponse } from '../types/response.ts';
|
|
4
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
5
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
6
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
+
import type { WebResponse } from '../types/response.ts';
|
|
8
8
|
|
|
9
9
|
import { EtagInterceptor } from './etag.ts';
|
|
10
10
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { buffer } from 'node:stream/consumers';
|
|
2
|
-
import { BrotliOptions, constants, createBrotliCompress, createDeflate, createGzip, ZlibOptions } from 'node:zlib';
|
|
2
|
+
import { type BrotliOptions, constants, createBrotliCompress, createDeflate, createGzip, type ZlibOptions } from 'node:zlib';
|
|
3
3
|
|
|
4
4
|
import { Injectable, Inject } from '@travetto/di';
|
|
5
5
|
import { Config } from '@travetto/config';
|
|
6
6
|
|
|
7
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
8
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
9
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
7
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
8
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
9
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
10
10
|
import { WebResponse } from '../types/response.ts';
|
|
11
11
|
import { WebError } from '../types/error.ts';
|
|
12
12
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Injectable, Inject } from '@travetto/di';
|
|
2
2
|
|
|
3
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
4
|
-
import { WebResponse } from '../types/response.ts';
|
|
5
|
-
import { WebInterceptor } from '../types/interceptor.ts';
|
|
6
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
-
import { WebAsyncContext } from '../context.ts';
|
|
3
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
4
|
+
import type { WebResponse } from '../types/response.ts';
|
|
5
|
+
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
6
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
+
import type { WebAsyncContext } from '../context.ts';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Enables access to contextual data when running in a web application
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Injectable, Inject } from '@travetto/di';
|
|
2
2
|
import { Config } from '@travetto/config';
|
|
3
3
|
import { Secret } from '@travetto/schema';
|
|
4
|
-
import { AsyncContext, AsyncContextValue } from '@travetto/context';
|
|
4
|
+
import { type AsyncContext, AsyncContextValue } from '@travetto/context';
|
|
5
5
|
|
|
6
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
7
|
-
import { WebResponse } from '../types/response.ts';
|
|
8
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
9
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
6
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
7
|
+
import type { WebResponse } from '../types/response.ts';
|
|
8
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
9
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
10
10
|
|
|
11
|
-
import { WebConfig } from '../config.ts';
|
|
12
|
-
import { Cookie, CookieSetOptions } from '../types/cookie.ts';
|
|
11
|
+
import type { WebConfig } from '../config.ts';
|
|
12
|
+
import type { Cookie, CookieSetOptions } from '../types/cookie.ts';
|
|
13
13
|
import { CookieJar } from '../util/cookie.ts';
|
|
14
|
-
import { WebAsyncContext } from '../context.ts';
|
|
14
|
+
import type { WebAsyncContext } from '../context.ts';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Web cookie configuration
|
package/src/interceptor/cors.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { Config } from '@travetto/config';
|
|
|
2
2
|
import { Injectable, Inject } from '@travetto/di';
|
|
3
3
|
import { Ignore } from '@travetto/schema';
|
|
4
4
|
|
|
5
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
6
|
-
import { HTTP_METHODS, HttpMethod, WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
-
import { WebResponse } from '../types/response.ts';
|
|
8
|
-
import { WebRequest } from '../types/request.ts';
|
|
9
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
5
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
6
|
+
import { HTTP_METHODS, type HttpMethod, type WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
+
import type { WebResponse } from '../types/response.ts';
|
|
8
|
+
import type { WebRequest } from '../types/request.ts';
|
|
9
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
10
10
|
import { WebCommonUtil } from '../util/common.ts';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
2
|
import zlib from 'node:zlib';
|
|
3
3
|
import util from 'node:util';
|
|
4
4
|
|
|
@@ -6,11 +6,11 @@ import { Injectable, Inject } from '@travetto/di';
|
|
|
6
6
|
import { Config } from '@travetto/config';
|
|
7
7
|
import { castTo } from '@travetto/runtime';
|
|
8
8
|
|
|
9
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
10
|
-
import { WebResponse } from '../types/response.ts';
|
|
11
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
12
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
13
|
-
import { WebHeaders } from '../types/headers.ts';
|
|
9
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
10
|
+
import type { WebResponse } from '../types/response.ts';
|
|
11
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
12
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
13
|
+
import type { WebHeaders } from '../types/headers.ts';
|
|
14
14
|
|
|
15
15
|
import { WebBodyUtil } from '../util/body.ts';
|
|
16
16
|
import { WebError } from '../types/error.ts';
|
package/src/interceptor/etag.ts
CHANGED
|
@@ -5,13 +5,13 @@ import { Config } from '@travetto/config';
|
|
|
5
5
|
import { Ignore } from '@travetto/schema';
|
|
6
6
|
import { BinaryUtil } from '@travetto/runtime';
|
|
7
7
|
|
|
8
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
8
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
9
9
|
import { WebResponse } from '../types/response.ts';
|
|
10
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
11
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
10
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
11
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
12
12
|
import { CompressInterceptor } from './compress.ts';
|
|
13
13
|
import { WebBodyUtil } from '../util/body.ts';
|
|
14
|
-
import { ByteSizeInput, WebCommonUtil } from '../util/common.ts';
|
|
14
|
+
import { type ByteSizeInput, WebCommonUtil } from '../util/common.ts';
|
|
15
15
|
import { WebHeaderUtil } from '../util/header.ts';
|
|
16
16
|
|
|
17
17
|
@Config('web.etag')
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Injectable, Inject } from '@travetto/di';
|
|
2
2
|
import { Config } from '@travetto/config';
|
|
3
3
|
|
|
4
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
5
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
6
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
7
|
-
import { WebResponse } from '../types/response.ts';
|
|
4
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
5
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
6
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
7
|
+
import type { WebResponse } from '../types/response.ts';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Web logging configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Injectable } from '@travetto/di';
|
|
2
2
|
|
|
3
|
-
import { WebInterceptor } from '../types/interceptor.ts';
|
|
4
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
5
|
-
import { WebResponse } from '../types/response.ts';
|
|
3
|
+
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
4
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
5
|
+
import type { WebResponse } from '../types/response.ts';
|
|
6
6
|
|
|
7
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
7
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
8
8
|
import { LoggingInterceptor } from './logging.ts';
|
|
9
9
|
import { WebCommonUtil } from '../util/common.ts';
|
|
10
10
|
|
|
@@ -2,10 +2,10 @@ import { Config } from '@travetto/config';
|
|
|
2
2
|
import { Inject, Injectable } from '@travetto/di';
|
|
3
3
|
import { castTo } from '@travetto/runtime';
|
|
4
4
|
|
|
5
|
-
import { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
6
|
-
import { WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
-
import { WebResponse } from '../types/response.ts';
|
|
8
|
-
import { WebChainedContext } from '../types/filter.ts';
|
|
5
|
+
import type { WebInterceptor, WebInterceptorContext } from '../types/interceptor.ts';
|
|
6
|
+
import type { WebInterceptorCategory } from '../types/core.ts';
|
|
7
|
+
import type { WebResponse } from '../types/response.ts';
|
|
8
|
+
import type { WebChainedContext } from '../types/filter.ts';
|
|
9
9
|
|
|
10
10
|
@Config('web.trustProxy')
|
|
11
11
|
export class TrustProxyConfig {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RegistryAdapter } from '@travetto/registry';
|
|
2
|
-
import { AppError, asFull, castTo, Class, RetainPrimitiveFields, safeAssign } from '@travetto/runtime';
|
|
1
|
+
import type { RegistryAdapter } from '@travetto/registry';
|
|
2
|
+
import { AppError, asFull, castTo, type Class, type RetainPrimitiveFields, safeAssign } from '@travetto/runtime';
|
|
3
3
|
import { WebHeaders } from '@travetto/web';
|
|
4
|
-
import { SchemaParameterConfig, SchemaRegistryIndex } from '@travetto/schema';
|
|
4
|
+
import { type SchemaParameterConfig, SchemaRegistryIndex } from '@travetto/schema';
|
|
5
5
|
|
|
6
|
-
import { ControllerConfig, EndpointConfig, EndpointParameterConfig, EndpointParamLocation } from './types';
|
|
6
|
+
import type { ControllerConfig, EndpointConfig, EndpointParameterConfig, EndpointParamLocation } from './types.ts';
|
|
7
7
|
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
8
8
|
|
|
9
9
|
function combineCommon<T extends ControllerConfig | EndpointConfig>(base: T, override: Partial<T>): T {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
|
|
2
|
-
import { Class, ClassInstance, getClass, isClass, RetainPrimitiveFields } from '@travetto/runtime';
|
|
1
|
+
import { type RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
|
|
2
|
+
import { type Class, type ClassInstance, getClass, isClass, type RetainPrimitiveFields } from '@travetto/runtime';
|
|
3
3
|
import { DependencyRegistryIndex } from '@travetto/di';
|
|
4
4
|
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
5
5
|
|
|
6
|
-
import { ControllerRegistryAdapter } from './registry-adapter';
|
|
7
|
-
import { ControllerConfig, EndpointConfig, EndpointDecorator } from './types';
|
|
8
|
-
import { WebAsyncContext } from '../context';
|
|
6
|
+
import { ControllerRegistryAdapter } from './registry-adapter.ts';
|
|
7
|
+
import type { ControllerConfig, EndpointConfig, EndpointDecorator } from './types.ts';
|
|
8
|
+
import { WebAsyncContext } from '../context.ts';
|
|
9
9
|
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
10
10
|
|
|
11
11
|
export class ControllerRegistryIndex implements RegistryIndex {
|
package/src/registry/types.ts
CHANGED
|
@@ -3,10 +3,10 @@ import type { SchemaClassConfig } from '@travetto/schema';
|
|
|
3
3
|
|
|
4
4
|
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
5
5
|
import type { WebChainedFilter, WebFilter } from '../types/filter.ts';
|
|
6
|
-
import { HttpMethod } from '../types/core.ts';
|
|
7
|
-
import { WebHeaders } from '../types/headers.ts';
|
|
8
|
-
import { WebResponse, WebResponseContext } from '../types/response.ts';
|
|
9
|
-
import { WebRequest } from '../types/request.ts';
|
|
6
|
+
import type { HttpMethod } from '../types/core.ts';
|
|
7
|
+
import type { WebHeaders } from '../types/headers.ts';
|
|
8
|
+
import type { WebResponse, WebResponseContext } from '../types/response.ts';
|
|
9
|
+
import type { WebRequest } from '../types/request.ts';
|
|
10
10
|
|
|
11
11
|
export type EndpointFunction = TypedFunction<Any, unknown>;
|
|
12
12
|
export type EndpointFunctionDescriptor = TypedPropertyDescriptor<EndpointFunction>;
|
package/src/registry/visitor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Class } from '@travetto/runtime';
|
|
1
|
+
import type { Class } from '@travetto/runtime';
|
|
2
2
|
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
3
3
|
|
|
4
|
-
import { ControllerVisitor, ControllerVisitorOptions } from './types.ts';
|
|
4
|
+
import type { ControllerVisitor, ControllerVisitorOptions } from './types.ts';
|
|
5
5
|
import { ControllerRegistryIndex } from './registry-index.ts';
|
|
6
6
|
|
|
7
7
|
/**
|
package/src/router/base.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Class, toConcrete } from '@travetto/runtime';
|
|
1
|
+
import { type Class, toConcrete } from '@travetto/runtime';
|
|
2
2
|
import { DependencyRegistryIndex, Injectable } from '@travetto/di';
|
|
3
3
|
import { ControllerRegistryIndex } from '@travetto/web';
|
|
4
4
|
|
|
5
|
-
import { ControllerConfig, EndpointConfig } from '../registry/types.ts';
|
|
5
|
+
import type { ControllerConfig, EndpointConfig } from '../registry/types.ts';
|
|
6
6
|
import type { WebRouter } from '../types/dispatch.ts';
|
|
7
|
-
import { WebInterceptor } from '../types/interceptor.ts';
|
|
8
|
-
import { WebResponse } from '../types/response.ts';
|
|
7
|
+
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
8
|
+
import type { WebResponse } from '../types/response.ts';
|
|
9
9
|
import type { WebFilterContext } from '../types/filter.ts';
|
|
10
10
|
|
|
11
11
|
import { EndpointUtil } from '../util/endpoint.ts';
|
package/src/router/standard.ts
CHANGED
|
@@ -3,12 +3,12 @@ import router from 'find-my-way';
|
|
|
3
3
|
import { AppError } from '@travetto/runtime';
|
|
4
4
|
import { Inject, Injectable } from '@travetto/di';
|
|
5
5
|
|
|
6
|
-
import { EndpointConfig } from '../registry/types.ts';
|
|
6
|
+
import type { EndpointConfig } from '../registry/types.ts';
|
|
7
7
|
|
|
8
8
|
import { WebResponse } from '../types/response.ts';
|
|
9
9
|
import { HTTP_METHODS } from '../types/core.ts';
|
|
10
10
|
import type { WebFilterContext } from '../types/filter.ts';
|
|
11
|
-
import { WebConfig } from '../config.ts';
|
|
11
|
+
import type { WebConfig } from '../config.ts';
|
|
12
12
|
|
|
13
13
|
import { BaseWebRouter } from './base.ts';
|
|
14
14
|
|
package/src/types/dispatch.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ControllerConfig, EndpointConfig } from '../registry/types.ts';
|
|
2
|
-
import { WebFilter } from './filter.ts';
|
|
1
|
+
import type { ControllerConfig, EndpointConfig } from '../registry/types.ts';
|
|
2
|
+
import type { WebFilter } from './filter.ts';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Defines the shape for a web dispatcher
|
package/src/types/error.ts
CHANGED
package/src/types/filter.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebResponse } from './response.ts';
|
|
2
|
-
import { WebRequest } from './request.ts';
|
|
1
|
+
import type { WebResponse } from './response.ts';
|
|
2
|
+
import type { WebRequest } from './request.ts';
|
|
3
3
|
|
|
4
4
|
export type WebFilterContext<C = {}> = { request: WebRequest } & C;
|
|
5
5
|
export type WebFilter<C extends WebFilterContext = WebFilterContext> = (context: C) => Promise<WebResponse>;
|
package/src/types/headers.ts
CHANGED
package/src/types/interceptor.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Class } from '@travetto/runtime';
|
|
|
2
2
|
|
|
3
3
|
import type { EndpointConfig } from '../registry/types.ts';
|
|
4
4
|
import type { WebChainedContext } from './filter.ts';
|
|
5
|
-
import { WebResponse } from './response.ts';
|
|
6
|
-
import { WebInterceptorCategory } from './core.ts';
|
|
5
|
+
import type { WebResponse } from './response.ts';
|
|
6
|
+
import type { WebInterceptorCategory } from './core.ts';
|
|
7
7
|
|
|
8
8
|
export type WebInterceptorContext<C = unknown> = { endpoint: EndpointConfig, config: C };
|
|
9
9
|
|
package/src/types/message.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
2
|
import { castTo } from '@travetto/runtime';
|
|
3
|
-
import { WebHeaders, WebHeadersInit } from './headers';
|
|
3
|
+
import { WebHeaders, type WebHeadersInit } from './headers.ts';
|
|
4
4
|
|
|
5
5
|
export type WebBinaryBody = Readable | Buffer;
|
|
6
6
|
|
package/src/types/request.ts
CHANGED
package/src/util/body.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TextDecoder } from 'node:util';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
|
|
4
|
-
import { Any, BinaryUtil, castTo, hasToJSON, JSONUtil, Util } from '@travetto/runtime';
|
|
4
|
+
import { type Any, BinaryUtil, castTo, hasToJSON, JSONUtil, Util } from '@travetto/runtime';
|
|
5
5
|
|
|
6
|
-
import { WebBinaryBody, WebMessage } from '../types/message.ts';
|
|
6
|
+
import type { WebBinaryBody, WebMessage } from '../types/message.ts';
|
|
7
7
|
import { WebHeaders } from '../types/headers.ts';
|
|
8
8
|
import { WebError } from '../types/error.ts';
|
|
9
9
|
|
package/src/util/common.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AppError, ErrorCategory, Util } from '@travetto/runtime';
|
|
1
|
+
import { AppError, type ErrorCategory, Util } from '@travetto/runtime';
|
|
2
2
|
|
|
3
3
|
import { WebResponse } from '../types/response.ts';
|
|
4
|
-
import { WebRequest } from '../types/request.ts';
|
|
5
|
-
import { WebError } from '../types/error.ts';
|
|
4
|
+
import type { WebRequest } from '../types/request.ts';
|
|
5
|
+
import type { WebError } from '../types/error.ts';
|
|
6
6
|
|
|
7
7
|
type List<T> = T[] | readonly T[];
|
|
8
8
|
type OrderedState<T> = { after?: List<T>, before?: List<T>, key: T };
|
package/src/util/cookie.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppError } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { Cookie, CookieGetOptions, CookieSetOptions } from '../types/cookie.ts';
|
|
3
|
+
import type { Cookie, CookieGetOptions, CookieSetOptions } from '../types/cookie.ts';
|
|
4
4
|
import { KeyGrip } from './keygrip.ts';
|
|
5
5
|
import { WebHeaderUtil } from './header.ts';
|
|
6
6
|
|
package/src/util/endpoint.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { asConstructable, castKey, castTo, Class, TypedObject } from '@travetto/runtime';
|
|
2
|
-
import { BindUtil, SchemaParameterConfig, SchemaRegistryIndex, SchemaValidator, ValidationResultError } from '@travetto/schema';
|
|
1
|
+
import { asConstructable, castKey, castTo, type Class, TypedObject } from '@travetto/runtime';
|
|
2
|
+
import { BindUtil, type SchemaParameterConfig, SchemaRegistryIndex, SchemaValidator, ValidationResultError } from '@travetto/schema';
|
|
3
3
|
import { DependencyRegistryIndex } from '@travetto/di';
|
|
4
4
|
|
|
5
|
-
import { WebChainedFilter, WebChainedContext, WebFilter } from '../types/filter.ts';
|
|
5
|
+
import type { WebChainedFilter, WebChainedContext, WebFilter } from '../types/filter.ts';
|
|
6
6
|
import { WebResponse } from '../types/response.ts';
|
|
7
|
-
import { WebInterceptor } from '../types/interceptor.ts';
|
|
8
|
-
import { WebRequest } from '../types/request.ts';
|
|
7
|
+
import type { WebInterceptor } from '../types/interceptor.ts';
|
|
8
|
+
import type { WebRequest } from '../types/request.ts';
|
|
9
9
|
import { WEB_INTERCEPTOR_CATEGORIES } from '../types/core.ts';
|
|
10
|
-
import { EndpointConfig, ControllerConfig, EndpointParameterConfig, EndpointFunction } from '../registry/types.ts';
|
|
10
|
+
import type { EndpointConfig, ControllerConfig, EndpointParameterConfig, EndpointFunction } from '../registry/types.ts';
|
|
11
11
|
import { ControllerRegistryIndex } from '../registry/registry-index.ts';
|
|
12
12
|
import { WebCommonUtil } from './common.ts';
|
|
13
13
|
|
package/src/util/header.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ByteRange, castKey, castTo } from '@travetto/runtime';
|
|
1
|
+
import { type ByteRange, castKey, castTo } from '@travetto/runtime';
|
|
2
2
|
|
|
3
3
|
import { type Cookie } from '../types/cookie.ts';
|
|
4
|
-
import { WebHeaders } from '../types/headers.ts';
|
|
4
|
+
import type { WebHeaders } from '../types/headers.ts';
|
|
5
5
|
|
|
6
6
|
export type WebParsedHeader = { value: string, parameters: Record<string, string>, q?: number };
|
|
7
7
|
|
package/src/util/keygrip.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import crypto
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
2
|
import { AppError, castKey } from '@travetto/runtime';
|
|
3
3
|
|
|
4
4
|
const CHAR_MAPPING = { '/': '_', '+': '-', '=': '' };
|
|
@@ -14,9 +14,9 @@ export class KeyGrip {
|
|
|
14
14
|
|
|
15
15
|
#keys: string[];
|
|
16
16
|
#algorithm: string;
|
|
17
|
-
#encoding: BinaryToTextEncoding;
|
|
17
|
+
#encoding: crypto.BinaryToTextEncoding;
|
|
18
18
|
|
|
19
|
-
constructor(keys: string[], algorithm = 'sha1', encoding: BinaryToTextEncoding = 'base64') {
|
|
19
|
+
constructor(keys: string[], algorithm = 'sha1', encoding: crypto.BinaryToTextEncoding = 'base64') {
|
|
20
20
|
if (!keys.length) {
|
|
21
21
|
throw new AppError('Keys must be defined');
|
|
22
22
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { buffer } from 'node:stream/consumers';
|
|
2
|
-
import { Readable } from 'node:stream';
|
|
2
|
+
import type { Readable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
import { AppError, BinaryUtil, castTo, JSONUtil } from '@travetto/runtime';
|
|
5
5
|
import { BindUtil } from '@travetto/schema';
|
|
6
6
|
|
|
7
|
-
import { WebResponse } from '../../src/types/response.ts';
|
|
8
|
-
import { WebRequest } from '../../src/types/request.ts';
|
|
7
|
+
import type { WebResponse } from '../../src/types/response.ts';
|
|
8
|
+
import type { WebRequest } from '../../src/types/request.ts';
|
|
9
9
|
import { DecompressInterceptor } from '../../src/interceptor/decompress.ts';
|
|
10
10
|
import { WebBodyUtil } from '../../src/util/body.ts';
|
|
11
11
|
import { WebCommonUtil } from '../../src/util/common.ts';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable } from '@travetto/di';
|
|
2
2
|
|
|
3
3
|
import type { WebFilterContext } from '../../src/types/filter.ts';
|
|
4
|
-
import { WebResponse } from '../../src/types/response.ts';
|
|
4
|
+
import type { WebResponse } from '../../src/types/response.ts';
|
|
5
5
|
import { StandardWebRouter } from '../../src/router/standard.ts';
|
|
6
6
|
import { WebTestDispatchUtil } from './dispatch-util.ts';
|
|
7
7
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Registry } from '@travetto/registry';
|
|
2
|
-
import { castTo, Class } from '@travetto/runtime';
|
|
2
|
+
import { castTo, type Class } from '@travetto/runtime';
|
|
3
3
|
import { AfterAll, BeforeAll } from '@travetto/test';
|
|
4
4
|
import { DependencyRegistryIndex, Injectable } from '@travetto/di';
|
|
5
|
-
import { ConfigSource, ConfigPayload } from '@travetto/config';
|
|
5
|
+
import type { ConfigSource, ConfigPayload } from '@travetto/config';
|
|
6
6
|
import { Schema } from '@travetto/schema';
|
|
7
7
|
|
|
8
|
-
import { WebDispatcher } from '../../../src/types/dispatch.ts';
|
|
9
|
-
import { WebRequest, WebRequestContext } from '../../../src/types/request.ts';
|
|
10
|
-
import { WebResponse } from '../../../src/types/response.ts';
|
|
11
|
-
import { WebMessageInit } from '../../../src/types/message.ts';
|
|
8
|
+
import type { WebDispatcher } from '../../../src/types/dispatch.ts';
|
|
9
|
+
import { WebRequest, type WebRequestContext } from '../../../src/types/request.ts';
|
|
10
|
+
import type { WebResponse } from '../../../src/types/response.ts';
|
|
11
|
+
import type { WebMessageInit } from '../../../src/types/message.ts';
|
|
12
12
|
|
|
13
13
|
@Injectable()
|
|
14
14
|
export class WebTestConfig implements ConfigSource {
|
|
@@ -7,9 +7,9 @@ import { Get, Post, Put, Delete, Patch } from '../../../src/decorator/endpoint.t
|
|
|
7
7
|
import { ContextParam, PathParam, QueryParam } from '../../../src/decorator/param.ts';
|
|
8
8
|
import { Produces, SetHeaders } from '../../../src/decorator/common.ts';
|
|
9
9
|
|
|
10
|
-
import { WebRequest } from '../../../src/types/request.ts';
|
|
10
|
+
import type { WebRequest } from '../../../src/types/request.ts';
|
|
11
11
|
import { WebResponse } from '../../../src/types/response.ts';
|
|
12
|
-
import { CookieJar } from '../../../src/util/cookie.ts';
|
|
12
|
+
import type { CookieJar } from '../../../src/util/cookie.ts';
|
|
13
13
|
|
|
14
14
|
@Controller('/test')
|
|
15
15
|
export class TestController {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
|
|
3
3
|
import { Suite, Test } from '@travetto/test';
|
|
4
|
-
import { Schema, SchemaRegistryIndex, ValidationResultError, Validator } from '@travetto/schema';
|
|
5
|
-
import { Controller, Post, Get, ControllerRegistryIndex, WebResponse, PathParam, QueryParam, HttpMethod } from '@travetto/web';
|
|
4
|
+
import { Schema, SchemaRegistryIndex, type ValidationResultError, Validator } from '@travetto/schema';
|
|
5
|
+
import { Controller, Post, Get, ControllerRegistryIndex, WebResponse, PathParam, QueryParam, type HttpMethod } from '@travetto/web';
|
|
6
6
|
|
|
7
7
|
import { BaseWebSuite } from './base.ts';
|
|
8
8
|
|