@visulima/api-platform 1.1.2 → 1.1.4

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 (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/chunk-AG2ROSSA.mjs +2 -0
  3. package/dist/{chunk-D5JLMBFH.mjs.map → chunk-AG2ROSSA.mjs.map} +1 -1
  4. package/dist/chunk-HONWWBY6.mjs +2 -0
  5. package/dist/{chunk-YR2QJYUL.mjs.map → chunk-HONWWBY6.mjs.map} +1 -1
  6. package/dist/chunk-JXD3457O.js +2 -0
  7. package/dist/chunk-JXD3457O.js.map +1 -0
  8. package/dist/chunk-M7LGAQP3.mjs +10 -0
  9. package/dist/{chunk-EGE7A4ZK.mjs.map → chunk-M7LGAQP3.mjs.map} +1 -1
  10. package/dist/chunk-OUWZ2PU5.js +2 -0
  11. package/dist/{chunk-JC4IRQUL.js.map → chunk-OUWZ2PU5.js.map} +0 -0
  12. package/dist/chunk-QIHOLJVA.js +2 -0
  13. package/dist/chunk-QIHOLJVA.js.map +1 -0
  14. package/dist/chunk-UI23SSBN.js +10 -0
  15. package/dist/chunk-UI23SSBN.js.map +1 -0
  16. package/dist/chunk-YOXCJZNX.mjs +2 -0
  17. package/dist/{chunk-5VRACIDE.mjs.map → chunk-YOXCJZNX.mjs.map} +0 -0
  18. package/dist/index-browser.js +1 -7
  19. package/dist/index-browser.mjs +1 -7
  20. package/dist/index-server.d.ts +1 -1
  21. package/dist/index-server.js +1 -452
  22. package/dist/index-server.js.map +1 -1
  23. package/dist/index-server.mjs +1 -452
  24. package/dist/index-server.mjs.map +1 -1
  25. package/dist/next/cli/index.js +3 -202
  26. package/dist/next/cli/index.js.map +1 -1
  27. package/dist/next/cli/index.mjs +3 -202
  28. package/dist/next/cli/index.mjs.map +1 -1
  29. package/dist/next/index-browser.js +1 -11
  30. package/dist/next/index-browser.mjs +1 -11
  31. package/dist/next/index-server.js +1 -75
  32. package/dist/next/index-server.js.map +1 -1
  33. package/dist/next/index-server.mjs +1 -75
  34. package/dist/next/index-server.mjs.map +1 -1
  35. package/package.json +4 -4
  36. package/dist/chunk-5VRACIDE.mjs +0 -10
  37. package/dist/chunk-CVURPKKG.js +0 -120
  38. package/dist/chunk-CVURPKKG.js.map +0 -1
  39. package/dist/chunk-D5JLMBFH.mjs +0 -284
  40. package/dist/chunk-EGE7A4ZK.mjs +0 -120
  41. package/dist/chunk-HOWWQBSN.js +0 -99
  42. package/dist/chunk-HOWWQBSN.js.map +0 -1
  43. package/dist/chunk-JC4IRQUL.js +0 -10
  44. package/dist/chunk-R6HXY2JR.js +0 -284
  45. package/dist/chunk-R6HXY2JR.js.map +0 -1
  46. package/dist/chunk-YR2QJYUL.mjs +0 -99
@@ -1,76 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
-
3
- var _chunkR6HXY2JRjs = require('../chunk-R6HXY2JR.js');
4
-
5
-
6
-
7
-
8
- var _chunkCVURPKKGjs = require('../chunk-CVURPKKG.js');
9
- require('../chunk-JC4IRQUL.js');
10
-
11
- // src/next/webpack/with-open-api.ts
12
- var _jsdocopenapi = require('@visulima/jsdoc-open-api');
13
- var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
14
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
15
- var withOpenApi = ({
16
- definition,
17
- sources,
18
- verbose,
19
- output = "swagger/swagger.json"
20
- }) => (nextConfig) => {
21
- return {
22
- ...nextConfig,
23
- webpack: (config, options) => {
24
- if (!options.isServer) {
25
- return config;
26
- }
27
- if (output.startsWith("/")) {
28
- output = output.slice(1);
29
- }
30
- if (!output.endsWith(".json")) {
31
- throw new Error("The output path must end with .json");
32
- }
33
- config = {
34
- ...config,
35
- plugins: [
36
- ...config.plugins,
37
- new (0, _jsdocopenapi.SwaggerCompilerPlugin)(
38
- `${options.dir}/${output}`,
39
- sources.map((source) => {
40
- const combinedPath = _path2.default.join(options.dir, source.replace("./", ""));
41
- _fs2.default.lstatSync(combinedPath).isDirectory();
42
- return combinedPath;
43
- }),
44
- {
45
- openapi: "3.0.0",
46
- ...definition
47
- },
48
- { verbose }
49
- )
50
- ]
51
- };
52
- if (typeof nextConfig.webpack === "function") {
53
- return nextConfig.webpack(config, options);
54
- }
55
- return config;
56
- }
57
- };
58
- };
59
- var with_open_api_default = withOpenApi;
60
-
61
- // src/next/routes/api/swagger.ts
62
- var _connect = require('@visulima/connect');
63
- var swaggerApiRoute = (options = {}) => {
64
- const handler = _chunkR6HXY2JRjs.swagger_handler_default.call(void 0, options);
65
- const router = _connect.createNodeRouter.call(void 0, ).get(handler);
66
- return router.handler();
67
- };
68
- var swagger_default2 = swaggerApiRoute;
69
-
70
-
71
-
72
-
73
-
74
-
75
- exports.RedocPage = _chunkCVURPKKGjs.redoc_default; exports.SwaggerPage = _chunkCVURPKKGjs.swagger_default; exports.getSwaggerStaticProps = _chunkCVURPKKGjs.get_static_properties_swagger_default; exports.swaggerApiRoute = swagger_default2; exports.withOpenApi = with_open_api_default;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQIHOLJVAjs = require('../chunk-QIHOLJVA.js');var _chunkUI23SSBNjs = require('../chunk-UI23SSBN.js');require('../chunk-OUWZ2PU5.js');var _jsdocopenapi = require('@visulima/jsdoc-open-api');var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);var _path = require('path'); var _path2 = _interopRequireDefault(_path);var l=({definition:i,sources:o,verbose:p,output:r="swagger/swagger.json"})=>n=>({...n,webpack:(e,t)=>{if(!t.isServer)return e;if(r.startsWith("/")&&(r=r.slice(1)),!r.endsWith(".json"))throw new Error("The output path must end with .json");return e={...e,plugins:[...e.plugins,new (0, _jsdocopenapi.SwaggerCompilerPlugin)(`${t.dir}/${r}`,o.map(m=>{let a=_path2.default.join(t.dir,m.replace("./",""));return _fs2.default.lstatSync(a).isDirectory(),a}),{openapi:"3.0.0",...i},{verbose:p})]},typeof n.webpack=="function"?n.webpack(e,t):e}}),d= exports.withOpenApi =l;var _connect = require('@visulima/connect');var c=(i={})=>{let o=_chunkQIHOLJVAjs.b.call(void 0, i);return _connect.createNodeRouter.call(void 0, ).get(o).handler()},h= exports.swaggerApiRoute =c;exports.RedocPage = _chunkUI23SSBNjs.a; exports.SwaggerPage = _chunkUI23SSBNjs.b; exports.getSwaggerStaticProps = _chunkUI23SSBNjs.c; exports.swaggerApiRoute = h; exports.withOpenApi = d;
76
2
  //# sourceMappingURL=index-server.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/next/webpack/with-open-api.ts","../../src/next/routes/api/swagger.ts"],"names":["swagger_default"],"mappings":";;;;;;;;;;;AACA,SAAS,6BAA6B;AAEtC,OAAO,QAAQ;AACf,OAAO,UAAU;AAGjB,IAAM,cAAc,CAAC;AAAA,EACjB;AAAA,EAAY;AAAA,EAAS;AAAA,EAAS,SAAS;AAE3C,MAAuI,CAAC,eAA2B;AAC/J,SAAO;AAAA,IACH,GAAG;AAAA,IACH,SAAS,CAAC,QAAuB,YAAiB;AAC9C,UAAI,CAAC,QAAQ,UAAU;AACnB,eAAO;AAAA,MACX;AAEA,UAAI,OAAO,WAAW,GAAG,GAAG;AAExB,iBAAS,OAAO,MAAM,CAAC;AAAA,MAC3B;AAEA,UAAI,CAAC,OAAO,SAAS,OAAO,GAAG;AAC3B,cAAM,IAAI,MAAM,qCAAqC;AAAA,MACzD;AAGA,eAAS;AAAA,QACL,GAAG;AAAA,QACH,SAAS;AAAA,UAEL,GAAG,OAAO;AAAA,UACV,IAAI;AAAA,YACA,GAAG,QAAQ,OAAO;AAAA,YAClB,QAAQ,IAAI,CAAC,WAAW;AACpB,oBAAM,eAAe,KAAK,KAAK,QAAQ,KAAK,OAAO,QAAQ,MAAM,EAAE,CAAC;AAGpE,iBAAG,UAAU,YAAY,EAAE,YAAY;AAEvC,qBAAO;AAAA,YACX,CAAC;AAAA,YACD;AAAA,cAEI,SAAS;AAAA,cACT,GAAG;AAAA,YACP;AAAA,YACA,EAAE,QAAQ;AAAA,UACd;AAAA,QACJ;AAAA,MACJ;AAEA,UAAI,OAAO,WAAW,YAAY,YAAY;AAC1C,eAAO,WAAW,QAAQ,QAAQ,OAAO;AAAA,MAC7C;AAEA,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;AAEA,IAAO,wBAAQ;;;AC9Df,SAAS,wBAAwB;AAOjC,IAAM,kBAAkB,CACpB,UAA0C,CAAC,MAC1C;AACD,QAAM,UAAU,wBAAe,OAAO;AAEtC,QAAM,SAAS,iBAAkD,EAAE,IAAI,OAAO;AAE9E,SAAO,OAAO,QAAQ;AAC1B;AAEA,IAAOA,mBAAQ","sourcesContent":["import type { BaseDefinition } from \"@visulima/jsdoc-open-api\";\nimport { SwaggerCompilerPlugin } from \"@visulima/jsdoc-open-api\";\nimport type { NextConfig } from \"next\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Configuration } from \"webpack\";\n\nconst withOpenApi = ({\n definition, sources, verbose, output = \"swagger/swagger.json\",\n// eslint-disable-next-line max-len\n}: { definition: Exclude<BaseDefinition, \"openapi\"> & { openapi?: string }; sources: string[]; verbose?: boolean; output: string }) => (nextConfig: NextConfig) => {\n return {\n ...nextConfig,\n webpack: (config: Configuration, options: any) => {\n if (!options.isServer) {\n return config;\n }\n\n if (output.startsWith(\"/\")) {\n // eslint-disable-next-line no-param-reassign\n output = output.slice(1);\n }\n\n if (!output.endsWith(\".json\")) {\n throw new Error(\"The output path must end with .json\");\n }\n\n // eslint-disable-next-line no-param-reassign\n config = {\n ...config,\n plugins: [\n // @ts-ignore\n ...config.plugins,\n new SwaggerCompilerPlugin(\n `${options.dir}/${output}`,\n sources.map((source) => {\n const combinedPath = path.join(options.dir, source.replace(\"./\", \"\"));\n\n // Check if the path is a directory\n fs.lstatSync(combinedPath).isDirectory();\n\n return combinedPath;\n }),\n {\n // @ts-ignore\n openapi: \"3.0.0\",\n ...definition,\n },\n { verbose },\n ),\n ],\n };\n\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options);\n }\n\n return config;\n },\n };\n};\n\nexport default withOpenApi;\n","import { createNodeRouter } from \"@visulima/connect\";\n// eslint-disable-next-line unicorn/prevent-abbreviations,import/no-extraneous-dependencies\nimport type { NextApiRequest, NextApiResponse } from \"next\";\n\nimport swaggerHandler, { SwaggerHandlerOptions } from \"../../../swagger/swagger-handler\";\n\n// eslint-disable-next-line max-len\nconst swaggerApiRoute = (\n options: Partial<SwaggerHandlerOptions> = {},\n) => {\n const handler = swaggerHandler(options);\n\n const router = createNodeRouter<NextApiRequest, NextApiResponse>().get(handler);\n\n return router.handler();\n};\n\nexport default swaggerApiRoute;\n"]}
