@rest-vir/define-service 1.2.3 → 1.2.4
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/dist/endpoint/endpoint.d.ts +20 -28
- package/dist/endpoint/endpoint.js +6 -7
- package/dist/service/define-service.js +2 -2
- package/dist/util/custom-shapes.d.ts +1 -1
- package/dist/util/custom-shapes.js +10 -9
- package/dist/util/origin.d.ts +5 -5
- package/dist/util/origin.js +4 -4
- package/dist/web-socket/web-socket-definition.d.ts +19 -23
- package/dist/web-socket/web-socket-definition.js +3 -4
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpMethod, type AnyObject, type Overwrite, type SelectFrom } from '@augment-vir/common';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Shape, type ShapeInitType } from 'object-shape-tester';
|
|
3
3
|
import { type RequireAtLeastOne } from 'type-fest';
|
|
4
4
|
import { type MinimalService } from '../service/minimal-service.js';
|
|
5
5
|
import { type NoParam } from '../util/no-param.js';
|
|
@@ -85,10 +85,10 @@ export type EndpointInit<AllowedMethods extends RequireAtLeastOne<Record<HttpMet
|
|
|
85
85
|
* @category Package : @rest-vir/define-service
|
|
86
86
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
87
87
|
*/
|
|
88
|
-
export declare const endpointInitShape:
|
|
89
|
-
requestDataShape: import("
|
|
90
|
-
responseDataShape: import("
|
|
91
|
-
searchParamsShape: import("
|
|
88
|
+
export declare const endpointInitShape: Shape<{
|
|
89
|
+
requestDataShape: Shape<import("@sinclair/typebox").TUnknown>;
|
|
90
|
+
responseDataShape: Shape<import("@sinclair/typebox").TUnknown>;
|
|
91
|
+
searchParamsShape: Shape<import("@sinclair/typebox").TUnknown>;
|
|
92
92
|
/**
|
|
93
93
|
* Set a required client origin for this endpoint.
|
|
94
94
|
*
|
|
@@ -97,23 +97,15 @@ export declare const endpointInitShape: ShapeDefinition<{
|
|
|
97
97
|
* service's origin requirement).
|
|
98
98
|
* - Any other set value overrides the service's origin requirement (if it has any).
|
|
99
99
|
*/
|
|
100
|
-
requiredClientOrigin: import("
|
|
100
|
+
requiredClientOrigin: Shape<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
|
|
101
101
|
anyOrigin: boolean;
|
|
102
|
-
}
|
|
102
|
+
}> | import("@sinclair/typebox").TUnsafe<RegExp> | import("@sinclair/typebox").TString | import("@sinclair/typebox").TUndefined | import("@sinclair/typebox").TUnsafe<() => void> | import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
|
|
103
103
|
anyOrigin: boolean;
|
|
104
|
-
}
|
|
105
|
-
methods: import("
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}]>;
|
|
110
|
-
bypassResponseValidation: import("object-shape-tester").ShapeOptional<import("object-shape-tester").ShapeOr<[undefined, null, boolean]>>;
|
|
111
|
-
customProps: import("object-shape-tester").ShapeOptional<import("object-shape-tester").ShapeOr<[undefined, import("object-shape-tester").ShapeIndexedKeys<[{
|
|
112
|
-
keys: import("object-shape-tester").ShapeUnknown<[unknown]>;
|
|
113
|
-
values: import("object-shape-tester").ShapeUnknown<[unknown]>;
|
|
114
|
-
required: false;
|
|
115
|
-
}]>]>>;
|
|
116
|
-
}, false>;
|
|
104
|
+
}> | import("@sinclair/typebox").TUnsafe<RegExp> | import("@sinclair/typebox").TString | import("@sinclair/typebox").TUnsafe<() => void>)[]>>)[]>>>;
|
|
105
|
+
methods: import("@sinclair/typebox").TUnsafe<Partial<Record<HttpMethod, boolean>>>;
|
|
106
|
+
bypassResponseValidation: Shape<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUndefined | import("@sinclair/typebox").TNull | import("@sinclair/typebox").TBoolean)[]>>>;
|
|
107
|
+
customProps: Shape<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUndefined | import("@sinclair/typebox").TUnsafe<Record<never, unknown>>)[]>>>;
|
|
108
|
+
}>;
|
|
117
109
|
/**
|
|
118
110
|
* Adds final properties to {@link EndpointInit} so it becomes {@link EndpointDefinition}.
|
|
119
111
|
*
|
|
@@ -122,12 +114,12 @@ export declare const endpointInitShape: ShapeDefinition<{
|
|
|
122
114
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
123
115
|
*/
|
|
124
116
|
export type WithFinalEndpointProps<Init, EndpointPath extends EndpointPathBase> = (Init extends AnyObject ? Overwrite<Init, {
|
|
125
|
-
requestDataShape: Init['requestDataShape'] extends NoParam ?
|
|
126
|
-
responseDataShape: Init['responseDataShape'] extends NoParam ?
|
|
127
|
-
RequestType: Init['requestDataShape'] extends NoParam ? any : undefined extends Init['requestDataShape'] ? undefined :
|
|
128
|
-
ResponseType: Init['responseDataShape'] extends NoParam ? any : undefined extends Init['responseDataShape'] ? undefined :
|
|
129
|
-
searchParamsShape: 'searchParamsShape' extends keyof Init ?
|
|
130
|
-
SearchParamsType: 'searchParamsShape' extends keyof Init ?
|
|
117
|
+
requestDataShape: Init['requestDataShape'] extends NoParam ? Shape | undefined : undefined extends Init['requestDataShape'] ? undefined : Shape<Init['requestDataShape']>;
|
|
118
|
+
responseDataShape: Init['responseDataShape'] extends NoParam ? Shape | undefined : undefined extends Init['responseDataShape'] ? undefined : Shape<Init['responseDataShape']>;
|
|
119
|
+
RequestType: Init['requestDataShape'] extends NoParam ? any : undefined extends Init['requestDataShape'] ? undefined : ShapeInitType<Init['requestDataShape']>;
|
|
120
|
+
ResponseType: Init['responseDataShape'] extends NoParam ? any : undefined extends Init['responseDataShape'] ? undefined : ShapeInitType<Init['responseDataShape']>;
|
|
121
|
+
searchParamsShape: 'searchParamsShape' extends keyof Init ? Shape<Init['searchParamsShape']> | undefined : undefined;
|
|
122
|
+
SearchParamsType: 'searchParamsShape' extends keyof Init ? ShapeInitType<Init['searchParamsShape']> : undefined;
|
|
131
123
|
customProps: 'customProps' extends keyof Init ? Init['customProps'] : undefined;
|
|
132
124
|
}> : never) & {
|
|
133
125
|
path: EndpointPath;
|
|
@@ -170,8 +162,8 @@ export type BaseEndpointForExecutorData = Pick<EndpointDefinition, 'requestDataS
|
|
|
170
162
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
171
163
|
*/
|
|
172
164
|
export type EndpointExecutorData<SpecificEndpoint extends BaseEndpointForExecutorData> = {
|
|
173
|
-
request:
|
|
174
|
-
response:
|
|
165
|
+
request: SpecificEndpoint['requestDataShape'] extends Shape ? SpecificEndpoint['requestDataShape']['runtimeType'] : SpecificEndpoint['requestDataShape'];
|
|
166
|
+
response: SpecificEndpoint['responseDataShape'] extends Shape ? SpecificEndpoint['responseDataShape']['runtimeType'] : undefined;
|
|
175
167
|
};
|
|
176
168
|
/**
|
|
177
169
|
* Attaches request and response type-only getters to an endpoint definition.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpMethod } from '@augment-vir/common';
|
|
2
|
-
import { defineShape, enumShape,
|
|
2
|
+
import { defineShape, enumShape, optionalShape, recordShape, unionShape, unknownShape, } from 'object-shape-tester';
|
|
3
3
|
import { ensureServiceDefinitionError } from '../service/service-definition.error.js';
|
|
4
4
|
import { originRequirementShape } from '../util/origin.js';
|
|
5
5
|
import { assertValidEndpointPath } from './endpoint-path.js';
|
|
@@ -22,17 +22,16 @@ export const endpointInitShape = defineShape({
|
|
|
22
22
|
* service's origin requirement).
|
|
23
23
|
* - Any other set value overrides the service's origin requirement (if it has any).
|
|
24
24
|
*/
|
|
25
|
-
requiredClientOrigin:
|
|
26
|
-
methods:
|
|
25
|
+
requiredClientOrigin: optionalShape(originRequirementShape),
|
|
26
|
+
methods: recordShape({
|
|
27
27
|
keys: enumShape(HttpMethod),
|
|
28
28
|
values: false,
|
|
29
|
-
|
|
29
|
+
partial: true,
|
|
30
30
|
}),
|
|
31
|
-
bypassResponseValidation:
|
|
32
|
-
customProps:
|
|
31
|
+
bypassResponseValidation: optionalShape(unionShape(undefined, null, false)),
|
|
32
|
+
customProps: optionalShape(unionShape(undefined, recordShape({
|
|
33
33
|
keys: unknownShape(),
|
|
34
34
|
values: unknownShape(),
|
|
35
|
-
required: false,
|
|
36
35
|
}))),
|
|
37
36
|
});
|
|
38
37
|
/**
|
|
@@ -35,10 +35,10 @@ function finalizeServiceDefinition(serviceInit) {
|
|
|
35
35
|
...endpointInit,
|
|
36
36
|
requestDataShape: endpointInit.requestDataShape == undefined
|
|
37
37
|
? undefined
|
|
38
|
-
: defineShape(endpointInit.requestDataShape
|
|
38
|
+
: defineShape(endpointInit.requestDataShape),
|
|
39
39
|
responseDataShape: endpointInit.responseDataShape == undefined
|
|
40
40
|
? undefined
|
|
41
|
-
: defineShape(endpointInit.responseDataShape
|
|
41
|
+
: defineShape(endpointInit.responseDataShape),
|
|
42
42
|
path: endpointPath,
|
|
43
43
|
service: minimalService,
|
|
44
44
|
customProps: endpointInit.customProps,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*
|
|
27
27
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
28
28
|
*/
|
|
29
|
-
export declare const formDataShape: import("object-shape-tester").
|
|
29
|
+
export declare const formDataShape: (defaultValue?: FormData | undefined) => import("object-shape-tester").Shape<import("@sinclair/typebox").TUnsafe<FormData>>;
|
|
30
30
|
/**
|
|
31
31
|
* Check if the input is a shape definition for {@link formDataShape}.
|
|
32
32
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createCustomShape, isSchema, isShape, Kind } from 'object-shape-tester';
|
|
2
|
+
const formDataShapeKind = 'FormData';
|
|
2
3
|
/**
|
|
3
4
|
* A custom shape definition for requests that require `FormData` as the body.
|
|
4
5
|
*
|
|
@@ -27,12 +28,12 @@ import { customShape, isCustomSpecifier, isShapeDefinition } from 'object-shape-
|
|
|
27
28
|
*
|
|
28
29
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
29
30
|
*/
|
|
30
|
-
export const formDataShape =
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
export const formDataShape = createCustomShape({
|
|
32
|
+
name: formDataShapeKind,
|
|
33
|
+
checkValue(value) {
|
|
33
34
|
return value instanceof FormData;
|
|
34
35
|
},
|
|
35
|
-
|
|
36
|
+
default: new FormData(),
|
|
36
37
|
});
|
|
37
38
|
/**
|
|
38
39
|
* Check if the input is a shape definition for {@link formDataShape}.
|
|
@@ -42,11 +43,11 @@ export const formDataShape = customShape({
|
|
|
42
43
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
43
44
|
*/
|
|
44
45
|
export function isFormDataShape(shape) {
|
|
45
|
-
if (
|
|
46
|
-
return isFormDataShape(shape
|
|
46
|
+
if (isShape(shape)) {
|
|
47
|
+
return isFormDataShape(shape.$_schema);
|
|
47
48
|
}
|
|
48
|
-
else if (
|
|
49
|
-
return shape
|
|
49
|
+
else if (isSchema(shape)) {
|
|
50
|
+
return shape[Kind] === formDataShapeKind;
|
|
50
51
|
}
|
|
51
52
|
else {
|
|
52
53
|
return false;
|
package/dist/util/origin.d.ts
CHANGED
|
@@ -51,13 +51,13 @@ export type OriginRequirement = undefined | string | RegExp | AnyOrigin | (((ori
|
|
|
51
51
|
* @category Package : @rest-vir/define-service
|
|
52
52
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
53
53
|
*/
|
|
54
|
-
export declare const originRequirementShape: import("object-shape-tester").
|
|
54
|
+
export declare const originRequirementShape: import("object-shape-tester").Shape<import("object-shape-tester").Shape<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
|
|
55
55
|
anyOrigin: boolean;
|
|
56
|
-
}
|
|
56
|
+
}> | import("@sinclair/typebox").TUnsafe<RegExp> | import("@sinclair/typebox").TString | import("@sinclair/typebox").TUndefined | import("@sinclair/typebox").TUnsafe<() => void> | import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
|
|
57
57
|
anyOrigin: boolean;
|
|
58
|
-
}
|
|
58
|
+
}> | import("@sinclair/typebox").TUnsafe<RegExp> | import("@sinclair/typebox").TString | import("@sinclair/typebox").TUnsafe<() => void>)[]>>)[]>>>;
|
|
59
59
|
/**
|
|
60
|
-
* - `boolean`: the origin was explicitly checked and passed (`true`)
|
|
60
|
+
* - `boolean`: the origin was explicitly checked and passed (`true`) unionShape failed (`false`)
|
|
61
61
|
* - `undefined`: no origin checking occurred
|
|
62
62
|
* - `AnyOrigin`: requirements explicitly allow any origin.
|
|
63
63
|
*
|
|
@@ -77,7 +77,7 @@ export type OriginRequirementResult = boolean | undefined | AnyOrigin;
|
|
|
77
77
|
export declare function checkOriginRequirement(origin: string | undefined, originRequirement: OriginRequirement): Promise<OriginRequirementResult>;
|
|
78
78
|
/**
|
|
79
79
|
* Narrower version of {@link checkOriginRequirement} that simply returns `true` if the origin
|
|
80
|
-
* matched
|
|
80
|
+
* matched unionShape `false` otherwise.
|
|
81
81
|
*
|
|
82
82
|
* @category Internal
|
|
83
83
|
* @category Package : @rest-vir/define-service
|
package/dist/util/origin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { check } from '@augment-vir/assert';
|
|
2
|
-
import { classShape, defineShape,
|
|
2
|
+
import { classShape, defineShape, exactShape, unionShape } from 'object-shape-tester';
|
|
3
3
|
/**
|
|
4
4
|
* Explicity denotes that any origin is allowed. Use {@link isAnyOrigin} to check if something is
|
|
5
5
|
* equal to this.
|
|
@@ -28,8 +28,8 @@ export function isAnyOrigin(input) {
|
|
|
28
28
|
* @category Package : @rest-vir/define-service
|
|
29
29
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
30
30
|
*/
|
|
31
|
-
export const originRequirementShape = defineShape(
|
|
32
|
-
|
|
31
|
+
export const originRequirementShape = defineShape(unionShape(undefined, '', exactShape(AnyOrigin), classShape(RegExp), () => { }, [
|
|
32
|
+
unionShape('', exactShape(AnyOrigin), classShape(RegExp), () => { }),
|
|
33
33
|
]));
|
|
34
34
|
/**
|
|
35
35
|
* Checks the given origin against the given origin requirement and determine if the origin matches.
|
|
@@ -68,7 +68,7 @@ export async function checkOriginRequirement(origin, originRequirement) {
|
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Narrower version of {@link checkOriginRequirement} that simply returns `true` if the origin
|
|
71
|
-
* matched
|
|
71
|
+
* matched unionShape `false` otherwise.
|
|
72
72
|
*
|
|
73
73
|
* @category Internal
|
|
74
74
|
* @category Package : @rest-vir/define-service
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AnyObject, type Overwrite, type SelectFrom } from '@augment-vir/common';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Shape, type ShapeInitType } from 'object-shape-tester';
|
|
3
3
|
import { type IsEqual } from 'type-fest';
|
|
4
4
|
import { type EndpointPathBase } from '../endpoint/endpoint-path.js';
|
|
5
5
|
import { type MinimalService } from '../service/minimal-service.js';
|
|
@@ -81,14 +81,14 @@ export type WebSocketInit<MessageFromClientShape = unknown, MessageFromServerSha
|
|
|
81
81
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
82
82
|
*/
|
|
83
83
|
export type WithFinalWebSocketProps<Init, WebSocketPath extends EndpointPathBase> = (Init extends AnyObject ? Overwrite<Init, {
|
|
84
|
-
messageFromClientShape: IsEqual<Init['messageFromClientShape'], NoParam> extends true ? any : Init['messageFromClientShape'] extends NoParam ?
|
|
85
|
-
messageFromHostShape: IsEqual<Init['messageFromHostShape'], NoParam> extends true ? any : Init['messageFromHostShape'] extends NoParam ?
|
|
86
|
-
MessageFromClientType: Init['messageFromClientShape'] extends NoParam ? any : undefined extends Init['messageFromClientShape'] ? undefined :
|
|
87
|
-
MessageFromHostType: Init['messageFromHostShape'] extends NoParam ? any : undefined extends Init['messageFromHostShape'] ? undefined :
|
|
88
|
-
protocolsShape: 'protocolsShape' extends keyof Init ? undefined extends Init['protocolsShape'] ? undefined :
|
|
89
|
-
ProtocolsType: undefined extends Init['protocolsShape'] ? string[] :
|
|
90
|
-
searchParamsShape: 'searchParamsShape' extends keyof Init ? undefined extends Init['searchParamsShape'] ? undefined :
|
|
91
|
-
SearchParamsType: 'searchParamsShape' extends keyof Init ?
|
|
84
|
+
messageFromClientShape: IsEqual<Init['messageFromClientShape'], NoParam> extends true ? any : Init['messageFromClientShape'] extends NoParam ? Shape | undefined : undefined extends Init['messageFromClientShape'] ? undefined : Shape<Init['messageFromClientShape']>;
|
|
85
|
+
messageFromHostShape: IsEqual<Init['messageFromHostShape'], NoParam> extends true ? any : Init['messageFromHostShape'] extends NoParam ? Shape | undefined : undefined extends Init['messageFromHostShape'] ? undefined : Shape<Init['messageFromHostShape']>;
|
|
86
|
+
MessageFromClientType: Init['messageFromClientShape'] extends NoParam ? any : undefined extends Init['messageFromClientShape'] ? undefined : ShapeInitType<Init['messageFromClientShape']>;
|
|
87
|
+
MessageFromHostType: Init['messageFromHostShape'] extends NoParam ? any : undefined extends Init['messageFromHostShape'] ? undefined : ShapeInitType<Init['messageFromHostShape']>;
|
|
88
|
+
protocolsShape: 'protocolsShape' extends keyof Init ? undefined extends Init['protocolsShape'] ? undefined : Shape<Init['protocolsShape']> | undefined : undefined;
|
|
89
|
+
ProtocolsType: undefined extends Init['protocolsShape'] ? string[] : ShapeInitType<Init['protocolsShape']>;
|
|
90
|
+
searchParamsShape: 'searchParamsShape' extends keyof Init ? undefined extends Init['searchParamsShape'] ? undefined : Shape<Init['searchParamsShape']> | undefined : undefined;
|
|
91
|
+
SearchParamsType: 'searchParamsShape' extends keyof Init ? ShapeInitType<Init['searchParamsShape']> : undefined;
|
|
92
92
|
customProps: 'customProps' extends keyof Init ? Init['customProps'] : undefined;
|
|
93
93
|
}> : never) & {
|
|
94
94
|
path: WebSocketPath;
|
|
@@ -124,10 +124,10 @@ export type GenericWebSocketDefinition = Overwrite<WebSocketDefinition, {
|
|
|
124
124
|
* @category Package : @rest-vir/define-service
|
|
125
125
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
126
126
|
*/
|
|
127
|
-
export declare const webSocketInitShape:
|
|
128
|
-
messageFromClientShape: import("
|
|
129
|
-
messageFromHostShape: import("
|
|
130
|
-
searchParamsShape: import("
|
|
127
|
+
export declare const webSocketInitShape: Shape<{
|
|
128
|
+
messageFromClientShape: Shape<import("@sinclair/typebox").TUnknown>;
|
|
129
|
+
messageFromHostShape: Shape<import("@sinclair/typebox").TUnknown>;
|
|
130
|
+
searchParamsShape: Shape<import("@sinclair/typebox").TUnknown>;
|
|
131
131
|
/**
|
|
132
132
|
* Set a required client origin for this WebSocket.
|
|
133
133
|
*
|
|
@@ -136,18 +136,14 @@ export declare const webSocketInitShape: ShapeDefinition<{
|
|
|
136
136
|
* service's origin requirement).
|
|
137
137
|
* - Any other set value overrides the service's origin requirement (if it has any).
|
|
138
138
|
*/
|
|
139
|
-
requiredClientOrigin: import("
|
|
139
|
+
requiredClientOrigin: Shape<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
|
|
140
140
|
anyOrigin: boolean;
|
|
141
|
-
}
|
|
141
|
+
}> | import("@sinclair/typebox").TUnsafe<RegExp> | import("@sinclair/typebox").TString | import("@sinclair/typebox").TUndefined | import("@sinclair/typebox").TUnsafe<() => void> | import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
|
|
142
142
|
anyOrigin: boolean;
|
|
143
|
-
}
|
|
144
|
-
customProps: import("
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
required: false;
|
|
148
|
-
}]>]>>;
|
|
149
|
-
protocolsShape: import("object-shape-tester").ShapeUnknown<[unknown]>;
|
|
150
|
-
}, false>;
|
|
143
|
+
}> | import("@sinclair/typebox").TUnsafe<RegExp> | import("@sinclair/typebox").TString | import("@sinclair/typebox").TUnsafe<() => void>)[]>>)[]>>>;
|
|
144
|
+
customProps: Shape<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUndefined | import("@sinclair/typebox").TUnsafe<Record<never, unknown>>)[]>>>;
|
|
145
|
+
protocolsShape: Shape<import("@sinclair/typebox").TUnknown>;
|
|
146
|
+
}>;
|
|
151
147
|
/**
|
|
152
148
|
* Attaches message type-only getters to a WebSocket definition.
|
|
153
149
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineShape,
|
|
1
|
+
import { defineShape, optionalShape, recordShape, unionShape, unknownShape, } from 'object-shape-tester';
|
|
2
2
|
import { assertValidEndpointPath } from '../endpoint/endpoint-path.js';
|
|
3
3
|
import { ensureServiceDefinitionError } from '../service/service-definition.error.js';
|
|
4
4
|
import { originRequirementShape } from '../util/origin.js';
|
|
@@ -21,11 +21,10 @@ export const webSocketInitShape = defineShape({
|
|
|
21
21
|
* service's origin requirement).
|
|
22
22
|
* - Any other set value overrides the service's origin requirement (if it has any).
|
|
23
23
|
*/
|
|
24
|
-
requiredClientOrigin:
|
|
25
|
-
customProps:
|
|
24
|
+
requiredClientOrigin: optionalShape(originRequirementShape),
|
|
25
|
+
customProps: optionalShape(unionShape(undefined, recordShape({
|
|
26
26
|
keys: unknownShape(),
|
|
27
27
|
values: unknownShape(),
|
|
28
|
-
required: false,
|
|
29
28
|
}))),
|
|
30
29
|
protocolsShape: unknownShape(),
|
|
31
30
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rest-vir/define-service",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Define an connect to a declarative and type safe REST and WebSocket service.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rest",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"test:update": "npm test update"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@augment-vir/assert": "^31.
|
|
44
|
-
"@augment-vir/common": "^31.
|
|
45
|
-
"date-vir": "^7.4.
|
|
43
|
+
"@augment-vir/assert": "^31.34.1",
|
|
44
|
+
"@augment-vir/common": "^31.34.1",
|
|
45
|
+
"date-vir": "^7.4.2",
|
|
46
46
|
"type-fest": "^4.41.0",
|
|
47
|
-
"url-vir": "^2.1.
|
|
47
|
+
"url-vir": "^2.1.6"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@augment-vir/test": "^31.
|
|
50
|
+
"@augment-vir/test": "^31.34.1",
|
|
51
51
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
52
52
|
"@web/test-runner": "^0.20.2",
|
|
53
53
|
"@web/test-runner-commands": "^0.9.0",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"@web/test-runner-visual-regression": "^0.10.0",
|
|
56
56
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
57
57
|
"markdown-code-example-inserter": "^3.0.3",
|
|
58
|
-
"object-shape-tester": "^
|
|
59
|
-
"typedoc": "^0.28.
|
|
58
|
+
"object-shape-tester": "^6.3.2",
|
|
59
|
+
"typedoc": "^0.28.12",
|
|
60
60
|
"ws": "^8.18.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|