vovk-cli 0.0.1-draft.232 → 0.0.1-draft.234

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.
@@ -3,9 +3,8 @@ import type { VovkRequest, VovkStreamAsyncIterable, KnownAny } from 'vovk';
3
3
  export type Controllers = {
4
4
  <% Object.values(t.schema.segments.extensions.controllers).forEach((controllerSchema) => { %>
5
5
  <%= controllerSchema.rpcModuleName %>: {
6
- <% Object.entries(controllerSchema.handlers).forEach(([handlerName, handler]) => {
7
- const hasInput = handler.validation?.body || handler.validation?.query || handler.validation?.params;
8
- <%= handlerName %>: (req<%= hasInput ? '' : '?' %>: 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>' %>,
6
+ <% Object.entries(controllerSchema.handlers).forEach(([handlerName, handler]) => { %>
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>' %>,
9
8
  <% }) %>
10
9
  };
11
10
  <% }) %>
@@ -204,7 +204,7 @@ export function convertJSONSchemaToTypeScriptDef(schema) {
204
204
  case 'array':
205
205
  return 'KnownAny[]'; // For arrays with no items defined
206
206
  default:
207
- return 'KnownAny';
207
+ return 'undefined';
208
208
  }
209
209
  };
210
210
  // Generate the interface
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.232",
3
+ "version": "0.0.1-draft.234",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },