@rexeus/typeweaver-core 0.5.1 → 0.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.
package/dist/index.cjs CHANGED
@@ -1,388 +1,393 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let zod = require("zod");
2
3
 
3
- var zod = require('zod');
4
-
5
- // src/HttpStatusCode.ts
6
- var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
7
- HttpStatusCode2[HttpStatusCode2["OK"] = 200] = "OK";
8
- HttpStatusCode2[HttpStatusCode2["CREATED"] = 201] = "CREATED";
9
- HttpStatusCode2[HttpStatusCode2["ACCEPTED"] = 202] = "ACCEPTED";
10
- HttpStatusCode2[HttpStatusCode2["NO_CONTENT"] = 204] = "NO_CONTENT";
11
- HttpStatusCode2[HttpStatusCode2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
12
- HttpStatusCode2[HttpStatusCode2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
13
- HttpStatusCode2[HttpStatusCode2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
14
- HttpStatusCode2[HttpStatusCode2["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
15
- HttpStatusCode2[HttpStatusCode2["IM_USED"] = 226] = "IM_USED";
16
- HttpStatusCode2[HttpStatusCode2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
17
- HttpStatusCode2[HttpStatusCode2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
18
- HttpStatusCode2[HttpStatusCode2["FOUND"] = 302] = "FOUND";
19
- HttpStatusCode2[HttpStatusCode2["SEE_OTHER"] = 303] = "SEE_OTHER";
20
- HttpStatusCode2[HttpStatusCode2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
21
- HttpStatusCode2[HttpStatusCode2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
22
- HttpStatusCode2[HttpStatusCode2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
23
- HttpStatusCode2[HttpStatusCode2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
24
- HttpStatusCode2[HttpStatusCode2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
25
- HttpStatusCode2[HttpStatusCode2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
26
- HttpStatusCode2[HttpStatusCode2["FORBIDDEN"] = 403] = "FORBIDDEN";
27
- HttpStatusCode2[HttpStatusCode2["NOT_FOUND"] = 404] = "NOT_FOUND";
28
- HttpStatusCode2[HttpStatusCode2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
29
- HttpStatusCode2[HttpStatusCode2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
30
- HttpStatusCode2[HttpStatusCode2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
31
- HttpStatusCode2[HttpStatusCode2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
32
- HttpStatusCode2[HttpStatusCode2["CONFLICT"] = 409] = "CONFLICT";
33
- HttpStatusCode2[HttpStatusCode2["GONE"] = 410] = "GONE";
34
- HttpStatusCode2[HttpStatusCode2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
35
- HttpStatusCode2[HttpStatusCode2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
36
- HttpStatusCode2[HttpStatusCode2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
37
- HttpStatusCode2[HttpStatusCode2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
38
- HttpStatusCode2[HttpStatusCode2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
39
- HttpStatusCode2[HttpStatusCode2["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
40
- HttpStatusCode2[HttpStatusCode2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
41
- HttpStatusCode2[HttpStatusCode2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
42
- HttpStatusCode2[HttpStatusCode2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
43
- HttpStatusCode2[HttpStatusCode2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
44
- HttpStatusCode2[HttpStatusCode2["LOCKED"] = 423] = "LOCKED";
45
- HttpStatusCode2[HttpStatusCode2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
46
- HttpStatusCode2[HttpStatusCode2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
47
- HttpStatusCode2[HttpStatusCode2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
48
- HttpStatusCode2[HttpStatusCode2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
49
- HttpStatusCode2[HttpStatusCode2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
50
- HttpStatusCode2[HttpStatusCode2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
51
- HttpStatusCode2[HttpStatusCode2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
52
- HttpStatusCode2[HttpStatusCode2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
53
- HttpStatusCode2[HttpStatusCode2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
54
- HttpStatusCode2[HttpStatusCode2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
55
- HttpStatusCode2[HttpStatusCode2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
56
- HttpStatusCode2[HttpStatusCode2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
57
- HttpStatusCode2[HttpStatusCode2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
58
- HttpStatusCode2[HttpStatusCode2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
59
- HttpStatusCode2[HttpStatusCode2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
60
- HttpStatusCode2[HttpStatusCode2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
61
- HttpStatusCode2[HttpStatusCode2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
62
- return HttpStatusCode2;
63
- })(HttpStatusCode || {});
64
- var HttpStatusCodeNameMap = {
65
- [200 /* OK */]: "Ok",
66
- [201 /* CREATED */]: "Created",
67
- [202 /* ACCEPTED */]: "Accepted",
68
- [204 /* NO_CONTENT */]: "NoContent",
69
- [205 /* RESET_CONTENT */]: "ResetContent",
70
- [206 /* PARTIAL_CONTENT */]: "PartialContent",
71
- [207 /* MULTI_STATUS */]: "MultiStatus",
72
- [208 /* ALREADY_REPORTED */]: "AlreadyReported",
73
- [226 /* IM_USED */]: "ImUsed",
74
- [300 /* MULTIPLE_CHOICES */]: "MultipleChoices",
75
- [301 /* MOVED_PERMANENTLY */]: "MovedPermanently",
76
- [302 /* FOUND */]: "Found",
77
- [303 /* SEE_OTHER */]: "SeeOther",
78
- [304 /* NOT_MODIFIED */]: "NotModified",
79
- [307 /* TEMPORARY_REDIRECT */]: "TemporaryRedirect",
80
- [308 /* PERMANENT_REDIRECT */]: "PermanentRedirect",
81
- [400 /* BAD_REQUEST */]: "BadRequest",
82
- [401 /* UNAUTHORIZED */]: "Unauthorized",
83
- [402 /* PAYMENT_REQUIRED */]: "PaymentRequired",
84
- [403 /* FORBIDDEN */]: "Forbidden",
85
- [404 /* NOT_FOUND */]: "NotFound",
86
- [405 /* METHOD_NOT_ALLOWED */]: "MethodNotAllowed",
87
- [406 /* NOT_ACCEPTABLE */]: "NotAcceptable",
88
- [407 /* PROXY_AUTHENTICATION_REQUIRED */]: "ProxyAuthenticationRequired",
89
- [408 /* REQUEST_TIMEOUT */]: "RequestTimeout",
90
- [409 /* CONFLICT */]: "Conflict",
91
- [410 /* GONE */]: "Gone",
92
- [411 /* LENGTH_REQUIRED */]: "LengthRequired",
93
- [412 /* PRECONDITION_FAILED */]: "PreconditionFailed",
94
- [413 /* PAYLOAD_TOO_LARGE */]: "PayloadTooLarge",
95
- [414 /* URI_TOO_LONG */]: "UriTooLong",
96
- [415 /* UNSUPPORTED_MEDIA_TYPE */]: "UnsupportedMediaType",
97
- [416 /* RANGE_NOT_SATISFIABLE */]: "RangeNotSatisfiable",
98
- [417 /* EXPECTATION_FAILED */]: "ExpectationFailed",
99
- [418 /* IM_A_TEAPOT */]: "ImATeapot",
100
- [421 /* MISDIRECTED_REQUEST */]: "MisdirectedRequest",
101
- [422 /* UNPROCESSABLE_ENTITY */]: "UnprocessableEntity",
102
- [423 /* LOCKED */]: "Locked",
103
- [424 /* FAILED_DEPENDENCY */]: "FailedDependency",
104
- [426 /* UPGRADE_REQUIRED */]: "UpgradeRequired",
105
- [428 /* PRECONDITION_REQUIRED */]: "PreconditionRequired",
106
- [429 /* TOO_MANY_REQUESTS */]: "TooManyRequests",
107
- [431 /* REQUEST_HEADER_FIELDS_TOO_LARGE */]: "RequestHeaderFieldsTooLarge",
108
- [451 /* UNAVAILABLE_FOR_LEGAL_REASONS */]: "UnavailableForLegalReasons",
109
- [500 /* INTERNAL_SERVER_ERROR */]: "InternalServerError",
110
- [501 /* NOT_IMPLEMENTED */]: "NotImplemented",
111
- [502 /* BAD_GATEWAY */]: "BadGateway",
112
- [503 /* SERVICE_UNAVAILABLE */]: "ServiceUnavailable",
113
- [504 /* GATEWAY_TIMEOUT */]: "GatewayTimeout",
114
- [505 /* HTTP_VERSION_NOT_SUPPORTED */]: "HttpVersionNotSupported",
115
- [506 /* VARIANT_ALSO_NEGOTIATES */]: "VariantAlsoNegotiates",
116
- [507 /* INSUFFICIENT_STORAGE */]: "InsufficientStorage",
117
- [508 /* LOOP_DETECTED */]: "LoopDetected",
118
- [510 /* NOT_EXTENDED */]: "NotExtended",
119
- [511 /* NETWORK_AUTHENTICATION_REQUIRED */]: "NetworkAuthenticationRequired"
4
+ //#region src/HttpStatusCode.ts
5
+ let HttpStatusCode = /* @__PURE__ */ function(HttpStatusCode) {
6
+ HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
7
+ HttpStatusCode[HttpStatusCode["CREATED"] = 201] = "CREATED";
8
+ HttpStatusCode[HttpStatusCode["ACCEPTED"] = 202] = "ACCEPTED";
9
+ HttpStatusCode[HttpStatusCode["NO_CONTENT"] = 204] = "NO_CONTENT";
10
+ HttpStatusCode[HttpStatusCode["RESET_CONTENT"] = 205] = "RESET_CONTENT";
11
+ HttpStatusCode[HttpStatusCode["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
12
+ HttpStatusCode[HttpStatusCode["MULTI_STATUS"] = 207] = "MULTI_STATUS";
13
+ HttpStatusCode[HttpStatusCode["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
14
+ HttpStatusCode[HttpStatusCode["IM_USED"] = 226] = "IM_USED";
15
+ HttpStatusCode[HttpStatusCode["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
16
+ HttpStatusCode[HttpStatusCode["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
17
+ HttpStatusCode[HttpStatusCode["FOUND"] = 302] = "FOUND";
18
+ HttpStatusCode[HttpStatusCode["SEE_OTHER"] = 303] = "SEE_OTHER";
19
+ HttpStatusCode[HttpStatusCode["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
20
+ HttpStatusCode[HttpStatusCode["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
21
+ HttpStatusCode[HttpStatusCode["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
22
+ HttpStatusCode[HttpStatusCode["BAD_REQUEST"] = 400] = "BAD_REQUEST";
23
+ HttpStatusCode[HttpStatusCode["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
24
+ HttpStatusCode[HttpStatusCode["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
25
+ HttpStatusCode[HttpStatusCode["FORBIDDEN"] = 403] = "FORBIDDEN";
26
+ HttpStatusCode[HttpStatusCode["NOT_FOUND"] = 404] = "NOT_FOUND";
27
+ HttpStatusCode[HttpStatusCode["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
28
+ HttpStatusCode[HttpStatusCode["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
29
+ HttpStatusCode[HttpStatusCode["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
30
+ HttpStatusCode[HttpStatusCode["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
31
+ HttpStatusCode[HttpStatusCode["CONFLICT"] = 409] = "CONFLICT";
32
+ HttpStatusCode[HttpStatusCode["GONE"] = 410] = "GONE";
33
+ HttpStatusCode[HttpStatusCode["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
34
+ HttpStatusCode[HttpStatusCode["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
35
+ HttpStatusCode[HttpStatusCode["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
36
+ HttpStatusCode[HttpStatusCode["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
37
+ HttpStatusCode[HttpStatusCode["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
38
+ HttpStatusCode[HttpStatusCode["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
39
+ HttpStatusCode[HttpStatusCode["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
40
+ HttpStatusCode[HttpStatusCode["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
41
+ HttpStatusCode[HttpStatusCode["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
42
+ HttpStatusCode[HttpStatusCode["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
43
+ HttpStatusCode[HttpStatusCode["LOCKED"] = 423] = "LOCKED";
44
+ HttpStatusCode[HttpStatusCode["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
45
+ HttpStatusCode[HttpStatusCode["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
46
+ HttpStatusCode[HttpStatusCode["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
47
+ HttpStatusCode[HttpStatusCode["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
48
+ HttpStatusCode[HttpStatusCode["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
49
+ HttpStatusCode[HttpStatusCode["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
50
+ HttpStatusCode[HttpStatusCode["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
51
+ HttpStatusCode[HttpStatusCode["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
52
+ HttpStatusCode[HttpStatusCode["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
53
+ HttpStatusCode[HttpStatusCode["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
54
+ HttpStatusCode[HttpStatusCode["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
55
+ HttpStatusCode[HttpStatusCode["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
56
+ HttpStatusCode[HttpStatusCode["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
57
+ HttpStatusCode[HttpStatusCode["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
58
+ HttpStatusCode[HttpStatusCode["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
59
+ HttpStatusCode[HttpStatusCode["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
60
+ HttpStatusCode[HttpStatusCode["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
61
+ return HttpStatusCode;
62
+ }({});
63
+ const HttpStatusCodeNameMap = {
64
+ [HttpStatusCode.OK]: "Ok",
65
+ [HttpStatusCode.CREATED]: "Created",
66
+ [HttpStatusCode.ACCEPTED]: "Accepted",
67
+ [HttpStatusCode.NO_CONTENT]: "NoContent",
68
+ [HttpStatusCode.RESET_CONTENT]: "ResetContent",
69
+ [HttpStatusCode.PARTIAL_CONTENT]: "PartialContent",
70
+ [HttpStatusCode.MULTI_STATUS]: "MultiStatus",
71
+ [HttpStatusCode.ALREADY_REPORTED]: "AlreadyReported",
72
+ [HttpStatusCode.IM_USED]: "ImUsed",
73
+ [HttpStatusCode.MULTIPLE_CHOICES]: "MultipleChoices",
74
+ [HttpStatusCode.MOVED_PERMANENTLY]: "MovedPermanently",
75
+ [HttpStatusCode.FOUND]: "Found",
76
+ [HttpStatusCode.SEE_OTHER]: "SeeOther",
77
+ [HttpStatusCode.NOT_MODIFIED]: "NotModified",
78
+ [HttpStatusCode.TEMPORARY_REDIRECT]: "TemporaryRedirect",
79
+ [HttpStatusCode.PERMANENT_REDIRECT]: "PermanentRedirect",
80
+ [HttpStatusCode.BAD_REQUEST]: "BadRequest",
81
+ [HttpStatusCode.UNAUTHORIZED]: "Unauthorized",
82
+ [HttpStatusCode.PAYMENT_REQUIRED]: "PaymentRequired",
83
+ [HttpStatusCode.FORBIDDEN]: "Forbidden",
84
+ [HttpStatusCode.NOT_FOUND]: "NotFound",
85
+ [HttpStatusCode.METHOD_NOT_ALLOWED]: "MethodNotAllowed",
86
+ [HttpStatusCode.NOT_ACCEPTABLE]: "NotAcceptable",
87
+ [HttpStatusCode.PROXY_AUTHENTICATION_REQUIRED]: "ProxyAuthenticationRequired",
88
+ [HttpStatusCode.REQUEST_TIMEOUT]: "RequestTimeout",
89
+ [HttpStatusCode.CONFLICT]: "Conflict",
90
+ [HttpStatusCode.GONE]: "Gone",
91
+ [HttpStatusCode.LENGTH_REQUIRED]: "LengthRequired",
92
+ [HttpStatusCode.PRECONDITION_FAILED]: "PreconditionFailed",
93
+ [HttpStatusCode.PAYLOAD_TOO_LARGE]: "PayloadTooLarge",
94
+ [HttpStatusCode.URI_TOO_LONG]: "UriTooLong",
95
+ [HttpStatusCode.UNSUPPORTED_MEDIA_TYPE]: "UnsupportedMediaType",
96
+ [HttpStatusCode.RANGE_NOT_SATISFIABLE]: "RangeNotSatisfiable",
97
+ [HttpStatusCode.EXPECTATION_FAILED]: "ExpectationFailed",
98
+ [HttpStatusCode.IM_A_TEAPOT]: "ImATeapot",
99
+ [HttpStatusCode.MISDIRECTED_REQUEST]: "MisdirectedRequest",
100
+ [HttpStatusCode.UNPROCESSABLE_ENTITY]: "UnprocessableEntity",
101
+ [HttpStatusCode.LOCKED]: "Locked",
102
+ [HttpStatusCode.FAILED_DEPENDENCY]: "FailedDependency",
103
+ [HttpStatusCode.UPGRADE_REQUIRED]: "UpgradeRequired",
104
+ [HttpStatusCode.PRECONDITION_REQUIRED]: "PreconditionRequired",
105
+ [HttpStatusCode.TOO_MANY_REQUESTS]: "TooManyRequests",
106
+ [HttpStatusCode.REQUEST_HEADER_FIELDS_TOO_LARGE]: "RequestHeaderFieldsTooLarge",
107
+ [HttpStatusCode.UNAVAILABLE_FOR_LEGAL_REASONS]: "UnavailableForLegalReasons",
108
+ [HttpStatusCode.INTERNAL_SERVER_ERROR]: "InternalServerError",
109
+ [HttpStatusCode.NOT_IMPLEMENTED]: "NotImplemented",
110
+ [HttpStatusCode.BAD_GATEWAY]: "BadGateway",
111
+ [HttpStatusCode.SERVICE_UNAVAILABLE]: "ServiceUnavailable",
112
+ [HttpStatusCode.GATEWAY_TIMEOUT]: "GatewayTimeout",
113
+ [HttpStatusCode.HTTP_VERSION_NOT_SUPPORTED]: "HttpVersionNotSupported",
114
+ [HttpStatusCode.VARIANT_ALSO_NEGOTIATES]: "VariantAlsoNegotiates",
115
+ [HttpStatusCode.INSUFFICIENT_STORAGE]: "InsufficientStorage",
116
+ [HttpStatusCode.LOOP_DETECTED]: "LoopDetected",
117
+ [HttpStatusCode.NOT_EXTENDED]: "NotExtended",
118
+ [HttpStatusCode.NETWORK_AUTHENTICATION_REQUIRED]: "NetworkAuthenticationRequired"
120
119
  };
121
120
 
122
- // src/HttpResponse.ts
121
+ //#endregion
122
+ //#region src/HttpResponse.ts
123
123
  var HttpResponse = class {
124
- constructor(statusCode, header, body) {
125
- this.statusCode = statusCode;
126
- this.header = header;
127
- this.body = body;
128
- }
124
+ constructor(statusCode, header, body) {
125
+ this.statusCode = statusCode;
126
+ this.header = header;
127
+ this.body = body;
128
+ }
129
129
  };
130
130
 
131
- // src/HttpMethod.ts
132
- var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
133
- HttpMethod2["GET"] = "GET";
134
- HttpMethod2["POST"] = "POST";
135
- HttpMethod2["PUT"] = "PUT";
136
- HttpMethod2["DELETE"] = "DELETE";
137
- HttpMethod2["PATCH"] = "PATCH";
138
- HttpMethod2["OPTIONS"] = "OPTIONS";
139
- HttpMethod2["HEAD"] = "HEAD";
140
- return HttpMethod2;
141
- })(HttpMethod || {});
131
+ //#endregion
132
+ //#region src/HttpMethod.ts
133
+ let HttpMethod = /* @__PURE__ */ function(HttpMethod) {
134
+ HttpMethod["GET"] = "GET";
135
+ HttpMethod["POST"] = "POST";
136
+ HttpMethod["PUT"] = "PUT";
137
+ HttpMethod["DELETE"] = "DELETE";
138
+ HttpMethod["PATCH"] = "PATCH";
139
+ HttpMethod["OPTIONS"] = "OPTIONS";
140
+ HttpMethod["HEAD"] = "HEAD";
141
+ return HttpMethod;
142
+ }({});
142
143
 
143
- // src/HttpOperationDefinition.ts
144
+ //#endregion
145
+ //#region src/HttpOperationDefinition.ts
146
+ /**
147
+ * Concrete implementation of HTTP operation definition.
148
+ *
149
+ * This class provides a type-safe way to define HTTP API operations with:
150
+ * - Full TypeScript type inference for all components
151
+ * - Integration with Zod schemas for runtime validation
152
+ * - Support for multiple response definitions per operation
153
+ * - OpenAPI-compatible structure
154
+ *
155
+ * The extensive generic parameters enable complete type safety from
156
+ * definition through to runtime execution and code generation.
157
+ *
158
+ * @template TOperationId - The operation identifier literal type
159
+ * @template TPath - The URL path literal type
160
+ * @template TMethod - The HTTP method type
161
+ * @template TSummary - The operation summary literal type
162
+ * @template THeader - The header schema type
163
+ * @template TParam - The path parameter schema type
164
+ * @template TQuery - The query parameter schema type
165
+ * @template TBody - The request body schema type
166
+ * @template TRequest - The complete request definition type
167
+ * @template TResponses - The array of response definitions
168
+ */
144
169
  var HttpOperationDefinition = class {
145
- operationId;
146
- path;
147
- method;
148
- summary;
149
- request;
150
- responses;
151
- constructor(definition) {
152
- this.operationId = definition.operationId;
153
- this.path = definition.path;
154
- this.method = definition.method;
155
- this.summary = definition.summary;
156
- this.request = definition.request;
157
- this.responses = definition.responses;
158
- }
170
+ operationId;
171
+ path;
172
+ method;
173
+ summary;
174
+ request;
175
+ responses;
176
+ constructor(definition) {
177
+ this.operationId = definition.operationId;
178
+ this.path = definition.path;
179
+ this.method = definition.method;
180
+ this.summary = definition.summary;
181
+ this.request = definition.request;
182
+ this.responses = definition.responses;
183
+ }
159
184
  };
160
185
 
161
- // src/HttpRequestDefinition.ts
186
+ //#endregion
187
+ //#region src/HttpRequestDefinition.ts
162
188
  var HttpRequestDefinition = class {
163
- header;
164
- param;
165
- query;
166
- body;
167
- constructor(definition) {
168
- this.header = definition.header;
169
- this.param = definition.param;
170
- this.query = definition.query;
171
- this.body = definition.body;
172
- }
189
+ header;
190
+ param;
191
+ query;
192
+ body;
193
+ constructor(definition) {
194
+ this.header = definition.header;
195
+ this.param = definition.param;
196
+ this.query = definition.query;
197
+ this.body = definition.body;
198
+ }
173
199
  };
174
- var HttpResponseDefinition = class _HttpResponseDefinition {
175
- constructor(definition) {
176
- this.definition = definition;
177
- this.name = definition.name;
178
- this.statusCode = definition.statusCode;
179
- this.description = definition.description;
180
- this.header = definition.header;
181
- this.body = definition.body;
182
- }
183
- name;
184
- statusCode;
185
- description;
186
- header;
187
- body;
188
- extend(definition) {
189
- const mergedHeader = (() => {
190
- if (this.header instanceof zod.z.ZodRecord || definition.header instanceof zod.z.ZodRecord || this.header instanceof zod.z.ZodOptional && this.header.unwrap() instanceof zod.z.ZodRecord || definition.header instanceof zod.z.ZodOptional && definition.header.unwrap() instanceof zod.z.ZodRecord) {
191
- throw new Error("Cannot merge ZodRecord headers");
192
- }
193
- if (!this.header && !definition.header) return void 0;
194
- if (!this.header) return definition.header;
195
- if (!definition.header) return this.header;
196
- const mergedHeader2 = zod.z.object({
197
- ...this.header instanceof zod.z.ZodObject ? this.header.shape : this.header.unwrap().shape,
198
- ...definition.header instanceof zod.z.ZodObject ? definition.header.shape : definition.header.unwrap().shape
199
- });
200
- if (Object.values(mergedHeader2.shape).every(
201
- (schema) => schema instanceof zod.z.ZodOptional
202
- )) {
203
- return mergedHeader2.optional();
204
- }
205
- return mergedHeader2;
206
- })();
207
- const mergedBody = (() => {
208
- if (!this.body && !definition.body) return void 0;
209
- if (!this.body) return definition.body;
210
- if (!definition.body) return this.body;
211
- if (this.body instanceof zod.z.ZodObject && definition.body instanceof zod.z.ZodObject) {
212
- return zod.z.object({
213
- ...this.body.shape,
214
- ...definition.body.shape
215
- });
216
- }
217
- return definition.body;
218
- })();
219
- const baseDefinition = {
220
- ...this.definition,
221
- name: definition.name,
222
- statusCode: definition.statusCode ?? this.statusCode,
223
- description: definition.description ?? this.description,
224
- header: mergedHeader,
225
- body: mergedBody
226
- };
227
- return new _HttpResponseDefinition(baseDefinition);
228
- }
200
+
201
+ //#endregion
202
+ //#region src/HttpResponseDefinition.ts
203
+ var HttpResponseDefinition = class HttpResponseDefinition {
204
+ name;
205
+ statusCode;
206
+ description;
207
+ header;
208
+ body;
209
+ constructor(definition) {
210
+ this.definition = definition;
211
+ this.name = definition.name;
212
+ this.statusCode = definition.statusCode;
213
+ this.description = definition.description;
214
+ this.header = definition.header;
215
+ this.body = definition.body;
216
+ }
217
+ extend(definition) {
218
+ const mergedHeader = (() => {
219
+ if (this.header instanceof zod.z.ZodRecord || definition.header instanceof zod.z.ZodRecord || this.header instanceof zod.z.ZodOptional && this.header.unwrap() instanceof zod.z.ZodRecord || definition.header instanceof zod.z.ZodOptional && definition.header.unwrap() instanceof zod.z.ZodRecord) throw new Error("Cannot merge ZodRecord headers");
220
+ if (!this.header && !definition.header) return void 0;
221
+ if (!this.header) return definition.header;
222
+ if (!definition.header) return this.header;
223
+ const mergedHeader = zod.z.object({
224
+ ...this.header instanceof zod.z.ZodObject ? this.header.shape : this.header.unwrap().shape,
225
+ ...definition.header instanceof zod.z.ZodObject ? definition.header.shape : definition.header.unwrap().shape
226
+ });
227
+ if (Object.values(mergedHeader.shape).every((schema) => schema instanceof zod.z.ZodOptional)) return mergedHeader.optional();
228
+ return mergedHeader;
229
+ })();
230
+ const mergedBody = (() => {
231
+ if (!this.body && !definition.body) return void 0;
232
+ if (!this.body) return definition.body;
233
+ if (!definition.body) return this.body;
234
+ if (this.body instanceof zod.z.ZodObject && definition.body instanceof zod.z.ZodObject) return zod.z.object({
235
+ ...this.body.shape,
236
+ ...definition.body.shape
237
+ });
238
+ return definition.body;
239
+ })();
240
+ return new HttpResponseDefinition({
241
+ ...this.definition,
242
+ name: definition.name,
243
+ statusCode: definition.statusCode ?? this.statusCode,
244
+ description: definition.description ?? this.description,
245
+ header: mergedHeader,
246
+ body: mergedBody
247
+ });
248
+ }
229
249
  };
230
250
 
231
- // src/RequestValidationError.ts
251
+ //#endregion
252
+ //#region src/RequestValidationError.ts
253
+ /**
254
+ * Error thrown when HTTP request validation fails.
255
+ *
256
+ * This error provides detailed information about validation failures across
257
+ * different parts of an HTTP request. Each category of issues is stored
258
+ * separately for precise error reporting and debugging.
259
+ *
260
+ * The error integrates with Zod's issue format, making it compatible with
261
+ * Zod schema validation while maintaining flexibility for custom validators.
262
+ */
232
263
  var RequestValidationError = class extends Error {
233
- message;
234
- /** Validation issues found in HTTP headers */
235
- headerIssues = [];
236
- /** Validation issues found in request body */
237
- bodyIssues = [];
238
- /** Validation issues found in query parameters */
239
- queryIssues = [];
240
- /** Validation issues found in path parameters */
241
- pathParamIssues = [];
242
- constructor(input) {
243
- const message = "Invalid request";
244
- super(message);
245
- this.message = message;
246
- if (input?.headerIssues) {
247
- this.headerIssues = input.headerIssues;
248
- }
249
- if (input?.bodyIssues) {
250
- this.bodyIssues = input.bodyIssues;
251
- }
252
- if (input?.queryIssues) {
253
- this.queryIssues = input.queryIssues;
254
- }
255
- if (input?.pathParamIssues) {
256
- this.pathParamIssues = input.pathParamIssues;
257
- }
258
- }
259
- /**
260
- * Adds header validation issues to the error.
261
- * @param issues - Array of Zod validation issues
262
- */
263
- addHeaderIssues(issues) {
264
- this.headerIssues.push(...issues);
265
- }
266
- /**
267
- * Adds body validation issues to the error.
268
- * @param issues - Array of Zod validation issues
269
- */
270
- addBodyIssues(issues) {
271
- this.bodyIssues.push(...issues);
272
- }
273
- /**
274
- * Adds query parameter validation issues to the error.
275
- * @param issues - Array of Zod validation issues
276
- */
277
- addQueryIssues(issues) {
278
- this.queryIssues.push(...issues);
279
- }
280
- /**
281
- * Adds path parameter validation issues to the error.
282
- * @param issues - Array of Zod validation issues
283
- */
284
- addPathParamIssues(issues) {
285
- this.pathParamIssues.push(...issues);
286
- }
287
- /**
288
- * Checks if this error contains any validation issues.
289
- * @returns true if any category has issues, false otherwise
290
- */
291
- hasIssues() {
292
- return this.headerIssues.length > 0 || this.bodyIssues.length > 0 || this.queryIssues.length > 0 || this.pathParamIssues.length > 0;
293
- }
264
+ message;
265
+ /** Validation issues found in HTTP headers */
266
+ headerIssues = [];
267
+ /** Validation issues found in request body */
268
+ bodyIssues = [];
269
+ /** Validation issues found in query parameters */
270
+ queryIssues = [];
271
+ /** Validation issues found in path parameters */
272
+ pathParamIssues = [];
273
+ constructor(input) {
274
+ const message = "Invalid request";
275
+ super(message);
276
+ this.message = message;
277
+ if (input?.headerIssues) this.headerIssues = input.headerIssues;
278
+ if (input?.bodyIssues) this.bodyIssues = input.bodyIssues;
279
+ if (input?.queryIssues) this.queryIssues = input.queryIssues;
280
+ if (input?.pathParamIssues) this.pathParamIssues = input.pathParamIssues;
281
+ }
282
+ /**
283
+ * Adds header validation issues to the error.
284
+ * @param issues - Array of Zod validation issues
285
+ */
286
+ addHeaderIssues(issues) {
287
+ this.headerIssues.push(...issues);
288
+ }
289
+ /**
290
+ * Adds body validation issues to the error.
291
+ * @param issues - Array of Zod validation issues
292
+ */
293
+ addBodyIssues(issues) {
294
+ this.bodyIssues.push(...issues);
295
+ }
296
+ /**
297
+ * Adds query parameter validation issues to the error.
298
+ * @param issues - Array of Zod validation issues
299
+ */
300
+ addQueryIssues(issues) {
301
+ this.queryIssues.push(...issues);
302
+ }
303
+ /**
304
+ * Adds path parameter validation issues to the error.
305
+ * @param issues - Array of Zod validation issues
306
+ */
307
+ addPathParamIssues(issues) {
308
+ this.pathParamIssues.push(...issues);
309
+ }
310
+ /**
311
+ * Checks if this error contains any validation issues.
312
+ * @returns true if any category has issues, false otherwise
313
+ */
314
+ hasIssues() {
315
+ return this.headerIssues.length > 0 || this.bodyIssues.length > 0 || this.queryIssues.length > 0 || this.pathParamIssues.length > 0;
316
+ }
294
317
  };
295
318
 
296
- // src/ResponseValidationError.ts
319
+ //#endregion
320
+ //#region src/ResponseValidationError.ts
297
321
  var ResponseValidationError = class extends Error {
298
- constructor(statusCode, input) {
299
- const message = `Response validation failed for status code '${statusCode}'`;
300
- super(message);
301
- this.statusCode = statusCode;
302
- this.message = message;
303
- this.issues = input?.issues ?? [];
304
- }
305
- message;
306
- issues;
307
- addHeaderIssues(responseName, issues) {
308
- this.addResponseIssues(responseName, issues);
309
- }
310
- addBodyIssues(responseName, issues) {
311
- this.addResponseIssues(responseName, [], issues);
312
- }
313
- addResponseIssues(responseName, headerIssues = [], bodyIssues = []) {
314
- if (headerIssues.length === 0 && bodyIssues.length === 0) {
315
- return;
316
- }
317
- const issue = this.issues.find(
318
- (i) => i.type === "INVALID_RESPONSE" && i.responseName === responseName
319
- );
320
- if (!issue) {
321
- this.issues.push({
322
- type: "INVALID_RESPONSE",
323
- responseName,
324
- headerIssues,
325
- bodyIssues
326
- });
327
- return;
328
- }
329
- if (headerIssues.length > 0) {
330
- issue.headerIssues.push(...headerIssues);
331
- }
332
- if (bodyIssues.length > 0) {
333
- issue.bodyIssues.push(...bodyIssues);
334
- }
335
- }
336
- addStatusCodeIssue(expectedStatusCodes) {
337
- const statusCodeIssue = this.issues.find(
338
- (i) => i.type === "INVALID_STATUS_CODE"
339
- );
340
- if (statusCodeIssue) {
341
- statusCodeIssue.expectedStatusCodes.push(...expectedStatusCodes);
342
- } else {
343
- this.issues.push({
344
- type: "INVALID_STATUS_CODE",
345
- invalidStatusCode: this.statusCode,
346
- expectedStatusCodes
347
- });
348
- }
349
- }
350
- getResponseHeaderIssues(responseName) {
351
- const issue = this.issues.find(
352
- (i) => i.type === "INVALID_RESPONSE" && i.responseName === responseName
353
- );
354
- return issue ? issue.headerIssues : [];
355
- }
356
- getResponseBodyIssues(responseName) {
357
- const issue = this.issues.find(
358
- (i) => i.type === "INVALID_RESPONSE" && i.responseName === responseName
359
- );
360
- return issue ? issue.bodyIssues : [];
361
- }
362
- hasResponseIssues(responseName) {
363
- if (responseName) {
364
- return this.issues.some(
365
- (issue) => issue.type === "INVALID_RESPONSE" && issue.responseName === responseName
366
- );
367
- }
368
- return this.issues.some((issue) => issue.type === "INVALID_RESPONSE");
369
- }
370
- hasStatusCodeIssues() {
371
- return this.issues.some((issue) => issue.type === "INVALID_STATUS_CODE");
372
- }
373
- hasIssues() {
374
- return this.issues.length > 0;
375
- }
322
+ message;
323
+ issues;
324
+ constructor(statusCode, input) {
325
+ const message = `Response validation failed for status code '${statusCode}'`;
326
+ super(message);
327
+ this.statusCode = statusCode;
328
+ this.message = message;
329
+ this.issues = input?.issues ?? [];
330
+ }
331
+ addHeaderIssues(responseName, issues) {
332
+ this.addResponseIssues(responseName, issues);
333
+ }
334
+ addBodyIssues(responseName, issues) {
335
+ this.addResponseIssues(responseName, [], issues);
336
+ }
337
+ addResponseIssues(responseName, headerIssues = [], bodyIssues = []) {
338
+ if (headerIssues.length === 0 && bodyIssues.length === 0) return;
339
+ const issue = this.issues.find((i) => i.type === "INVALID_RESPONSE" && i.responseName === responseName);
340
+ if (!issue) {
341
+ this.issues.push({
342
+ type: "INVALID_RESPONSE",
343
+ responseName,
344
+ headerIssues,
345
+ bodyIssues
346
+ });
347
+ return;
348
+ }
349
+ if (headerIssues.length > 0) issue.headerIssues.push(...headerIssues);
350
+ if (bodyIssues.length > 0) issue.bodyIssues.push(...bodyIssues);
351
+ }
352
+ addStatusCodeIssue(expectedStatusCodes) {
353
+ const statusCodeIssue = this.issues.find((i) => i.type === "INVALID_STATUS_CODE");
354
+ if (statusCodeIssue) statusCodeIssue.expectedStatusCodes.push(...expectedStatusCodes);
355
+ else this.issues.push({
356
+ type: "INVALID_STATUS_CODE",
357
+ invalidStatusCode: this.statusCode,
358
+ expectedStatusCodes
359
+ });
360
+ }
361
+ getResponseHeaderIssues(responseName) {
362
+ const issue = this.issues.find((i) => i.type === "INVALID_RESPONSE" && i.responseName === responseName);
363
+ return issue ? issue.headerIssues : [];
364
+ }
365
+ getResponseBodyIssues(responseName) {
366
+ const issue = this.issues.find((i) => i.type === "INVALID_RESPONSE" && i.responseName === responseName);
367
+ return issue ? issue.bodyIssues : [];
368
+ }
369
+ hasResponseIssues(responseName) {
370
+ if (responseName) return this.issues.some((issue) => issue.type === "INVALID_RESPONSE" && issue.responseName === responseName);
371
+ return this.issues.some((issue) => issue.type === "INVALID_RESPONSE");
372
+ }
373
+ hasStatusCodeIssues() {
374
+ return this.issues.some((issue) => issue.type === "INVALID_STATUS_CODE");
375
+ }
376
+ hasIssues() {
377
+ return this.issues.length > 0;
378
+ }
376
379
  };
377
380
 
378
- // src/UnknownResponse.ts
381
+ //#endregion
382
+ //#region src/UnknownResponse.ts
379
383
  var UnknownResponse = class extends HttpResponse {
380
- constructor(statusCode, header, body, validationError) {
381
- super(statusCode, header, body);
382
- this.validationError = validationError;
383
- }
384
+ constructor(statusCode, header, body, validationError) {
385
+ super(statusCode, header, body);
386
+ this.validationError = validationError;
387
+ }
384
388
  };
385
389
 
390
+ //#endregion
386
391
  exports.HttpMethod = HttpMethod;
387
392
  exports.HttpOperationDefinition = HttpOperationDefinition;
388
393
  exports.HttpRequestDefinition = HttpRequestDefinition;
@@ -392,4 +397,4 @@ exports.HttpStatusCode = HttpStatusCode;
392
397
  exports.HttpStatusCodeNameMap = HttpStatusCodeNameMap;
393
398
  exports.RequestValidationError = RequestValidationError;
394
399
  exports.ResponseValidationError = ResponseValidationError;
395
- exports.UnknownResponse = UnknownResponse;
400
+ exports.UnknownResponse = UnknownResponse;