@forklaunch/core 0.1.8 → 0.1.10

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.
Files changed (140) hide show
  1. package/dist/cache/index.d.ts +1 -0
  2. package/dist/cache/index.d.ts.map +1 -0
  3. package/dist/cache/index.js +3 -20
  4. package/dist/cache/interfaces/ttlCache.interface.d.ts +1 -0
  5. package/dist/cache/interfaces/ttlCache.interface.d.ts.map +1 -0
  6. package/dist/cache/interfaces/ttlCache.interface.js +1 -3
  7. package/dist/cache/redisTtlCache.d.ts +1 -0
  8. package/dist/cache/redisTtlCache.d.ts.map +1 -0
  9. package/dist/cache/redisTtlCache.js +3 -8
  10. package/dist/cache/types/ttlCacheRecord.types.d.ts +1 -0
  11. package/dist/cache/types/ttlCacheRecord.types.d.ts.map +1 -0
  12. package/dist/cache/types/ttlCacheRecord.types.js +1 -3
  13. package/dist/controllers/index.d.ts +1 -0
  14. package/dist/controllers/index.d.ts.map +1 -0
  15. package/dist/controllers/index.js +1 -18
  16. package/dist/controllers/interfaces/controller.interface.d.ts +1 -0
  17. package/dist/controllers/interfaces/controller.interface.d.ts.map +1 -0
  18. package/dist/controllers/interfaces/controller.interface.js +1 -3
  19. package/dist/database/index.d.ts +1 -0
  20. package/dist/database/index.d.ts.map +1 -0
  21. package/dist/database/index.js +1 -18
  22. package/dist/database/mikro/models/entities/base.entity.d.ts +1 -0
  23. package/dist/database/mikro/models/entities/base.entity.d.ts.map +1 -0
  24. package/dist/database/mikro/models/entities/base.entity.js +7 -18
  25. package/dist/entityMapper/index.d.ts +1 -0
  26. package/dist/entityMapper/index.d.ts.map +1 -0
  27. package/dist/entityMapper/index.js +2 -19
  28. package/dist/entityMapper/interfaces/entityMapper.interface.d.ts +1 -0
  29. package/dist/entityMapper/interfaces/entityMapper.interface.d.ts.map +1 -0
  30. package/dist/entityMapper/interfaces/entityMapper.interface.js +1 -3
  31. package/dist/entityMapper/models/baseEntityMapper.model.d.ts +1 -0
  32. package/dist/entityMapper/models/baseEntityMapper.model.d.ts.map +1 -0
  33. package/dist/entityMapper/models/baseEntityMapper.model.js +2 -8
  34. package/dist/entityMapper/models/requestEntityMapper.model.d.ts +1 -0
  35. package/dist/entityMapper/models/requestEntityMapper.model.d.ts.map +1 -0
  36. package/dist/entityMapper/models/requestEntityMapper.model.js +4 -9
  37. package/dist/entityMapper/models/responseEntityMapper.model.d.ts +1 -0
  38. package/dist/entityMapper/models/responseEntityMapper.model.d.ts.map +1 -0
  39. package/dist/entityMapper/models/responseEntityMapper.model.js +4 -9
  40. package/dist/entityMapper/types/entityMapper.types.d.ts +1 -0
  41. package/dist/entityMapper/types/entityMapper.types.d.ts.map +1 -0
  42. package/dist/entityMapper/types/entityMapper.types.js +1 -3
  43. package/dist/eslint.config.d.mts +3 -0
  44. package/dist/eslint.config.d.mts.map +1 -0
  45. package/dist/eslint.config.mjs +10 -0
  46. package/dist/http/httpStatusCodes.d.ts +1 -0
  47. package/dist/http/httpStatusCodes.d.ts.map +1 -0
  48. package/dist/http/httpStatusCodes.js +10 -21
  49. package/dist/http/index.d.ts +1 -0
  50. package/dist/http/index.d.ts.map +1 -0
  51. package/dist/http/index.js +5 -22
  52. package/dist/http/interfaces/forklaunchExpress.abstractClass.d.ts +146 -0
  53. package/dist/http/interfaces/forklaunchExpress.abstractClass.d.ts.map +1 -0
  54. package/dist/http/interfaces/forklaunchExpress.abstractClass.js +316 -0
  55. package/dist/http/middleware/index.d.ts +1 -0
  56. package/dist/http/middleware/index.d.ts.map +1 -0
  57. package/dist/http/middleware/index.js +2 -19
  58. package/dist/http/middleware/request.middleware.d.ts +11 -9
  59. package/dist/http/middleware/request.middleware.d.ts.map +1 -0
  60. package/dist/http/middleware/request.middleware.js +11 -45
  61. package/dist/http/middleware/response.middleware.d.ts +5 -2
  62. package/dist/http/middleware/response.middleware.d.ts.map +1 -0
  63. package/dist/http/middleware/response.middleware.js +1 -5
  64. package/dist/http/openApiV3Generator.d.ts +1 -0
  65. package/dist/http/openApiV3Generator.d.ts.map +1 -0
  66. package/dist/http/openApiV3Generator.js +28 -13
  67. package/dist/http/regex.d.ts +1 -0
  68. package/dist/http/regex.d.ts.map +1 -0
  69. package/dist/http/regex.js +1 -5
  70. package/dist/http/types/api.types.d.ts +129 -51
  71. package/dist/http/types/api.types.d.ts.map +1 -0
  72. package/dist/http/types/api.types.js +1 -3
  73. package/dist/http/types/forklaunch.types.d.ts +2 -3
  74. package/dist/http/types/forklaunch.types.d.ts.map +1 -0
  75. package/dist/http/types/forklaunch.types.js +1 -3
  76. package/dist/http/types/index.d.ts +1 -0
  77. package/dist/http/types/index.d.ts.map +1 -0
  78. package/dist/http/types/index.js +3 -20
  79. package/dist/http/types/primitive.types.d.ts +5 -4
  80. package/dist/http/types/primitive.types.d.ts.map +1 -0
  81. package/dist/http/types/primitive.types.js +1 -3
  82. package/dist/index.d.ts +1 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +6 -23
  85. package/dist/jest.config.d.ts +1 -0
  86. package/dist/jest.config.d.ts.map +1 -0
  87. package/dist/jest.config.js +1 -4
  88. package/dist/services/index.d.ts +1 -0
  89. package/dist/services/index.d.ts.map +1 -0
  90. package/dist/services/index.js +1 -18
  91. package/dist/services/interfaces/baseService.d.ts +1 -0
  92. package/dist/services/interfaces/baseService.d.ts.map +1 -0
  93. package/dist/services/interfaces/baseService.js +1 -3
  94. package/dist/tests/entityMapper.test.d.ts +1 -0
  95. package/dist/tests/entityMapper.test.d.ts.map +1 -0
  96. package/dist/tests/entityMapper.test.js +34 -24
  97. package/dist/tests/http.middleware.test.d.ts +1 -0
  98. package/dist/tests/http.middleware.test.d.ts.map +1 -0
  99. package/dist/tests/http.middleware.test.js +16 -17
  100. package/dist/tests/openApiV3Generator.test.d.ts +1 -0
  101. package/dist/tests/openApiV3Generator.test.d.ts.map +1 -0
  102. package/dist/tests/openApiV3Generator.test.js +5 -9
  103. package/dist/tests/redisTtlCache.test.d.ts +1 -0
  104. package/dist/tests/redisTtlCache.test.d.ts.map +1 -0
  105. package/dist/tests/redisTtlCache.test.js +4 -7
  106. package/dist/tsconfig.tsbuildinfo +1 -0
  107. package/package.json +5 -2
  108. package/dist/cache/index.js.map +0 -1
  109. package/dist/cache/interfaces/ttlCache.interface.js.map +0 -1
  110. package/dist/cache/redisTtlCache.js.map +0 -1
  111. package/dist/cache/types/ttlCacheRecord.types.js.map +0 -1
  112. package/dist/controllers/index.js.map +0 -1
  113. package/dist/controllers/interfaces/controller.interface.js.map +0 -1
  114. package/dist/database/index.js.map +0 -1
  115. package/dist/database/mikro/models/entities/base.entity.js.map +0 -1
  116. package/dist/entityMapper/index.js.map +0 -1
  117. package/dist/entityMapper/interfaces/entityMapper.interface.js.map +0 -1
  118. package/dist/entityMapper/models/baseEntityMapper.model.js.map +0 -1
  119. package/dist/entityMapper/models/requestEntityMapper.model.js.map +0 -1
  120. package/dist/entityMapper/models/responseEntityMapper.model.js.map +0 -1
  121. package/dist/entityMapper/types/entityMapper.types.js.map +0 -1
  122. package/dist/http/httpStatusCodes.js.map +0 -1
  123. package/dist/http/index.js.map +0 -1
  124. package/dist/http/middleware/index.js.map +0 -1
  125. package/dist/http/middleware/request.middleware.js.map +0 -1
  126. package/dist/http/middleware/response.middleware.js.map +0 -1
  127. package/dist/http/openApiV3Generator.js.map +0 -1
  128. package/dist/http/regex.js.map +0 -1
  129. package/dist/http/types/api.types.js.map +0 -1
  130. package/dist/http/types/forklaunch.types.js.map +0 -1
  131. package/dist/http/types/index.js.map +0 -1
  132. package/dist/http/types/primitive.types.js.map +0 -1
  133. package/dist/index.js.map +0 -1
  134. package/dist/jest.config.js.map +0 -1
  135. package/dist/services/index.js.map +0 -1
  136. package/dist/services/interfaces/baseService.js.map +0 -1
  137. package/dist/tests/entityMapper.test.js.map +0 -1
  138. package/dist/tests/http.middleware.test.js.map +0 -1
  139. package/dist/tests/openApiV3Generator.test.js.map +0 -1
  140. package/dist/tests/redisTtlCache.test.js.map +0 -1
