vovk 3.0.0-draft.294 → 3.0.0-draft.296

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.
@@ -4,7 +4,7 @@ exports.openAPIToVovkSchema = openAPIToVovkSchema;
4
4
  const types_1 = require("../types");
5
5
  const generateFnName_1 = require("./generateFnName");
6
6
  const camelCase_1 = require("../utils/camelCase");
7
- const lodash_1 = require("lodash");
7
+ const upperFirst_1 = require("../utils/upperFirst");
8
8
  // fast clone JSON object while ignoring Date, RegExp, and Function types
9
9
  function cloneJSON(obj) {
10
10
  if (obj === null || typeof obj !== 'object')
@@ -39,7 +39,7 @@ function applyComponents(schema, key, components, mixinName) {
39
39
  const componentName = $ref.replace(`#/${key}/`, '');
40
40
  if (components[componentName]) {
41
41
  newObj.$ref = `#/$defs/${componentName}`;
42
- newObj['tsType'] ??= `Mixins.${(0, lodash_1.capitalize)((0, camelCase_1.camelCase)(mixinName))}.${(0, lodash_1.capitalize)((0, camelCase_1.camelCase)(componentName))}`;
42
+ newObj['tsType'] ??= `Mixins.${(0, upperFirst_1.upperFirst)((0, camelCase_1.camelCase)(mixinName))}.${(0, upperFirst_1.upperFirst)((0, camelCase_1.camelCase)(componentName))}`;
43
43
  }
44
44
  else {
45
45
  delete newObj.$ref; // Remove $ref if component not found (Telegram API has Type $refs that is not defined in components)
@@ -148,7 +148,9 @@ function openAPIToVovkSchema({ apiRoot, source: { object: openAPIObject }, getMo
148
148
  getModuleName = normalizeGetModuleName(getModuleName);
149
149
  getMethodName = normalizeGetMethodName(getMethodName);
150
150
  return Object.entries(openAPIObject.paths ?? {}).reduce((acc, [path, operations]) => {
151
- Object.entries(operations ?? {}).forEach(([method, operation]) => {
151
+ Object.entries(operations ?? {})
152
+ .filter(([, operation]) => operation && typeof operation === 'object')
153
+ .forEach(([method, operation]) => {
152
154
  const rpcModuleName = getModuleName({
153
155
  method: method.toUpperCase(),
154
156
  path,
@@ -0,0 +1 @@
1
+ export declare function upperFirst(str: string): string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.upperFirst = upperFirst;
4
+ function upperFirst(str) {
5
+ return str.charAt(0).toUpperCase() + str.slice(1);
6
+ }
@@ -4,7 +4,7 @@ exports.openAPIToVovkSchema = openAPIToVovkSchema;
4
4
  const types_1 = require("../types");
5
5
  const generateFnName_1 = require("./generateFnName");
6
6
  const camelCase_1 = require("../utils/camelCase");
7
- const lodash_1 = require("lodash");
7
+ const upperFirst_1 = require("../utils/upperFirst");
8
8
  // fast clone JSON object while ignoring Date, RegExp, and Function types
9
9
  function cloneJSON(obj) {
10
10
  if (obj === null || typeof obj !== 'object')
@@ -39,7 +39,7 @@ function applyComponents(schema, key, components, mixinName) {
39
39
  const componentName = $ref.replace(`#/${key}/`, '');
40
40
  if (components[componentName]) {
41
41
  newObj.$ref = `#/$defs/${componentName}`;
42
- newObj['tsType'] ??= `Mixins.${(0, lodash_1.capitalize)((0, camelCase_1.camelCase)(mixinName))}.${(0, lodash_1.capitalize)((0, camelCase_1.camelCase)(componentName))}`;
42
+ newObj['tsType'] ??= `Mixins.${(0, upperFirst_1.upperFirst)((0, camelCase_1.camelCase)(mixinName))}.${(0, upperFirst_1.upperFirst)((0, camelCase_1.camelCase)(componentName))}`;
43
43
  }
44
44
  else {
45
45
  delete newObj.$ref; // Remove $ref if component not found (Telegram API has Type $refs that is not defined in components)
@@ -148,7 +148,9 @@ function openAPIToVovkSchema({ apiRoot, source: { object: openAPIObject }, getMo
148
148
  getModuleName = normalizeGetModuleName(getModuleName);
149
149
  getMethodName = normalizeGetMethodName(getMethodName);
150
150
  return Object.entries(openAPIObject.paths ?? {}).reduce((acc, [path, operations]) => {
151
- Object.entries(operations ?? {}).forEach(([method, operation]) => {
151
+ Object.entries(operations ?? {})
152
+ .filter(([, operation]) => operation && typeof operation === 'object')
153
+ .forEach(([method, operation]) => {
152
154
  const rpcModuleName = getModuleName({
153
155
  method: method.toUpperCase(),
154
156
  path,
@@ -0,0 +1 @@
1
+ export declare function upperFirst(str: string): string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.upperFirst = upperFirst;
4
+ function upperFirst(str) {
5
+ return str.charAt(0).toUpperCase() + str.slice(1);
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.294",
3
+ "version": "3.0.0-draft.296",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",