vovk 3.0.0-draft.469 → 3.0.0-draft.471

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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  </picture>
8
8
  </a>
9
9
  <br>
10
- <strong>Back-end for <a href="https://nextjs.org/">Next.js</a></strong>
10
+ <strong>Back-end for Next.js</strong>
11
11
  </p>
12
12
 
13
13
  ---
@@ -19,4 +19,3 @@ The main library with [100% self-composition](https://bundlephobia.com/result?p=
19
19
  ```sh
20
20
  npm install vovk
21
21
  ```
22
-
package/cjs/VovkApp.js CHANGED
@@ -226,7 +226,7 @@ class VovkApp {
226
226
  return this.#respondWithError({
227
227
  req,
228
228
  statusCode: types_1.HttpStatus.NOT_FOUND,
229
- message: `${Object.keys(handlers)} - Route ${path.join('/')} is not found`,
229
+ message: `Route ${path.join('/')} is not found`,
230
230
  });
231
231
  }
232
232
  const { staticMethod, controller } = handler;
@@ -50,7 +50,6 @@ function vovkSchemaToOpenAPI({ config, rootEntry = 'api', schema: fullSchema, ou
50
50
  const components = {};
51
51
  const { openAPIObject, samples: samplesConfig, package: packageJson, readme: readmeConfig, origin, imports, reExports, } = (0, resolveGeneratorConfigValues_1.resolveGeneratorConfigValues)({
52
52
  config,
53
- schema: fullSchema,
54
53
  outputConfigs,
55
54
  isBundle,
56
55
  segmentName: givenSegmentName ?? null,
package/cjs/types.d.ts CHANGED
@@ -328,18 +328,19 @@ export type VovkSamplesConfig = {
328
328
  apiRoot?: string;
329
329
  headers?: Record<string, string>;
330
330
  };
331
- type ClientConfigCommon = {
332
- enabled?: boolean;
333
- outDir?: string;
334
- fromTemplates?: string[];
335
- prettifyClient?: boolean;
336
- } & ({
331
+ type IncludeExcludeSegments = {
337
332
  excludeSegments?: never;
338
333
  includeSegments?: string[];
339
334
  } | {
340
335
  excludeSegments?: string[];
341
336
  includeSegments?: never;
342
- });
337
+ };
338
+ type ClientConfigCommon = {
339
+ enabled?: boolean;
340
+ outDir?: string;
341
+ fromTemplates?: string[];
342
+ prettifyClient?: boolean;
343
+ } & IncludeExcludeSegments;
343
344
  type ClientConfigComposed = ClientConfigCommon;
344
345
  type ClientConfigSegmented = ClientConfigCommon;
345
346
  type BundleConfig = {
@@ -353,13 +354,7 @@ type BundleConfig = {
353
354
  entry: string;
354
355
  }) => Promise<void>;
355
356
  outputConfig?: VovkOutputConfig<GeneratorConfigImports>;
356
- } & ({
357
- excludeSegments?: never;
358
- includeSegments?: string[];
359
- } | {
360
- excludeSegments?: string[];
361
- includeSegments?: never;
362
- });
357
+ } & IncludeExcludeSegments;
363
358
  type GeneratorConfigImports = {
364
359
  fetcher?: string | [string, string] | [string];
365
360
  validateOnClient?: string | [string, string] | [string] | null;
@@ -423,13 +418,13 @@ export interface VovkSegmentConfig extends VovkOutputConfig<SegmentConfigImports
423
418
  }
424
419
  type VovkUserConfig = {
425
420
  $schema?: typeof VovkSchemaIdEnum.CONFIG | (string & {});
426
- emitConfig?: boolean | (keyof VovkStrictConfig | (string & {}))[];
421
+ exposeConfigKeys?: boolean | (keyof VovkStrictConfig | (string & {}))[];
427
422
  schemaOutDir?: string;
428
423
  modulesDir?: string;
429
424
  rootEntry?: string;
430
425
  logLevel?: 'error' | 'trace' | 'debug' | 'info' | 'warn' | (string & {});
431
426
  libs?: {
432
- ajv: KnownAny;
427
+ ajv?: KnownAny;
433
428
  [key: string]: KnownAny;
434
429
  };
435
430
  devHttps?: boolean;
@@ -448,9 +443,9 @@ type VovkUserConfig = {
448
443
  };
449
444
  };
450
445
  export type VovkConfig = VovkUserConfig;
451
- export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'libs' | 'composedClient' | 'segmentedClient' | 'bundle'>> & {
452
- emitConfig: (keyof VovkStrictConfig | string)[];
453
- bundle: RequireAllExcept<NonNullable<VovkUserConfig['bundle']>, 'includeSegments' | 'excludeSegments'>;
446
+ export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'exposeConfigKeys' | 'libs' | 'composedClient' | 'segmentedClient' | 'bundle'>> & {
447
+ exposeConfigKeys: (keyof VovkStrictConfig | string)[];
448
+ bundle: Required<Omit<NonNullable<VovkUserConfig['bundle']>, 'includeSegments' | 'excludeSegments'>> & IncludeExcludeSegments;
454
449
  libs: Record<string, KnownAny>;
455
450
  composedClient: RequireFields<ClientConfigComposed, 'enabled' | 'fromTemplates' | 'outDir' | 'prettifyClient'>;
456
451
  segmentedClient: RequireFields<ClientConfigSegmented, 'enabled' | 'fromTemplates' | 'outDir' | 'prettifyClient'>;
@@ -461,7 +456,6 @@ export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'lib
461
456
  };
462
457
  };
463
458
  export type RequireFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
464
- export type RequireAllExcept<T, K extends keyof T> = Required<Omit<T, K>> & Pick<T, K>;
465
459
  export type IsEmptyObject<T> = T extends object ? keyof T extends never ? true : T extends Partial<T> ? Partial<T> extends T ? true : false : false : false;
466
460
  export type Prettify<T> = {
467
461
  [K in keyof T]: T[K];
@@ -23,7 +23,7 @@ function createStandardValidation({ toJSONSchema, }) {
23
23
  if (result.issues?.length) {
24
24
  throw new HttpException_1.HttpException(types_1.HttpStatus.BAD_REQUEST, `Validation failed. Invalid ${type === 'iteration' ? `${type} #${i}` : type} on server: ${result.issues
25
25
  .map(({ message, path }) => `${message}${path ? ` at ${path.join('.')}` : ''}`)
26
- .join(', ')}`, { [type]: data, result });
26
+ .join(', ')}`, { issues: result.issues });
27
27
  }
28
28
  return result.value;
29
29
  },
@@ -1,9 +1,8 @@
1
1
  import type { PackageJson } from 'type-fest';
2
- import type { VovkOutputConfig, VovkPackageJson, VovkReadmeConfig, VovkSamplesConfig, VovkSchema, VovkStrictConfig } from '../types';
2
+ import type { VovkConfig, VovkOutputConfig, VovkPackageJson, VovkReadmeConfig, VovkSamplesConfig } from '../types';
3
3
  import type { OpenAPIObject } from 'openapi3-ts/oas31';
4
- export declare function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentName, isBundle, projectPackageJson, }: {
5
- config: VovkStrictConfig | undefined;
6
- schema: VovkSchema;
4
+ export declare function resolveGeneratorConfigValues({ config, outputConfigs, segmentName, isBundle, projectPackageJson, }: {
5
+ config: VovkConfig | undefined;
7
6
  outputConfigs: VovkOutputConfig[];
8
7
  segmentName: string | null;
9
8
  isBundle: boolean;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resolveGeneratorConfigValues = resolveGeneratorConfigValues;
7
7
  const deepExtend_1 = __importDefault(require("./deepExtend"));
8
- function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentName, isBundle, projectPackageJson, }) {
8
+ function resolveGeneratorConfigValues({ config, outputConfigs, segmentName, isBundle, projectPackageJson, }) {
9
9
  const packageJson = (0, deepExtend_1.default)({}, {
10
10
  main: './index.cjs',
11
11
  module: './index.mjs',
@@ -17,7 +17,7 @@ function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentNa
17
17
  types: './index.d.mts',
18
18
  },
19
19
  },
20
- }, Object.fromEntries(Object.entries(projectPackageJson ?? {}).filter(([key]) => ['name', 'version', 'description', 'license', 'authors', 'repository', 'homepage', 'bugs', 'keywords'].includes(key))), config?.outputConfig?.package, isBundle ? config?.bundle?.outputConfig?.package : undefined, typeof segmentName === 'string' ? schema.segments?.[segmentName]?.meta?.package : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.package : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.package), {}));
20
+ }, Object.fromEntries(Object.entries(projectPackageJson ?? {}).filter(([key]) => ['name', 'version', 'description', 'license', 'authors', 'repository', 'homepage', 'bugs', 'keywords'].includes(key))), config?.outputConfig?.package, isBundle ? config?.bundle?.outputConfig?.package : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.package : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.package), {}));
21
21
  return {
22
22
  package: packageJson,
23
23
  openAPIObject: (0, deepExtend_1.default)({}, {
@@ -27,7 +27,7 @@ function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentNa
27
27
  version: packageJson.version,
28
28
  description: packageJson.description,
29
29
  },
30
- }, config?.outputConfig?.openAPIObject, isBundle ? config?.bundle?.outputConfig?.openAPIObject : undefined, typeof segmentName === 'string' ? schema?.segments?.[segmentName]?.meta?.openAPIObject : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.openAPIObject : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.openAPIObject), {})),
30
+ }, config?.outputConfig?.openAPIObject, isBundle ? config?.bundle?.outputConfig?.openAPIObject : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.openAPIObject : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.openAPIObject), {})),
31
31
  samples: (0, deepExtend_1.default)({}, config?.outputConfig?.samples, isBundle ? config?.bundle?.outputConfig?.samples : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.samples : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.samples), {})),
