@voltro/plugin-openapi 0.84.0 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1215 -0
- package/README.md +6 -0
- package/THIRD-PARTY-NOTICES.md +118 -600
- package/dist/generate.js +436 -0
- package/dist/index.js +94 -563
- package/dist/rpc.js +45 -0
- package/dist/swaggerUi.js +20 -0
- package/package.json +4 -4
package/dist/rpc.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { errorResponse as e, toJsonSchema as t } from "./generate.js";
|
|
2
|
+
//#region src/rpc.ts
|
|
3
|
+
var n = "/rpc", r = "rpc", i = (e) => e.ast._tag === "Never", a = (e, t) => `${e} ${t}`, o = (e) => `Voltro rpc ${e}. This \`/rpc/<name>\` path is a documentation projection of the procedure's input/output schemas — live calls go through ${e === "query" || e === "stream" ? "the batched `POST /rpc` endpoint (first snapshot / element) or the WebSocket rpc channel (reactive/streaming)" : "the batched `POST /rpc` endpoint"}, NOT a REST request to this path. The request body below is the rpc payload.`, s = (n, s) => {
|
|
4
|
+
let { kind: c, name: l } = n, u = {
|
|
5
|
+
required: !0,
|
|
6
|
+
content: { "application/json": { schema: t(n.input, s) } }
|
|
7
|
+
}, d = (() => {
|
|
8
|
+
if (c === "stream") return {
|
|
9
|
+
description: "Stream of elements. The rpc transport pushes each element as it is produced (WebSocket) or drains to the first element over `POST /rpc`. The schema below is ONE element, not the whole response.",
|
|
10
|
+
content: { "application/x-ndjson": { schema: t(n.element, s) } }
|
|
11
|
+
};
|
|
12
|
+
let e = t(n.output, s);
|
|
13
|
+
return {
|
|
14
|
+
description: c === "query" ? "OK — the query snapshot (the first/initial snapshot over `POST /rpc`; the WebSocket channel then pushes reactive updates)." : "OK",
|
|
15
|
+
content: { "application/json": { schema: e } }
|
|
16
|
+
};
|
|
17
|
+
})(), f = i(n.error) ? {} : { 422: {
|
|
18
|
+
description: "A typed error from the procedure — one of its declared error variants (the rpc failure channel).",
|
|
19
|
+
content: { "application/json": { schema: t(n.error, s) } }
|
|
20
|
+
} };
|
|
21
|
+
return {
|
|
22
|
+
tags: [r],
|
|
23
|
+
summary: a(c, l),
|
|
24
|
+
description: o(c),
|
|
25
|
+
"x-voltro-rpc": {
|
|
26
|
+
kind: c,
|
|
27
|
+
procedure: l
|
|
28
|
+
},
|
|
29
|
+
requestBody: u,
|
|
30
|
+
responses: {
|
|
31
|
+
200: d,
|
|
32
|
+
...f,
|
|
33
|
+
500: e("Internal Server Error — an untyped defect.")
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, c = (e, t) => {
|
|
37
|
+
let r = {};
|
|
38
|
+
for (let i of e) {
|
|
39
|
+
let e = `${n}/${i.name}`;
|
|
40
|
+
r[e] = { post: s(i, t) };
|
|
41
|
+
}
|
|
42
|
+
return r;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { c as rpcPathItems };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/swaggerUi.ts
|
|
2
|
+
var e = "5.17.14", t = `https://unpkg.com/swagger-ui-dist@${e}/swagger-ui.css`, n = `https://unpkg.com/swagger-ui-dist@${e}/swagger-ui-bundle.js`, r = (e, r = "API docs", i = {}) => `<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<title>${r}</title>
|
|
8
|
+
<link rel="stylesheet" href="${t}" integrity="sha384-wxLW6kwyHktdDGr6Pv1zgm/VGJh99lfUbzSn6HNHBENZlCN7W602k9VkGdxuFvPn" crossorigin="anonymous" />
|
|
9
|
+
<style>body { margin: 0 }</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="swagger-ui"></div>
|
|
13
|
+
<script src="${n}" integrity="sha384-wmyclcVGX/WhUkdkATwhaK1X1JtiNrr2EoYJ+diV3vj4v6OC5yCeSu+yW13SYJep" crossorigin="anonymous"><\/script>
|
|
14
|
+
<script>
|
|
15
|
+
window.ui = SwaggerUIBundle({ ${i.urls !== void 0 && i.urls.length > 0 ? `urls: ${JSON.stringify(i.urls)}, ${i.primaryName === void 0 ? "" : `'urls.primaryName': ${JSON.stringify(i.primaryName)}, `}` : `url: ${JSON.stringify(e)}, `}dom_id: '#swagger-ui', deepLinking: true });
|
|
16
|
+
<\/script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>`;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { r as swaggerUiHtml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-openapi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0",
|
|
4
4
|
"description": "Generate an OpenAPI 3.1 spec from defineRestRoute descriptors and serve it + a Swagger-UI docs page. Zero hand-maintained API docs — the REST descriptors ARE the source of truth.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"node": ">=24.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@voltro/env": "0.
|
|
37
|
-
"@voltro/protocol": "0.
|
|
36
|
+
"@voltro/env": "0.86.0",
|
|
37
|
+
"@voltro/protocol": "0.86.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"effect": "
|
|
40
|
+
"effect": "4.0.1"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|