express-endpoints-collection 1.0.3 → 1.0.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.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/dist/generator.d.ts +0 -7
  3. package/dist/generator.d.ts.map +0 -1
  4. package/dist/generator.js +0 -53
  5. package/dist/generator.js.map +0 -1
  6. package/dist/index.d.ts +0 -26
  7. package/dist/index.d.ts.map +0 -1
  8. package/dist/index.js +0 -122
  9. package/dist/index.js.map +0 -1
  10. package/dist/types/EndpointArgs.d.ts +0 -13
  11. package/dist/types/EndpointArgs.d.ts.map +0 -1
  12. package/dist/types/EndpointArgs.js +0 -3
  13. package/dist/types/EndpointArgs.js.map +0 -1
  14. package/dist/types/EndpointInfo.d.ts +0 -11
  15. package/dist/types/EndpointInfo.d.ts.map +0 -1
  16. package/dist/types/EndpointInfo.js +0 -3
  17. package/dist/types/EndpointInfo.js.map +0 -1
  18. package/dist/types/EndpointInputSchema.d.ts +0 -8
  19. package/dist/types/EndpointInputSchema.d.ts.map +0 -1
  20. package/dist/types/EndpointInputSchema.js +0 -3
  21. package/dist/types/EndpointInputSchema.js.map +0 -1
  22. package/dist/types/EndpointOutputSchema.d.ts +0 -7
  23. package/dist/types/EndpointOutputSchema.d.ts.map +0 -1
  24. package/dist/types/EndpointOutputSchema.js +0 -3
  25. package/dist/types/EndpointOutputSchema.js.map +0 -1
  26. package/dist/types/HttpMethod.d.ts +0 -2
  27. package/dist/types/HttpMethod.d.ts.map +0 -1
  28. package/dist/types/HttpMethod.js +0 -3
  29. package/dist/types/HttpMethod.js.map +0 -1
  30. package/dist/types/TypedRequest.d.ts +0 -9
  31. package/dist/types/TypedRequest.d.ts.map +0 -1
  32. package/dist/types/TypedRequest.js +0 -3
  33. package/dist/types/TypedRequest.js.map +0 -1
  34. package/dist/types/TypedRequestHandler.d.ts +0 -6
  35. package/dist/types/TypedRequestHandler.d.ts.map +0 -1
  36. package/dist/types/TypedRequestHandler.js +0 -3
  37. package/dist/types/TypedRequestHandler.js.map +0 -1
  38. package/dist/types/TypedResponse.d.ts +0 -11
  39. package/dist/types/TypedResponse.d.ts.map +0 -1
  40. package/dist/types/TypedResponse.js +0 -3
  41. package/dist/types/TypedResponse.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-endpoints-collection",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "./dist/index.js",
5
5
  "repository": "https://github.com/pilotpirxie/express-endpoints-collection.git",
6
6
  "author": "pilotpirxie <10637666+pilotpirxie@users.noreply.github.com>",
@@ -1,7 +0,0 @@
1
- import { EndpointInfo } from "./types/EndpointInfo";
2
- export declare function generateOpenAPI({ title, version, endpoints, }: {
3
- title: string;
4
- version: string;
5
- endpoints: EndpointInfo[];
6
- }): import("openapi3-ts/oas30").OpenAPIObject;
7
- //# sourceMappingURL=generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAWpD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,OAAO,EACP,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B,6CAmDA"}
package/dist/generator.js DELETED
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateOpenAPI = generateOpenAPI;
4
- const zod_to_openapi_1 = require("@asteasolutions/zod-to-openapi");
5
- const zod_1 = require("zod");
6
- (0, zod_to_openapi_1.extendZodWithOpenApi)(zod_1.z);
7
- function generateOpenAPI({ title, version, endpoints, }) {
8
- const registry = new zod_to_openapi_1.OpenAPIRegistry();
9
- endpoints.forEach((endpoint) => {
10
- const openapiPath = endpoint.path.replace(/:(\w+)/g, "{$1}");
11
- const responses = {};
12
- for (const outputSchema of endpoint.outputSchema) {
13
- responses[outputSchema.status.toString()] = {
14
- description: outputSchema.description ||
15
- `Response for status code ${outputSchema.status}`,
16
- content: outputSchema.body
17
- ? {
18
- "application/json": {
19
- schema: outputSchema.body,
20
- },
21
- }
22
- : undefined,
23
- };
24
- }
25
- registry.registerPath({
26
- method: endpoint.method,
27
- path: openapiPath,
28
- summary: endpoint.summary || "",
29
- request: {
30
- params: endpoint.inputSchema?.params,
31
- query: endpoint.inputSchema?.query,
32
- body: endpoint.inputSchema?.body
33
- ? {
34
- content: {
35
- "application/json": { schema: endpoint.inputSchema.body },
36
- },
37
- }
38
- : undefined,
39
- headers: endpoint.inputSchema?.headers,
40
- },
41
- responses,
42
- });
43
- });
44
- const generator = new zod_to_openapi_1.OpenApiGeneratorV3(registry.definitions);
45
- return generator.generateDocument({
46
- openapi: "3.0.0",
47
- info: {
48
- title,
49
- version,
50
- },
51
- });
52
- }
53
- //# sourceMappingURL=generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":";;AAWA,0CA2DC;AArED,mEAKwC;AACxC,6BAAwB;AAExB,IAAA,qCAAoB,EAAC,OAAC,CAAC,CAAC;AAExB,SAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,OAAO,EACP,SAAS,GAKV;IACC,MAAM,QAAQ,GAAG,IAAI,gCAAe,EAAE,CAAC;IAEvC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7D,MAAM,SAAS,GAAmC,EAAE,CAAC;QAErD,KAAK,MAAM,YAAY,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;YACjD,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG;gBAC1C,WAAW,EACT,YAAY,CAAC,WAAW;oBACxB,4BAA4B,YAAY,CAAC,MAAM,EAAE;gBACnD,OAAO,EAAE,YAAY,CAAC,IAAI;oBACxB,CAAC,CAAC;wBACE,kBAAkB,EAAE;4BAClB,MAAM,EAAE,YAAY,CAAC,IAAI;yBAC1B;qBACF;oBACH,CAAC,CAAC,SAAS;aACd,CAAC;QACJ,CAAC;QAED,QAAQ,CAAC,YAAY,CAAC;YACpB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,EAAE;YAC/B,OAAO,EAAE;gBACP,MAAM,EAAE,QAAQ,CAAC,WAAW,EAAE,MAAM;gBACpC,KAAK,EAAE,QAAQ,CAAC,WAAW,EAAE,KAAK;gBAClC,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE,IAAI;oBAC9B,CAAC,CAAC;wBACE,OAAO,EAAE;4BACP,kBAAkB,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE;yBAC1D;qBACF;oBACH,CAAC,CAAC,SAAS;gBACb,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO;aACvC;YACD,SAAS;SACV,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,mCAAkB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE/D,OAAO,SAAS,CAAC,gBAAgB,CAAC;QAChC,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK;YACL,OAAO;SACR;KACF,CAAC,CAAC;AACL,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import { RequestHandler } from "express";
2
- import { EndpointInputSchema } from "./types/EndpointInputSchema";
3
- import { EndpointOutputSchema } from "./types/EndpointOutputSchema";
4
- import { EndpointInfo } from "./types/EndpointInfo";
5
- import { EndpointArgs } from "./types/EndpointArgs";
6
- import { HttpMethod } from "./types/HttpMethod";
7
- import { TypedRequestHandler } from "./types/TypedRequestHandler";
8
- export declare class EndpointsCollection {
9
- private endpoints;
10
- private router;
11
- constructor();
12
- private static validateInput;
13
- private static validateOutput;
14
- callOriginal(method: HttpMethod, path: string, { inputSchema, outputSchema, summary, afterOutput, beforeOutput, afterInput, beforeInput, }: EndpointArgs<EndpointInputSchema, EndpointOutputSchema>, handlers: RequestHandler | RequestHandler[] | TypedRequestHandler<any, any>): import("express-serve-static-core").Router;
15
- get<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handlers: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
16
- post<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handler: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
17
- put<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handlers: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
18
- delete<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handlers: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
19
- patch<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handlers: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
20
- options<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handlers: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
21
- head<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handlers: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
22
- trace<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema>(path: string, args: EndpointArgs<TInput, TOutput>, handlers: TypedRequestHandler<TInput, TOutput>): import("express-serve-static-core").Router;
23
- getEndpoints(): EndpointInfo[];
24
- getRouter(): import("express-serve-static-core").Router;
25
- }
26
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,MAAM,CAAY;;IAI1B,OAAO,CAAC,MAAM,CAAC,aAAa;IAmB5B,OAAO,CAAC,MAAM,CAAC,cAAc;IA6BtB,YAAY,CACjB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,EACE,WAAW,EACX,YAAY,EACZ,OAAO,EACP,WAAgB,EAChB,YAAiB,EACjB,UAAe,EACf,WAAgB,GACjB,EAAE,YAAY,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,EAC1D,QAAQ,EAAE,cAAc,GAAG,cAAc,EAAE,GAAG,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC;IAyCtE,GAAG,CACR,MAAM,SAAS,mBAAmB,EAClC,OAAO,SAAS,oBAAoB,EAEpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,QAAQ,EAAE,m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EAAE,OAAO,CAAC;IAKzC,KAAK,CACV,MAAM,SAAS,mBAAmB,EAClC,OAAO,SAAS,oBAAoB,EAEpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,QAAQ,EAAE,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC;IAKzC,YAAY;IAIZ,SAAS;CAGjB"}
package/dist/index.js DELETED
@@ -1,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EndpointsCollection = void 0;
4
- const express_1 = require("express");
5
- const zod_1 = require("zod");
6
- class EndpointsCollection {
7
- constructor() {
8
- this.endpoints = [];
9
- this.router = (0, express_1.Router)();
10
- }
11
- static validateInput(schema) {
12
- return (req, res, next) => {
13
- try {
14
- if (schema.query)
15
- schema.query.parse(req.query);
16
- if (schema.body)
17
- schema.body.parse(req.body);
18
- if (schema.params)
19
- schema.params.parse(req.params);
20
- if (schema.headers)
21
- schema.headers.parse(req.headers);
22
- next();
23
- }
24
- catch (error) {
25
- if (error instanceof zod_1.z.ZodError) {
26
- return res.status(400).json({
27
- error: error.errors,
28
- });
29
- }
30
- next(error);
31
- }
32
- };
33
- }
34
- static validateOutput(schema) {
35
- return (req, res, next) => {
36
- const originalJson = res.json;
37
- // @ts-ignore
38
- res.json = (body) => {
39
- const status = res.statusCode;
40
- const schemaForStatus = schema.find((s) => s.status === status);
41
- try {
42
- if (schemaForStatus?.body) {
43
- schemaForStatus.body.parse(body);
44
- }
45
- originalJson.call(res, body);
46
- }
47
- catch (error) {
48
- if (error instanceof zod_1.z.ZodError) {
49
- console.error("Error in response validation", error.errors);
50
- return res.status(500).json({
51
- error: "Internal server error",
52
- });
53
- }
54
- next(error);
55
- }
56
- };
57
- next();
58
- };
59
- }
60
- callOriginal(method, path, { inputSchema, outputSchema, summary, afterOutput = [], beforeOutput = [], afterInput = [], beforeInput = [], }, handlers) {
61
- this.endpoints.push({
62
- path,
63
- method: method,
64
- inputSchema,
65
- outputSchema,
66
- summary,
67
- });
68
- const combinedHandlers = [];
69
- if (beforeInput) {
70
- combinedHandlers.push(beforeInput);
71
- }
72
- if (inputSchema) {
73
- combinedHandlers.push(EndpointsCollection.validateInput(inputSchema));
74
- }
75
- if (afterInput) {
76
- combinedHandlers.push(afterInput);
77
- }
78
- combinedHandlers.push(handlers);
79
- if (beforeOutput) {
80
- combinedHandlers.push(beforeOutput);
81
- }
82
- if (outputSchema) {
83
- combinedHandlers.push(EndpointsCollection.validateOutput(outputSchema));
84
- }
85
- if (afterOutput) {
86
- combinedHandlers.push(afterOutput);
87
- }
88
- return this.router[method](path, ...combinedHandlers);
89
- }
90
- get(path, args, handlers) {
91
- return this.callOriginal("get", path, args, handlers);
92
- }
93
- post(path, args, handler) {
94
- return this.callOriginal("post", path, args, handler);
95
- }
96
- put(path, args, handlers) {
97
- return this.callOriginal("put", path, args, handlers);
98
- }
99
- delete(path, args, handlers) {
100
- return this.callOriginal("delete", path, args, handlers);
101
- }
102
- patch(path, args, handlers) {
103
- return this.callOriginal("patch", path, args, handlers);
104
- }
105
- options(path, args, handlers) {
106
- return this.callOriginal("options", path, args, handlers);
107
- }
108
- head(path, args, handlers) {
109
- return this.callOriginal("head", path, args, handlers);
110
- }
111
- trace(path, args, handlers) {
112
- return this.callOriginal("trace", path, args, handlers);
113
- }
114
- getEndpoints() {
115
- return this.endpoints;
116
- }
117
- getRouter() {
118
- return this.router;
119
- }
120
- }
121
- exports.EndpointsCollection = EndpointsCollection;
122
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAMiB;AAMjB,6BAAwB;AAGxB,MAAa,mBAAmB;IAI9B;QAHQ,cAAS,GAAmB,EAAE,CAAC;QAC/B,WAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IAEJ,CAAC;IAEf,MAAM,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,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAEM,OAAO,CAIZ,IAAY,EACZ,IAAmC,EACnC,QAA8C;QAE9C,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAEM,IAAI,CAIT,IAAY,EACZ,IAAmC,EACnC,QAA8C;QAE9C,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IAEM,KAAK,CAIV,IAAY,EACZ,IAAmC,EACnC,QAA8C;QAE9C,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAEM,YAAY;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AA1MD,kDA0MC"}
@@ -1,13 +0,0 @@
1
- import { EndpointInputSchema } from "./EndpointInputSchema";
2
- import { EndpointOutputSchema } from "./EndpointOutputSchema";
3
- import { RequestHandler } from "express";
4
- export type EndpointArgs<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema> = {
5
- inputSchema?: TInput;
6
- outputSchema: TOutput;
7
- summary?: string;
8
- beforeInput?: RequestHandler | RequestHandler[];
9
- afterInput?: RequestHandler | RequestHandler[];
10
- beforeOutput?: RequestHandler | RequestHandler[];
11
- afterOutput?: RequestHandler | RequestHandler[];
12
- };
13
- //# sourceMappingURL=EndpointArgs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointArgs.d.ts","sourceRoot":"","sources":["../../src/types/EndpointArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,YAAY,CACtB,MAAM,SAAS,mBAAmB,EAClC,OAAO,SAAS,oBAAoB,IAClC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAC;IAChD,UAAU,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAC;IAC/C,YAAY,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAC;IACjD,WAAW,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAC;CACjD,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=EndpointArgs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointArgs.js","sourceRoot":"","sources":["../../src/types/EndpointArgs.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import { EndpointInputSchema } from "./EndpointInputSchema";
2
- import { EndpointOutputSchema } from "./EndpointOutputSchema";
3
- import { HttpMethod } from "./HttpMethod";
4
- export type EndpointInfo = {
5
- path: string;
6
- method: HttpMethod;
7
- inputSchema?: EndpointInputSchema;
8
- outputSchema: EndpointOutputSchema;
9
- summary?: string;
10
- };
11
- //# sourceMappingURL=EndpointInfo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointInfo.d.ts","sourceRoot":"","sources":["../../src/types/EndpointInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,oBAAoB,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=EndpointInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointInfo.js","sourceRoot":"","sources":["../../src/types/EndpointInfo.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export type EndpointInputSchema = {
3
- query?: z.ZodObject<any>;
4
- body?: z.ZodObject<any>;
5
- params?: z.ZodObject<any>;
6
- headers?: z.ZodObject<any>;
7
- };
8
- //# sourceMappingURL=EndpointInputSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointInputSchema.d.ts","sourceRoot":"","sources":["../../src/types/EndpointInputSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;CAC5B,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=EndpointInputSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointInputSchema.js","sourceRoot":"","sources":["../../src/types/EndpointInputSchema.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { z } from "zod";
2
- export type EndpointOutputSchema = {
3
- status: number;
4
- description?: string;
5
- body?: z.ZodType;
6
- }[];
7
- //# sourceMappingURL=EndpointOutputSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointOutputSchema.d.ts","sourceRoot":"","sources":["../../src/types/EndpointOutputSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;CAClB,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=EndpointOutputSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EndpointOutputSchema.js","sourceRoot":"","sources":["../../src/types/EndpointOutputSchema.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export type HttpMethod = "get" | "post" | "put" | "delete" | "patch" | "options" | "head" | "trace";
2
- //# sourceMappingURL=HttpMethod.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpMethod.d.ts","sourceRoot":"","sources":["../../src/types/HttpMethod.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,GACP,SAAS,GACT,MAAM,GACN,OAAO,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=HttpMethod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpMethod.js","sourceRoot":"","sources":["../../src/types/HttpMethod.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- import { EndpointInputSchema } from "./EndpointInputSchema";
2
- import { z } from "zod";
3
- export type TypedRequest<T extends EndpointInputSchema> = {
4
- body: z.infer<NonNullable<T["body"]>>;
5
- query: z.infer<NonNullable<T["query"]>>;
6
- params: z.infer<NonNullable<T["params"]>>;
7
- headers: z.infer<NonNullable<T["headers"]>>;
8
- };
9
- //# sourceMappingURL=TypedRequest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypedRequest.d.ts","sourceRoot":"","sources":["../../src/types/TypedRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,mBAAmB,IAAI;IACxD,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC7C,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=TypedRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypedRequest.js","sourceRoot":"","sources":["../../src/types/TypedRequest.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import { EndpointInputSchema } from "./EndpointInputSchema";
2
- import { EndpointOutputSchema } from "./EndpointOutputSchema";
3
- import { TypedRequest } from "./TypedRequest";
4
- import { TypedResponse } from "./TypedResponse";
5
- export type TypedRequestHandler<TInput extends EndpointInputSchema, TOutput extends EndpointOutputSchema> = (req: TypedRequest<TInput>, res: TypedResponse<TOutput>) => void | Promise<void>;
6
- //# sourceMappingURL=TypedRequestHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypedRequestHandler.d.ts","sourceRoot":"","sources":["../../src/types/TypedRequestHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,mBAAmB,CAC7B,MAAM,SAAS,mBAAmB,EAClC,OAAO,SAAS,oBAAoB,IAClC,CACF,GAAG,EAAE,YAAY,CAAC,MAAM,CAAC,EACzB,GAAG,EAAE,aAAa,CAAC,OAAO,CAAC,KACxB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=TypedRequestHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypedRequestHandler.js","sourceRoot":"","sources":["../../src/types/TypedRequestHandler.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import { EndpointOutputSchema } from "./EndpointOutputSchema";
2
- import { z } from "zod";
3
- export type TypedResponse<T extends EndpointOutputSchema> = {
4
- json: (data: z.infer<NonNullable<T[number]["body"]>>) => void;
5
- status: <S extends T[number]["status"]>(code: S) => Omit<TypedResponse<T>, "status"> & {
6
- json: (data: z.infer<NonNullable<Extract<T[number], {
7
- status: S;
8
- }>["body"]>>) => void;
9
- };
10
- };
11
- //# sourceMappingURL=TypedResponse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypedResponse.d.ts","sourceRoot":"","sources":["../../src/types/TypedResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,oBAAoB,IAAI;IAC1D,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC9D,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACpC,IAAI,EAAE,CAAC,KACJ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;QACtC,IAAI,EAAE,CACJ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;YAAE,MAAM,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAClE,IAAI,CAAC;KACX,CAAC;CACH,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=TypedResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypedResponse.js","sourceRoot":"","sources":["../../src/types/TypedResponse.ts"],"names":[],"mappings":""}