@visulima/api-platform 1.2.0 → 1.2.2
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/CHANGELOG.md +24 -0
- package/README.md +7 -0
- package/dist/chunk-GTXHW632.mjs +10 -0
- package/dist/chunk-GTXHW632.mjs.map +1 -0
- package/dist/{chunk-34PWA43J.js → chunk-NR4FOSWI.js} +3 -3
- package/dist/chunk-NR4FOSWI.js.map +1 -0
- package/dist/framework/next/index-browser.js +1 -1
- package/dist/framework/next/index-browser.mjs +1 -1
- package/dist/framework/next/index-server.js +1 -1
- package/dist/framework/next/index-server.mjs +1 -1
- package/package.json +18 -18
- package/dist/chunk-34PWA43J.js.map +0 -1
- package/dist/chunk-ZEVXRYAP.mjs +0 -10
- package/dist/chunk-ZEVXRYAP.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## @visulima/api-platform [1.2.2](https://github.com/visulima/visulima/compare/@visulima/api-platform@1.2.1...@visulima/api-platform@1.2.2) (2023-01-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* allow higher node versions ([c93d55b](https://github.com/visulima/visulima/commit/c93d55b80135282235e933da52d9c88ade3073a8))
|
|
7
|
+
* allow higher node versions ([faf4780](https://github.com/visulima/visulima/commit/faf478069f3508249db22ed2171ddee4fa380122))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* **@visulima/connect:** upgraded to 1.3.2
|
|
14
|
+
* **@visulima/jsdoc-open-api:** upgraded to 1.3.1
|
|
15
|
+
* **@visulima/crud:** upgraded to 1.0.9
|
|
16
|
+
* **@visulima/readdir:** upgraded to 1.3.3
|
|
17
|
+
|
|
18
|
+
## @visulima/api-platform [1.2.1](https://github.com/visulima/visulima/compare/@visulima/api-platform@1.2.0...@visulima/api-platform@1.2.1) (2023-01-08)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **api-platform:** fixed issue with swagger css loading ([292fcb5](https://github.com/visulima/visulima/commit/292fcb5ef2681fb31f21df1f43fbe38a85a94023))
|
|
24
|
+
|
|
1
25
|
## @visulima/api-platform [1.2.0](https://github.com/visulima/visulima/compare/@visulima/api-platform@1.1.8...@visulima/api-platform@1.2.0) (2022-12-23)
|
|
2
26
|
|
|
3
27
|
|
package/README.md
CHANGED
|
@@ -77,6 +77,13 @@ pnpm add @visulima/api-platform zod @visulima/readdir
|
|
|
77
77
|
npm install swagger-ui-react
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
To have a styled version of the swagger-ui you need to add the following css to your project:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import "swagger-ui-react/swagger-ui.css"
|
|
84
|
+
```
|
|
85
|
+
> Note: For `next.js` you can add it to your `_app.tsx` file
|
|
86
|
+
|
|
80
87
|
Or
|
|
81
88
|
|
|
82
89
|
```sh
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import g from"next/head";import{RedocStandalone as i}from"redoc";import{Fragment as f,jsx as o,jsxs as p}from"react/jsx-runtime";var c=(t,r={})=>({swaggerData:e})=>p(f,{children:[p(g,{children:[o("title",{children:t}),o("style",{children:`
|
|
2
|
+
body {
|
|
3
|
+
background: #fafafa !important;
|
|
4
|
+
}
|
|
5
|
+
`})]}),o(i,{...r,spec:e})]}),n=c;import m from"next/dynamic";import P from"next/head";import{Fragment as l,jsx as a,jsxs as s}from"react/jsx-runtime";var d=m(()=>import("swagger-ui-react"),{ssr:!1}),S=(t,r={})=>({swaggerData:e})=>s(l,{children:[s(P,{children:[a("title",{children:t}),a("style",{children:`
|
|
6
|
+
body {
|
|
7
|
+
background: #fafafa !important;
|
|
8
|
+
}
|
|
9
|
+
`})]}),a(d,{...r,spec:e})]}),y=S;import w from"debug";var u=w("visulima:api-platform:swagger:get-static-properties-swagger"),x=t=>async()=>{let e=await(await fetch(t)).json();return u(e),{props:{swaggerUrl:t,swaggerData:JSON.parse(JSON.stringify(e))}}},I=x;export{n as a,y as b,I as c};
|
|
10
|
+
//# sourceMappingURL=chunk-GTXHW632.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/framework/next/routes/pages/swagger/redoc.tsx","../src/framework/next/routes/pages/swagger/swagger.tsx","../src/framework/next/routes/pages/swagger/get-static-properties-swagger.ts"],"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\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"],"mappings":"AAGA,OAAOA,MAAU,YAIjB,OAAS,mBAAAC,MAAuB,QAUpB,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBALZ,IAAMC,EAI0D,CAACC,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACF,EAAA,CAAiB,GAAGM,EAAS,KAAMC,EAAa,GACrD,EAGLC,EAAQJ,EC/Bf,OAAOK,MAAa,eAEpB,OAAOC,MAAU,YAaL,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBARZ,IAAMC,EAAYL,EAAQ,IAAM,OAAO,oBAAqB,CAAE,IAAK,EAAM,CAAC,EAGpEM,EAI0D,CAACC,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FL,EAAAF,EAAA,CACI,UAAAE,EAACH,EAAA,CACG,UAAAE,EAAC,SAAO,SAAAI,EAAK,EACbJ,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACE,EAAA,CAAW,GAAGG,EAAS,KAAMC,EAAa,GAC/C,EAGLC,EAAQJ,EChCf,OAAOK,MAAW,QAKlB,IAAMC,EAAeD,EAAM,6DAA6D,EAGlFE,EAEiBC,GAAe,SAKhC,CAGF,IAAMC,EAAc,MADH,MAAM,MAAMD,CAAU,GACJ,KAAK,EAExC,OAAAF,EAAaG,CAAW,EAEjB,CACH,MAAO,CACH,WAAAD,EACA,YAAa,KAAK,MAAM,KAAK,UAAUC,CAAW,CAAC,CACvD,CACJ,CACJ,EAEOC,EAAQH","names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default","dynamic","Head","Fragment","jsx","jsxs","SwaggerUI","SwaggerApiDocument","name","swagger","swaggerData","swagger_default","debug","swaggerDebug","getStaticProps","swaggerUrl","swaggerData","get_static_properties_swagger_default"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _head = require('next/head'); var _head2 = _interopRequireDefault(_head);var _redoc = require('redoc');var _jsxruntime = require('react/jsx-runtime');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _head = require('next/head'); var _head2 = _interopRequireDefault(_head);var _redoc = require('redoc');var _jsxruntime = require('react/jsx-runtime');var c=(t,r={})=>({swaggerData:e})=>_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, _head2.default,{children:[_jsxruntime.jsx.call(void 0, "title",{children:t}),_jsxruntime.jsx.call(void 0, "style",{children:`
|
|
2
2
|
body {
|
|
3
3
|
background: #fafafa !important;
|
|
4
4
|
}
|
|
5
|
-
`})]}),_jsxruntime.jsx.call(void 0, _redoc.RedocStandalone,{...r,spec:e})]}),n= exports.a =
|
|
5
|
+
`})]}),_jsxruntime.jsx.call(void 0, _redoc.RedocStandalone,{...r,spec:e})]}),n= exports.a =c;var _dynamic = require('next/dynamic'); var _dynamic2 = _interopRequireDefault(_dynamic);var d=_dynamic2.default.call(void 0, ()=>Promise.resolve().then(() => require("swagger-ui-react")),{ssr:!1}),S=(t,r={})=>({swaggerData:e})=>_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, _head2.default,{children:[_jsxruntime.jsx.call(void 0, "title",{children:t}),_jsxruntime.jsx.call(void 0, "style",{children:`
|
|
6
6
|
body {
|
|
7
7
|
background: #fafafa !important;
|
|
8
8
|
}
|
|
9
9
|
`})]}),_jsxruntime.jsx.call(void 0, d,{...r,spec:e})]}),y= exports.b =S;var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);var u=_debug2.default.call(void 0, "visulima:api-platform:swagger:get-static-properties-swagger"),x=t=>async()=>{let e=await(await fetch(t)).json();return u(e),{props:{swaggerUrl:t,swaggerData:JSON.parse(JSON.stringify(e))}}},I= exports.c =x;exports.a = n; exports.b = y; exports.c = I;
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-NR4FOSWI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/framework/next/routes/pages/swagger/redoc.tsx","../src/framework/next/routes/pages/swagger/swagger.tsx","../src/framework/next/routes/pages/swagger/get-static-properties-swagger.ts"],"names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default","dynamic","SwaggerUI","SwaggerApiDocument","swagger_default","debug","swaggerDebug","getStaticProps","swaggerUrl","get_static_properties_swagger_default"],"mappings":"AAGA,OAAOA,MAAU,YAIjB,OAAS,mBAAAC,MAAuB,QAUpB,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBALZ,IAAMC,EAI0D,CAACC,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACF,EAAA,CAAiB,GAAGM,EAAS,KAAMC,EAAa,GACrD,EAGLC,EAAQJ,EC/Bf,OAAOK,MAAa,eAEpB,OAAOV,MAAU,YAaL,mBAAAE,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBARZ,IAAMO,EAAYD,EAAQ,IAAM,OAAO,oBAAqB,CAAE,IAAK,EAAM,CAAC,EAGpEE,EAI0D,CAACN,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACQ,EAAA,CAAW,GAAGJ,EAAS,KAAMC,EAAa,GAC/C,EAGLK,EAAQD,EChCf,OAAOE,MAAW,QAKlB,IAAMC,EAAeD,EAAM,6DAA6D,EAGlFE,EAEiBC,GAAe,SAKhC,CAGF,IAAMT,EAAc,MADH,MAAM,MAAMS,CAAU,GACJ,KAAK,EAExC,OAAAF,EAAaP,CAAW,EAEjB,CACH,MAAO,CACH,WAAAS,EACA,YAAa,KAAK,MAAM,KAAK,UAAUT,CAAW,CAAC,CACvD,CACJ,CACJ,EAEOU,EAAQF","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\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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNR4FOSWIjs = require('../../chunk-NR4FOSWI.js');require('../../chunk-OUWZ2PU5.js');exports.RedocPage = _chunkNR4FOSWIjs.a; exports.SwaggerPage = _chunkNR4FOSWIjs.b; exports.getSwaggerStaticProps = _chunkNR4FOSWIjs.c;
|
|
2
2
|
//# sourceMappingURL=index-browser.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c}from"../../chunk-
|
|
1
|
+
import{a,b,c}from"../../chunk-GTXHW632.mjs";import"../../chunk-YOXCJZNX.mjs";export{a as RedocPage,b as SwaggerPage,c as getSwaggerStaticProps};
|
|
2
2
|
//# sourceMappingURL=index-browser.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkLS3DG7TOjs = require('../../chunk-LS3DG7TO.js');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkLS3DG7TOjs = require('../../chunk-LS3DG7TO.js');var _chunkNR4FOSWIjs = require('../../chunk-NR4FOSWI.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:p,verbose:s,output:r="swagger/swagger.json"})=>a=>({...a,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}`,p.map(m=>{let o=_path2.default.join(t.dir,m.replace("./",""));return _fs2.default.lstatSync(o).isDirectory(),o}),{openapi:"3.0.0",...i},{verbose:s})]},typeof a.webpack=="function"?a.webpack(e,t):e}}),u= exports.withOpenApi =l;var d=(i={})=>_chunkLS3DG7TOjs.c.call(void 0, i),c= exports.swaggerApiRoute =d;exports.RedocPage = _chunkNR4FOSWIjs.a; exports.SwaggerPage = _chunkNR4FOSWIjs.b; exports.getSwaggerStaticProps = _chunkNR4FOSWIjs.c; exports.swaggerApiRoute = c; exports.withOpenApi = u;
|
|
2
2
|
//# sourceMappingURL=index-server.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as n}from"../../chunk-KJQOIMY2.mjs";import{a as h,b as y,c as b}from"../../chunk-
|
|
1
|
+
import{c as n}from"../../chunk-KJQOIMY2.mjs";import{a as h,b as y,c as b}from"../../chunk-GTXHW632.mjs";import"../../chunk-YOXCJZNX.mjs";import{SwaggerCompilerPlugin as g}from"@visulima/jsdoc-open-api";import f from"fs";import w from"path";var l=({definition:i,sources:p,verbose:s,output:r="swagger/swagger.json"})=>a=>({...a,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 g(`${t.dir}/${r}`,p.map(m=>{let o=w.join(t.dir,m.replace("./",""));return f.lstatSync(o).isDirectory(),o}),{openapi:"3.0.0",...i},{verbose:s})]},typeof a.webpack=="function"?a.webpack(e,t):e}}),u=l;var d=(i={})=>n(i),c=d;export{h as RedocPage,y as SwaggerPage,b as getSwaggerStaticProps,c as swaggerApiRoute,u as withOpenApi};
|
|
2
2
|
//# sourceMappingURL=index-server.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/api-platform",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Visulima API platform is a set of tools to build and consume web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -76,6 +76,9 @@
|
|
|
76
76
|
"module": "dist/index-server.mjs",
|
|
77
77
|
"browser": "dist/index-browser.mjs",
|
|
78
78
|
"types": "dist/index-server.d.ts",
|
|
79
|
+
"bin": {
|
|
80
|
+
"api-platform": "./bin/index.js"
|
|
81
|
+
},
|
|
79
82
|
"files": [
|
|
80
83
|
"bin/**",
|
|
81
84
|
"next/**",
|
|
@@ -96,8 +99,8 @@
|
|
|
96
99
|
"test": "vitest"
|
|
97
100
|
},
|
|
98
101
|
"dependencies": {
|
|
99
|
-
"@visulima/connect": "1.3.
|
|
100
|
-
"@visulima/jsdoc-open-api": "1.3.
|
|
102
|
+
"@visulima/connect": "1.3.2",
|
|
103
|
+
"@visulima/jsdoc-open-api": "1.3.1",
|
|
101
104
|
"accepts": "^1.3.8",
|
|
102
105
|
"debug": "^4.3.4",
|
|
103
106
|
"http-errors": "^2.0.0",
|
|
@@ -113,15 +116,19 @@
|
|
|
113
116
|
"@anolilab/eslint-config": "^4.0.9",
|
|
114
117
|
"@anolilab/semantic-release-preset": "^2.0.7",
|
|
115
118
|
"@hapi/hapi": "^21.1.0",
|
|
119
|
+
"@koa/router": "^12.0.0",
|
|
116
120
|
"@rushstack/eslint-plugin-security": "^0.5.0",
|
|
117
121
|
"@testing-library/react": "^13.4.0",
|
|
118
122
|
"@testing-library/react-hooks": "^8.0.1",
|
|
119
123
|
"@types/accepts": "^1.3.5",
|
|
120
124
|
"@types/cors": "^2.8.12",
|
|
121
125
|
"@types/debug": "^4.1.7",
|
|
126
|
+
"@types/express": "^4.17.15",
|
|
127
|
+
"@types/express-serve-static-core": "^4.17.31",
|
|
122
128
|
"@types/http-errors": "^2.0.0",
|
|
123
129
|
"@types/jstoxml": "^2.0.2",
|
|
124
130
|
"@types/koa": "^2.13.5",
|
|
131
|
+
"@types/koa__router": "^12.0.0",
|
|
125
132
|
"@types/lodash.merge": "^4.6.7",
|
|
126
133
|
"@types/lodash.set": "^4.3.7",
|
|
127
134
|
"@types/node": "^18.8.4",
|
|
@@ -132,9 +139,8 @@
|
|
|
132
139
|
"@types/webpack": "^5.28.0",
|
|
133
140
|
"@typescript-eslint/eslint-plugin": "^5.40.0",
|
|
134
141
|
"@typescript-eslint/parser": "^5.40.0",
|
|
135
|
-
"@
|
|
136
|
-
"@visulima/
|
|
137
|
-
"@visulima/readdir": "1.3.2",
|
|
142
|
+
"@visulima/crud": "1.0.9",
|
|
143
|
+
"@visulima/readdir": "1.3.3",
|
|
138
144
|
"chalk": "4.1.2",
|
|
139
145
|
"commander": "^9.4.1",
|
|
140
146
|
"core-js": "^3.25.5",
|
|
@@ -162,10 +168,8 @@
|
|
|
162
168
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
|
|
163
169
|
"eslint-plugin-you-dont-need-momentjs": "^1.6.0",
|
|
164
170
|
"express": "^4.18.2",
|
|
165
|
-
"@types/express": "^4.17.15",
|
|
166
171
|
"fastify": "^4.10.2",
|
|
167
172
|
"koa": "^2.14.1",
|
|
168
|
-
"@koa/router": "^12.0.0",
|
|
169
173
|
"mobx": "^6.6.2",
|
|
170
174
|
"next": "^12.0.0 || ^13.0.0",
|
|
171
175
|
"next-test-api-route-handler": "^4.0.0-canary.1",
|
|
@@ -178,11 +182,10 @@
|
|
|
178
182
|
"read-pkg": "^7.1.0",
|
|
179
183
|
"redoc": "^2.0.0",
|
|
180
184
|
"rimraf": "^3.0.2",
|
|
181
|
-
"
|
|
182
|
-
"semantic-release": "^19.0.5",
|
|
185
|
+
"semantic-release": "^20.0.0",
|
|
183
186
|
"styled-components": "^5.3.6",
|
|
184
|
-
"swagger-ui-react": "^4.14.3",
|
|
185
187
|
"swagger-ui-dist": "^4.15.5",
|
|
188
|
+
"swagger-ui-react": "^4.14.3",
|
|
186
189
|
"tsup": "^6.2.3",
|
|
187
190
|
"typescript": "^4.8.4",
|
|
188
191
|
"vitest": "^0.26.1",
|
|
@@ -196,15 +199,15 @@
|
|
|
196
199
|
},
|
|
197
200
|
"optionalDependencies": {
|
|
198
201
|
"@hapi/hapi": "^21.1.0",
|
|
199
|
-
"@
|
|
200
|
-
"@visulima/
|
|
202
|
+
"@koa/router": "^12.0.0",
|
|
203
|
+
"@visulima/crud": "1.0.9",
|
|
204
|
+
"@visulima/readdir": "1.3.3",
|
|
201
205
|
"chalk": "4.1.2",
|
|
202
206
|
"commander": "^9.4.1",
|
|
203
207
|
"cors": "^2.8.5",
|
|
204
208
|
"express": "^4.18.2",
|
|
205
209
|
"fastify": "^4.10.2",
|
|
206
210
|
"koa": "^2.14.1",
|
|
207
|
-
"@koa/router": "^12.0.0",
|
|
208
211
|
"next": "^12.0.0 || ^13.0.0",
|
|
209
212
|
"rate-limiter-flexible": "^2.3.11",
|
|
210
213
|
"redoc": "^2.0.0",
|
|
@@ -213,14 +216,11 @@
|
|
|
213
216
|
"webpack": "^5.74.0"
|
|
214
217
|
},
|
|
215
218
|
"engines": {
|
|
216
|
-
"node": ">=16"
|
|
219
|
+
"node": ">=16.18.0 <=19.0"
|
|
217
220
|
},
|
|
218
221
|
"publishConfig": {
|
|
219
222
|
"access": "public"
|
|
220
223
|
},
|
|
221
|
-
"bin": {
|
|
222
|
-
"api-platform": "./bin/index.js"
|
|
223
|
-
},
|
|
224
224
|
"sources": [
|
|
225
225
|
"src/index-browser.tsx",
|
|
226
226
|
"src/index-server.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/framework/next/routes/pages/swagger/redoc.tsx","../src/framework/next/routes/pages/swagger/swagger.tsx","../src/framework/next/routes/pages/swagger/get-static-properties-swagger.ts"],"names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default","dynamic","SwaggerUI","SwaggerApiDocument","swagger_default","debug","swaggerDebug","getStaticProps","swaggerUrl","get_static_properties_swagger_default"],"mappings":"AAGA,OAAOA,MAAU,YAIjB,OAAS,mBAAAC,MAAuB,QAUpB,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBALZ,IAAMC,EAI0D,CAACC,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACF,EAAA,CAAiB,GAAGM,EAAS,KAAMC,EAAa,GACrD,EAGLC,EAAQJ,EC/Bf,OAAOK,MAAa,eAEpB,OAAOV,MAAU,YAgBL,mBAAAE,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBAXZ,IAAMO,EAAYD,EAAQ,IAAM,OAAO,oBAAqB,CAAE,IAAK,EAAM,CAAC,EAG1EA,EAAQ,OAAO,mCAAoC,CAAE,IAAK,EAAM,CAAC,EAGjE,IAAME,EAI0D,CAACN,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACQ,EAAA,CAAW,GAAGJ,EAAS,KAAMC,EAAa,GAC/C,EAGLK,EAAQD,ECnCf,OAAOE,MAAW,QAKlB,IAAMC,EAAeD,EAAM,6DAA6D,EAGlFE,EAEiBC,GAAe,SAKhC,CAGF,IAAMT,EAAc,MADH,MAAM,MAAMS,CAAU,GACJ,KAAK,EAExC,OAAAF,EAAaP,CAAW,EAEjB,CACH,MAAO,CACH,WAAAS,EACA,YAAa,KAAK,MAAM,KAAK,UAAUT,CAAW,CAAC,CACvD,CACJ,CACJ,EAEOU,EAAQF","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"]}
|
package/dist/chunk-ZEVXRYAP.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import i from"next/head";import{RedocStandalone as c}from"redoc";import{Fragment as m,jsx as o,jsxs as p}from"react/jsx-runtime";var f=(t,r={})=>({swaggerData:e})=>p(m,{children:[p(i,{children:[o("title",{children:t}),o("style",{children:`
|
|
2
|
-
body {
|
|
3
|
-
background: #fafafa !important;
|
|
4
|
-
}
|
|
5
|
-
`})]}),o(c,{...r,spec:e})]}),n=f;import g from"next/dynamic";import P from"next/head";import{Fragment as l,jsx as a,jsxs as s}from"react/jsx-runtime";var d=g(()=>import("swagger-ui-react"),{ssr:!1});g(import("swagger-ui-react/swagger-ui.css"),{ssr:!1});var S=(t,r={})=>({swaggerData:e})=>s(l,{children:[s(P,{children:[a("title",{children:t}),a("style",{children:`
|
|
6
|
-
body {
|
|
7
|
-
background: #fafafa !important;
|
|
8
|
-
}
|
|
9
|
-
`})]}),a(d,{...r,spec:e})]}),y=S;import w from"debug";var u=w("visulima:api-platform:swagger:get-static-properties-swagger"),x=t=>async()=>{let e=await(await fetch(t)).json();return u(e),{props:{swaggerUrl:t,swaggerData:JSON.parse(JSON.stringify(e))}}},I=x;export{n as a,y as b,I as c};
|
|
10
|
-
//# sourceMappingURL=chunk-ZEVXRYAP.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/framework/next/routes/pages/swagger/redoc.tsx","../src/framework/next/routes/pages/swagger/swagger.tsx","../src/framework/next/routes/pages/swagger/get-static-properties-swagger.ts"],"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"],"mappings":"AAGA,OAAOA,MAAU,YAIjB,OAAS,mBAAAC,MAAuB,QAUpB,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBALZ,IAAMC,EAI0D,CAACC,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACF,EAAA,CAAiB,GAAGM,EAAS,KAAMC,EAAa,GACrD,EAGLC,EAAQJ,EC/Bf,OAAOK,MAAa,eAEpB,OAAOC,MAAU,YAgBL,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBAXZ,IAAMC,EAAYL,EAAQ,IAAM,OAAO,oBAAqB,CAAE,IAAK,EAAM,CAAC,EAG1EA,EAAQ,OAAO,mCAAoC,CAAE,IAAK,EAAM,CAAC,EAGjE,IAAMM,EAI0D,CAACC,EAAMC,EAAU,CAAC,IAAM,CAAC,CAAE,YAAAC,CAAY,IAC3FL,EAAAF,EAAA,CACI,UAAAE,EAACH,EAAA,CACG,UAAAE,EAAC,SAAO,SAAAI,EAAK,EACbJ,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACE,EAAA,CAAW,GAAGG,EAAS,KAAMC,EAAa,GAC/C,EAGLC,EAAQJ,ECnCf,OAAOK,MAAW,QAKlB,IAAMC,EAAeD,EAAM,6DAA6D,EAGlFE,EAEiBC,GAAe,SAKhC,CAGF,IAAMC,EAAc,MADH,MAAM,MAAMD,CAAU,GACJ,KAAK,EAExC,OAAAF,EAAaG,CAAW,EAEjB,CACH,MAAO,CACH,WAAAD,EACA,YAAa,KAAK,MAAM,KAAK,UAAUC,CAAW,CAAC,CACvD,CACJ,CACJ,EAEOC,EAAQH","names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default","dynamic","Head","Fragment","jsx","jsxs","SwaggerUI","SwaggerApiDocument","name","swagger","swaggerData","swagger_default","debug","swaggerDebug","getStaticProps","swaggerUrl","swaggerData","get_static_properties_swagger_default"]}
|