vovk-cli 0.0.1-draft.227 → 0.0.1-draft.229

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.
@@ -2,7 +2,7 @@
2
2
  import type { VovkRequest, VovkStreamAsyncIterable, KnownAny } from 'vovk';
3
3
  export type Controllers = {
4
4
  <% Object.values(t.schema.segments.extensions.controllers).forEach((controllerSchema) => { %>
5
- <%= controllerSchema.originalControllerName ?? controllerSchema.rpcModuleName.replace(/RPC$/, '') + 'Controller' %>: {
5
+ <%= controllerSchema.rpcModuleName %>: {
6
6
  <% Object.entries(controllerSchema.handlers).forEach(([handlerName, handler]) => { %>
7
7
  <%= handlerName %>: (req: VovkRequest<<%- t.convertJSONSchemaToTypeScriptDef(handler.validation?.body) ?? 'null' %>, <%- t.convertJSONSchemaToTypeScriptDef(handler.validation?.query) ?? 'undefined' %>, <%- t.convertJSONSchemaToTypeScriptDef(handler.validation?.params ?? 'undefined') %>>) => <%- handler.validation?.output ? `Promise<${t.convertJSONSchemaToTypeScriptDef(handler.validation?.body)}>` : handler.validation?.iteration ? `Promise<VovkStreamAsyncIterable<${t.convertJSONSchemaToTypeScriptDef(handler.validation?.iteration)}>>` : 'Promise<KnownAny>' %>,
8
8
  <% }) %>
@@ -5,6 +5,10 @@ export function convertJSONSchemaToTypeScriptDef(schema) {
5
5
  const escapeStringLiteral = (str) => {
6
6
  return str.replace(/'/g, "\\'");
7
7
  };
8
+ // Helper function to escape JSDoc comment closing sequences
9
+ const escapeJSDocComment = (str) => {
10
+ return str.replace(/\*\//g, '*\\/');
11
+ };
8
12
  // Helper function to resolve $ref references
9
13
  const resolveRef = (ref) => {
10
14
  if (!ref.startsWith('#/'))
@@ -28,7 +32,8 @@ export function convertJSONSchemaToTypeScriptDef(schema) {
28
32
  if (!description) {
29
33
  return '';
30
34
  }
31
- return `${indentation}/**\n${indentation} * ${description}\n${indentation} */`;
35
+ const safeDescription = escapeJSDocComment(description);
36
+ return `${indentation}/**\n${indentation} * ${safeDescription}\n${indentation} */`;
32
37
  };
33
38
  // Helper function to convert schema to TypeScript type
34
39
  const schemaToType = (schema, indentation = ' ') => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.227",
3
+ "version": "0.0.1-draft.229",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },