vovk 3.0.0-draft.420 → 3.0.0-draft.421

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/cjs/VovkApp.js CHANGED
@@ -70,8 +70,6 @@ class VovkApp {
70
70
  methodKeys = allMethodKeys
71
71
  // First, try to match literal routes exactly.
72
72
  .filter((p) => {
73
- if (p.includes('{'))
74
- return false; // Skip parameterized paths
75
73
  return p === pathStr;
76
74
  });
77
75
  if (!methodKeys.length) {
@@ -85,7 +85,7 @@ function createVovkApp() {
85
85
  };
86
86
  const properties = Object.keys(controller._handlers[propertyKey]?.validation?.params?.properties ?? {});
87
87
  const kebab = toKebabCase(propertyKey); // 🥙
88
- const path = properties.length ? `${kebab}/${properties.map((prop) => `:${prop}`).join('/')}` : kebab;
88
+ const path = properties.length ? `${kebab}/${properties.map((prop) => `{${prop}}`).join('/')}` : kebab;
89
89
  assignSchema({ controller, propertyKey, path, options, httpMethod, vovkApp });
90
90
  }
91
91
  return decorator;
@@ -24,7 +24,8 @@ type CallerInput = {
24
24
  output?: KnownAny;
25
25
  iteration?: KnownAny;
26
26
  } | undefined;
27
- init?: RequestInit;
27
+ init: RequestInit | undefined;
28
+ apiRoot: string | undefined;
28
29
  meta: Record<string, KnownAny> | undefined;
29
30
  handlerName: string;
30
31
  moduleName: string;
@@ -35,6 +36,7 @@ declare function defaultResultFormatter(result: KnownAny, _schema: VovkHandlerSc
35
36
  export declare function createLLMTools({ modules, caller, meta, resultFormatter, onExecute, onError, }: {
36
37
  modules: Record<string, object | [object, {
37
38
  init?: RequestInit;
39
+ apiRoot?: string;
38
40
  }]>;
39
41
  caller?: typeof defaultCaller;
40
42
  meta?: Record<string, KnownAny>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createLLMTools = createLLMTools;
4
- const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, resultFormatter, onExecute, onError, }) => {
4
+ const createLLMTool = ({ moduleName, handlerName, caller, module, init, apiRoot, meta, resultFormatter, onExecute, onError, }) => {
5
5
  if (!module) {
6
6
  throw new Error(`Module "${moduleName}" not found.`);
7
7
  }
@@ -23,6 +23,7 @@ const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, re
23
23
  query,
24
24
  params,
25
25
  init,
26
+ apiRoot,
26
27
  meta,
27
28
  handlerName,
28
29
  moduleName,
@@ -131,9 +132,10 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
131
132
  const tools = Object.entries(moduleWithConfig ?? {})
132
133
  .map(([moduleName, moduleWithconfig]) => {
133
134
  let init;
135
+ let apiRoot;
134
136
  let module;
135
137
  if (Array.isArray(moduleWithconfig)) {
136
- [module, { init }] = moduleWithconfig;
138
+ [module, { init, apiRoot }] = moduleWithconfig;
137
139
  }
138
140
  else {
139
141
  module = moduleWithconfig;
@@ -146,6 +148,7 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
146
148
  caller,
147
149
  module,
148
150
  init,
151
+ apiRoot,
149
152
  meta,
150
153
  resultFormatter: resultFormatter
151
154
  ? resultFormatter === 'mcp'
package/mjs/VovkApp.js CHANGED
@@ -70,8 +70,6 @@ class VovkApp {
70
70
  methodKeys = allMethodKeys
71
71
  // First, try to match literal routes exactly.
72
72
  .filter((p) => {
73
- if (p.includes('{'))
74
- return false; // Skip parameterized paths
75
73
  return p === pathStr;
76
74
  });
77
75
  if (!methodKeys.length) {
@@ -85,7 +85,7 @@ function createVovkApp() {
85
85
  };
86
86
  const properties = Object.keys(controller._handlers[propertyKey]?.validation?.params?.properties ?? {});
87
87
  const kebab = toKebabCase(propertyKey); // 🥙
88
- const path = properties.length ? `${kebab}/${properties.map((prop) => `:${prop}`).join('/')}` : kebab;
88
+ const path = properties.length ? `${kebab}/${properties.map((prop) => `{${prop}}`).join('/')}` : kebab;
89
89
  assignSchema({ controller, propertyKey, path, options, httpMethod, vovkApp });
90
90
  }
91
91
  return decorator;
@@ -24,7 +24,8 @@ type CallerInput = {
24
24
  output?: KnownAny;
25
25
  iteration?: KnownAny;
26
26
  } | undefined;
27
- init?: RequestInit;
27
+ init: RequestInit | undefined;
28
+ apiRoot: string | undefined;
28
29
  meta: Record<string, KnownAny> | undefined;
29
30
  handlerName: string;
30
31
  moduleName: string;
@@ -35,6 +36,7 @@ declare function defaultResultFormatter(result: KnownAny, _schema: VovkHandlerSc
35
36
  export declare function createLLMTools({ modules, caller, meta, resultFormatter, onExecute, onError, }: {
36
37
  modules: Record<string, object | [object, {
37
38
  init?: RequestInit;
39
+ apiRoot?: string;
38
40
  }]>;
39
41
  caller?: typeof defaultCaller;
40
42
  meta?: Record<string, KnownAny>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createLLMTools = createLLMTools;
4
- const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, resultFormatter, onExecute, onError, }) => {
4
+ const createLLMTool = ({ moduleName, handlerName, caller, module, init, apiRoot, meta, resultFormatter, onExecute, onError, }) => {
5
5
  if (!module) {
6
6
  throw new Error(`Module "${moduleName}" not found.`);
7
7
  }
@@ -23,6 +23,7 @@ const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, re
23
23
  query,
24
24
  params,
25
25
  init,
26
+ apiRoot,
26
27
  meta,
27
28
  handlerName,
28
29
  moduleName,
@@ -131,9 +132,10 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
131
132
  const tools = Object.entries(moduleWithConfig ?? {})
132
133
  .map(([moduleName, moduleWithconfig]) => {
133
134
  let init;
135
+ let apiRoot;
134
136
  let module;
135
137
  if (Array.isArray(moduleWithconfig)) {
136
- [module, { init }] = moduleWithconfig;
138
+ [module, { init, apiRoot }] = moduleWithconfig;
137
139
  }
138
140
  else {
139
141
  module = moduleWithconfig;
@@ -146,6 +148,7 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
146
148
  caller,
147
149
  module,
148
150
  init,
151
+ apiRoot,
149
152
  meta,
150
153
  resultFormatter: resultFormatter
151
154
  ? resultFormatter === 'mcp'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.420",
3
+ "version": "3.0.0-draft.421",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",