32
32
  readme: (0, deepExtend_1.default)({}, config?.outputConfig?.readme, isBundle ? config?.bundle?.outputConfig?.readme : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.readme : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.readme), {})),
33
33
  origin: [
package/mjs/VovkApp.js CHANGED
@@ -226,7 +226,7 @@ class VovkApp {
226
226
  return this.#respondWithError({
227
227
  req,
228
228
  statusCode: types_1.HttpStatus.NOT_FOUND,
229
- message: `${Object.keys(handlers)} - Route ${path.join('/')} is not found`,
229
+ message: `Route ${path.join('/')} is not found`,
230
230
  });
231
231
  }
232
232
  const { staticMethod, controller } = handler;
@@ -50,7 +50,6 @@ function vovkSchemaToOpenAPI({ config, rootEntry = 'api', schema: fullSchema, ou
50
50
  const components = {};
51
51
  const { openAPIObject, samples: samplesConfig, package: packageJson, readme: readmeConfig, origin, imports, reExports, } = (0, resolveGeneratorConfigValues_1.resolveGeneratorConfigValues)({
52
52
  config,
53
- schema: fullSchema,
54
53
  outputConfigs,
55
54
  isBundle,
56
55
  segmentName: givenSegmentName ?? null,
package/mjs/types.d.ts CHANGED
@@ -328,18 +328,19 @@ export type VovkSamplesConfig = {
328
328
  apiRoot?: string;
329
329
  headers?: Record<string, string>;
330
330
  };
331
- type ClientConfigCommon = {
332
- enabled?: boolean;
333
- outDir?: string;
334
- fromTemplates?: string[];
335
- prettifyClient?: boolean;
336
- } & ({
331
+ type IncludeExcludeSegments = {
337
332
  excludeSegments?: never;
338
333
  includeSegments?: string[];
339
334
  } | {
340
335
  excludeSegments?: string[];
341
336
  includeSegments?: never;
342
- });
337
+ };
338
+ type ClientConfigCommon = {
339
+ enabled?: boolean;
340
+ outDir?: string;
341
+ fromTemplates?: string[];
342
+ prettifyClient?: boolean;
343
+ } & IncludeExcludeSegments;
343
344
  type ClientConfigComposed = ClientConfigCommon;
344
345
  type ClientConfigSegmented = ClientConfigCommon;
345
346
  type BundleConfig = {
@@ -353,13 +354,7 @@ type BundleConfig = {
353
354
  entry: string;
354
355
  }) => Promise<void>;
355
356
  outputConfig?: VovkOutputConfig<GeneratorConfigImports>;
356
- } & ({
357
- excludeSegments?: never;
358
- includeSegments?: string[];
359
- } | {
360
- excludeSegments?: string[];
361
- includeSegments?: never;
362
- });
357
+ } & IncludeExcludeSegments;
363
358
  type GeneratorConfigImports = {
364
359
  fetcher?: string | [string, string] | [string];
365
360
  validateOnClient?: string | [string, string] | [string] | null;
@@ -423,13 +418,13 @@ export interface VovkSegmentConfig extends VovkOutputConfig<SegmentConfigImports
423
418
  }
424
419
  type VovkUserConfig = {
425
420
  $schema?: typeof VovkSchemaIdEnum.CONFIG | (string & {});
426
- emitConfig?: boolean | (keyof VovkStrictConfig | (string & {}))[];
421
+ exposeConfigKeys?: boolean | (keyof VovkStrictConfig | (string & {}))[];
427
422
  schemaOutDir?: string;
428
423
  modulesDir?: string;
429
424
  rootEntry?: string;
430
425
  logLevel?: 'error' | 'trace' | 'debug' | 'info' | 'warn' | (string & {});
431
426
  libs?: {
432
- ajv: KnownAny;
427
+ ajv?: KnownAny;
433
428
  [key: string]: KnownAny;
434
429
  };
435
430
  devHttps?: boolean;
@@ -448,9 +443,9 @@ type VovkUserConfig = {
448
443
  };
449
444
  };
450
445
  export type VovkConfig = VovkUserConfig;
451
- export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'libs' | 'composedClient' | 'segmentedClient' | 'bundle'>> & {
452
- emitConfig: (keyof VovkStrictConfig | string)[];
453
- bundle: RequireAllExcept<NonNullable<VovkUserConfig['bundle']>, 'includeSegments' | 'excludeSegments'>;
446
+ export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'exposeConfigKeys' | 'libs' | 'composedClient' | 'segmentedClient' | 'bundle'>> & {
447
+ exposeConfigKeys: (keyof VovkStrictConfig | string)[];
448
+ bundle: Required<Omit<NonNullable<VovkUserConfig['bundle']>, 'includeSegments' | 'excludeSegments'>> & IncludeExcludeSegments;
454
449
  libs: Record<string, KnownAny>;
455
450
  composedClient: RequireFields<ClientConfigComposed, 'enabled' | 'fromTemplates' | 'outDir' | 'prettifyClient'>;
456
451
  segmentedClient: RequireFields<ClientConfigSegmented, 'enabled' | 'fromTemplates' | 'outDir' | 'prettifyClient'>;
@@ -461,7 +456,6 @@ export type VovkStrictConfig = Required<Omit<VovkUserConfig, 'emitConfig' | 'lib
461
456
  };
462
457
  };
463
458
  export type RequireFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
464
- export type RequireAllExcept<T, K extends keyof T> = Required<Omit<T, K>> & Pick<T, K>;
465
459
  export type IsEmptyObject<T> = T extends object ? keyof T extends never ? true : T extends Partial<T> ? Partial<T> extends T ? true : false : false : false;
466
460
  export type Prettify<T> = {
467
461
  [K in keyof T]: T[K];
@@ -23,7 +23,7 @@ function createStandardValidation({ toJSONSchema, }) {
23
23
  if (result.issues?.length) {
24
24
  throw new HttpException_1.HttpException(types_1.HttpStatus.BAD_REQUEST, `Validation failed. Invalid ${type === 'iteration' ? `${type} #${i}` : type} on server: ${result.issues
25
25
  .map(({ message, path }) => `${message}${path ? ` at ${path.join('.')}` : ''}`)
26
- .join(', ')}`, { [type]: data, result });
26
+ .join(', ')}`, { issues: result.issues });
27
27
  }
28
28
  return result.value;
29
29
  },
@@ -1,9 +1,8 @@
1
1
  import type { PackageJson } from 'type-fest';
2
- import type { VovkOutputConfig, VovkPackageJson, VovkReadmeConfig, VovkSamplesConfig, VovkSchema, VovkStrictConfig } from '../types';
2
+ import type { VovkConfig, VovkOutputConfig, VovkPackageJson, VovkReadmeConfig, VovkSamplesConfig } from '../types';
3
3
  import type { OpenAPIObject } from 'openapi3-ts/oas31';
4
- export declare function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentName, isBundle, projectPackageJson, }: {
5
- config: VovkStrictConfig | undefined;
6
- schema: VovkSchema;
4
+ export declare function resolveGeneratorConfigValues({ config, outputConfigs, segmentName, isBundle, projectPackageJson, }: {
5
+ config: VovkConfig | undefined;
7
6
  outputConfigs: VovkOutputConfig[];
8
7
  segmentName: string | null;
9
8
  isBundle: boolean;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resolveGeneratorConfigValues = resolveGeneratorConfigValues;
7
7
  const deepExtend_1 = __importDefault(require("./deepExtend"));
8
- function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentName, isBundle, projectPackageJson, }) {
8
+ function resolveGeneratorConfigValues({ config, outputConfigs, segmentName, isBundle, projectPackageJson, }) {
9
9
  const packageJson = (0, deepExtend_1.default)({}, {
10
10
  main: './index.cjs',
11
11
  module: './index.mjs',
@@ -17,7 +17,7 @@ function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentNa
17
17
  types: './index.d.mts',
18
18
  },
19
19
  },
20
- }, Object.fromEntries(Object.entries(projectPackageJson ?? {}).filter(([key]) => ['name', 'version', 'description', 'license', 'authors', 'repository', 'homepage', 'bugs', 'keywords'].includes(key))), config?.outputConfig?.package, isBundle ? config?.bundle?.outputConfig?.package : undefined, typeof segmentName === 'string' ? schema.segments?.[segmentName]?.meta?.package : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.package : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.package), {}));
20
+ }, Object.fromEntries(Object.entries(projectPackageJson ?? {}).filter(([key]) => ['name', 'version', 'description', 'license', 'authors', 'repository', 'homepage', 'bugs', 'keywords'].includes(key))), config?.outputConfig?.package, isBundle ? config?.bundle?.outputConfig?.package : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.package : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.package), {}));
21
21
  return {
22
22
  package: packageJson,
23
23
  openAPIObject: (0, deepExtend_1.default)({}, {
@@ -27,7 +27,7 @@ function resolveGeneratorConfigValues({ config, schema, outputConfigs, segmentNa
27
27
  version: packageJson.version,
28
28
  description: packageJson.description,
29
29
  },
30
- }, config?.outputConfig?.openAPIObject, isBundle ? config?.bundle?.outputConfig?.openAPIObject : undefined, typeof segmentName === 'string' ? schema?.segments?.[segmentName]?.meta?.openAPIObject : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.openAPIObject : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.openAPIObject), {})),
30
+ }, config?.outputConfig?.openAPIObject, isBundle ? config?.bundle?.outputConfig?.openAPIObject : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.openAPIObject : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.openAPIObject), {})),
31
31
  samples: (0, deepExtend_1.default)({}, config?.outputConfig?.samples, isBundle ? config?.bundle?.outputConfig?.samples : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.samples : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.samples), {})),
32
32
  readme: (0, deepExtend_1.default)({}, config?.outputConfig?.readme, isBundle ? config?.bundle?.outputConfig?.readme : undefined, typeof segmentName === 'string' ? config?.outputConfig?.segments?.[segmentName]?.readme : undefined, outputConfigs?.reduce((acc, config) => (0, deepExtend_1.default)(acc, config.readme), {})),
33
33
  origin: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.469",
3
+ "version": "3.0.0-draft.471",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",