1
+ {"version":3,"sources":["../../src/next/webpack/with-open-api.ts","../../src/next/routes/api/swagger.ts"],"names":["SwaggerCompilerPlugin","fs","path","withOpenApi","definition","sources","verbose","output","nextConfig","config","options","source","combinedPath","with_open_api_default","createNodeRouter","swaggerApiRoute","handler","swagger_handler_default","swagger_default"],"mappings":"6HACA,OAAS,yBAAAA,MAA6B,2BAEtC,OAAOC,MAAQ,KACf,OAAOC,MAAU,OAGjB,IAAMC,EAAc,CAAC,CACjB,WAAAC,EAAY,QAAAC,EAAS,QAAAC,EAAS,OAAAC,EAAS,sBAE3C,IAAwIC,IAC7H,CACH,GAAGA,EACH,QAAS,CAACC,EAAuBC,IAAiB,CAC9C,GAAI,CAACA,EAAQ,SACT,OAAOD,EAQX,GALIF,EAAO,WAAW,GAAG,IAErBA,EAASA,EAAO,MAAM,CAAC,GAGvB,CAACA,EAAO,SAAS,OAAO,EACxB,MAAM,IAAI,MAAM,qCAAqC,EA6BzD,OAzBAE,EAAS,CACL,GAAGA,EACH,QAAS,CAEL,GAAGA,EAAO,QACV,IAAIT,EACA,GAAGU,EAAQ,OAAOH,IAClBF,EAAQ,IAAKM,GAAW,CACpB,IAAMC,EAAeV,EAAK,KAAKQ,EAAQ,IAAKC,EAAO,QAAQ,KAAM,EAAE,CAAC,EAGpE,OAAAV,EAAG,UAAUW,CAAY,EAAE,YAAY,EAEhCA,CACX,CAAC,EACD,CAEI,QAAS,QACT,GAAGR,CACP,EACA,CAAE,QAAAE,CAAQ,CACd,CACJ,CACJ,EAEI,OAAOE,EAAW,SAAY,WACvBA,EAAW,QAAQC,EAAQC,CAAO,EAGtCD,CACX,CACJ,GAGGI,EAAQV,EC9Df,OAAS,oBAAAW,MAAwB,oBAOjC,IAAMC,EAAkB,CACpBL,EAA0C,CAAC,IAC1C,CACD,IAAMM,EAAUC,EAAeP,CAAO,EAItC,OAFeI,EAAkD,EAAE,IAAIE,CAAO,EAEhE,QAAQ,CAC1B,EAEOE,EAAQH","sourcesContent":["import type { BaseDefinition } from \"@visulima/jsdoc-open-api\";\nimport { SwaggerCompilerPlugin } from \"@visulima/jsdoc-open-api\";\nimport type { NextConfig } from \"next\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Configuration } from \"webpack\";\n\nconst withOpenApi = ({\n definition, sources, verbose, output = \"swagger/swagger.json\",\n// eslint-disable-next-line max-len\n}: { definition: Exclude<BaseDefinition, \"openapi\"> & { openapi?: string }; sources: string[]; verbose?: boolean; output: string }) => (nextConfig: NextConfig) => {\n return {\n ...nextConfig,\n webpack: (config: Configuration, options: any) => {\n if (!options.isServer) {\n return config;\n }\n\n if (output.startsWith(\"/\")) {\n // eslint-disable-next-line no-param-reassign\n output = output.slice(1);\n }\n\n if (!output.endsWith(\".json\")) {\n throw new Error(\"The output path must end with .json\");\n }\n\n // eslint-disable-next-line no-param-reassign\n config = {\n ...config,\n plugins: [\n // @ts-ignore\n ...config.plugins,\n new SwaggerCompilerPlugin(\n `${options.dir}/${output}`,\n sources.map((source) => {\n const combinedPath = path.join(options.dir, source.replace(\"./\", \"\"));\n\n // Check if the path is a directory\n fs.lstatSync(combinedPath).isDirectory();\n\n return combinedPath;\n }),\n {\n // @ts-ignore\n openapi: \"3.0.0\",\n ...definition,\n },\n { verbose },\n ),\n ],\n };\n\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options);\n }\n\n return config;\n },\n };\n};\n\nexport default withOpenApi;\n","import { createNodeRouter } from \"@visulima/connect\";\n// eslint-disable-next-line unicorn/prevent-abbreviations,import/no-extraneous-dependencies\nimport type { NextApiRequest, NextApiResponse } from \"next\";\n\nimport swaggerHandler, { SwaggerHandlerOptions } from \"../../../swagger/swagger-handler\";\n\n// eslint-disable-next-line max-len\nconst swaggerApiRoute = (\n options: Partial<SwaggerHandlerOptions> = {},\n) => {\n const handler = swaggerHandler(options);\n\n const router = createNodeRouter<NextApiRequest, NextApiResponse>().get(handler);\n\n return router.handler();\n};\n\nexport default swaggerApiRoute;\n"]}
@@ -1,76 +1,2 @@
1
- import {
2
- swagger_handler_default
3
- } from "../chunk-D5JLMBFH.mjs";
4
- import {
5
- get_static_properties_swagger_default,
6
- redoc_default,
7
- swagger_default
8
- } from "../chunk-EGE7A4ZK.mjs";
9
- import "../chunk-5VRACIDE.mjs";
10
-
11
- // src/next/webpack/with-open-api.ts
12
- import { SwaggerCompilerPlugin } from "@visulima/jsdoc-open-api";
13
- import fs from "fs";
14
- import path from "path";
15
- var withOpenApi = ({
16
- definition,
17
- sources,
18
- verbose,
19
- output = "swagger/swagger.json"
20
- }) => (nextConfig) => {
21
- return {
22
- ...nextConfig,
23
- webpack: (config, options) => {
24
- if (!options.isServer) {
25
- return config;
26
- }
27
- if (output.startsWith("/")) {
28
- output = output.slice(1);
29
- }
30
- if (!output.endsWith(".json")) {
31
- throw new Error("The output path must end with .json");
32
- }
33
- config = {
34
- ...config,
35
- plugins: [
36
- ...config.plugins,
37
- new SwaggerCompilerPlugin(
38
- `${options.dir}/${output}`,
39
- sources.map((source) => {
40
- const combinedPath = path.join(options.dir, source.replace("./", ""));
41
- fs.lstatSync(combinedPath).isDirectory();
42
- return combinedPath;
43
- }),
44
- {
45
- openapi: "3.0.0",
46
- ...definition
47
- },
48
- { verbose }
49
- )
50
- ]
51
- };
52
- if (typeof nextConfig.webpack === "function") {
53
- return nextConfig.webpack(config, options);
54
- }
55
- return config;
56
- }
57
- };
58
- };
59
- var with_open_api_default = withOpenApi;
60
-
61
- // src/next/routes/api/swagger.ts
62
- import { createNodeRouter } from "@visulima/connect";
63
- var swaggerApiRoute = (options = {}) => {
64
- const handler = swagger_handler_default(options);
65
- const router = createNodeRouter().get(handler);
66
- return router.handler();
67
- };
68
- var swagger_default2 = swaggerApiRoute;
69
- export {
70
- redoc_default as RedocPage,
71
- swagger_default as SwaggerPage,
72
- get_static_properties_swagger_default as getSwaggerStaticProps,
73
- swagger_default2 as swaggerApiRoute,
74
- with_open_api_default as withOpenApi
75
- };
1
+ import{b as s}from"../chunk-AG2ROSSA.mjs";import{a as x,b as y,c as A}from"../chunk-M7LGAQP3.mjs";import"../chunk-YOXCJZNX.mjs";import{SwaggerCompilerPlugin as f}from"@visulima/jsdoc-open-api";import u from"fs";import g from"path";var l=({definition:i,sources:o,verbose:p,output:r="swagger/swagger.json"})=>n=>({...n,webpack:(e,t)=>{if(!t.isServer)return e;if(r.startsWith("/")&&(r=r.slice(1)),!r.endsWith(".json"))throw new Error("The output path must end with .json");return e={...e,plugins:[...e.plugins,new f(`${t.dir}/${r}`,o.map(m=>{let a=g.join(t.dir,m.replace("./",""));return u.lstatSync(a).isDirectory(),a}),{openapi:"3.0.0",...i},{verbose:p})]},typeof n.webpack=="function"?n.webpack(e,t):e}}),d=l;import{createNodeRouter as w}from"@visulima/connect";var c=(i={})=>{let o=s(i);return w().get(o).handler()},h=c;export{x as RedocPage,y as SwaggerPage,A as getSwaggerStaticProps,h as swaggerApiRoute,d as withOpenApi};
76
2
  //# sourceMappingURL=index-server.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/next/webpack/with-open-api.ts","../../src/next/routes/api/swagger.ts"],"sourcesContent":["import type { BaseDefinition } from \"@visulima/jsdoc-open-api\";\nimport { SwaggerCompilerPlugin } from \"@visulima/jsdoc-open-api\";\nimport type { NextConfig } from \"next\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Configuration } from \"webpack\";\n\nconst withOpenApi = ({\n definition, sources, verbose, output = \"swagger/swagger.json\",\n// eslint-disable-next-line max-len\n}: { definition: Exclude<BaseDefinition, \"openapi\"> & { openapi?: string }; sources: string[]; verbose?: boolean; output: string }) => (nextConfig: NextConfig) => {\n return {\n ...nextConfig,\n webpack: (config: Configuration, options: any) => {\n if (!options.isServer) {\n return config;\n }\n\n if (output.startsWith(\"/\")) {\n // eslint-disable-next-line no-param-reassign\n output = output.slice(1);\n }\n\n if (!output.endsWith(\".json\")) {\n throw new Error(\"The output path must end with .json\");\n }\n\n // eslint-disable-next-line no-param-reassign\n config = {\n ...config,\n plugins: [\n // @ts-ignore\n ...config.plugins,\n new SwaggerCompilerPlugin(\n `${options.dir}/${output}`,\n sources.map((source) => {\n const combinedPath = path.join(options.dir, source.replace(\"./\", \"\"));\n\n // Check if the path is a directory\n fs.lstatSync(combinedPath).isDirectory();\n\n return combinedPath;\n }),\n {\n // @ts-ignore\n openapi: \"3.0.0\",\n ...definition,\n },\n { verbose },\n ),\n ],\n };\n\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options);\n }\n\n return config;\n },\n };\n};\n\nexport default withOpenApi;\n","import { createNodeRouter } from \"@visulima/connect\";\n// eslint-disable-next-line unicorn/prevent-abbreviations,import/no-extraneous-dependencies\nimport type { NextApiRequest, NextApiResponse } from \"next\";\n\nimport swaggerHandler, { SwaggerHandlerOptions } from \"../../../swagger/swagger-handler\";\n\n// eslint-disable-next-line max-len\nconst swaggerApiRoute = (\n options: Partial<SwaggerHandlerOptions> = {},\n) => {\n const handler = swaggerHandler(options);\n\n const router = createNodeRouter<NextApiRequest, NextApiResponse>().get(handler);\n\n return router.handler();\n};\n\nexport default swaggerApiRoute;\n"],"mappings":";;;;;;;;;;;AACA,SAAS,6BAA6B;AAEtC,OAAO,QAAQ;AACf,OAAO,UAAU;AAGjB,IAAM,cAAc,CAAC;AAAA,EACjB;AAAA,EAAY;AAAA,EAAS;AAAA,EAAS,SAAS;AAE3C,MAAuI,CAAC,eAA2B;AAC/J,SAAO;AAAA,IACH,GAAG;AAAA,IACH,SAAS,CAAC,QAAuB,YAAiB;AAC9C,UAAI,CAAC,QAAQ,UAAU;AACnB,eAAO;AAAA,MACX;AAEA,UAAI,OAAO,WAAW,GAAG,GAAG;AAExB,iBAAS,OAAO,MAAM,CAAC;AAAA,MAC3B;AAEA,UAAI,CAAC,OAAO,SAAS,OAAO,GAAG;AAC3B,cAAM,IAAI,MAAM,qCAAqC;AAAA,MACzD;AAGA,eAAS;AAAA,QACL,GAAG;AAAA,QACH,SAAS;AAAA,UAEL,GAAG,OAAO;AAAA,UACV,IAAI;AAAA,YACA,GAAG,QAAQ,OAAO;AAAA,YAClB,QAAQ,IAAI,CAAC,WAAW;AACpB,oBAAM,eAAe,KAAK,KAAK,QAAQ,KAAK,OAAO,QAAQ,MAAM,EAAE,CAAC;AAGpE,iBAAG,UAAU,YAAY,EAAE,YAAY;AAEvC,qBAAO;AAAA,YACX,CAAC;AAAA,YACD;AAAA,cAEI,SAAS;AAAA,cACT,GAAG;AAAA,YACP;AAAA,YACA,EAAE,QAAQ;AAAA,UACd;AAAA,QACJ;AAAA,MACJ;AAEA,UAAI,OAAO,WAAW,YAAY,YAAY;AAC1C,eAAO,WAAW,QAAQ,QAAQ,OAAO;AAAA,MAC7C;AAEA,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;AAEA,IAAO,wBAAQ;;;AC9Df,SAAS,wBAAwB;AAOjC,IAAM,kBAAkB,CACpB,UAA0C,CAAC,MAC1C;AACD,QAAM,UAAU,wBAAe,OAAO;AAEtC,QAAM,SAAS,iBAAkD,EAAE,IAAI,OAAO;AAE9E,SAAO,OAAO,QAAQ;AAC1B;AAEA,IAAOA,mBAAQ;","names":["swagger_default"]}
