vovk 3.0.0-draft.227 → 3.0.0-draft.228

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 @@ import type { VovkDefaultFetcherOptions, VovkClientFetcher } from './types.js';
2
2
  export declare const DEFAULT_ERROR_MESSAGE = "Unknown error at default fetcher";
3
3
  export declare function createFetcher<T>({ prepareRequestInit, transformResponse, }?: {
4
4
  prepareRequestInit?: (init: RequestInit, options: VovkDefaultFetcherOptions<T>) => RequestInit | Promise<RequestInit> | void | Promise<void>;
5
- transformResponse?: (resp: unknown, options: VovkDefaultFetcherOptions<T>, init: RequestInit) => unknown;
5
+ transformResponse?: (resp: unknown, response: Response, options: VovkDefaultFetcherOptions<T>, init: RequestInit) => unknown;
6
6
  }): VovkClientFetcher<VovkDefaultFetcherOptions<T>>;
7
7
  export declare const fetcher: VovkClientFetcher<{
8
8
  apiRoot?: string;
@@ -82,7 +82,8 @@ function createFetcher({ prepareRequestInit, transformResponse, } = {}) {
82
82
  }
83
83
  resp = await resp;
84
84
  return transformResponse
85
- ? ((await transformResponse(resp, options, requestInit)) ?? resp)
85
+ ? ((await transformResponse(resp, response, options, requestInit)) ??
86
+ resp)
86
87
  : resp;
87
88
  };
88
89
  return newFetcher;
package/cjs/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createVovkApp } from './createVovkApp';
2
- import { HttpStatus, HttpMethod, VovkSchemaIdEnum, type KnownAny, type VovkErrorResponse, type VovkRequest, type VovkBody, type VovkQuery, type VovkParams, type VovkReturnType, type VovkYieldType, type VovkOutput, type VovkIteration, type VovkSegmentSchema, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMFunction, type VovkTypedMethod } from './types';
2
+ import { HttpStatus, HttpMethod, VovkSchemaIdEnum, type KnownAny, type VovkErrorResponse, type VovkRequest, type VovkBody, type VovkQuery, type VovkParams, type VovkReturnType, type VovkYieldType, type VovkOutput, type VovkIteration, type VovkSegmentSchema, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMTool, type VovkTypedMethod } from './types';
3
3
  import { type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkValidateOnClient, type VovkStreamAsyncIterable, createRPC, fetcher, createFetcher } from './client/index';
4
4
  import { openapi, openAPIToVovkSchema, vovkSchemaToOpenAPI } from './openapi/index';
5
5
  import { HttpException } from './HttpException';
@@ -11,7 +11,7 @@ import { withStandard } from './utils/withStandard';
11
11
  import { multitenant } from './utils/multitenant';
12
12
  import { createLLMTools } from './utils/createLLMTools';
13
13
  import { createCodeExamples } from './utils/createCodeExamples';
14
- export { type KnownAny, type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkStreamAsyncIterable, type VovkValidateOnClient, type VovkSegmentSchema, type VovkErrorResponse, type VovkRequest, type VovkOutput, type VovkIteration, type VovkBody, type VovkQuery, type VovkParams, type VovkYieldType, type VovkReturnType, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMFunction, type VovkTypedMethod, VovkSchemaIdEnum, JSONLinesResponse, HttpException, HttpStatus, HttpMethod, createVovkApp, createDecorator, createRPC, fetcher, createFetcher, generateStaticAPI, withValidationLibrary, withStandard, multitenant, createLLMTools, createCodeExamples, openapi, openAPIToVovkSchema, vovkSchemaToOpenAPI, };
14
+ export { type KnownAny, type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkStreamAsyncIterable, type VovkValidateOnClient, type VovkSegmentSchema, type VovkErrorResponse, type VovkRequest, type VovkOutput, type VovkIteration, type VovkBody, type VovkQuery, type VovkParams, type VovkYieldType, type VovkReturnType, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMTool, type VovkTypedMethod, VovkSchemaIdEnum, JSONLinesResponse, HttpException, HttpStatus, HttpMethod, createVovkApp, createDecorator, createRPC, fetcher, createFetcher, generateStaticAPI, withValidationLibrary, withStandard, multitenant, createLLMTools, createCodeExamples, openapi, openAPIToVovkSchema, vovkSchemaToOpenAPI, };
15
15
  export declare const get: {
16
16
  (givenPath?: string | undefined, options?: import("./types").DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types").DecoratorOptions) => (givenTarget: KnownAny, propertyKey: string) => void>;
17
17
  auto: (options?: import("./types").DecoratorOptions) => (givenTarget: KnownAny, propertyKey: string) => void;
@@ -1,2 +1,2 @@
1
1
  import { type VovkSchema, VovkStrictConfig } from '../types';
2
- export declare function openAPIToVovkSchema({ apiRoot, source: { object: openAPIObject }, getModuleName, getMethodName, }: VovkStrictConfig['extendClientWithOpenAPI']['rootModules'][number]): VovkSchema;
2
+ export declare function openAPIToVovkSchema({ apiRoot, source: { object: openAPIObject }, getModuleName, getMethodName, }: VovkStrictConfig['extendClientWithOpenAPI']['extensionModules'][number]): VovkSchema;
package/cjs/types.d.ts CHANGED
@@ -210,7 +210,7 @@ export declare enum HttpStatus {
210
210
  GATEWAY_TIMEOUT = 504,
211
211
  HTTP_VERSION_NOT_SUPPORTED = 505
212
212
  }
213
- export interface VovkLLMFunction {
213
+ export interface VovkLLMTool {
214
214
  execute: (input: {
215
215
  body?: KnownAny;
216
216
  query?: KnownAny;
@@ -320,7 +320,7 @@ type VovkUserConfig = {
320
320
  libs?: Record<string, KnownAny>;
321
321
  segmentConfig?: false | SegmentConfig;
322
322
  extendClientWithOpenAPI?: {
323
- rootModules: {
323
+ extensionModules: {
324
324
  source: {
325
325
  file: string;
326
326
  } | {
@@ -337,7 +337,7 @@ type VovkUserConfig = {
337
337
  export type VovkConfig = VovkUserConfig;
338
338
  export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'libs' | 'imports' | 'composedClient' | 'segmentedClient' | 'bundle' | 'extendClientWithOpenAPI'>> & {
339
339
  emitConfig: (keyof VovkStrictConfig | string)[];
340
- bundle: RequireAllExcept<Exclude<VovkUserConfig['bundle'], undefined>, 'includeSegments' | 'excludeSegments'>;
340
+ bundle: RequireAllExcept<NonNullable<VovkUserConfig['bundle']>, 'includeSegments' | 'excludeSegments'>;
341
341
  imports: {
342
342
  fetcher: [string, string] | [string];
343
343
  validateOnClient: [string, string] | [string] | null;
@@ -347,15 +347,15 @@ export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'lib
347
347
  composedClient: RequireFields<ClientConfigFull, 'enabled' | 'fromTemplates' | 'outDir'>;
348
348
  segmentedClient: RequireFields<ClientConfigSegmented, 'enabled' | 'fromTemplates' | 'outDir'>;
349
349
  extendClientWithOpenAPI: {
350
- rootModules: {
351
- source: Exclude<Exclude<VovkConfig['extendClientWithOpenAPI'], undefined>['rootModules'][number]['source'], {
350
+ extensionModules: {
351
+ source: Exclude<NonNullable<VovkConfig['extendClientWithOpenAPI']>['extensionModules'][number]['source'], {
352
352
  file: string;
353
353
  } | {
354
354
  url: string;
355
355
  }>;
356
356
  apiRoot: string;
357
- getModuleName: Exclude<VovkConfig['extendClientWithOpenAPI'], undefined>['rootModules'][number]['getModuleName'];
358
- getMethodName: Exclude<VovkConfig['extendClientWithOpenAPI'], undefined>['rootModules'][number]['getMethodName'];
357
+ getModuleName: NonNullable<VovkConfig['extendClientWithOpenAPI']>['extensionModules'][number]['getModuleName'];
358
+ getMethodName: NonNullable<VovkConfig['extendClientWithOpenAPI']>['extensionModules'][number]['getMethodName'];
359
359
  }[];
360
360
  };
361
361
  };
@@ -1,4 +1,4 @@
1
- import type { KnownAny, VovkHandlerSchema, VovkLLMFunction } from '../types';
1
+ import type { KnownAny, VovkHandlerSchema, VovkLLMTool } from '../types';
2
2
  type Handler = ((...args: KnownAny[]) => KnownAny) & {
3
3
  fn?: (input: KnownAny) => KnownAny;
4
4
  isRPC?: boolean;
@@ -23,6 +23,6 @@ export declare function createLLMTools({ modules, caller, onExecute, onError, }:
23
23
  onExecute?: (result: KnownAny, callerInput: CallerInput, options: KnownAny) => void;
24
24
  onError?: (error: Error, callerInput: CallerInput, options: KnownAny) => void;
25
25
  }): {
26
- tools: VovkLLMFunction[];
26
+ tools: VovkLLMTool[];
27
27
  };
28
28
  export {};
@@ -2,7 +2,7 @@ import type { VovkDefaultFetcherOptions, VovkClientFetcher } from './types.js';
2
2
  export declare const DEFAULT_ERROR_MESSAGE = "Unknown error at default fetcher";
3
3
  export declare function createFetcher<T>({ prepareRequestInit, transformResponse, }?: {
4
4
  prepareRequestInit?: (init: RequestInit, options: VovkDefaultFetcherOptions<T>) => RequestInit | Promise<RequestInit> | void | Promise<void>;
5
- transformResponse?: (resp: unknown, options: VovkDefaultFetcherOptions<T>, init: RequestInit) => unknown;
5
+ transformResponse?: (resp: unknown, response: Response, options: VovkDefaultFetcherOptions<T>, init: RequestInit) => unknown;
6
6
  }): VovkClientFetcher<VovkDefaultFetcherOptions<T>>;
7
7
  export declare const fetcher: VovkClientFetcher<{
8
8
  apiRoot?: string;
@@ -82,7 +82,8 @@ function createFetcher({ prepareRequestInit, transformResponse, } = {}) {
82
82
  }
83
83
  resp = await resp;
84
84
  return transformResponse
85
- ? ((await transformResponse(resp, options, requestInit)) ?? resp)
85
+ ? ((await transformResponse(resp, response, options, requestInit)) ??
86
+ resp)
86
87
  : resp;
87
88
  };
88
89
  return newFetcher;
package/mjs/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createVovkApp } from './createVovkApp';
2
- import { HttpStatus, HttpMethod, VovkSchemaIdEnum, type KnownAny, type VovkErrorResponse, type VovkRequest, type VovkBody, type VovkQuery, type VovkParams, type VovkReturnType, type VovkYieldType, type VovkOutput, type VovkIteration, type VovkSegmentSchema, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMFunction, type VovkTypedMethod } from './types';
2
+ import { HttpStatus, HttpMethod, VovkSchemaIdEnum, type KnownAny, type VovkErrorResponse, type VovkRequest, type VovkBody, type VovkQuery, type VovkParams, type VovkReturnType, type VovkYieldType, type VovkOutput, type VovkIteration, type VovkSegmentSchema, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMTool, type VovkTypedMethod } from './types';
3
3
  import { type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkValidateOnClient, type VovkStreamAsyncIterable, createRPC, fetcher, createFetcher } from './client/index';
4
4
  import { openapi, openAPIToVovkSchema, vovkSchemaToOpenAPI } from './openapi/index';
5
5
  import { HttpException } from './HttpException';
@@ -11,7 +11,7 @@ import { withStandard } from './utils/withStandard';
11
11
  import { multitenant } from './utils/multitenant';
12
12
  import { createLLMTools } from './utils/createLLMTools';
13
13
  import { createCodeExamples } from './utils/createCodeExamples';
14
- export { type KnownAny, type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkStreamAsyncIterable, type VovkValidateOnClient, type VovkSegmentSchema, type VovkErrorResponse, type VovkRequest, type VovkOutput, type VovkIteration, type VovkBody, type VovkQuery, type VovkParams, type VovkYieldType, type VovkReturnType, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMFunction, type VovkTypedMethod, VovkSchemaIdEnum, JSONLinesResponse, HttpException, HttpStatus, HttpMethod, createVovkApp, createDecorator, createRPC, fetcher, createFetcher, generateStaticAPI, withValidationLibrary, withStandard, multitenant, createLLMTools, createCodeExamples, openapi, openAPIToVovkSchema, vovkSchemaToOpenAPI, };
14
+ export { type KnownAny, type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkStreamAsyncIterable, type VovkValidateOnClient, type VovkSegmentSchema, type VovkErrorResponse, type VovkRequest, type VovkOutput, type VovkIteration, type VovkBody, type VovkQuery, type VovkParams, type VovkYieldType, type VovkReturnType, type VovkControllerSchema, type VovkHandlerSchema, type VovkSchema, type VovkConfig, type VovkStrictConfig, type VovkValidationType, type VovkLLMTool, type VovkTypedMethod, VovkSchemaIdEnum, JSONLinesResponse, HttpException, HttpStatus, HttpMethod, createVovkApp, createDecorator, createRPC, fetcher, createFetcher, generateStaticAPI, withValidationLibrary, withStandard, multitenant, createLLMTools, createCodeExamples, openapi, openAPIToVovkSchema, vovkSchemaToOpenAPI, };
15
15
  export declare const get: {
16
16
  (givenPath?: string | undefined, options?: import("./types").DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types").DecoratorOptions) => (givenTarget: KnownAny, propertyKey: string) => void>;
17
17
  auto: (options?: import("./types").DecoratorOptions) => (givenTarget: KnownAny, propertyKey: string) => void;
@@ -1,2 +1,2 @@
1
1
  import { type VovkSchema, VovkStrictConfig } from '../types';
2
- export declare function openAPIToVovkSchema({ apiRoot, source: { object: openAPIObject }, getModuleName, getMethodName, }: VovkStrictConfig['extendClientWithOpenAPI']['rootModules'][number]): VovkSchema;
2
+ export declare function openAPIToVovkSchema({ apiRoot, source: { object: openAPIObject }, getModuleName, getMethodName, }: VovkStrictConfig['extendClientWithOpenAPI']['extensionModules'][number]): VovkSchema;
package/mjs/types.d.ts CHANGED
@@ -210,7 +210,7 @@ export declare enum HttpStatus {
210
210
  GATEWAY_TIMEOUT = 504,
211
211
  HTTP_VERSION_NOT_SUPPORTED = 505
212
212
  }
213
- export interface VovkLLMFunction {
213
+ export interface VovkLLMTool {
214
214
  execute: (input: {
215
215
  body?: KnownAny;
216
216
  query?: KnownAny;
@@ -320,7 +320,7 @@ type VovkUserConfig = {
320
320
  libs?: Record<string, KnownAny>;
321
321
  segmentConfig?: false | SegmentConfig;
322
322
  extendClientWithOpenAPI?: {
323
- rootModules: {
323
+ extensionModules: {
324
324
  source: {
325
325
  file: string;
326
326
  } | {
@@ -337,7 +337,7 @@ type VovkUserConfig = {
337
337
  export type VovkConfig = VovkUserConfig;
338
338
  export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'libs' | 'imports' | 'composedClient' | 'segmentedClient' | 'bundle' | 'extendClientWithOpenAPI'>> & {
339
339
  emitConfig: (keyof VovkStrictConfig | string)[];
340
- bundle: RequireAllExcept<Exclude<VovkUserConfig['bundle'], undefined>, 'includeSegments' | 'excludeSegments'>;
340
+ bundle: RequireAllExcept<NonNullable<VovkUserConfig['bundle']>, 'includeSegments' | 'excludeSegments'>;
341
341
  imports: {
342
342
  fetcher: [string, string] | [string];
343
343
  validateOnClient: [string, string] | [string] | null;
@@ -347,15 +347,15 @@ export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'lib
347
347
  composedClient: RequireFields<ClientConfigFull, 'enabled' | 'fromTemplates' | 'outDir'>;
348
348
  segmentedClient: RequireFields<ClientConfigSegmented, 'enabled' | 'fromTemplates' | 'outDir'>;
349
349
  extendClientWithOpenAPI: {
350
- rootModules: {
351
- source: Exclude<Exclude<VovkConfig['extendClientWithOpenAPI'], undefined>['rootModules'][number]['source'], {
350
+ extensionModules: {
351
+ source: Exclude<NonNullable<VovkConfig['extendClientWithOpenAPI']>['extensionModules'][number]['source'], {
352
352
  file: string;
353
353
  } | {
354
354
  url: string;
355
355
  }>;
356
356
  apiRoot: string;
357
- getModuleName: Exclude<VovkConfig['extendClientWithOpenAPI'], undefined>['rootModules'][number]['getModuleName'];
358
- getMethodName: Exclude<VovkConfig['extendClientWithOpenAPI'], undefined>['rootModules'][number]['getMethodName'];
357
+ getModuleName: NonNullable<VovkConfig['extendClientWithOpenAPI']>['extensionModules'][number]['getModuleName'];
358
+ getMethodName: NonNullable<VovkConfig['extendClientWithOpenAPI']>['extensionModules'][number]['getMethodName'];
359
359
  }[];
360
360
  };
361
361
  };
@@ -1,4 +1,4 @@
1
- import type { KnownAny, VovkHandlerSchema, VovkLLMFunction } from '../types';
1
+ import type { KnownAny, VovkHandlerSchema, VovkLLMTool } from '../types';
2
2
  type Handler = ((...args: KnownAny[]) => KnownAny) & {
3
3
  fn?: (input: KnownAny) => KnownAny;
4
4
  isRPC?: boolean;
@@ -23,6 +23,6 @@ export declare function createLLMTools({ modules, caller, onExecute, onError, }:
23
23
  onExecute?: (result: KnownAny, callerInput: CallerInput, options: KnownAny) => void;
24
24
  onError?: (error: Error, callerInput: CallerInput, options: KnownAny) => void;
25
25
  }): {
26
- tools: VovkLLMFunction[];
26
+ tools: VovkLLMTool[];
27
27
  };
28
28
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.227",
3
+ "version": "3.0.0-draft.228",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",