@@ -1,38 +1,5 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createRequestContext = createRequestContext;
27
- exports.enrichRequestDetails = enrichRequestDetails;
28
- exports.preHandlerParse = preHandlerParse;
29
- exports.parseRequestParams = parseRequestParams;
30
- exports.parseRequestBody = parseRequestBody;
31
- exports.parseRequestHeaders = parseRequestHeaders;
32
- exports.parseRequestQuery = parseRequestQuery;
33
- exports.parseRequestAuth = parseRequestAuth;
34
- const jose = __importStar(require("jose"));
35
- const uuid_1 = require("uuid");
1
+ import * as jose from 'jose';
2
+ import { v4 } from 'uuid';
36
3
  /**
37
4
  * Middleware to create and add a request context.
38
5
  *
@@ -43,10 +10,10 @@ const uuid_1 = require("uuid");
43
10
  * @param {SV} schemaValidator - The schema validator.
44
11
  * @returns {Function} - Middleware function to create request context.
45
12
  */
46
- function createRequestContext(schemaValidator) {
13
+ export function createRequestContext(schemaValidator) {
47
14
  return (req, res, next) => {
48
15
  req.schemaValidator = schemaValidator;
49
- let correlationId = (0, uuid_1.v4)();
16
+ let correlationId = v4();
50
17
  if (req.headers['x-correlation-id']) {
51
18
  correlationId = req.headers['x-correlation-id'];
52
19
  }
@@ -69,7 +36,7 @@ function createRequestContext(schemaValidator) {
69
36
  * @param {PathParamHttpContractDetails<SV> | HttpContractDetails<SV>} contractDetails - The contract details.
70
37
  * @returns {Function} - Middleware function to enrich request details.
71
38
  */
72
- function enrichRequestDetails(contractDetails) {
39
+ export function enrichRequestDetails(contractDetails) {
73
40
  return (req, _res, next) => {
74
41
  req.contractDetails = contractDetails;
75
42
  if (next) {
@@ -86,7 +53,7 @@ function enrichRequestDetails(contractDetails) {
86
53
  * @param {StringOnlyObject<SV>} [schemaInput] - The schema input.
87
54
  * @returns {number | void} - Returns 400 if validation fails.
88
55
  */
89
- function preHandlerParse(schemaValidator, object, schemaInput) {
56
+ export function preHandlerParse(schemaValidator, object, schemaInput) {
90
57
  if (!schemaInput) {
91
58
  return;
92
59
  }
@@ -106,7 +73,7 @@ function preHandlerParse(schemaValidator, object, schemaInput) {
106
73
  * @param {Response} res - The response object.
107
74
  * @param {NextFunction} [next] - The next middleware function.
108
75
  */
109
- function parseRequestParams(req, res, next) {
76
+ export function parseRequestParams(req, res, next) {
110
77
  const params = req.contractDetails.params;
111
78
  if (preHandlerParse(req.schemaValidator, req.params, params) === 400) {
112
79
  res.status(400).send('Invalid request parameters.');
@@ -129,7 +96,7 @@ function parseRequestParams(req, res, next) {
129
96
  * @param {Response} res - The response object.
130
97
  * @param {NextFunction} [next] - The next middleware function.
131
98
  */
132
- function parseRequestBody(req, res, next) {
99
+ export function parseRequestBody(req, res, next) {
133
100
  if (req.headers['content-type'] === 'application/json') {
134
101
  const body = (req.schemaValidator,
135
102
  req.contractDetails).body;
@@ -155,7 +122,7 @@ function parseRequestBody(req, res, next) {
155
122
  * @param {Response} res - The response object.
156
123
  * @param {NextFunction} [next] - The next middleware function.
157
124
  */
158
- function parseRequestHeaders(req, res, next) {
125
+ export function parseReqHeaders(req, res, next) {
159
126
  const headers = req.contractDetails.requestHeaders;
160
127
  if (preHandlerParse(req.schemaValidator, req.headers, headers) === 400) {
161
128
  res.status(400).send('Invalid request headers.');
@@ -178,7 +145,7 @@ function parseRequestHeaders(req, res, next) {
178
145
  * @param {Response} res - The response object.
179
146
  * @param {NextFunction} [next] - The next middleware function.
180
147
  */
181
- function parseRequestQuery(req, res, next) {
148
+ export function parseRequestQuery(req, res, next) {
182
149
  const query = req.contractDetails.query;
183
150
  if (preHandlerParse(req.schemaValidator, req.query, query) === 400) {
184
151
  res.status(400).send('Invalid request query.');
@@ -256,7 +223,7 @@ async function checkAuthorizationToken(authorizationMethod, authorizationString)
256
223
  * @param {Response} res - The response object.
257
224
  * @param {NextFunction} [next] - The next middleware function.
258
225
  */
259
- async function parseRequestAuth(req, res, next) {
226
+ export async function parseRequestAuth(req, res, next) {
260
227
  const auth = req.contractDetails.auth;
261
228
  if (auth) {
262
229
  const errorAndMessage = await checkAuthorizationToken(auth.method, req.headers.authorization);
@@ -303,4 +270,3 @@ async function parseRequestAuth(req, res, next) {
303
270
  // next();
304
271
  // }
305
272
  }
306
- //# sourceMappingURL=request.middleware.js.map
@@ -1,5 +1,7 @@
1
1
  import { AnySchemaValidator } from '@forklaunch/validator';
2
- import { ForklaunchNextFunction, ForklaunchRequest, ForklaunchResponse } from '../types/api.types';
2
+ import { ParsedQs } from 'qs';
3
+ import { ForklaunchNextFunction, ForklaunchRequest, ForklaunchResHeaders, ForklaunchResponse } from '../types/api.types';
4
+ import { ParamsDictionary } from '../types/primitive.types';
3
5
  /**
4
6
  * Middleware to parse and validate the response.
5
7
  *
@@ -11,4 +13,5 @@ import { ForklaunchNextFunction, ForklaunchRequest, ForklaunchResponse } from '.
11
13
  * @param {Response} res - The response object.
12
14
  * @param {NextFunction} [next] - The next middleware function.
13
15
  */
14
- export declare function parseResponse<SV extends AnySchemaValidator, Request extends ForklaunchRequest<SV>, Response extends ForklaunchResponse, NextFunction extends ForklaunchNextFunction>(req: Request, res: Response, next?: NextFunction): void;
16
+ export declare function parseResponse<SV extends AnySchemaValidator, P extends ParamsDictionary, ResBodyMap extends Record<number, unknown>, ReqBody extends Record<string, unknown>, ReqQuery extends ParsedQs, ReqHeaders extends Record<string, string>, ResHeaders extends Record<string, string>, LocalsObj extends Record<string, unknown>>(req: ForklaunchRequest<SV, P, ReqBody, ReqQuery, ReqHeaders>, res: ForklaunchResponse<ResBodyMap, ForklaunchResHeaders & ResHeaders, LocalsObj>, next?: ForklaunchNextFunction): void;
17
+ //# sourceMappingURL=response.middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.middleware.d.ts","sourceRoot":"","sources":["../../../http/middleware/response.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAoBlC;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,EAAE,SAAS,kBAAkB,EAC7B,CAAC,SAAS,gBAAgB,EAC1B,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,QAAQ,SAAS,QAAQ,EACzB,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAEzC,GAAG,EAAE,iBAAiB,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,EAC5D,GAAG,EAAE,kBAAkB,CACrB,UAAU,EACV,oBAAoB,GAAG,UAAU,EACjC,SAAS,CACV,EACD,IAAI,CAAC,EAAE,sBAAsB,QAwC9B"}
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseResponse = parseResponse;
4
1
  /**
5
2
  * Checks if any validation is required for the given contract details.
6
3
  *
@@ -25,7 +22,7 @@ function checkAnyValidation(contractDetails) {
25
22
  * @param {Response} res - The response object.
26
23
  * @param {NextFunction} [next] - The next middleware function.
27
24
  */
28
- function parseResponse(req, res, next) {
25
+ export function parseResponse(req, res, next) {
29
26
  if (req.contractDetails.responseHeaders) {
30
27
  const schema = req.schemaValidator.schemify(req.contractDetails.responseHeaders);
31
28
  req.schemaValidator.validate(schema, res.getHeaders());
@@ -50,4 +47,3 @@ function parseResponse(req, res, next) {
50
47
  next();
51
48
  }
52
49
  }
53
- //# sourceMappingURL=response.middleware.js.map
@@ -11,3 +11,4 @@ import { ForklaunchRouter } from './types/forklaunch.types';
11
11
  * @returns {OpenAPIObject} - The generated Swagger document.
12
12
  */
13
13
  export declare function generateSwaggerDocument<SV extends AnySchemaValidator>(schemaValidator: SV, port: string | number, routers: ForklaunchRouter<SV>[]): OpenAPIObject;
14
+ //# sourceMappingURL=openApiV3Generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openApiV3Generator.d.ts","sourceRoot":"","sources":["../../http/openApiV3Generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,aAAa,EAKd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAiH5D;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,SAAS,kBAAkB,EACnE,eAAe,EAAE,EAAE,EACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,GAC9B,aAAa,CAqGf"}
@@ -1,10 +1,4 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateSwaggerDocument = generateSwaggerDocument;
7
- const httpStatusCodes_1 = __importDefault(require("./httpStatusCodes"));
1
+ import HTTPStatuses from './httpStatusCodes';
8
2
  /**
9
3
  * Capitalizes the first letter of a string.
10
4
  *
@@ -81,6 +75,28 @@ function contentResolver(schemaValidator, body) {
81
75
  }
82
76
  };
83
77
  }
78
+ /**
79
+ * Maps a method to a Swagger method type.
80
+ *
81
+ * @param {string} method - The method to map.
82
+ * @returns {string} - The mapped method.
83
+ */
84
+ function mapMethodType(method) {
85
+ switch (method) {
86
+ case 'GET':
87
+ return 'get';
88
+ case 'POST':
89
+ return 'post';
90
+ case 'PUT':
91
+ return 'put';
92
+ case 'DELETE':
93
+ return 'delete';
94
+ case 'PATCH':
95
+ return 'patch';
96
+ default:
97
+ return 'get';
98
+ }
99
+ }
84
100
  /**
85
101
  * Generates a Swagger document from given routers.
86
102
  *
@@ -90,7 +106,7 @@ function contentResolver(schemaValidator, body) {
90
106
  * @param {ForklaunchRouter<SV>[]} routers - The routers to include in the Swagger document.
91
107
  * @returns {OpenAPIObject} - The generated Swagger document.
92
108
  */
93
- function generateSwaggerDocument(schemaValidator, port, routers) {
109
+ export function generateSwaggerDocument(schemaValidator, port, routers) {
94
110
  const tags = [];
95
111
  const paths = {};
96
112
  routers.forEach((router) => {
@@ -108,7 +124,7 @@ function generateSwaggerDocument(schemaValidator, port, routers) {
108
124
  const responses = {};
109
125
  for (const key in route.contractDetails.responses) {
110
126
  responses[key] = {
111
- description: httpStatusCodes_1.default[key],
127
+ description: HTTPStatuses[key],
112
128
  content: contentResolver(schemaValidator, route.contractDetails.responses[key])
113
129
  };
114
130
  }
@@ -151,11 +167,11 @@ function generateSwaggerDocument(schemaValidator, port, routers) {
151
167
  }
152
168
  if (route.contractDetails.auth) {
153
169
  responses[401] = {
154
- description: httpStatusCodes_1.default[401],
170
+ description: HTTPStatuses[401],
155
171
  content: contentResolver(schemaValidator, schemaValidator.string)
156
172
  };
157
173
  responses[403] = {
158
- description: httpStatusCodes_1.default[403],
174
+ description: HTTPStatuses[403],
159
175
  content: contentResolver(schemaValidator, schemaValidator.string)
160
176
  };
161
177
  if (route.contractDetails.auth.method === 'jwt') {
@@ -166,9 +182,8 @@ function generateSwaggerDocument(schemaValidator, port, routers) {
166
182
  ];
167
183
  }
168
184
  }
169
- paths[fullPath][route.method] = pathItemObject;
185
+ paths[fullPath][mapMethodType(route.method)] = pathItemObject;
170
186
  });
171
187
  });
172
188
  return swaggerDocument(port, tags, paths);
173
189
  }
174
- //# sourceMappingURL=openApiV3Generator.js.map
@@ -6,3 +6,4 @@
6
6
  * @throws {Error} - Throws an error if there are unmatched brackets or groups.
7
7
  */
8
8
  export declare function generateStringFromRegex(regex: RegExp | string): string;
9
+ //# sourceMappingURL=regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../http/regex.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAwGtE"}
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateStringFromRegex = generateStringFromRegex;
4
1
  /**
5
2
  * Generates a string from a given regular expression or string representation of a regex.
6
3
  *
@@ -8,7 +5,7 @@ exports.generateStringFromRegex = generateStringFromRegex;
8
5
  * @returns {string} - The generated string based on the regex pattern.
9
6
  * @throws {Error} - Throws an error if there are unmatched brackets or groups.
10
7
  */
11
- function generateStringFromRegex(regex) {
8
+ export function generateStringFromRegex(regex) {
12
9
  let regexStr = typeof regex === 'object' ? regex.source : regex;
13
10
  // Remove leading and trailing slashes if present
14
11
  if (regexStr.startsWith('/'))
@@ -112,4 +109,3 @@ function generateStringFromRegex(regex) {
112
109
  }
113
110
  return result;
114
111
  }
115
- //# sourceMappingURL=regex.js.map
@@ -1,9 +1,8 @@
1
1
  import { Prettify } from '@forklaunch/common';
2
2
  import { AnySchemaValidator, Schema } from '@forklaunch/validator';
3
3
  import { IdiomaticSchema, SchemaValidator } from '@forklaunch/validator/types';
4
- import { IncomingHttpHeaders } from 'http';
5
4
  import { ParsedQs } from 'qs';
6
- import { HttpContractDetails, ParamsDictionary, PathParamHttpContractDetails } from './primitive.types';
5
+ import { Body, HeadersObject, HttpContractDetails, ParamsDictionary, ParamsObject, PathParamHttpContractDetails, QueryObject, ResponsesObject } from './primitive.types';
7
6
  /**
8
7
  * Interface representing the context of a request.
9
8
  */
@@ -22,7 +21,7 @@ export interface RequestContext {
22
21
  * @template ReqQuery - A type for the request query, defaulting to ParsedQs.
23
22
  * @template Headers - A type for the request headers, defaulting to IncomingHttpHeaders.
24
23
  */
25
- export interface ForklaunchRequest<SV extends AnySchemaValidator, P = ParamsDictionary, ReqBody = unknown, ReqQuery = ParsedQs, Headers = IncomingHttpHeaders> {
24
+ export interface ForklaunchRequest<SV extends AnySchemaValidator, P extends ParamsDictionary, ReqBody extends Record<string, unknown>, ReqQuery extends ParsedQs, ReqHeaders extends Record<string, string>> {
26
25
  /** Context of the request */
27
26
  context: Prettify<RequestContext>;
28
27
  /** Contract details for the request */
@@ -32,58 +31,16 @@ export interface ForklaunchRequest<SV extends AnySchemaValidator, P = ParamsDict
32
31
  /** Request parameters */
33
32
  params: P;
34
33
  /** Request headers */
35
- headers: Headers;
34
+ headers: ReqHeaders;
36
35
  /** Request body */
37
36
  body: ReqBody;
38
37
  /** Request query */
39
38
  query: ReqQuery;
40
39
  }
41
- /**
42
- * Interface representing a Forklaunch response.
43
- *
44
- * @template ResBody - A type for the response body, defaulting to common status code responses.
45
- * @template StatusCode - A type for the status code, defaulting to number.
46
- */
47
- export interface ForklaunchResponse<ResBody = {
48
- 400: unknown;
49
- 401: unknown;
50
- 403: unknown;
51
- 500: unknown;
52
- }, StatusCode = number, Headers = {
53
- 'x-correlation-id': string;
54
- }> {
55
- /** Data of the response body */
56
- bodyData: unknown;
57
- /** Status code of the response */
58
- statusCode: StatusCode;
59
- /** Whether the response is corked */
60
- corked: boolean;
61
- /**
62
- * Gets the headers of the response.
63
- * @returns {Headers} - The headers of the response.
64
- */
65
- getHeaders: () => Headers;
66
- /**
67
- * Sets a header for the response.
68
- * @param {string} key - The header key.
69
- * @param {string} value - The header value.
70
- */
71
- setHeader: <K extends keyof Headers>(key: K, value: Headers[K]) => void;
72
- /**
73
- * Sets the status of the response.
74
- * @param {U} code - The status code.
75
- * @param {string} [message] - Optional message.
76
- * @returns {ForklaunchResponse<ResBody[U], U>} - The response with the given status.
77
- */
78
- status: {
79
- <U extends keyof ResBody>(code: U): ForklaunchResponse<ResBody[U], U>;
80
- <U extends keyof ResBody>(code: U, message?: string): ForklaunchResponse<ResBody[U], U>;
81
- <U extends 500>(code: U): ForklaunchResponse<string, U>;
82
- <U extends 500>(code: U, message?: string): ForklaunchResponse<string, U>;
83
- };
40
+ export interface ForklaunchStatusResponse<ResBody> {
84
41
  /**
85
42
  * Sends the response.
86
- * @param {ResBody} [body] - The response body.
43
+ * @param {ResBodyMap} [body] - The response body.
87
44
  * @param {boolean} [close_connection] - Whether to close the connection.
88
45
  * @returns {T} - The sent response.
89
46
  */
@@ -93,7 +50,7 @@ export interface ForklaunchResponse<ResBody = {
93
50
  };
94
51
  /**
95
52
  * Sends a JSON response.
96
- * @param {ResBody} [body] - The response body.
53
+ * @param {ResBodyMap} [body] - The response body.
97
54
  * @returns {boolean|T} - The JSON response.
98
55
  */
99
56
  json: {
@@ -102,7 +59,7 @@ export interface ForklaunchResponse<ResBody = {
102
59
  };
103
60
  /**
104
61
  * Sends a JSONP response.
105
- * @param {ResBody} [body] - The response body.
62
+ * @param {ResBodyMap} [body] - The response body.
106
63
  * @returns {boolean|T} - The JSONP response.
107
64
  */
108
65
  jsonp: {
@@ -110,6 +67,45 @@ export interface ForklaunchResponse<ResBody = {
110
67
  <T>(body?: ResBody): T;
111
68
  };
112
69
  }
70
+ /**
71
+ * Interface representing a Forklaunch response.
72
+ *
73
+ * @template ResBodyMap - A type for the response body, defaulting to common status code responses.
74
+ * @template StatusCode - A type for the status code, defaulting to number.
75
+ */
76
+ export interface ForklaunchResponse<ResBodyMap extends Record<number, unknown>, ResHeaders extends Record<string, string>, LocalsObj extends Record<string, unknown>> {
77
+ /** Data of the response body */
78
+ bodyData: unknown;
79
+ /** Status code of the response */
80
+ statusCode: keyof ResBodyMap & number;
81
+ /** Whether the response is corked */
82
+ corked: boolean;
83
+ /** Whether the response is finished */
84
+ headersSent: boolean;
85
+ /**
86
+ * Gets the headers of the response.
87
+ * @returns {Omit<ResHeaders, keyof ForklaunchResHeaders> & ForklaunchResHeaders} - The headers of the response.
88
+ */
89
+ getHeaders: () => Omit<ResHeaders, keyof ForklaunchResHeaders> & ForklaunchResHeaders;
90
+ /**
91
+ * Sets a header for the response.
92
+ * @param {string} key - The header key.
93
+ * @param {string} value - The header value.
94
+ */
95
+ setHeader: <K extends keyof (ResHeaders & ForklaunchResHeaders)>(key: K, value: K extends keyof ForklaunchResHeaders ? ForklaunchResHeaders[K] : ResHeaders[K]) => void;
96
+ /**
97
+ * Sets the status of the response.
98
+ * @param {U} code - The status code.
99
+ * @param {string} [message] - Optional message.
100
+ * @returns {ForklaunchResponse<(ResBodyMap)[U], ResHeaders, U, LocalsObj>} - The response with the given status.
101
+ */
102
+ status: {
103
+ <U extends keyof (ResBodyMap & ForklaunchResErrors)>(code: U): ForklaunchStatusResponse<(Omit<ForklaunchResErrors, keyof ResBodyMap> & ResBodyMap)[U]>;
104
+ <U extends keyof (ResBodyMap & ForklaunchResErrors)>(code: U, message?: string): ForklaunchStatusResponse<(Omit<ForklaunchResErrors, keyof ResBodyMap> & ResBodyMap)[U]>;
105
+ };
106
+ /** Local variables */
107
+ locals: LocalsObj;
108
+ }
113
109
  /**
114
110
  * Type representing a mapped schema.
115
111
  *
@@ -118,9 +114,91 @@ export interface ForklaunchResponse<ResBody = {
118
114
  */
119
115
  export type MapSchema<SV extends AnySchemaValidator, T extends IdiomaticSchema<SV> | SV['_ValidSchemaObject']> = Schema<T, SV> extends infer U ? {
120
116
  [key: string]: unknown;
121
- } extends U ? never : U : never;
117
+ } extends U ? unknown : U : never;
122
118
  /**
123
119
  * Type representing the next function in a middleware.
124
120
  * @param {unknown} [err] - Optional error parameter.
125
121
  */
126
122
  export type ForklaunchNextFunction = (err?: unknown) => void;
123
+ /**
124
+ * Represents a middleware handler with schema validation.
125
+ *
126
+ * @template SV - A type that extends AnySchemaValidator.
127
+ * @template P - A type for request parameters, defaulting to ParamsDictionary.
128
+ * @template ResBodyMap - A type for the response body, defaulting to unknown.
129
+ * @template ReqBody - A type for the request body, defaulting to unknown.
130
+ * @template ReqQuery - A type for the request query, defaulting to ParsedQs.
131
+ * @template LocalsObj - A type for local variables, defaulting to an empty object.
132
+ * @template StatusCode - A type for the status code, defaulting to number.
133
+ */
134
+ export interface ForklaunchMiddlewareHandler<SV extends AnySchemaValidator, P extends ParamsDictionary, ResBodyMap extends Record<number, unknown>, ReqBody extends Record<string, unknown>, ReqQuery extends ParsedQs, ReqHeaders extends Record<string, string>, ResHeaders extends Record<string, string>, LocalsObj extends Record<string, unknown>> {
135
+ (req: ForklaunchRequest<SV, P, ReqBody, ReqQuery, ReqHeaders>, res: ForklaunchResponse<ResBodyMap, ResHeaders, LocalsObj>, next?: ForklaunchNextFunction): void | Promise<void>;
136
+ }
137
+ /**
138
+ * Represents a schema middleware handler with typed parameters, responses, body, and query.
139
+ *
140
+ * @template SV - A type that extends AnySchemaValidator.
141
+ * @template P - A type for parameter schemas, defaulting to ParamsObject.
142
+ * @template ResBodyMap - A type for response schemas, defaulting to ResponsesObject.
143
+ * @template ReqBody - A type for the request body, defaulting to Body.
144
+ * @template ReqQuery - A type for the request query, defaulting to QueryObject.
145
+ * @template LocalsObj - A type for local variables, defaulting to an empty object.
146
+ */
147
+ export type ForklaunchSchemaMiddlewareHandler<SV extends AnySchemaValidator, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV> | unknown, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>> = ForklaunchMiddlewareHandler<SV, MapSchema<SV, P> extends infer Params ? unknown extends Params ? never : Params : never, MapSchema<SV, ResBodyMap> extends infer ResponseBodyMap ? unknown extends ResponseBodyMap ? ForklaunchResErrors : ResponseBodyMap : never, MapSchema<SV, ReqBody> extends infer Body ? unknown extends Body ? never : Body : never, MapSchema<SV, ReqQuery> extends infer Query ? unknown extends Query ? never : Query : never, MapSchema<SV, ReqHeaders> extends infer RequestHeaders ? unknown extends RequestHeaders ? ForklaunchResHeaders : ReqHeaders : never, MapSchema<SV, ResHeaders> extends infer ResponseHeaders ? unknown extends ResponseHeaders ? never : ResHeaders : never, LocalsObj>;
148
+ /**
149
+ * Represents a live type function for the SDK.
150
+ *
151
+ * @template SV - A type that extends AnySchemaValidator.
152
+ * @template Path - A type for the route path.
153
+ * @template P - A type for request parameters.
154
+ * @template ResBodyMap - A type for response schemas.
155
+ * @template ReqBody - A type for the request body.
156
+ * @template ReqQuery - A type for the request query.
157
+ * @template ReqHeaders - A type for the request headers.
158
+ * @template ResHeaders - A type for the response headers.
159
+ *
160
+ */
161
+ export type LiveTypeFunction<SV extends AnySchemaValidator, Route extends string, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>> = (MapSchema<SV, P> extends infer Params ? unknown extends Params ? unknown : {
162
+ params: Params;
163
+ } : unknown) & (MapSchema<SV, ReqBody> extends infer Body ? unknown extends Body ? unknown : {
164
+ body: Body;
165
+ } : unknown) & (MapSchema<SV, ReqQuery> extends infer Query ? unknown extends Query ? unknown : {
166
+ query: Query;
167
+ } : unknown) & (MapSchema<SV, ReqHeaders> extends infer ReqHeaders ? unknown extends ReqHeaders ? unknown : {
168
+ headers: ReqHeaders;
169
+ } : unknown) extends infer Request ? SdkResponse<ForklaunchResErrors & (MapSchema<SV, ResBodyMap> extends infer Response ? unknown extends Response ? unknown : Response : unknown), MapSchema<SV, ResHeaders> extends infer ResHeaders ? unknown extends ResHeaders ? unknown : ResHeaders : unknown> extends infer Return ? unknown extends Request ? (route: Route) => Promise<Return> : (route: Route, request: Request) => Promise<Return> : never : never;
170
+ /**
171
+ * Represents a basic SDK Response object.
172
+ *
173
+ * @template ResBodyMap - A type for the response body.
174
+ * @template ResHeaders - A type for the response headers.
175
+ */
176
+ type SdkResponse<ResBodyMap extends Record<number, unknown>, ResHeaders extends Record<string, string> | unknown> = Prettify<{
177
+ [key in keyof ResBodyMap]: {
178
+ code: key;
179
+ response: ResBodyMap[key];
180
+ } & (unknown extends ResHeaders ? unknown : {
181
+ headers: ResHeaders;
182
+ });
183
+ }[keyof ResBodyMap]>;
184
+ /**
185
+ * Represents the default error types for responses.
186
+ */
187
+ export type ForklaunchResErrors<BadRequest = string, Unauthorized = string, Forbidden = string, InternalServerErrorType = string> = {
188
+ 400: BadRequest;
189
+ 401: Unauthorized;
190
+ 403: Forbidden;
191
+ 500: InternalServerErrorType;
192
+ };
193
+ /**
194
+ * Represents the default header types for responses.
195
+ */
196
+ export type ForklaunchResHeaders = {
197
+ 'x-correlation-id': string;
198
+ };
199
+ /**
200
+ * Represents the default error types for responses.
201
+ */
202
+ export type ExpressLikeRouterFunction = (req: unknown, res: unknown, next?: (err?: unknown) => void) => Promise<void> | void;
203
+ export {};
204
+ //# sourceMappingURL=api.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../http/types/api.types.ts"],"names":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GAAG,EAAE,SAAS,CAAC;IACf,GAAG,EAAE,uBAAuB,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,KAC3B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=api.types.js.map
1
+ export {};
@@ -21,10 +21,9 @@ export interface ForklaunchRoute<SV extends AnySchemaValidator> {
21
21
  basePath: string;
22
22
  /** The path for the route, which can be a string, RegExp, or an array of strings or RegExps */
23
23
  path: string | RegExp | (string | RegExp)[];
24
- /** The SDK path for the route */
25
- sdkPath: string;
26
24
  /** The HTTP method for the route */
27
- method: 'get' | 'post' | 'put' | 'patch' | 'delete';
25
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
28
26
  /** The contract details for the route */
29
27
  contractDetails: PathParamHttpContractDetails<SV> | HttpContractDetails<SV>;
30
28
  }
29
+ //# sourceMappingURL=forklaunch.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forklaunch.types.d.ts","sourceRoot":"","sources":["../../../http/types/forklaunch.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,mBAAmB,CAAC;AAE3B;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,EAAE,SAAS,kBAAkB;IAC7D,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,EAAE,SAAS,kBAAkB;IAC5D,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC5C,oCAAoC;IACpC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,yCAAyC;IACzC,eAAe,EAAE,4BAA4B,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAC;CAC7E"}
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=forklaunch.types.js.map
1
+ export {};
@@ -1,3 +1,4 @@
1
1
  export * from './api.types';
2
2
  export * from './forklaunch.types';
3
3
  export * from './primitive.types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../http/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
@@ -1,20 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./api.types"), exports);
18
- __exportStar(require("./forklaunch.types"), exports);
19
- __exportStar(require("./primitive.types"), exports);
20
- //# sourceMappingURL=index.js.map
1
+ export * from './api.types';
2
+ export * from './forklaunch.types';
3
+ export * from './primitive.types';
@@ -68,7 +68,7 @@ export type AuthMethod = 'jwt' | 'session';
68
68
  * @template ResponseSchemas - A type for response schemas, defaulting to ResponsesObject.
69
69
  * @template QuerySchemas - A type for query schemas, defaulting to QueryObject.
70
70
  */
71
- export interface PathParamHttpContractDetails<SV extends AnySchemaValidator, ParamSchemas extends ParamsObject<SV> = ParamsObject<SV>, ResponseSchemas extends ResponsesObject<SV> = ResponsesObject<SV>, QuerySchemas extends QueryObject<SV> = QueryObject<SV>, RequestHeaders extends HeadersObject<SV> = HeadersObject<SV>, ResponseHeaders extends HeadersObject<SV> = HeadersObject<SV>> {
71
+ export interface PathParamHttpContractDetails<SV extends AnySchemaValidator, ParamSchemas extends ParamsObject<SV> = ParamsObject<SV>, ResponseSchemas extends ResponsesObject<SV> = ResponsesObject<SV>, QuerySchemas extends QueryObject<SV> = QueryObject<SV>, ReqHeaders extends HeadersObject<SV> = HeadersObject<SV>, ResHeaders extends HeadersObject<SV> = HeadersObject<SV>> {
72
72
  /** Name of the contract */
73
73
  name: string;
74
74
  /** Summary of the contract */
@@ -76,9 +76,9 @@ export interface PathParamHttpContractDetails<SV extends AnySchemaValidator, Par
76
76
  /** Response schemas for the contract */
77
77
  responses: ResponseSchemas;
78
78
  /** Optional request headers for the contract */
79
- requestHeaders?: RequestHeaders;
79
+ requestHeaders?: ReqHeaders;
80
80
  /** Optional response headers for the contract */
81
- responseHeaders?: ResponseHeaders;
81
+ responseHeaders?: ResHeaders;
82
82
  /** Optional parameter schemas for the contract */
83
83
  params?: ParamSchemas;
84
84
  /** Optional query schemas for the contract */
@@ -101,9 +101,10 @@ export interface PathParamHttpContractDetails<SV extends AnySchemaValidator, Par
101
101
  * @template BodySchema - A type for the body schema, defaulting to Body.
102
102
  * @template QuerySchemas - A type for query schemas, defaulting to QueryObject.
103
103
  */
104
- export interface HttpContractDetails<SV extends AnySchemaValidator, ParamSchemas extends ParamsObject<SV> = ParamsObject<SV>, ResponseSchemas extends ResponsesObject<SV> = ResponsesObject<SV>, BodySchema extends Body<SV> = Body<SV>, QuerySchemas extends QueryObject<SV> = QueryObject<SV>> extends PathParamHttpContractDetails<SV, ParamSchemas, ResponseSchemas, QuerySchemas> {
104
+ export interface HttpContractDetails<SV extends AnySchemaValidator, ParamSchemas extends ParamsObject<SV> = ParamsObject<SV>, ResponseSchemas extends ResponsesObject<SV> = ResponsesObject<SV>, BodySchema extends Body<SV> = Body<SV>, QuerySchemas extends QueryObject<SV> = QueryObject<SV>, ReqHeaders extends HeadersObject<SV> = HeadersObject<SV>, ResHeaders extends HeadersObject<SV> = HeadersObject<SV>> extends PathParamHttpContractDetails<SV, ParamSchemas, ResponseSchemas, QuerySchemas, ReqHeaders, ResHeaders> {
105
105
  /** Optional body schema for the contract */
106
106
  body?: BodySchema;
107
107
  /** Optional content type for the contract */
108
108
  contentType?: 'application/json' | 'multipart/form-data' | 'application/x-www-form-urlencoded';
109
109
  }
110
+ //# sourceMappingURL=primitive.types.d.ts.map