hono-takibi 0.6.4 → 0.6.6

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.
Files changed (169) hide show
  1. package/LICENSE +21 -0
  2. package/dist/config/index.js +6 -13
  3. package/dist/core/helper/get-camel-case-schema-name-helper.js +3 -6
  4. package/dist/core/helper/get-pascal-case-schema-name-helper.js +3 -6
  5. package/dist/core/helper/get-to-safe-identifier-helper.d.ts +2 -2
  6. package/dist/core/helper/get-to-safe-identifier-helper.js +3 -6
  7. package/dist/core/helper/get-variable-name-helper.d.ts +1 -1
  8. package/dist/core/helper/get-variable-name-helper.js +4 -7
  9. package/dist/core/helper/get-variable-schema-name-helper.d.ts +1 -1
  10. package/dist/core/helper/get-variable-schema-name-helper.js +5 -8
  11. package/dist/core/schema/references/extract-refs.d.ts +1 -1
  12. package/dist/core/schema/references/extract-refs.js +4 -7
  13. package/dist/core/schema/references/find-references.d.ts +1 -1
  14. package/dist/core/schema/references/find-references.js +3 -6
  15. package/dist/core/schema/references/get-ref-name.js +1 -4
  16. package/dist/core/schema/references/get-ref-schema-name.d.ts +2 -2
  17. package/dist/core/schema/references/get-ref-schema-name.js +5 -8
  18. package/dist/core/schema/references/resolve-schemas-dependencies.d.ts +1 -1
  19. package/dist/core/schema/references/resolve-schemas-dependencies.js +3 -6
  20. package/dist/core/schema/references/traverse-schema-dependencies.d.ts +1 -1
  21. package/dist/core/schema/references/traverse-schema-dependencies.js +3 -6
  22. package/dist/core/schema/references/traverse-schema.d.ts +1 -1
  23. package/dist/core/schema/references/traverse-schema.js +3 -6
  24. package/dist/core/text/capitalize.d.ts +2 -2
  25. package/dist/core/text/capitalize.js +3 -6
  26. package/dist/core/text/decapitalize.d.ts +2 -2
  27. package/dist/core/text/decapitalize.js +3 -6
  28. package/dist/core/text/escape-str.d.ts +2 -2
  29. package/dist/core/text/escape-str.js +3 -6
  30. package/dist/core/text/regex-pattern.d.ts +2 -2
  31. package/dist/core/text/regex-pattern.js +3 -6
  32. package/dist/core/text/remove-zod-prefix.d.ts +2 -2
  33. package/dist/core/text/remove-zod-prefix.js +3 -6
  34. package/dist/core/validator/is-all-optional.d.ts +2 -2
  35. package/dist/core/validator/is-all-optional.js +3 -6
  36. package/dist/core/validator/is-array-with-schema-reference.d.ts +3 -3
  37. package/dist/core/validator/is-array-with-schema-reference.js +3 -6
  38. package/dist/core/validator/is-format-number.d.ts +1 -1
  39. package/dist/core/validator/is-format-number.js +1 -4
  40. package/dist/core/validator/is-format-string.d.ts +3 -3
  41. package/dist/core/validator/is-format-string.js +3 -6
  42. package/dist/core/validator/is-http-method.d.ts +3 -3
  43. package/dist/core/validator/is-http-method.js +3 -6
  44. package/dist/core/validator/is-nullable-schema.d.ts +3 -3
  45. package/dist/core/validator/is-nullable-schema.js +3 -6
  46. package/dist/core/validator/is-operation.d.ts +3 -3
  47. package/dist/core/validator/is-operation.js +3 -6
  48. package/dist/core/validator/is-ref-object.d.ts +2 -2
  49. package/dist/core/validator/is-ref-object.js +3 -6
  50. package/dist/core/validator/is-schema-reference.d.ts +3 -3
  51. package/dist/core/validator/is-schema-reference.js +3 -6
  52. package/dist/core/validator/is-unique-content-schema.d.ts +4 -4
  53. package/dist/core/validator/is-unique-content-schema.js +4 -7
  54. package/dist/core/zod/get-zod-string-format.d.ts +1 -1
  55. package/dist/core/zod/get-zod-string-format.js +1 -4
  56. package/dist/format/index.js +3 -6
  57. package/dist/generator/zod/generate-zod-array.js +1 -4
  58. package/dist/generator/zod/generate-zod-coerce.js +3 -6
  59. package/dist/generator/zod/generate-zod-default.d.ts +1 -1
  60. package/dist/generator/zod/generate-zod-default.js +1 -4
  61. package/dist/generator/zod/generate-zod-enum.d.ts +1 -1
  62. package/dist/generator/zod/generate-zod-enum.js +3 -6
  63. package/dist/generator/zod/generate-zod-gt.js +1 -4
  64. package/dist/generator/zod/generate-zod-infer.js +1 -4
  65. package/dist/generator/zod/generate-zod-integer-schema.d.ts +1 -1
  66. package/dist/generator/zod/generate-zod-integer-schema.js +13 -16
  67. package/dist/generator/zod/generate-zod-intersection.js +1 -4
  68. package/dist/generator/zod/generate-zod-length.js +1 -4
  69. package/dist/generator/zod/generate-zod-lt.js +1 -4
  70. package/dist/generator/zod/generate-zod-max.js +1 -4
  71. package/dist/generator/zod/generate-zod-min.js +1 -4
  72. package/dist/generator/zod/generate-zod-nullable.js +1 -4
  73. package/dist/generator/zod/generate-zod-number.d.ts +1 -1
  74. package/dist/generator/zod/generate-zod-number.js +17 -20
  75. package/dist/generator/zod/generate-zod-object-schema.js +1 -4
  76. package/dist/generator/zod/generate-zod-object.d.ts +2 -2
  77. package/dist/generator/zod/generate-zod-object.js +14 -17
  78. package/dist/generator/zod/generate-zod-partial-schema.js +1 -4
  79. package/dist/generator/zod/generate-zod-passthrough.js +1 -4
  80. package/dist/generator/zod/generate-zod-record.d.ts +2 -2
  81. package/dist/generator/zod/generate-zod-record.js +3 -6
  82. package/dist/generator/zod/generate-zod-regex.js +3 -6
  83. package/dist/generator/zod/generate-zod-string.d.ts +1 -1
  84. package/dist/generator/zod/generate-zod-string.js +15 -18
  85. package/dist/generator/zod/generate-zod-union.js +1 -4
  86. package/dist/generator/zod/generate-zod.d.ts +2 -2
  87. package/dist/generator/zod/generate-zod.js +46 -50
  88. package/dist/generator/zod/helper/strip-max-if-lt-exist-helper.js +1 -4
  89. package/dist/generator/zod/helper/strip-min-if-gt-exist-helper.js +1 -4
  90. package/dist/generator/zod/helper/strip-min-max-exist-helper.js +1 -4
  91. package/dist/generator/zod/openapi/generate-zod-to-openapi-schema-definition.d.ts +1 -1
  92. package/dist/generator/zod/openapi/generate-zod-to-openapi-schema-definition.js +7 -10
  93. package/dist/generator/zod/openapi/generate-zod-to-openapi.d.ts +1 -1
  94. package/dist/generator/zod/openapi/generate-zod-to-openapi.js +1 -4
  95. package/dist/generator/zod/property/generate-zod-properties-schema.d.ts +2 -2
  96. package/dist/generator/zod/property/generate-zod-properties-schema.js +10 -13
  97. package/dist/generator/zod/property/generate-zod-property-schema.d.ts +2 -2
  98. package/dist/generator/zod/property/generate-zod-property-schema.js +11 -14
  99. package/dist/generator/zod/reference/generate-array-reference-schema.d.ts +2 -2
  100. package/dist/generator/zod/reference/generate-array-reference-schema.js +9 -12
  101. package/dist/generator/zod/reference/generate-reference-schema.d.ts +2 -2
  102. package/dist/generator/zod/reference/generate-reference-schema.js +5 -8
  103. package/dist/generator/zod/sub/generate-zod-schema-from-sub-schema.d.ts +2 -2
  104. package/dist/generator/zod/sub/generate-zod-schema-from-sub-schema.js +4 -7
  105. package/dist/generator/zod-openapi-hono/app/docs/generate-docs.d.ts +1 -1
  106. package/dist/generator/zod-openapi-hono/app/docs/generate-docs.js +1 -4
  107. package/dist/generator/zod-openapi-hono/app/generate-app-route-handler.js +1 -4
  108. package/dist/generator/zod-openapi-hono/app/generators/generate-apply-openapi-routes.js +3 -6
  109. package/dist/generator/zod-openapi-hono/app/generators/generate-import-routes.js +1 -4
  110. package/dist/generator/zod-openapi-hono/app/helper/get-route-maps.d.ts +1 -1
  111. package/dist/generator/zod-openapi-hono/app/helper/get-route-maps.js +5 -8
  112. package/dist/generator/zod-openapi-hono/app/helper/process-import-map.d.ts +1 -1
  113. package/dist/generator/zod-openapi-hono/app/helper/process-import-map.js +1 -4
  114. package/dist/generator/zod-openapi-hono/app/index.d.ts +2 -2
  115. package/dist/generator/zod-openapi-hono/app/index.js +17 -20
  116. package/dist/generator/zod-openapi-hono/app/register-component/generate-register-component.d.ts +1 -1
  117. package/dist/generator/zod-openapi-hono/app/register-component/generate-register-component.js +1 -4
  118. package/dist/generator/zod-openapi-hono/handler/generate-handler-name.js +3 -6
  119. package/dist/generator/zod-openapi-hono/handler/generate-handler.js +1 -4
  120. package/dist/generator/zod-openapi-hono/handler/generate-zod-openapi-hono-handler.d.ts +2 -2
  121. package/dist/generator/zod-openapi-hono/handler/generate-zod-openapi-hono-handler.js +15 -21
  122. package/dist/generator/zod-openapi-hono/handler/helper/group-handlers-by-file-name-helper.d.ts +1 -1
  123. package/dist/generator/zod-openapi-hono/handler/helper/group-handlers-by-file-name-helper.js +1 -4
  124. package/dist/generator/zod-openapi-hono/handler/import/generate-import-handlers.d.ts +1 -1
  125. package/dist/generator/zod-openapi-hono/handler/import/generate-import-handlers.js +1 -4
  126. package/dist/generator/zod-openapi-hono/handler/import/get-handler-imports.js +1 -4
  127. package/dist/generator/zod-openapi-hono/openapi/component/allof/generate-allof-code.d.ts +2 -2
  128. package/dist/generator/zod-openapi-hono/openapi/component/allof/generate-allof-code.js +5 -8
  129. package/dist/generator/zod-openapi-hono/openapi/component/allof/process/process-alllof.d.ts +2 -2
  130. package/dist/generator/zod-openapi-hono/openapi/component/allof/process/process-alllof.js +5 -8
  131. package/dist/generator/zod-openapi-hono/openapi/component/anyof/generate-anyof-code.d.ts +2 -2
  132. package/dist/generator/zod-openapi-hono/openapi/component/anyof/generate-anyof-code.js +7 -10
  133. package/dist/generator/zod-openapi-hono/openapi/component/generate-components-code.d.ts +2 -2
  134. package/dist/generator/zod-openapi-hono/openapi/component/generate-components-code.js +7 -10
  135. package/dist/generator/zod-openapi-hono/openapi/component/not/generate-not-code.d.ts +1 -1
  136. package/dist/generator/zod-openapi-hono/openapi/component/not/generate-not-code.js +1 -4
  137. package/dist/generator/zod-openapi-hono/openapi/component/oneof/generate-oneof-code.d.ts +2 -2
  138. package/dist/generator/zod-openapi-hono/openapi/component/oneof/generate-oneof-code.js +7 -10
  139. package/dist/generator/zod-openapi-hono/openapi/generate-zod-openapi-hono.d.ts +2 -2
  140. package/dist/generator/zod-openapi-hono/openapi/generate-zod-openapi-hono.js +5 -8
  141. package/dist/generator/zod-openapi-hono/openapi/route/generate-create-route.js +1 -4
  142. package/dist/generator/zod-openapi-hono/openapi/route/generate-route-code.d.ts +2 -2
  143. package/dist/generator/zod-openapi-hono/openapi/route/generate-route-code.js +7 -10
  144. package/dist/generator/zod-openapi-hono/openapi/route/generate-route-name.js +3 -6
  145. package/dist/generator/zod-openapi-hono/openapi/route/generate-route.d.ts +2 -2
  146. package/dist/generator/zod-openapi-hono/openapi/route/generate-route.js +12 -15
  147. package/dist/generator/zod-openapi-hono/openapi/route/params/generate-params-object.d.ts +2 -2
  148. package/dist/generator/zod-openapi-hono/openapi/route/params/generate-params-object.js +6 -9
  149. package/dist/generator/zod-openapi-hono/openapi/route/params/generate-request-parameter.d.ts +2 -2
  150. package/dist/generator/zod-openapi-hono/openapi/route/params/generate-request-parameter.js +15 -18
  151. package/dist/generator/zod-openapi-hono/openapi/route/params/generate-request-params-array.d.ts +1 -1
  152. package/dist/generator/zod-openapi-hono/openapi/route/params/generate-request-params-array.js +3 -6
  153. package/dist/generator/zod-openapi-hono/openapi/route/params/generate-request-params.js +1 -4
  154. package/dist/generator/zod-openapi-hono/openapi/route/request/body/generate-insert-request-body.js +1 -4
  155. package/dist/generator/zod-openapi-hono/openapi/route/request/body/generate-request-body.d.ts +1 -1
  156. package/dist/generator/zod-openapi-hono/openapi/route/request/body/generate-request-body.js +3 -6
  157. package/dist/generator/zod-openapi-hono/openapi/route/request/object/generate-format-request-object.js +1 -4
  158. package/dist/generator/zod-openapi-hono/openapi/route/response/generate-response-schema.d.ts +2 -2
  159. package/dist/generator/zod-openapi-hono/openapi/route/response/generate-response-schema.js +8 -11
  160. package/dist/index.d.ts +1 -1
  161. package/dist/index.js +29 -37
  162. package/dist/types/index.js +1 -0
  163. package/dist/vite-plugin/index.d.ts +2 -1
  164. package/dist/vite-plugin/index.js +5 -8
  165. package/dist/vite-plugin/vite-mode.d.ts +1 -1
  166. package/dist/vite-plugin/vite-mode.js +14 -20
  167. package/package.json +14 -14
  168. package/dist/type/index.js +0 -2
  169. /package/dist/{type → types}/index.d.ts +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 - present, Hono Takibi Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,12 +1,5 @@
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_CONFIG = void 0;
7
- exports.getConfig = getConfig;
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- exports.DEFAULT_CONFIG = {
1
+ import fs from 'node:fs';
2
+ export const DEFAULT_CONFIG = {
10
3
  schema: {
11
4
  name: 'PascalCase',
12
5
  export: false,
@@ -20,9 +13,9 @@ exports.DEFAULT_CONFIG = {
20
13
  * Loads the configuration from the `hono-takibi.json` file or returns the default configuration.
21
14
  * @returns { Config } The configuration object.
22
15
  */
23
- function getConfig() {
24
- const config = node_fs_1.default.existsSync('hono-takibi.json')
25
- ? { ...exports.DEFAULT_CONFIG, ...JSON.parse(node_fs_1.default.readFileSync('hono-takibi.json', 'utf-8')) }
26
- : exports.DEFAULT_CONFIG;
16
+ export function getConfig() {
17
+ const config = fs.existsSync('hono-takibi.json')
18
+ ? { ...DEFAULT_CONFIG, ...JSON.parse(fs.readFileSync('hono-takibi.json', 'utf-8')) }
19
+ : DEFAULT_CONFIG;
27
20
  return config;
28
21
  }
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCamelCaseSchemaNameHelper = getCamelCaseSchemaNameHelper;
4
- const decapitalize_1 = require("../text/decapitalize");
1
+ import { decapitalize } from '../text/decapitalize.js';
5
2
  /**
6
3
  * Generates a camelCase schema name from a given schema name.
7
4
  * @param { string } schemaName - The original schema name.
8
5
  * @returns { string } The camelCase schema name.
9
6
  */
10
- function getCamelCaseSchemaNameHelper(schemaName) {
11
- const decapitalizedSchemaName = (0, decapitalize_1.decapitalize)(schemaName);
7
+ export function getCamelCaseSchemaNameHelper(schemaName) {
8
+ const decapitalizedSchemaName = decapitalize(schemaName);
12
9
  return `${decapitalizedSchemaName}Schema`;
13
10
  }
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPascalCaseSchemaNameHelper = getPascalCaseSchemaNameHelper;
4
- const capitalize_1 = require("../text/capitalize");
1
+ import { capitalize } from '../text/capitalize.js';
5
2
  /**
6
3
  * Generates a PascalCase schema name from a given schema name.
7
4
  * @param { string } schemaName - The original schema name.
8
5
  * @returns { string } The PascalCase schema name.
9
6
  */
10
- function getPascalCaseSchemaNameHelper(schemaName) {
11
- const capitalizedSchemaName = (0, capitalize_1.capitalize)(schemaName);
7
+ export function getPascalCaseSchemaNameHelper(schemaName) {
8
+ const capitalizedSchemaName = capitalize(schemaName);
12
9
  return `${capitalizedSchemaName}Schema`;
13
10
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * getToSafeIdentifierHelper
3
- * @param {string} str - The string to be converted to a safe identifier
4
- * @returns {string} - A normalized, safe identifier
3
+ * @param { string } str - The string to be converted to a safe identifier
4
+ * @returns { string } - A normalized, safe identifier
5
5
  */
6
6
  export declare function getToSafeIdentifierHelper(str: string): string;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getToSafeIdentifierHelper = getToSafeIdentifierHelper;
4
1
  /**
5
2
  * getToSafeIdentifierHelper
6
- * @param {string} str - The string to be converted to a safe identifier
7
- * @returns {string} - A normalized, safe identifier
3
+ * @param { string } str - The string to be converted to a safe identifier
4
+ * @returns { string } - A normalized, safe identifier
8
5
  */
9
- function getToSafeIdentifierHelper(str) {
6
+ export function getToSafeIdentifierHelper(str) {
10
7
  const trimmed = str.trim();
11
8
  if (trimmed.includes('-')) {
12
9
  return trimmed.replace(/\s*-\s*/g, '_');
@@ -1,4 +1,4 @@
1
- import type { Config } from '../../config';
1
+ import type { Config } from '../../config/index.js';
2
2
  /**
3
3
  * Generates a variable name from a given name and config.
4
4
  * @param { string } name - The name of the schema.
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVariableNameHelper = getVariableNameHelper;
4
- const capitalize_1 = require("../text/capitalize");
5
- const decapitalize_1 = require("../text/decapitalize");
1
+ import { capitalize } from '../text/capitalize.js';
2
+ import { decapitalize } from '../text/decapitalize.js';
6
3
  /**
7
4
  * Generates a variable name from a given name and config.
8
5
  * @param { string } name - The name of the schema.
9
6
  * @param { Config } config - The config of the schema.
10
7
  * @returns { string } The variable name.
11
8
  */
12
- function getVariableNameHelper(name, config) {
13
- return config.type.name === 'camelCase' ? (0, decapitalize_1.decapitalize)(name) : (0, capitalize_1.capitalize)(name);
9
+ export function getVariableNameHelper(name, config) {
10
+ return config.type.name === 'camelCase' ? decapitalize(name) : capitalize(name);
14
11
  }
@@ -1,4 +1,4 @@
1
- import type { Config } from '../../config';
1
+ import type { Config } from '../../config/index.js';
2
2
  /**
3
3
  * Generates a variable schema name from a given name and config.
4
4
  * @param { string } name - The name of the schema.
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVariableSchemaNameHelper = getVariableSchemaNameHelper;
4
- const get_camel_case_schema_name_helper_1 = require("./get-camel-case-schema-name-helper");
5
- const get_pascal_case_schema_name_helper_1 = require("./get-pascal-case-schema-name-helper");
1
+ import { getCamelCaseSchemaNameHelper } from './get-camel-case-schema-name-helper.js';
2
+ import { getPascalCaseSchemaNameHelper } from './get-pascal-case-schema-name-helper.js';
6
3
  /**
7
4
  * Generates a variable schema name from a given name and config.
8
5
  * @param { string } name - The name of the schema.
9
6
  * @param { Config } config - The config of the schema.
10
7
  * @returns { string } The variable schema name.
11
8
  */
12
- function getVariableSchemaNameHelper(name, config) {
9
+ export function getVariableSchemaNameHelper(name, config) {
13
10
  return config.schema.name === 'camelCase'
14
- ? (0, get_camel_case_schema_name_helper_1.getCamelCaseSchemaNameHelper)(name)
15
- : (0, get_pascal_case_schema_name_helper_1.getPascalCaseSchemaNameHelper)(name);
11
+ ? getCamelCaseSchemaNameHelper(name)
12
+ : getPascalCaseSchemaNameHelper(name);
16
13
  }
@@ -1,4 +1,4 @@
1
- import type { Schema } from '../../../type';
1
+ import type { Schema } from '../../../types/index.js';
2
2
  /**
3
3
  * Extracts all references from a given schema
4
4
  * @param { Schema } schema - The schema to extract references from
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractRefs = extractRefs;
4
- const is_ref_object_1 = require("../../validator/is-ref-object");
1
+ import { isRefObject } from '../../validator/is-ref-object.js';
5
2
  /**
6
3
  * Extracts all references from a given schema
7
4
  * @param { Schema } schema - The schema to extract references from
8
5
  * @returns { string[] } An array of reference names
9
6
  */
10
- function extractRefs(schema) {
7
+ export function extractRefs(schema) {
11
8
  const refs = [];
12
9
  const traverse = (obj) => {
13
- if (!(0, is_ref_object_1.isRefObject)(obj))
10
+ if (!isRefObject(obj))
14
11
  return;
15
12
  for (const [key, value] of Object.entries(obj)) {
16
13
  if (key !== '$ref') {
17
- if ((0, is_ref_object_1.isRefObject)(value)) {
14
+ if (isRefObject(value)) {
18
15
  traverse(value);
19
16
  }
20
17
  continue;
@@ -1,4 +1,4 @@
1
- import type { Schema } from '../../../type';
1
+ import type { Schema } from '../../../types/index.js';
2
2
  /**
3
3
  * Collects all $ref references from an OpenAPI schema by recursively traversing it
4
4
  * @param { Schema } schema - The schema to search for references
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findReferences = findReferences;
4
- const traverse_schema_1 = require("./traverse-schema");
1
+ import { traverseSchema } from './traverse-schema.js';
5
2
  /**
6
3
  * Collects all $ref references from an OpenAPI schema by recursively traversing it
7
4
  * @param { Schema } schema - The schema to search for references
@@ -25,8 +22,8 @@ const traverse_schema_1 = require("./traverse-schema");
25
22
  * const refs = findReferences(schema)
26
23
  * // refs contains: Set { 'Tag', 'Category' }
27
24
  */
28
- function findReferences(schema) {
25
+ export function findReferences(schema) {
29
26
  const refs = new Set();
30
- (0, traverse_schema_1.traverseSchema)(schema, refs);
27
+ traverseSchema(schema, refs);
31
28
  return refs;
32
29
  }
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRefName = getRefName;
4
1
  /**
5
2
  * Extracts the type name from an OpenAPI schema reference ($ref)
6
3
  * @param { string } ref - OpenAPI schema reference path (e.g., '#/components/schemas/Address')
@@ -33,7 +30,7 @@ exports.getRefName = getRefName;
33
30
  * Process: Splits by '/' -> ['#', 'components', 'schemas', 'Address']
34
31
  * Output: Returns 'Address'
35
32
  */
36
- function getRefName(ref) {
33
+ export function getRefName(ref) {
37
34
  // split('/'): Split a string into an array using slashes
38
35
  // 1. ["#", "components", "schemas", "Address"]
39
36
  // pop() to get the last element
@@ -1,5 +1,5 @@
1
- import type { Config } from '../../../config';
2
- import type { Schema } from '../../../type';
1
+ import type { Config } from '../../../config/index.js';
2
+ import type { Schema } from '../../../types/index.js';
3
3
  /**
4
4
  * Retrieves the referenced schema name from a schema object.
5
5
  * @param { Schema } schema - The schema object
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRefSchemaName = getRefSchemaName;
4
- const get_variable_schema_name_helper_1 = require("../../helper/get-variable-schema-name-helper");
5
- const get_ref_name_1 = require("./get-ref-name");
1
+ import { getVariableSchemaNameHelper } from '../../helper/get-variable-schema-name-helper.js';
2
+ import { getRefName } from './get-ref-name.js';
6
3
  /**
7
4
  * Retrieves the referenced schema name from a schema object.
8
5
  * @param { Schema } schema - The schema object
@@ -10,13 +7,13 @@ const get_ref_name_1 = require("./get-ref-name");
10
7
  * @returns { string } The referenced schema name
11
8
  * @throws { Error } Will throw an error if the $ref property or the reference name is not found
12
9
  */
13
- function getRefSchemaName(schema, config) {
10
+ export function getRefSchemaName(schema, config) {
14
11
  if (!schema.$ref) {
15
12
  throw new Error('refName is not found');
16
13
  }
17
- const refName = (0, get_ref_name_1.getRefName)(schema.$ref);
14
+ const refName = getRefName(schema.$ref);
18
15
  if (!refName) {
19
16
  throw new Error('refName is not found');
20
17
  }
21
- return (0, get_variable_schema_name_helper_1.getVariableSchemaNameHelper)(refName, config);
18
+ return getVariableSchemaNameHelper(refName, config);
22
19
  }
@@ -1,4 +1,4 @@
1
- import type { Schema } from '../../../type';
1
+ import type { Schema } from '../../../types/index.js';
2
2
  /**
3
3
  * Resolves dependencies between schemas and returns them in topological order for safe processing
4
4
  * @param { Record<string, Schema> } schemas - Record mapping schema names to their Schema objects
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveSchemasDependencies = resolveSchemasDependencies;
4
- const traverse_schema_dependencies_1 = require("./traverse-schema-dependencies");
1
+ import { traverseSchemaDependencies } from './traverse-schema-dependencies.js';
5
2
  /**
6
3
  * Resolves dependencies between schemas and returns them in topological order for safe processing
7
4
  * @param { Record<string, Schema> } schemas - Record mapping schema names to their Schema objects
@@ -59,13 +56,13 @@ const traverse_schema_dependencies_1 = require("./traverse-schema-dependencies")
59
56
  * - Uses depth-first search for dependency resolution
60
57
  * - Automatically handles circular dependencies by preventing infinite recursion
61
58
  */
62
- function resolveSchemasDependencies(schemas) {
59
+ export function resolveSchemasDependencies(schemas) {
63
60
  const visited = new Set();
64
61
  const recursionStack = new Set();
65
62
  const orderedSchemas = [];
66
63
  for (const schemaName of Object.keys(schemas)) {
67
64
  if (!visited.has(schemaName)) {
68
- (0, traverse_schema_dependencies_1.traverseSchemaDependencies)(schemaName, schemas, visited, recursionStack, orderedSchemas);
65
+ traverseSchemaDependencies(schemaName, schemas, visited, recursionStack, orderedSchemas);
69
66
  }
70
67
  }
71
68
  return orderedSchemas;
@@ -1,4 +1,4 @@
1
- import type { Schema } from '../../../type';
1
+ import type { Schema } from '../../../types/index.js';
2
2
  /**
3
3
  * Traverses the schema dependencies and returns them in topological order
4
4
  * @param { string } schemaName - The name of the schema to traverse
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.traverseSchemaDependencies = traverseSchemaDependencies;
4
- const extract_refs_1 = require("./extract-refs");
1
+ import { extractRefs } from './extract-refs.js';
5
2
  /**
6
3
  * Traverses the schema dependencies and returns them in topological order
7
4
  * @param { string } schemaName - The name of the schema to traverse
@@ -10,7 +7,7 @@ const extract_refs_1 = require("./extract-refs");
10
7
  * @param { Set<string> } recursionStack - The recursion stack
11
8
  * @param { string[] } orderedSchemas - The ordered schemas
12
9
  */
13
- function traverseSchemaDependencies(schemaName, schemas, visited, recursionStack, orderedSchemas) {
10
+ export function traverseSchemaDependencies(schemaName, schemas, visited, recursionStack, orderedSchemas) {
14
11
  if (visited.has(schemaName))
15
12
  return;
16
13
  if (recursionStack.has(schemaName)) {
@@ -19,7 +16,7 @@ function traverseSchemaDependencies(schemaName, schemas, visited, recursionStack
19
16
  recursionStack.add(schemaName);
20
17
  const schema = schemas[schemaName];
21
18
  if (schema) {
22
- for (const ref of (0, extract_refs_1.extractRefs)(schema)) {
19
+ for (const ref of extractRefs(schema)) {
23
20
  if (schemas[ref]) {
24
21
  traverseSchemaDependencies(ref, schemas, visited, recursionStack, orderedSchemas);
25
22
  }
@@ -1,4 +1,4 @@
1
- import type { Schema } from '../../../type';
1
+ import type { Schema } from '../../../types/index.js';
2
2
  /**
3
3
  * Recursively traverses an OpenAPI schema to collect all $ref references
4
4
  * @param { Schema } schema - The OpenAPI schema object to traverse
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.traverseSchema = traverseSchema;
4
- const get_ref_name_1 = require("./get-ref-name");
1
+ import { getRefName } from './get-ref-name.js';
5
2
  /**
6
3
  * Recursively traverses an OpenAPI schema to collect all $ref references
7
4
  * @param { Schema } schema - The OpenAPI schema object to traverse
@@ -45,13 +42,13 @@ const get_ref_name_1 = require("./get-ref-name");
45
42
  * (e.g., '#/components/schemas/User' → 'User')
46
43
  * - Performs depth-first traversal of the schema structure
47
44
  */
48
- function traverseSchema(schema, refs) {
45
+ export function traverseSchema(schema, refs) {
49
46
  // Exit if schema is undefined or not an object
50
47
  if (!schema || typeof schema !== 'object')
51
48
  return;
52
49
  // If schema has a $ref property, extract and store the referenced schema name
53
50
  if (schema.$ref) {
54
- const ref = (0, get_ref_name_1.getRefName)(schema.$ref);
51
+ const ref = getRefName(schema.$ref);
55
52
  if (ref)
56
53
  refs.add(ref);
57
54
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Capitalize the first letter of a string
3
- * @param {string} str - String to capitalize
4
- * @returns {string} String with first letter capitalized
3
+ * @param { string } str - String to capitalize
4
+ * @returns { string } String with first letter capitalized
5
5
  *
6
6
  * @example
7
7
  * capitalize('posts') // Returns: 'Posts'
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.capitalize = capitalize;
4
1
  /**
5
2
  * Capitalize the first letter of a string
6
- * @param {string} str - String to capitalize
7
- * @returns {string} String with first letter capitalized
3
+ * @param { string } str - String to capitalize
4
+ * @returns { string } String with first letter capitalized
8
5
  *
9
6
  * @example
10
7
  * capitalize('posts') // Returns: 'Posts'
@@ -16,6 +13,6 @@ exports.capitalize = capitalize;
16
13
  * - Returns empty string if input is empty
17
14
  * - Commonly used for generating type names and class names
18
15
  */
19
- function capitalize(str) {
16
+ export function capitalize(str) {
20
17
  return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
21
18
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Decapitalize the first letter of a string
3
- * @param {string} str - String to decapitalize
4
- * @returns {string} String with the first letter in lowercase
3
+ * @param { string } str - String to decapitalize
4
+ * @returns { string } String with the first letter in lowercase
5
5
  *
6
6
  * @example
7
7
  * decapitalize('Posts') // Returns: 'posts'
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decapitalize = decapitalize;
4
1
  /**
5
2
  * Decapitalize the first letter of a string
6
- * @param {string} str - String to decapitalize
7
- * @returns {string} String with the first letter in lowercase
3
+ * @param { string } str - String to decapitalize
4
+ * @returns { string } String with the first letter in lowercase
8
5
  *
9
6
  * @example
10
7
  * decapitalize('Posts') // Returns: 'posts'
@@ -15,6 +12,6 @@ exports.decapitalize = decapitalize;
15
12
  * - Leaves the rest of the string unchanged
16
13
  * - Returns an empty string if the input is empty
17
14
  */
18
- function decapitalize(str) {
15
+ export function decapitalize(str) {
19
16
  return `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
20
17
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Escape text for use in TypeScript code
3
- * @param {string} text - The text to escape
4
- * @returns {string} The escaped text
3
+ * @param { string } text - The text to escape
4
+ * @returns { string } The escaped text
5
5
  */
6
6
  export declare function escapeStr(text: string): string;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.escapeStr = escapeStr;
4
1
  /**
5
2
  * Escape text for use in TypeScript code
6
- * @param {string} text - The text to escape
7
- * @returns {string} The escaped text
3
+ * @param { string } text - The text to escape
4
+ * @returns { string } The escaped text
8
5
  */
9
- function escapeStr(text) {
6
+ export function escapeStr(text) {
10
7
  return (text
11
8
  // Basic text cleaning
12
9
  .replace(/\n/g, ' ') // Replace line breaks with spaces
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Generates a regex pattern from a string
3
- * @param {string} pattern - The pattern to generate a regex from
4
- * @returns {string} Generated regex pattern
3
+ * @param { string } pattern - The pattern to generate a regex from
4
+ * @returns { string } Generated regex pattern
5
5
  */
6
6
  export declare function regexPattern(pattern: string): string;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.regexPattern = regexPattern;
4
1
  /**
5
2
  * Generates a regex pattern from a string
6
- * @param {string} pattern - The pattern to generate a regex from
7
- * @returns {string} Generated regex pattern
3
+ * @param { string } pattern - The pattern to generate a regex from
4
+ * @returns { string } Generated regex pattern
8
5
  */
9
- function regexPattern(pattern) {
6
+ export function regexPattern(pattern) {
10
7
  const escapedPattern = pattern.replace(/(?<!\\)\//g, '\\/');
11
8
  const res = `/${escapedPattern}/`;
12
9
  return res;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Remove the zod prefix from a zod schema
3
- * @param {string} zodSchema - The zod schema to remove the prefix from
4
- * @returns {string} The zod schema without the prefix
3
+ * @param { string } zodSchema - The zod schema to remove the prefix from
4
+ * @returns { string } The zod schema without the prefix
5
5
  */
6
6
  export declare function removeZodPrefix(zodSchema: string): string;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeZodPrefix = removeZodPrefix;
4
1
  /**
5
2
  * Remove the zod prefix from a zod schema
6
- * @param {string} zodSchema - The zod schema to remove the prefix from
7
- * @returns {string} The zod schema without the prefix
3
+ * @param { string } zodSchema - The zod schema to remove the prefix from
4
+ * @returns { string } The zod schema without the prefix
8
5
  */
9
- function removeZodPrefix(zodSchema) {
6
+ export function removeZodPrefix(zodSchema) {
10
7
  return zodSchema.replace('z.', '');
11
8
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Check if all properties in the object are optional
3
- * @param {string[]} objectProperties - An array of strings representing the object properties
4
- * @returns {boolean} A boolean indicating if all properties are optional
3
+ * @param { string[] } objectProperties - An array of strings representing the object properties
4
+ * @returns { boolean } A boolean indicating if all properties are optional
5
5
  */
6
6
  export declare function isAllOptional(objectProperties: string[]): boolean;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAllOptional = isAllOptional;
4
1
  /**
5
2
  * Check if all properties in the object are optional
6
- * @param {string[]} objectProperties - An array of strings representing the object properties
7
- * @returns {boolean} A boolean indicating if all properties are optional
3
+ * @param { string[] } objectProperties - An array of strings representing the object properties
4
+ * @returns { boolean } A boolean indicating if all properties are optional
8
5
  */
9
- function isAllOptional(objectProperties) {
6
+ export function isAllOptional(objectProperties) {
10
7
  return objectProperties.every((prop) => prop.includes('.optional()'));
11
8
  }
@@ -1,7 +1,7 @@
1
- import type { Schema } from '../../type';
1
+ import type { Schema } from '../../types/index.js';
2
2
  /**
3
3
  * Check if an array has a schema reference
4
- * @param {Schema} schema - The schema to check
5
- * @returns {boolean} A boolean indicating if the array has a schema reference
4
+ * @param { Schema } schema - The schema to check
5
+ * @returns { boolean } A boolean indicating if the array has a schema reference
6
6
  */
7
7
  export declare function isArrayWithSchemaReference(schema: Schema): boolean;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isArrayWithSchemaReference = isArrayWithSchemaReference;
4
1
  /**
5
2
  * Check if an array has a schema reference
6
- * @param {Schema} schema - The schema to check
7
- * @returns {boolean} A boolean indicating if the array has a schema reference
3
+ * @param { Schema } schema - The schema to check
4
+ * @returns { boolean } A boolean indicating if the array has a schema reference
8
5
  */
9
- function isArrayWithSchemaReference(schema) {
6
+ export function isArrayWithSchemaReference(schema) {
10
7
  return schema.type === 'array' && Boolean(schema.items?.$ref);
11
8
  }
@@ -1,4 +1,4 @@
1
- import type { Format, FormatNumber } from '../../type';
1
+ import type { Format, FormatNumber } from '../../types/index.js';
2
2
  /**
3
3
  * Check if the format is a number type
4
4
  * @param {Format} format - OpenAPI format type
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFormatNumber = isFormatNumber;
4
1
  /**
5
2
  * Check if the format is a number type
6
3
  * @param {Format} format - OpenAPI format type
7
4
  * @returns {boolean} true if the format is a number type, false otherwise
8
5
  */
9
- function isFormatNumber(format) {
6
+ export function isFormatNumber(format) {
10
7
  return ['int32', 'int64', 'float', 'double'].includes(format);
11
8
  }
@@ -1,7 +1,7 @@
1
- import type { Format, FormatString } from '../../type';
1
+ import type { Format, FormatString } from '../../types/index.js';
2
2
  /**
3
3
  * Check if the format is a string type
4
- * @param {Format} format - OpenAPI format type
5
- * @returns {boolean} true if the format is a string type, false otherwise
4
+ * @param { Format } format - OpenAPI format type
5
+ * @returns { boolean } true if the format is a string type, false otherwise
6
6
  */
7
7
  export declare function isFormatString(format: Format): format is FormatString;