vovk 3.2.2 → 3.4.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/dist/HttpException.d.ts +7 -0
- package/dist/HttpException.js +15 -0
- package/dist/JSONLinesResponse.d.ts +14 -0
- package/dist/JSONLinesResponse.js +59 -0
- package/dist/VovkApp.d.ts +29 -0
- package/dist/VovkApp.js +189 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +7 -0
- package/dist/client/types.d.ts +102 -0
- package/dist/client/types.js +2 -0
- package/dist/createDecorator.d.ts +6 -0
- package/dist/createDecorator.js +43 -0
- package/dist/createVovkApp.d.ts +62 -0
- package/dist/createVovkApp.js +129 -0
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -0
- package/dist/tools/createTool.d.ts +32 -32
- package/dist/tools/createToolFactory.d.ts +33 -33
- package/dist/tools/deriveTools.d.ts +5 -5
- package/dist/tools/deriveTools.js +5 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/standard-tool.d.ts +17 -0
- package/dist/types/standard-tool.js +1 -0
- package/dist/types/tools.d.ts +20 -16
- package/dist/types.d.ts +239 -0
- package/dist/types.js +66 -0
- package/dist/utils/generateStaticAPI.d.ts +4 -0
- package/dist/utils/generateStaticAPI.js +30 -0
- package/dist/utils/getSchema.d.ts +20 -0
- package/dist/utils/getSchema.js +33 -0
- package/dist/utils/parseQuery.d.ts +25 -0
- package/dist/utils/parseQuery.js +156 -0
- package/dist/utils/reqForm.d.ts +2 -0
- package/dist/utils/reqForm.js +32 -0
- package/dist/utils/reqMeta.d.ts +2 -0
- package/dist/utils/reqMeta.js +13 -0
- package/dist/utils/reqQuery.d.ts +2 -0
- package/dist/utils/reqQuery.js +10 -0
- package/dist/utils/serializeQuery.d.ts +13 -0
- package/dist/utils/serializeQuery.js +65 -0
- package/dist/utils/setHandlerSchema.d.ts +4 -0
- package/dist/utils/setHandlerSchema.js +15 -0
- package/dist/utils/withValidation.d.ts +21 -0
- package/dist/utils/withValidation.js +88 -0
- package/dist/validation/createStandardValidation.d.ts +32 -32
- package/dist/validation/procedure.d.ts +32 -32
- package/dist/validation/validationSchemasObjectToSingleValidationSchema.d.ts +17 -0
- package/dist/validation/validationSchemasObjectToSingleValidationSchema.js +92 -0
- package/package.json +1 -1
- package/dist/core/compose.d.ts +0 -38
- package/dist/core/compose.js +0 -31
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = reqForm;
|
|
4
|
+
const formMap = new WeakMap();
|
|
5
|
+
async function reqForm(req) {
|
|
6
|
+
if (formMap.has(req)) {
|
|
7
|
+
return formMap.get(req);
|
|
8
|
+
}
|
|
9
|
+
const body = await req.formData();
|
|
10
|
+
const formData = {};
|
|
11
|
+
for (const [key, value] of body.entries()) {
|
|
12
|
+
if (value instanceof File) {
|
|
13
|
+
// If this key already exists, convert to array or append to existing array
|
|
14
|
+
if (formData[key]) {
|
|
15
|
+
if (Array.isArray(formData[key])) {
|
|
16
|
+
formData[key].push(value);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
formData[key] = [formData[key], value];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
formData[key] = value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
formData[key] = value.toString();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
formMap.set(req, formData);
|
|
31
|
+
return formData;
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = reqMeta;
|
|
4
|
+
const metaMap = new WeakMap();
|
|
5
|
+
function reqMeta(req, meta) {
|
|
6
|
+
if (meta) {
|
|
7
|
+
metaMap.set(req, { ...metaMap.get(req), ...meta });
|
|
8
|
+
}
|
|
9
|
+
else if (meta === null) {
|
|
10
|
+
metaMap.delete(req);
|
|
11
|
+
}
|
|
12
|
+
return (metaMap.get(req) ?? {});
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = reqQuery;
|
|
7
|
+
const parseQuery_1 = __importDefault(require("./parseQuery"));
|
|
8
|
+
function reqQuery(req) {
|
|
9
|
+
return (0, parseQuery_1.default)(req.nextUrl.search);
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { KnownAny } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Serialize a nested object (including arrays, arrays of objects, etc.)
|
|
4
|
+
* into a bracket-based query string.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* serializeQuery({ x: 'xx', y: [1, 2], z: { f: 'x' } })
|
|
8
|
+
* => "x=xx&y[0]=1&y[1]=2&z[f]=x"
|
|
9
|
+
*
|
|
10
|
+
* @param obj - The input object to be serialized
|
|
11
|
+
* @returns - A bracket-based query string (without leading "?")
|
|
12
|
+
*/
|
|
13
|
+
export default function serializeQuery(obj: Record<string, KnownAny>): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = serializeQuery;
|
|
4
|
+
/**
|
|
5
|
+
* Recursively build query parameters from an object.
|
|
6
|
+
*
|
|
7
|
+
* @param key - The query key so far (e.g. 'user', 'user[0]', 'user[0][name]')
|
|
8
|
+
* @param value - The current value to serialize
|
|
9
|
+
* @returns - An array of `key=value` strings
|
|
10
|
+
*/
|
|
11
|
+
function buildParams(key, value) {
|
|
12
|
+
if (value === null || value === undefined) {
|
|
13
|
+
return []; // skip null/undefined values entirely
|
|
14
|
+
}
|
|
15
|
+
// If value is an object or array, we need to recurse
|
|
16
|
+
if (typeof value === 'object') {
|
|
17
|
+
// Array case
|
|
18
|
+
if (Array.isArray(value)) {
|
|
19
|
+
/**
|
|
20
|
+
* We use index-based bracket notation here:
|
|
21
|
+
* e.g. for value = ['aa', 'bb'] and key = 'foo'
|
|
22
|
+
* => "foo[0]=aa&foo[1]=bb"
|
|
23
|
+
*
|
|
24
|
+
* If you prefer "foo[]=aa&foo[]=bb" style, replace:
|
|
25
|
+
* `${key}[${i}]`
|
|
26
|
+
* with:
|
|
27
|
+
* `${key}[]`
|
|
28
|
+
*/
|
|
29
|
+
return value.flatMap((v, i) => {
|
|
30
|
+
const newKey = `${key}[${i}]`;
|
|
31
|
+
return buildParams(newKey, v);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// Plain object case
|
|
35
|
+
return Object.keys(value).flatMap((k) => {
|
|
36
|
+
const newKey = `${key}[${k}]`;
|
|
37
|
+
return buildParams(newKey, value[k]);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return [`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Serialize a nested object (including arrays, arrays of objects, etc.)
|
|
44
|
+
* into a bracket-based query string.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* serializeQuery({ x: 'xx', y: [1, 2], z: { f: 'x' } })
|
|
48
|
+
* => "x=xx&y[0]=1&y[1]=2&z[f]=x"
|
|
49
|
+
*
|
|
50
|
+
* @param obj - The input object to be serialized
|
|
51
|
+
* @returns - A bracket-based query string (without leading "?")
|
|
52
|
+
*/
|
|
53
|
+
function serializeQuery(obj) {
|
|
54
|
+
if (!obj || typeof obj !== 'object')
|
|
55
|
+
return '';
|
|
56
|
+
// Collect query segments
|
|
57
|
+
const segments = [];
|
|
58
|
+
for (const key in obj) {
|
|
59
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
60
|
+
const value = obj[key];
|
|
61
|
+
segments.push(...buildParams(key, value));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return segments.join('&');
|
|
65
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KnownAny, VovkController, VovkHandlerSchema } from '../types';
|
|
2
|
+
export declare function setHandlerSchema(h: ((...args: KnownAny[]) => KnownAny) & {
|
|
3
|
+
_getSchema?: (controller: VovkController) => Omit<VovkHandlerSchema, 'httpMethod' | 'path'>;
|
|
4
|
+
}, schema: Omit<VovkHandlerSchema, 'httpMethod' | 'path'>): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setHandlerSchema = setHandlerSchema;
|
|
4
|
+
async function setHandlerSchema(h, schema) {
|
|
5
|
+
h._getSchema = (controller) => {
|
|
6
|
+
if (!controller) {
|
|
7
|
+
throw new Error('Error setting client validators. Controller not found. Did you forget to use an HTTP decorator?');
|
|
8
|
+
}
|
|
9
|
+
const handlerName = Object.getOwnPropertyNames(controller).find((key) => controller[key]._sourceMethod === h);
|
|
10
|
+
if (!handlerName) {
|
|
11
|
+
throw new Error('Error setting client validators. Handler not found.');
|
|
12
|
+
}
|
|
13
|
+
return schema;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VovkValidationType, type KnownAny, type VovkRequest } from '../types';
|
|
2
|
+
export declare function withValidation<T extends (req: KnownAny, params: KnownAny) => KnownAny, BODY_MODEL, QUERY_MODEL, PARAMS_MODEL, OUTPUT_MODEL, ITERATION_MODEL>({ disableServerSideValidation, skipSchemaEmission, validateEachIteration, body, query, params, output, iteration, handle, getJSONSchemaFromModel, validate, }: {
|
|
3
|
+
disableServerSideValidation?: boolean | VovkValidationType[];
|
|
4
|
+
skipSchemaEmission?: boolean | VovkValidationType[];
|
|
5
|
+
validateEachIteration?: boolean;
|
|
6
|
+
body?: BODY_MODEL;
|
|
7
|
+
query?: QUERY_MODEL;
|
|
8
|
+
params?: PARAMS_MODEL;
|
|
9
|
+
output?: OUTPUT_MODEL;
|
|
10
|
+
iteration?: ITERATION_MODEL;
|
|
11
|
+
handle: T;
|
|
12
|
+
getJSONSchemaFromModel?: (model: NonNullable<BODY_MODEL | QUERY_MODEL | PARAMS_MODEL | OUTPUT_MODEL | ITERATION_MODEL>, meta: {
|
|
13
|
+
type: VovkValidationType;
|
|
14
|
+
}) => KnownAny;
|
|
15
|
+
validate: (data: KnownAny, model: NonNullable<BODY_MODEL | QUERY_MODEL | PARAMS_MODEL | OUTPUT_MODEL | ITERATION_MODEL>, meta: {
|
|
16
|
+
type: VovkValidationType;
|
|
17
|
+
req: VovkRequest<KnownAny, KnownAny>;
|
|
18
|
+
status?: number;
|
|
19
|
+
i?: number;
|
|
20
|
+
}) => KnownAny;
|
|
21
|
+
}): T;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withValidation = withValidation;
|
|
4
|
+
const HttpException_1 = require("../HttpException");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const setHandlerSchema_1 = require("./setHandlerSchema");
|
|
7
|
+
const validationTypes = ['body', 'query', 'params', 'output', 'iteration'];
|
|
8
|
+
function withValidation({ disableServerSideValidation, skipSchemaEmission, validateEachIteration, body, query, params, output, iteration, handle, getJSONSchemaFromModel, validate, }) {
|
|
9
|
+
const disableServerSideValidationKeys = disableServerSideValidation === false
|
|
10
|
+
? []
|
|
11
|
+
: disableServerSideValidation === true
|
|
12
|
+
? validationTypes
|
|
13
|
+
: (disableServerSideValidation ?? []);
|
|
14
|
+
const skipSchemaEmissionKeys = skipSchemaEmission === false ? [] : skipSchemaEmission === true ? validationTypes : (skipSchemaEmission ?? []);
|
|
15
|
+
const outputHandler = async (req, handlerParams) => {
|
|
16
|
+
const data = await handle(req, handlerParams);
|
|
17
|
+
if (output && iteration) {
|
|
18
|
+
throw new HttpException_1.HttpException(types_1.HttpStatus.INTERNAL_SERVER_ERROR, "Output and iteration are mutually exclusive. You can't use them together.");
|
|
19
|
+
}
|
|
20
|
+
if (output && !disableServerSideValidationKeys.includes('output')) {
|
|
21
|
+
if (!data) {
|
|
22
|
+
throw new HttpException_1.HttpException(types_1.HttpStatus.INTERNAL_SERVER_ERROR, 'Output is required. You probably forgot to return something from your handler.');
|
|
23
|
+
}
|
|
24
|
+
await validate(data, output, { type: 'output', req });
|
|
25
|
+
}
|
|
26
|
+
if (iteration && !disableServerSideValidationKeys.includes('iteration')) {
|
|
27
|
+
// We assume `data` is an async iterable here; you might want to check that:
|
|
28
|
+
if (!data || typeof data[Symbol.asyncIterator] !== 'function') {
|
|
29
|
+
throw new HttpException_1.HttpException(types_1.HttpStatus.INTERNAL_SERVER_ERROR, 'Data is not an async iterable but iteration validation is defined.');
|
|
30
|
+
}
|
|
31
|
+
// Return a brand-new async generator that yields validated items
|
|
32
|
+
return (async function* () {
|
|
33
|
+
let i = 0;
|
|
34
|
+
for await (const item of data) {
|
|
35
|
+
if (validateEachIteration || i === 0) {
|
|
36
|
+
await validate(item, iteration, { type: 'iteration', req, status: 200, i });
|
|
37
|
+
}
|
|
38
|
+
i++;
|
|
39
|
+
yield item;
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
}
|
|
43
|
+
else if (validateEachIteration) {
|
|
44
|
+
throw new HttpException_1.HttpException(types_1.HttpStatus.INTERNAL_SERVER_ERROR, 'validateEachIteration is set but iteration is not defined.');
|
|
45
|
+
}
|
|
46
|
+
return data;
|
|
47
|
+
};
|
|
48
|
+
const resultHandler = async (req, handlerParams) => {
|
|
49
|
+
if (body && !disableServerSideValidationKeys.includes('body')) {
|
|
50
|
+
const data = await req.json();
|
|
51
|
+
const instance = (await validate(data, body, { type: 'body', req })) ?? data;
|
|
52
|
+
// redeclare to add ability to call req.json() again
|
|
53
|
+
req.json = () => Promise.resolve(data);
|
|
54
|
+
req.vovk.body = () => Promise.resolve(instance);
|
|
55
|
+
}
|
|
56
|
+
if (query && !disableServerSideValidationKeys.includes('query')) {
|
|
57
|
+
const data = req.vovk.query();
|
|
58
|
+
const instance = (await validate(data, query, { type: 'query', req })) ?? data;
|
|
59
|
+
req.vovk.query = () => instance;
|
|
60
|
+
}
|
|
61
|
+
if (params && !disableServerSideValidationKeys.includes('params')) {
|
|
62
|
+
const data = req.vovk.params();
|
|
63
|
+
const instance = (await validate(data, params, { type: 'params', req })) ?? data;
|
|
64
|
+
req.vovk.params = () => instance;
|
|
65
|
+
}
|
|
66
|
+
return outputHandler(req, handlerParams);
|
|
67
|
+
};
|
|
68
|
+
if (getJSONSchemaFromModel) {
|
|
69
|
+
const validation = {};
|
|
70
|
+
if (body && !skipSchemaEmissionKeys.includes('body')) {
|
|
71
|
+
validation.body = getJSONSchemaFromModel(body, { type: 'body' });
|
|
72
|
+
}
|
|
73
|
+
if (query && !skipSchemaEmissionKeys.includes('query')) {
|
|
74
|
+
validation.query = getJSONSchemaFromModel(query, { type: 'query' });
|
|
75
|
+
}
|
|
76
|
+
if (params && !skipSchemaEmissionKeys.includes('params')) {
|
|
77
|
+
validation.params = getJSONSchemaFromModel(params, { type: 'params' });
|
|
78
|
+
}
|
|
79
|
+
if (output && !skipSchemaEmissionKeys.includes('output')) {
|
|
80
|
+
validation.output = getJSONSchemaFromModel(output, { type: 'output' });
|
|
81
|
+
}
|
|
82
|
+
if (iteration && !skipSchemaEmissionKeys.includes('iteration')) {
|
|
83
|
+
validation.iteration = getJSONSchemaFromModel(iteration, { type: 'iteration' });
|
|
84
|
+
}
|
|
85
|
+
(0, setHandlerSchema_1.setHandlerSchema)(resultHandler, { validation });
|
|
86
|
+
}
|
|
87
|
+
return resultHandler;
|
|
88
|
+
}
|
|
@@ -147,122 +147,122 @@ export declare function createStandardValidation({ toJSONSchema, }: {
|
|
|
147
147
|
name: string;
|
|
148
148
|
title?: string;
|
|
149
149
|
description: string;
|
|
150
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
151
|
-
onError?: ((error: Error, tool: import("../
|
|
150
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<TInput, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
151
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<TInput, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
152
152
|
target?: CombinedSpec.Target;
|
|
153
153
|
} & {
|
|
154
154
|
inputSchema: CombinedSpec<TInput, TInput>;
|
|
155
155
|
} & {
|
|
156
156
|
outputSchema: CombinedSpec<TOutput, TOutput>;
|
|
157
157
|
} & {
|
|
158
|
-
execute: (input: TInput, processingMeta?:
|
|
158
|
+
execute: (input: TInput, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
159
159
|
toModelOutput: TToModelOutput;
|
|
160
|
-
}): import("../
|
|
160
|
+
}): import("../index.js").VovkTool<TInput, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>;
|
|
161
161
|
<TInput, TOutput>(options: {
|
|
162
162
|
name: string;
|
|
163
163
|
title?: string;
|
|
164
164
|
description: string;
|
|
165
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
166
|
-
onError?: ((error: Error, tool: import("../
|
|
165
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<TInput, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
166
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<TInput, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
167
167
|
target?: CombinedSpec.Target;
|
|
168
168
|
} & {
|
|
169
169
|
inputSchema: CombinedSpec<TInput, TInput>;
|
|
170
170
|
} & {
|
|
171
171
|
outputSchema: CombinedSpec<TOutput, TOutput>;
|
|
172
172
|
} & {
|
|
173
|
-
execute: (input: TInput, processingMeta?:
|
|
173
|
+
execute: (input: TInput, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
174
174
|
toModelOutput?: undefined;
|
|
175
|
-
}): import("../
|
|
175
|
+
}): import("../index.js").VovkTool<TInput, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>;
|
|
176
176
|
<TInput, TOutput, TToModelOutput extends (...args: KnownAny[]) => KnownAny>(options: {
|
|
177
177
|
name: string;
|
|
178
178
|
title?: string;
|
|
179
179
|
description: string;
|
|
180
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
181
|
-
onError?: ((error: Error, tool: import("../
|
|
180
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<TInput, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
181
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<TInput, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
182
182
|
target?: CombinedSpec.Target;
|
|
183
183
|
} & {
|
|
184
184
|
inputSchema: CombinedSpec<TInput, TInput>;
|
|
185
185
|
} & {
|
|
186
186
|
outputSchema?: undefined;
|
|
187
187
|
} & {
|
|
188
|
-
execute: (input: TInput, processingMeta?:
|
|
188
|
+
execute: (input: TInput, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
189
189
|
toModelOutput: TToModelOutput;
|
|
190
|
-
}): import("../
|
|
190
|
+
}): import("../index.js").VovkTool<TInput, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>;
|
|
191
191
|
<TInput, TOutput>(options: {
|
|
192
192
|
name: string;
|
|
193
193
|
title?: string;
|
|
194
194
|
description: string;
|
|
195
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
196
|
-
onError?: ((error: Error, tool: import("../
|
|
195
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<TInput, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
196
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<TInput, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
197
197
|
target?: CombinedSpec.Target;
|
|
198
198
|
} & {
|
|
199
199
|
inputSchema: CombinedSpec<TInput, TInput>;
|
|
200
200
|
} & {
|
|
201
201
|
outputSchema?: undefined;
|
|
202
202
|
} & {
|
|
203
|
-
execute: (input: TInput, processingMeta?:
|
|
203
|
+
execute: (input: TInput, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
204
204
|
toModelOutput?: undefined;
|
|
205
|
-
}): import("../
|
|
205
|
+
}): import("../index.js").VovkTool<TInput, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>;
|
|
206
206
|
<TOutput, TToModelOutput extends (...args: KnownAny[]) => KnownAny>(options: {
|
|
207
207
|
name: string;
|
|
208
208
|
title?: string;
|
|
209
209
|
description: string;
|
|
210
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
211
|
-
onError?: ((error: Error, tool: import("../
|
|
210
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<null, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
211
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<null, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
212
212
|
target?: CombinedSpec.Target;
|
|
213
213
|
} & {
|
|
214
214
|
inputSchema?: undefined;
|
|
215
215
|
} & {
|
|
216
216
|
outputSchema: CombinedSpec<TOutput, TOutput>;
|
|
217
217
|
} & {
|
|
218
|
-
execute: (input: null, processingMeta?:
|
|
218
|
+
execute: (input: null, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
219
219
|
toModelOutput: TToModelOutput;
|
|
220
|
-
}): import("../
|
|
220
|
+
}): import("../index.js").VovkTool<null, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>;
|
|
221
221
|
<TOutput>(options: {
|
|
222
222
|
name: string;
|
|
223
223
|
title?: string;
|
|
224
224
|
description: string;
|
|
225
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
226
|
-
onError?: ((error: Error, tool: import("../
|
|
225
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<null, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
226
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<null, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
227
227
|
target?: CombinedSpec.Target;
|
|
228
228
|
} & {
|
|
229
229
|
inputSchema?: undefined;
|
|
230
230
|
} & {
|
|
231
231
|
outputSchema: CombinedSpec<TOutput, TOutput>;
|
|
232
232
|
} & {
|
|
233
|
-
execute: (input: null, processingMeta?:
|
|
233
|
+
execute: (input: null, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
234
234
|
toModelOutput?: undefined;
|
|
235
|
-
}): import("../
|
|
235
|
+
}): import("../index.js").VovkTool<null, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>;
|
|
236
236
|
<TOutput, TToModelOutput extends (...args: KnownAny[]) => KnownAny>(options: {
|
|
237
237
|
name: string;
|
|
238
238
|
title?: string;
|
|
239
239
|
description: string;
|
|
240
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
241
|
-
onError?: ((error: Error, tool: import("../
|
|
240
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<null, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
241
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<null, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>) => void) | undefined;
|
|
242
242
|
target?: CombinedSpec.Target;
|
|
243
243
|
} & {
|
|
244
244
|
inputSchema?: undefined;
|
|
245
245
|
} & {
|
|
246
246
|
outputSchema?: undefined;
|
|
247
247
|
} & {
|
|
248
|
-
execute: (input: null, processingMeta?:
|
|
248
|
+
execute: (input: null, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
249
249
|
toModelOutput: TToModelOutput;
|
|
250
|
-
}): import("../
|
|
250
|
+
}): import("../index.js").VovkTool<null, TOutput, TToModelOutput extends import("../tools/toModelOutputDefault.js").ToModelOutputDefaultFn ? import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput> : TToModelOutput extends (...args: KnownAny[]) => infer R ? R extends Promise<infer U> ? U : R : unknown>;
|
|
251
251
|
<TOutput>(options: {
|
|
252
252
|
name: string;
|
|
253
253
|
title?: string;
|
|
254
254
|
description: string;
|
|
255
|
-
onExecute?: ((result: unknown, tool: import("../
|
|
256
|
-
onError?: ((error: Error, tool: import("../
|
|
255
|
+
onExecute?: ((result: unknown, tool: import("../index.js").VovkTool<null, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
256
|
+
onError?: ((error: Error, tool: import("../index.js").VovkTool<null, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>) => void) | undefined;
|
|
257
257
|
target?: CombinedSpec.Target;
|
|
258
258
|
} & {
|
|
259
259
|
inputSchema?: undefined;
|
|
260
260
|
} & {
|
|
261
261
|
outputSchema?: undefined;
|
|
262
262
|
} & {
|
|
263
|
-
execute: (input: null, processingMeta?:
|
|
263
|
+
execute: (input: null, processingMeta?: KnownAny) => TOutput | Promise<TOutput>;
|
|
264
264
|
toModelOutput?: undefined;
|
|
265
|
-
}): import("../
|
|
265
|
+
}): import("../index.js").VovkTool<null, TOutput, import("../tools/toModelOutputDefault.js").DefaultModelOutput<TOutput>>;
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
268
|
export {};
|