@rest-vir/implement-service 1.5.1 → 1.6.0

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.
@@ -23,6 +23,7 @@ export type EndpointImplementationErrorOutput = {
23
23
  responseData?: undefined;
24
24
  headers?: OutgoingHttpHeaders | undefined;
25
25
  dataType?: undefined;
26
+ responseHandled?: never;
26
27
  };
27
28
  /**
28
29
  * The object that all endpoint implementations should return.
@@ -31,7 +32,25 @@ export type EndpointImplementationErrorOutput = {
31
32
  * @category Package : @rest-vir/implement-service
32
33
  * @package [`@rest-vir/implement-service`](https://www.npmjs.com/package/@rest-vir/implement-service)
33
34
  */
34
- export type EndpointImplementationOutput<ResponseDataType = unknown> = EndpointImplementationErrorOutput | ({
35
+ /**
36
+ * Returned by an endpoint implementation that has taken full control of the response (e.g. SSE
37
+ * streaming via `response.hijack()`). When the framework receives this, it skips response
38
+ * validation, the post-hook, and the final `response.send()`.
39
+ *
40
+ * @category Internal
41
+ * @category Package : @rest-vir/implement-service
42
+ * @package [`@rest-vir/implement-service`](https://www.npmjs.com/package/@rest-vir/implement-service)
43
+ */
44
+ export type EndpointImplementationHandledOutput = {
45
+ /** The response has been fully handled by the endpoint implementation. */
46
+ responseHandled: true;
47
+ statusCode?: never;
48
+ responseData?: never;
49
+ responseErrorMessage?: never;
50
+ dataType?: never;
51
+ headers?: never;
52
+ };
53
+ export type EndpointImplementationOutput<ResponseDataType = unknown> = EndpointImplementationErrorOutput | EndpointImplementationHandledOutput | ({
35
54
  statusCode: HttpStatusByCategory<SuccessHttpStatusCategories>;
36
55
  responseErrorMessage?: never;
37
56
  /**
@@ -40,6 +59,7 @@ export type EndpointImplementationOutput<ResponseDataType = unknown> = EndpointI
40
59
  */
41
60
  dataType?: string | undefined;
42
61
  headers?: OutgoingHttpHeaders | undefined;
62
+ responseHandled?: never;
43
63
  } & (ResponseDataType extends undefined ? {
44
64
  responseData?: ResponseDataType;
45
65
  } : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rest-vir/implement-service",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "Implement a service defined by @rest-vir/define-service.",
5
5
  "keywords": [
6
6
  "rest",
@@ -39,17 +39,17 @@
39
39
  "test:update": "npm test update"
40
40
  },
41
41
  "dependencies": {
42
- "@augment-vir/assert": "^31.68.1",
43
- "@augment-vir/common": "^31.68.1",
44
- "@rest-vir/define-service": "^1.5.1",
42
+ "@augment-vir/assert": "^31.68.2",
43
+ "@augment-vir/common": "^31.68.2",
44
+ "@rest-vir/define-service": "^1.6.0",
45
45
  "@types/ws": "^8.18.1",
46
- "fastify": "^5.8.2",
46
+ "fastify": "^5.8.4",
47
47
  "path-to-regexp": "^8.3.0",
48
- "type-fest": "^5.4.4"
48
+ "type-fest": "^5.5.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@augment-vir/test": "^31.68.1",
52
- "@types/node": "^25.3.0",
51
+ "@augment-vir/test": "^31.68.2",
52
+ "@types/node": "^25.5.0",
53
53
  "c8": "^11.0.0",
54
54
  "istanbul-smart-text-reporter": "^1.1.5",
55
55
  "markdown-code-example-inserter": "^3.0.3",