@rest-vir/define-service 0.4.0 → 0.4.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject, HttpMethod,
|
|
1
|
+
import { AnyObject, HttpMethod, Overwrite, type SelectFrom } from '@augment-vir/common';
|
|
2
2
|
import { type ShapeDefinition, type ShapeToRuntimeType } from 'object-shape-tester';
|
|
3
3
|
import { type RequireAtLeastOne } from 'type-fest';
|
|
4
4
|
import { type MinimalService } from '../service/minimal-service.js';
|
|
@@ -6,14 +6,6 @@ import { type NoParam } from '../util/no-param.js';
|
|
|
6
6
|
import { type OriginRequirement } from '../util/origin.js';
|
|
7
7
|
import { BaseSearchParams } from '../util/search-params.js';
|
|
8
8
|
import { type EndpointPathBase } from './endpoint-path.js';
|
|
9
|
-
/**
|
|
10
|
-
* Base Endpoint request/response shape type.
|
|
11
|
-
*
|
|
12
|
-
* @category Internal
|
|
13
|
-
* @category Package : @rest-vir/define-service
|
|
14
|
-
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
15
|
-
*/
|
|
16
|
-
export type EndpointDataShapeBase = JsonCompatibleValue;
|
|
17
9
|
/**
|
|
18
10
|
* The type for setting up an individual endpoint, used in `defineService`.
|
|
19
11
|
*
|
|
@@ -21,7 +13,7 @@ export type EndpointDataShapeBase = JsonCompatibleValue;
|
|
|
21
13
|
* @category Package : @rest-vir/define-service
|
|
22
14
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
23
15
|
*/
|
|
24
|
-
export type EndpointInit<AllowedMethods extends RequireAtLeastOne<Record<HttpMethod, boolean>> = RequireAtLeastOne<Record<HttpMethod, boolean>>, RequestDataShape
|
|
16
|
+
export type EndpointInit<AllowedMethods extends RequireAtLeastOne<Record<HttpMethod, boolean>> = RequireAtLeastOne<Record<HttpMethod, boolean>>, RequestDataShape = unknown, ResponseDataShape = unknown> = {
|
|
25
17
|
/**
|
|
26
18
|
* Shape definition for request data. Set to `undefined` for no request data.
|
|
27
19
|
*
|
|
@@ -141,7 +133,7 @@ export type WithFinalEndpointProps<Init, EndpointPath extends EndpointPathBase>
|
|
|
141
133
|
* @category Package : @rest-vir/define-service
|
|
142
134
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
143
135
|
*/
|
|
144
|
-
export type EndpointDefinition<AllowedMethods extends RequireAtLeastOne<Record<HttpMethod, boolean>> = RequireAtLeastOne<Record<HttpMethod, boolean>>, RequestDataShape
|
|
136
|
+
export type EndpointDefinition<AllowedMethods extends RequireAtLeastOne<Record<HttpMethod, boolean>> = RequireAtLeastOne<Record<HttpMethod, boolean>>, RequestDataShape = NoParam, ResponseDataShape = NoParam, EndpointPath extends EndpointPathBase = EndpointPathBase> = WithFinalEndpointProps<EndpointInit<AllowedMethods, RequestDataShape, ResponseDataShape>, EndpointPath>;
|
|
145
137
|
/**
|
|
146
138
|
* A generic version of {@link EndpointDefinition} that any endpoint can be assigned to.
|
|
147
139
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpMethod
|
|
1
|
+
import { HttpMethod } from '@augment-vir/common';
|
|
2
2
|
import { defineShape, enumShape, indexedKeys, optional, or, unknownShape, } from 'object-shape-tester';
|
|
3
3
|
import { ensureServiceDefinitionError } from '../service/service-definition.error.js';
|
|
4
4
|
import { originRequirementShape } from '../util/origin.js';
|