1
+ {"version":3,"sources":["../../src/next/webpack/with-open-api.ts","../../src/next/routes/api/swagger.ts"],"sourcesContent":["import type { BaseDefinition } from \"@visulima/jsdoc-open-api\";\nimport { SwaggerCompilerPlugin } from \"@visulima/jsdoc-open-api\";\nimport type { NextConfig } from \"next\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Configuration } from \"webpack\";\n\nconst withOpenApi = ({\n definition, sources, verbose, output = \"swagger/swagger.json\",\n// eslint-disable-next-line max-len\n}: { definition: Exclude<BaseDefinition, \"openapi\"> & { openapi?: string }; sources: string[]; verbose?: boolean; output: string }) => (nextConfig: NextConfig) => {\n return {\n ...nextConfig,\n webpack: (config: Configuration, options: any) => {\n if (!options.isServer) {\n return config;\n }\n\n if (output.startsWith(\"/\")) {\n // eslint-disable-next-line no-param-reassign\n output = output.slice(1);\n }\n\n if (!output.endsWith(\".json\")) {\n throw new Error(\"The output path must end with .json\");\n }\n\n // eslint-disable-next-line no-param-reassign\n config = {\n ...config,\n plugins: [\n // @ts-ignore\n ...config.plugins,\n new SwaggerCompilerPlugin(\n `${options.dir}/${output}`,\n sources.map((source) => {\n const combinedPath = path.join(options.dir, source.replace(\"./\", \"\"));\n\n // Check if the path is a directory\n fs.lstatSync(combinedPath).isDirectory();\n\n return combinedPath;\n }),\n {\n // @ts-ignore\n openapi: \"3.0.0\",\n ...definition,\n },\n { verbose },\n ),\n ],\n };\n\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options);\n }\n\n return config;\n },\n };\n};\n\nexport default withOpenApi;\n","import { createNodeRouter } from \"@visulima/connect\";\n// eslint-disable-next-line unicorn/prevent-abbreviations,import/no-extraneous-dependencies\nimport type { NextApiRequest, NextApiResponse } from \"next\";\n\nimport swaggerHandler, { SwaggerHandlerOptions } from \"../../../swagger/swagger-handler\";\n\n// eslint-disable-next-line max-len\nconst swaggerApiRoute = (\n options: Partial<SwaggerHandlerOptions> = {},\n) => {\n const handler = swaggerHandler(options);\n\n const router = createNodeRouter<NextApiRequest, NextApiResponse>().get(handler);\n\n return router.handler();\n};\n\nexport default swaggerApiRoute;\n"],"mappings":"gIACA,OAAS,yBAAAA,MAA6B,2BAEtC,OAAOC,MAAQ,KACf,OAAOC,MAAU,OAGjB,IAAMC,EAAc,CAAC,CACjB,WAAAC,EAAY,QAAAC,EAAS,QAAAC,EAAS,OAAAC,EAAS,sBAE3C,IAAwIC,IAC7H,CACH,GAAGA,EACH,QAAS,CAACC,EAAuBC,IAAiB,CAC9C,GAAI,CAACA,EAAQ,SACT,OAAOD,EAQX,GALIF,EAAO,WAAW,GAAG,IAErBA,EAASA,EAAO,MAAM,CAAC,GAGvB,CAACA,EAAO,SAAS,OAAO,EACxB,MAAM,IAAI,MAAM,qCAAqC,EA6BzD,OAzBAE,EAAS,CACL,GAAGA,EACH,QAAS,CAEL,GAAGA,EAAO,QACV,IAAIT,EACA,GAAGU,EAAQ,OAAOH,IAClBF,EAAQ,IAAKM,GAAW,CACpB,IAAMC,EAAeV,EAAK,KAAKQ,EAAQ,IAAKC,EAAO,QAAQ,KAAM,EAAE,CAAC,EAGpE,OAAAV,EAAG,UAAUW,CAAY,EAAE,YAAY,EAEhCA,CACX,CAAC,EACD,CAEI,QAAS,QACT,GAAGR,CACP,EACA,CAAE,QAAAE,CAAQ,CACd,CACJ,CACJ,EAEI,OAAOE,EAAW,SAAY,WACvBA,EAAW,QAAQC,EAAQC,CAAO,EAGtCD,CACX,CACJ,GAGGI,EAAQV,EC9Df,OAAS,oBAAAW,MAAwB,oBAOjC,IAAMC,EAAkB,CACpBC,EAA0C,CAAC,IAC1C,CACD,IAAMC,EAAUC,EAAeF,CAAO,EAItC,OAFeG,EAAkD,EAAE,IAAIF,CAAO,EAEhE,QAAQ,CAC1B,EAEOG,EAAQL","names":["SwaggerCompilerPlugin","fs","path","withOpenApi","definition","sources","verbose","output","nextConfig","config","options","source","combinedPath","with_open_api_default","createNodeRouter","swaggerApiRoute","options","handler","swagger_handler_default","createNodeRouter","swagger_default"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/api-platform",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "visulima api platform",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -113,7 +113,7 @@
113
113
  "@types/accepts": "^1.3.5",
114
114
  "@types/cors": "^2.8.12",
115
115
  "@types/debug": "^4.1.7",
116
- "@types/http-errors": "^1.8.2",
116
+ "@types/http-errors": "^2.0.0",
117
117
  "@types/jstoxml": "^2.0.2",
118
118
  "@types/lodash.merge": "^4.6.7",
119
119
  "@types/lodash.set": "^4.3.7",
@@ -125,7 +125,7 @@
125
125
  "@types/webpack": "^5.28.0",
126
126
  "@typescript-eslint/eslint-plugin": "^5.40.0",
127
127
  "@typescript-eslint/parser": "^5.40.0",
128
- "@visulima/crud": "1.0.4",
128
+ "@visulima/crud": "1.0.5",
129
129
  "@visulima/readdir": "1.3.2",
130
130
  "chalk": "5.2.0",
131
131
  "commander": "^9.4.1",
@@ -180,7 +180,7 @@
180
180
  "zod": "^3.19.1"
181
181
  },
182
182
  "optionalDependencies": {
183
- "@visulima/crud": "1.0.4",
183
+ "@visulima/crud": "1.0.5",
184
184
  "@visulima/readdir": "1.3.2",
185
185
  "chalk": "4.1.2",
186
186
  "commander": "^9.4.1",
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export {
8
- __export
9
- };
10
- //# sourceMappingURL=chunk-5VRACIDE.mjs.map
@@ -1,120 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/next/routes/pages/swagger/redoc.tsx
2
- var _head = require('next/head'); var _head2 = _interopRequireDefault(_head);
3
- var _redoc = require('redoc');
4
- var _jsxdevruntime = require('react/jsx-dev-runtime');
5
- var RedocApiDocument = (name, swagger = {}) => ({ swaggerData }) => /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, _jsxdevruntime.Fragment, {
6
- children: [
7
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, _head2.default, {
8
- children: [
9
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, "title", {
10
- children: name
11
- }, void 0, false, {
12
- fileName: "src/next/routes/pages/swagger/redoc.tsx",
13
- lineNumber: 20,
14
- columnNumber: 21
15
- }, this),
16
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, "style", {
17
- children: `
18
- body {
19
- background: #fafafa !important;
20
- }
21
- `
22
- }, void 0, false, {
23
- fileName: "src/next/routes/pages/swagger/redoc.tsx",
24
- lineNumber: 21,
25
- columnNumber: 21
26
- }, this)
27
- ]
28
- }, void 0, true, {
29
- fileName: "src/next/routes/pages/swagger/redoc.tsx",
30
- lineNumber: 19,
31
- columnNumber: 17
32
- }, this),
33
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, _redoc.RedocStandalone, {
34
- ...swagger,
35
- spec: swaggerData
36
- }, void 0, false, {
37
- fileName: "src/next/routes/pages/swagger/redoc.tsx",
38
- lineNumber: 30,
39
- columnNumber: 17
40
- }, this)
41
- ]
42
- }, void 0, true, {
43
- fileName: "src/next/routes/pages/swagger/redoc.tsx",
44
- lineNumber: 18,
45
- columnNumber: 13
46
- }, this);
47
- var redoc_default = RedocApiDocument;
48
-
49
- // src/next/routes/pages/swagger/swagger.tsx
50
- var _dynamic = require('next/dynamic'); var _dynamic2 = _interopRequireDefault(_dynamic);
51
-
52
-
53
- var SwaggerUI = _dynamic2.default.call(void 0, () => Promise.resolve().then(() => require("swagger-ui-react")), { ssr: false });
54
- _dynamic2.default.call(void 0, Promise.resolve().then(() => require("swagger-ui-react/swagger-ui.css")), { ssr: false });
55
- var SwaggerApiDocument = (name, swagger = {}) => ({ swaggerData }) => /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, _jsxdevruntime.Fragment, {
56
- children: [
57
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, _head2.default, {
58
- children: [
59
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, "title", {
60
- children: name
61
- }, void 0, false, {
62
- fileName: "src/next/routes/pages/swagger/swagger.tsx",
63
- lineNumber: 23,
64
- columnNumber: 21
65
- }, this),
66
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, "style", {
67
- children: `
68
- body {
69
- background: #fafafa !important;
70
- }
71
- `
72
- }, void 0, false, {
73
- fileName: "src/next/routes/pages/swagger/swagger.tsx",
74
- lineNumber: 24,
75
- columnNumber: 21
76
- }, this)
77
- ]
78
- }, void 0, true, {
79
- fileName: "src/next/routes/pages/swagger/swagger.tsx",
80
- lineNumber: 22,
81
- columnNumber: 17
82
- }, this),
83
- /* @__PURE__ */ _jsxdevruntime.jsxDEV.call(void 0, SwaggerUI, {
84
- ...swagger,
85
- spec: swaggerData
86
- }, void 0, false, {
87
- fileName: "src/next/routes/pages/swagger/swagger.tsx",
88
- lineNumber: 33,
89
- columnNumber: 17
90
- }, this)
91
- ]
92
- }, void 0, true, {
93
- fileName: "src/next/routes/pages/swagger/swagger.tsx",
94
- lineNumber: 21,
95
- columnNumber: 13
96
- }, this);
97
- var swagger_default = SwaggerApiDocument;
98
-
99
- // src/next/routes/pages/swagger/get-static-properties-swagger.ts
100
- var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
101
- var swaggerDebug = _debug2.default.call(void 0, "visulima:api-platform:swagger:get-static-properties-swagger");
102
- var getStaticProps = (swaggerUrl) => async () => {
103
- const response = await fetch(swaggerUrl);
104
- const swaggerData = await response.json();
105
- swaggerDebug(swaggerData);
106
- return {
107
- props: {
108
- swaggerUrl,
109
- swaggerData: JSON.parse(JSON.stringify(swaggerData))
110
- }
111
- };
112
- };
113
- var get_static_properties_swagger_default = getStaticProps;
114
-
115
-
116
-
117
-
118
-
119
- exports.redoc_default = redoc_default; exports.swagger_default = swagger_default; exports.get_static_properties_swagger_default = get_static_properties_swagger_default;
120
- //# sourceMappingURL=chunk-CVURPKKG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/next/routes/pages/swagger/redoc.tsx","../src/next/routes/pages/swagger/swagger.tsx","../src/next/routes/pages/swagger/get-static-properties-swagger.ts"],"names":["Head","Fragment","jsxDEV"],"mappings":";AAGA,OAAO,UAAU;AAIjB,SAAS,uBAAuB;AAUpB,mBAEQ,cAFR;AALZ,IAAM,mBAI0D,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,MAC3F;AAAA,EACI;AAAA,2BAAC;AAAA,MACG;AAAA,+BAAC;AAAA,UAAO;AAAA,WAAR;AAAA;AAAA;AAAA;AAAA,eAAa;AAAA,QACb,uBAAC;AAAA,UACI;AAAA;AAAA;AAAA;AAAA;AAAA,WADL;AAAA;AAAA;AAAA;AAAA,eAMA;AAAA;AAAA,OARJ;AAAA;AAAA;AAAA;AAAA,WASA;AAAA,IAEA,uBAAC;AAAA,MAAiB,GAAG;AAAA,MAAS,MAAM;AAAA,OAApC;AAAA;AAAA;AAAA;AAAA,WAAiD;AAAA;AAAA,GAZrD;AAAA;AAAA;AAAA;AAAA,OAaA;AAGZ,IAAO,gBAAQ;;;AC/Bf,OAAO,aAAa;AAEpB,OAAOA,WAAU;AAgBL,qBAAAC,WAEQ,UAAAC,eAFR;AAXZ,IAAM,YAAY,QAAQ,MAAM,OAAO,qBAAqB,EAAE,KAAK,MAAM,CAAC;AAG1E,QAAQ,OAAO,oCAAoC,EAAE,KAAK,MAAM,CAAC;AAGjE,IAAM,qBAI0D,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,MAC3F,gBAAAA,QAAAD,WAAA;AAAA,EACI;AAAA,oBAAAC,QAACF,OAAA;AAAA,MACG;AAAA,wBAAAE,QAAC;AAAA,UAAO;AAAA,WAAR;AAAA;AAAA;AAAA;AAAA,eAAa;AAAA,QACb,gBAAAA,QAAC;AAAA,UACI;AAAA;AAAA;AAAA;AAAA;AAAA,WADL;AAAA;AAAA;AAAA;AAAA,eAMA;AAAA;AAAA,OARJ;AAAA;AAAA;AAAA;AAAA,WASA;AAAA,IAEA,gBAAAA,QAAC;AAAA,MAAW,GAAG;AAAA,MAAS,MAAM;AAAA,OAA9B;AAAA;AAAA;AAAA;AAAA,WAA2C;AAAA;AAAA,GAZ/C;AAAA;AAAA;AAAA;AAAA,OAaA;AAGZ,IAAO,kBAAQ;;;ACnCf,OAAO,WAAW;AAKlB,IAAM,eAAe,MAAM,6DAA6D;AAGxF,IAAM,iBAEgB,CAAC,eAAe,YAKhC;AAEF,QAAM,WAAW,MAAM,MAAM,UAAU;AACvC,QAAM,cAAc,MAAM,SAAS,KAAK;AAExC,eAAa,WAAW;AAExB,SAAO;AAAA,IACH,OAAO;AAAA,MACH;AAAA,MACA,aAAa,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC;AAAA,IACvD;AAAA,EACJ;AACJ;AAEA,IAAO,wCAAQ","sourcesContent":["// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { InferGetStaticPropsType, NextPage } from \"next\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport Head from \"next/head\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { RedocStandaloneProps } from \"redoc\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { RedocStandalone } from \"redoc\";\n\nimport getStaticProps from \"./get-static-properties-swagger\";\n\n// eslint-disable-next-line max-len\nconst RedocApiDocument: (\n name: string,\n swagger?: Exclude<RedocStandaloneProps, \"spec\">,\n // eslint-disable-next-line max-len,unicorn/no-useless-undefined\n) => NextPage<InferGetStaticPropsType<typeof getStaticProps>> = (name, swagger = {}) => ({ swaggerData }: InferGetStaticPropsType<typeof getStaticProps>) => (\n <>\n <Head>\n <title>{name}</title>\n <style>\n {`\nbody {\n background: #fafafa !important;\n}\n`}\n </style>\n </Head>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <RedocStandalone {...swagger} spec={swaggerData} />\n </>\n);\n\nexport default RedocApiDocument;\n","import type { InferGetStaticPropsType, NextPage } from \"next\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport dynamic from \"next/dynamic\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport Head from \"next/head\";\nimport type { SwaggerUIProps } from \"swagger-ui-react\";\n\nimport getStaticProps from \"./get-static-properties-swagger\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nconst SwaggerUI = dynamic(() => import(\"swagger-ui-react\"), { ssr: false });\n// @ts-ignore\n// eslint-disable-next-line import/no-extraneous-dependencies\ndynamic(import(\"swagger-ui-react/swagger-ui.css\"), { ssr: false });\n\n// eslint-disable-next-line max-len\nconst SwaggerApiDocument: (\n name: string,\n swagger?: Exclude<SwaggerUIProps, \"spec\">,\n // eslint-disable-next-line max-len,unicorn/no-useless-undefined\n) => NextPage<InferGetStaticPropsType<typeof getStaticProps>> = (name, swagger = {}) => ({ swaggerData }: InferGetStaticPropsType<typeof getStaticProps>) => (\n <>\n <Head>\n <title>{name}</title>\n <style>\n {`\nbody {\n background: #fafafa !important;\n}\n`}\n </style>\n </Head>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <SwaggerUI {...swagger} spec={swaggerData} />\n </>\n);\n\nexport default SwaggerApiDocument;\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport debug from \"debug\";\nimport type { GetStaticProps } from \"next\";\nimport type { OpenAPIV3 } from \"openapi-types\";\n\n// eslint-disable-next-line testing-library/no-debugging-utils\nconst swaggerDebug = debug(\"visulima:api-platform:swagger:get-static-properties-swagger\");\n\n// eslint-disable-next-line unicorn/consistent-function-scoping\nconst getStaticProps: (\n swaggerUrl: string,\n) => GetStaticProps = (swaggerUrl) => async (): Promise<{\n props: {\n swaggerUrl: string;\n swaggerData: OpenAPIV3.Document;\n };\n}> => {\n // eslint-disable-next-line compat/compat\n const response = await fetch(swaggerUrl);\n const swaggerData = await response.json();\n\n swaggerDebug(swaggerData);\n\n return {\n props: {\n swaggerUrl,\n swaggerData: JSON.parse(JSON.stringify(swaggerData)),\n },\n };\n};\n\nexport default getStaticProps;\n"]}