@rest-vir/define-service 1.2.3 → 1.2.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.
@@ -1,5 +1,5 @@
1
1
  import { HttpMethod, type AnyObject, type Overwrite, type SelectFrom } from '@augment-vir/common';
2
- import { type ShapeDefinition, type ShapeToRuntimeType } from 'object-shape-tester';
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: ShapeDefinition<{
89
- requestDataShape: import("object-shape-tester").ShapeUnknown<[unknown]>;
90
- responseDataShape: import("object-shape-tester").ShapeUnknown<[unknown]>;
91
- searchParamsShape: import("object-shape-tester").ShapeUnknown<[unknown]>;
88
+ export declare const endpointInitShape: Shape<{
89
+ requestDataShape: Shape<import("@sinclair/typebox").TUnsafe<unknown>>;
90
+ responseDataShape: Shape<import("@sinclair/typebox").TUnsafe<unknown>>;
91
+ searchParamsShape: Shape<import("@sinclair/typebox").TUnsafe<unknown>>;
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("object-shape-tester").ShapeOptional<ShapeDefinition<import("object-shape-tester").ShapeOr<[undefined, string, import("object-shape-tester").ShapeExact<readonly [{
100
+ requiredClientOrigin: Shape<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
101
101
  anyOrigin: boolean;
102
- }]>, import("object-shape-tester").ShapeClass<[RegExpConstructor]>, () => void, import("object-shape-tester").ShapeOr<[string, import("object-shape-tester").ShapeExact<readonly [{
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
- }]>, import("object-shape-tester").ShapeClass<[RegExpConstructor]>, () => void]>[]]>, false>>;
105
- methods: import("object-shape-tester").ShapeIndexedKeys<[{
106
- keys: import("object-shape-tester").ShapeEnum<readonly [typeof HttpMethod]>;
107
- values: boolean;
108
- required: false;
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").TBoolean | import("@sinclair/typebox").TNull | import("@sinclair/typebox").TUndefined)[]>>>;
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 ? ShapeDefinition<any, true> | undefined : undefined extends Init['requestDataShape'] ? undefined : ShapeDefinition<Init['requestDataShape'], true>;
126
- responseDataShape: Init['responseDataShape'] extends NoParam ? ShapeDefinition<any, true> | undefined : undefined extends Init['responseDataShape'] ? undefined : ShapeDefinition<Init['responseDataShape'], true>;
127
- RequestType: Init['requestDataShape'] extends NoParam ? any : undefined extends Init['requestDataShape'] ? undefined : ShapeToRuntimeType<ShapeDefinition<Init['requestDataShape'], true>, false, true>;
128
- ResponseType: Init['responseDataShape'] extends NoParam ? any : undefined extends Init['responseDataShape'] ? undefined : ShapeToRuntimeType<ShapeDefinition<Init['responseDataShape'], true>, false, true>;
129
- searchParamsShape: 'searchParamsShape' extends keyof Init ? ShapeDefinition<Init['searchParamsShape'], true> | undefined : undefined;
130
- SearchParamsType: 'searchParamsShape' extends keyof Init ? ShapeToRuntimeType<ShapeDefinition<Init['searchParamsShape'], true>, false, true> : undefined;
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: ShapeToRuntimeType<SpecificEndpoint['requestDataShape'], false, true>;
174
- response: ShapeToRuntimeType<SpecificEndpoint['responseDataShape'], false, true>;
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, indexedKeys, optional, or, unknownShape, } from 'object-shape-tester';
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: optional(originRequirementShape),
26
- methods: indexedKeys({
25
+ requiredClientOrigin: optionalShape(originRequirementShape),
26
+ methods: recordShape({
27
27
  keys: enumShape(HttpMethod),
28
28
  values: false,
29
- required: false,
29
+ partial: true,
30
30
  }),
31
- bypassResponseValidation: optional(or(undefined, null, false)),
32
- customProps: optional(or(undefined, indexedKeys({
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, true),
38
+ : defineShape(endpointInit.requestDataShape),
39
39
  responseDataShape: endpointInit.responseDataShape == undefined
40
40
  ? undefined
41
- : defineShape(endpointInit.responseDataShape, true),
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").CustomSpecifier<FormData>;
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 { customShape, isCustomSpecifier, isShapeDefinition } from 'object-shape-tester';
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 = customShape({
31
- customName: 'FormData',
32
- checker(value) {
31
+ export const formDataShape = createCustomShape({
32
+ name: formDataShapeKind,
33
+ checkValue(value) {
33
34
  return value instanceof FormData;
34
35
  },
35
- defaultValue: new FormData(),
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 (isShapeDefinition(shape)) {
46
- return isFormDataShape(shape.shape);
46
+ if (isShape(shape)) {
47
+ return isFormDataShape(shape.$_schema);
47
48
  }
48
- else if (isCustomSpecifier(shape)) {
49
- return shape.customName === formDataShape.customName;
49
+ else if (isSchema(shape)) {
50
+ return shape[Kind] === formDataShapeKind;
50
51
  }
51
52
  else {
52
53
  return false;
@@ -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").ShapeDefinition<import("object-shape-tester").ShapeOr<[undefined, string, import("object-shape-tester").ShapeExact<readonly [{
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
- }]>, import("object-shape-tester").ShapeClass<[RegExpConstructor]>, () => void, import("object-shape-tester").ShapeOr<[string, import("object-shape-tester").ShapeExact<readonly [{
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
- }]>, import("object-shape-tester").ShapeClass<[RegExpConstructor]>, () => void]>[]]>, false>;
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`) or failed (`false`)
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 or `false` otherwise.
80
+ * matched unionShape `false` otherwise.
81
81
  *
82
82
  * @category Internal
83
83
  * @category Package : @rest-vir/define-service
@@ -1,5 +1,5 @@
1
1
  import { check } from '@augment-vir/assert';
2
- import { classShape, defineShape, exact, or } from 'object-shape-tester';
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(or(undefined, '', exact(AnyOrigin), classShape(RegExp), () => { }, [
32
- or('', exact(AnyOrigin), classShape(RegExp), () => { }),
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 or `false` otherwise.
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 ShapeDefinition, type ShapeToRuntimeType } from 'object-shape-tester';
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 ? ShapeDefinition<any, true> | undefined : undefined extends Init['messageFromClientShape'] ? undefined : ShapeDefinition<Init['messageFromClientShape'], true>;
85
- messageFromHostShape: IsEqual<Init['messageFromHostShape'], NoParam> extends true ? any : Init['messageFromHostShape'] extends NoParam ? ShapeDefinition<any, true> | undefined : undefined extends Init['messageFromHostShape'] ? undefined : ShapeDefinition<Init['messageFromHostShape'], true>;
86
- MessageFromClientType: Init['messageFromClientShape'] extends NoParam ? any : undefined extends Init['messageFromClientShape'] ? undefined : ShapeToRuntimeType<ShapeDefinition<Init['messageFromClientShape'], true>, false, true>;
87
- MessageFromHostType: Init['messageFromHostShape'] extends NoParam ? any : undefined extends Init['messageFromHostShape'] ? undefined : ShapeToRuntimeType<ShapeDefinition<Init['messageFromHostShape'], true>, false, true>;
88
- protocolsShape: 'protocolsShape' extends keyof Init ? undefined extends Init['protocolsShape'] ? undefined : ShapeDefinition<Init['protocolsShape'], true> | undefined : undefined;
89
- ProtocolsType: undefined extends Init['protocolsShape'] ? string[] : ShapeToRuntimeType<ShapeDefinition<Init['protocolsShape'], true>, false, true>;
90
- searchParamsShape: 'searchParamsShape' extends keyof Init ? undefined extends Init['searchParamsShape'] ? undefined : ShapeDefinition<Init['searchParamsShape'], true> | undefined : undefined;
91
- SearchParamsType: 'searchParamsShape' extends keyof Init ? ShapeToRuntimeType<ShapeDefinition<Init['searchParamsShape'], true>, false, true> : undefined;
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: ShapeDefinition<{
128
- messageFromClientShape: import("object-shape-tester").ShapeUnknown<[unknown]>;
129
- messageFromHostShape: import("object-shape-tester").ShapeUnknown<[unknown]>;
130
- searchParamsShape: import("object-shape-tester").ShapeUnknown<[unknown]>;
127
+ export declare const webSocketInitShape: Shape<{
128
+ messageFromClientShape: Shape<import("@sinclair/typebox").TUnsafe<unknown>>;
129
+ messageFromHostShape: Shape<import("@sinclair/typebox").TUnsafe<unknown>>;
130
+ searchParamsShape: Shape<import("@sinclair/typebox").TUnsafe<unknown>>;
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("object-shape-tester").ShapeOptional<ShapeDefinition<import("object-shape-tester").ShapeOr<[undefined, string, import("object-shape-tester").ShapeExact<readonly [{
139
+ requiredClientOrigin: Shape<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TUnsafe<{
140
140
  anyOrigin: boolean;
141
- }]>, import("object-shape-tester").ShapeClass<[RegExpConstructor]>, () => void, import("object-shape-tester").ShapeOr<[string, import("object-shape-tester").ShapeExact<readonly [{
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
- }]>, import("object-shape-tester").ShapeClass<[RegExpConstructor]>, () => void]>[]]>, false>>;
144
- customProps: import("object-shape-tester").ShapeOptional<import("object-shape-tester").ShapeOr<[undefined, import("object-shape-tester").ShapeIndexedKeys<[{
145
- keys: import("object-shape-tester").ShapeUnknown<[unknown]>;
146
- values: import("object-shape-tester").ShapeUnknown<[unknown]>;
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").TUnsafe<unknown>>;
146
+ }>;
151
147
  /**
152
148
  * Attaches message type-only getters to a WebSocket definition.
153
149
  *
@@ -1,4 +1,4 @@
1
- import { defineShape, indexedKeys, optional, or, unknownShape, } from 'object-shape-tester';
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: optional(originRequirementShape),
25
- customProps: optional(or(undefined, indexedKeys({
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",
3
+ "version": "1.2.5",
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.33.0",
44
- "@augment-vir/common": "^31.33.0",
45
- "date-vir": "^7.4.0",
46
- "type-fest": "^4.41.0",
47
- "url-vir": "^2.1.3"
43
+ "@augment-vir/assert": "^31.40.0",
44
+ "@augment-vir/common": "^31.40.0",
45
+ "date-vir": "^8.0.0",
46
+ "type-fest": "^5.1.0",
47
+ "url-vir": "^2.1.6"
48
48
  },
49
49
  "devDependencies": {
50
- "@augment-vir/test": "^31.33.0",
50
+ "@augment-vir/test": "^31.40.0",
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": "^5.3.0",
59
- "typedoc": "^0.28.10",
58
+ "object-shape-tester": "^6.9.2",
59
+ "typedoc": "^0.28.14",
60
60
  "ws": "^8.18.3"
61
61
  },
62
62
  "peerDependencies": {