@goast/core 0.3.8 → 0.4.0-beta2

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 (310) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -4
  3. package/esm/_dnt.shims.d.ts +11 -0
  4. package/esm/_dnt.shims.d.ts.map +1 -0
  5. package/esm/_dnt.shims.js +66 -0
  6. package/esm/index.d.ts +6 -0
  7. package/esm/index.d.ts.map +1 -0
  8. package/esm/lib/ast/index.d.ts +2 -0
  9. package/esm/lib/ast/index.d.ts.map +1 -0
  10. package/{types → esm}/lib/ast/node.d.ts +2 -1
  11. package/esm/lib/ast/node.d.ts.map +1 -0
  12. package/esm/lib/ast/node.js +6 -0
  13. package/{types → esm}/lib/codegen/config.d.ts +3 -2
  14. package/esm/lib/codegen/config.d.ts.map +1 -0
  15. package/{types → esm}/lib/codegen/endpoints-generator.d.ts +9 -6
  16. package/esm/lib/codegen/endpoints-generator.d.ts.map +1 -0
  17. package/esm/lib/codegen/endpoints-generator.js +9 -4
  18. package/{types → esm}/lib/codegen/generator.d.ts +11 -11
  19. package/esm/lib/codegen/generator.d.ts.map +1 -0
  20. package/esm/lib/codegen/generator.js +24 -10
  21. package/esm/lib/codegen/index.d.ts +7 -0
  22. package/esm/lib/codegen/index.d.ts.map +1 -0
  23. package/{types → esm}/lib/codegen/internal-utils.d.ts +1 -0
  24. package/esm/lib/codegen/internal-utils.d.ts.map +1 -0
  25. package/{types → esm}/lib/codegen/schemas-generator.d.ts +9 -6
  26. package/esm/lib/codegen/schemas-generator.d.ts.map +1 -0
  27. package/esm/lib/codegen/schemas-generator.js +11 -5
  28. package/{types → esm}/lib/codegen/services-generator.d.ts +9 -6
  29. package/esm/lib/codegen/services-generator.d.ts.map +1 -0
  30. package/esm/lib/codegen/services-generator.js +9 -4
  31. package/{types → esm}/lib/codegen/types.d.ts +5 -3
  32. package/esm/lib/codegen/types.d.ts.map +1 -0
  33. package/esm/lib/collect/collector.d.ts +4 -0
  34. package/esm/lib/collect/collector.d.ts.map +1 -0
  35. package/{types → esm}/lib/collect/helpers.d.ts +3 -2
  36. package/esm/lib/collect/helpers.d.ts.map +1 -0
  37. package/esm/lib/collect/index.d.ts +4 -0
  38. package/esm/lib/collect/index.d.ts.map +1 -0
  39. package/{types → esm}/lib/collect/types.d.ts +2 -1
  40. package/esm/lib/collect/types.d.ts.map +1 -0
  41. package/{types → esm}/lib/internal-utils.d.ts +1 -0
  42. package/esm/lib/internal-utils.d.ts.map +1 -0
  43. package/esm/lib/parse/deref-proxy.d.ts +4 -0
  44. package/esm/lib/parse/deref-proxy.d.ts.map +1 -0
  45. package/esm/lib/parse/deref-proxy.js +18 -3
  46. package/esm/lib/parse/index.d.ts +4 -0
  47. package/esm/lib/parse/index.d.ts.map +1 -0
  48. package/{types → esm}/lib/parse/openapi-types.d.ts +1 -0
  49. package/esm/lib/parse/openapi-types.d.ts.map +1 -0
  50. package/{types → esm}/lib/parse/parser.d.ts +4 -3
  51. package/esm/lib/parse/parser.d.ts.map +1 -0
  52. package/esm/lib/parse/parser.js +17 -6
  53. package/{types → esm}/lib/parse/types.d.ts +3 -2
  54. package/esm/lib/parse/types.d.ts.map +1 -0
  55. package/{types → esm}/lib/transform/api-types.d.ts +3 -2
  56. package/esm/lib/transform/api-types.d.ts.map +1 -0
  57. package/{types → esm}/lib/transform/helpers.d.ts +4 -3
  58. package/esm/lib/transform/helpers.d.ts.map +1 -0
  59. package/esm/lib/transform/helpers.js +9 -3
  60. package/esm/lib/transform/index.d.ts +3 -0
  61. package/esm/lib/transform/index.d.ts.map +1 -0
  62. package/esm/lib/transform/transform-document.d.ts +4 -0
  63. package/esm/lib/transform/transform-document.d.ts.map +1 -0
  64. package/esm/lib/transform/transform-endpoint.d.ts +5 -0
  65. package/esm/lib/transform/transform-endpoint.d.ts.map +1 -0
  66. package/esm/lib/transform/transform-schema.d.ts +5 -0
  67. package/esm/lib/transform/transform-schema.d.ts.map +1 -0
  68. package/esm/lib/transform/transform-schema.js +3 -1
  69. package/esm/lib/transform/transformer.d.ts +5 -0
  70. package/esm/lib/transform/transformer.d.ts.map +1 -0
  71. package/esm/lib/transform/transformer.js +1 -1
  72. package/{types → esm}/lib/transform/types.d.ts +5 -4
  73. package/esm/lib/transform/types.d.ts.map +1 -0
  74. package/{types → esm}/lib/utils/action-provider.d.ts +2 -1
  75. package/esm/lib/utils/action-provider.d.ts.map +1 -0
  76. package/esm/lib/utils/action-provider.js +6 -1
  77. package/{types → esm}/lib/utils/array.utils.d.ts +1 -0
  78. package/esm/lib/utils/array.utils.d.ts.map +1 -0
  79. package/esm/lib/utils/asset-manager.d.ts +8 -0
  80. package/esm/lib/utils/asset-manager.d.ts.map +1 -0
  81. package/esm/lib/utils/asset-manager.js +49 -0
  82. package/{types → esm}/lib/utils/class.utils.d.ts +1 -0
  83. package/esm/lib/utils/class.utils.d.ts.map +1 -0
  84. package/{types → esm}/lib/utils/common.utils.d.ts +2 -1
  85. package/esm/lib/utils/common.utils.d.ts.map +1 -0
  86. package/{types → esm}/lib/utils/condition.d.ts +1 -0
  87. package/esm/lib/utils/condition.d.ts.map +1 -0
  88. package/esm/lib/utils/endpoint.utils.d.ts +3 -0
  89. package/esm/lib/utils/endpoint.utils.d.ts.map +1 -0
  90. package/{types → esm}/lib/utils/error.utils.d.ts +1 -0
  91. package/esm/lib/utils/error.utils.d.ts.map +1 -0
  92. package/{types → esm}/lib/utils/factory.d.ts +2 -1
  93. package/esm/lib/utils/factory.d.ts.map +1 -0
  94. package/esm/lib/utils/factory.js +6 -1
  95. package/{types → esm}/lib/utils/file-system.utils.d.ts +2 -1
  96. package/esm/lib/utils/file-system.utils.d.ts.map +1 -0
  97. package/esm/lib/utils/file-system.utils.js +1 -1
  98. package/{types → esm}/lib/utils/generator.utils.d.ts +1 -0
  99. package/esm/lib/utils/generator.utils.d.ts.map +1 -0
  100. package/esm/lib/utils/index.d.ts +16 -0
  101. package/esm/lib/utils/index.d.ts.map +1 -0
  102. package/esm/lib/utils/index.js +1 -0
  103. package/{types → esm}/lib/utils/object.utils.d.ts +1 -0
  104. package/esm/lib/utils/object.utils.d.ts.map +1 -0
  105. package/esm/lib/utils/object.utils.js +6 -1
  106. package/{types → esm}/lib/utils/schema.utils.d.ts +3 -2
  107. package/esm/lib/utils/schema.utils.d.ts.map +1 -0
  108. package/{types → esm}/lib/utils/source-builder.d.ts +8 -6
  109. package/esm/lib/utils/source-builder.d.ts.map +1 -0
  110. package/esm/lib/utils/source-builder.js +39 -6
  111. package/esm/lib/utils/string-builder/index.d.ts +4 -0
  112. package/esm/lib/utils/string-builder/index.d.ts.map +1 -0
  113. package/{types → esm}/lib/utils/string-builder/options.d.ts +1 -0
  114. package/esm/lib/utils/string-builder/options.d.ts.map +1 -0
  115. package/esm/lib/utils/string-builder/options.js +1 -1
  116. package/{types → esm}/lib/utils/string-builder/string-builder.d.ts +3 -2
  117. package/esm/lib/utils/string-builder/string-builder.d.ts.map +1 -0
  118. package/esm/lib/utils/string-builder/string-builder.js +12 -1
  119. package/{types → esm}/lib/utils/string-builder/utils.d.ts +3 -2
  120. package/esm/lib/utils/string-builder/utils.d.ts.map +1 -0
  121. package/{types → esm}/lib/utils/string.utils.d.ts +3 -2
  122. package/esm/lib/utils/string.utils.d.ts.map +1 -0
  123. package/{types → esm}/lib/utils/string.utils.types.d.ts +1 -0
  124. package/esm/lib/utils/string.utils.types.d.ts.map +1 -0
  125. package/{types → esm}/lib/utils/type.utils.d.ts +2 -0
  126. package/esm/lib/utils/type.utils.d.ts.map +1 -0
  127. package/esm/package.json +3 -0
  128. package/package.json +23 -31
  129. package/script/_dnt.shims.d.ts +11 -0
  130. package/script/_dnt.shims.d.ts.map +1 -0
  131. package/script/_dnt.shims.js +75 -0
  132. package/script/index.d.ts +6 -0
  133. package/script/index.d.ts.map +1 -0
  134. package/script/index.js +8 -0
  135. package/script/lib/ast/index.d.ts +2 -0
  136. package/script/lib/ast/index.d.ts.map +1 -0
  137. package/{cjs → script}/lib/ast/index.js +1 -1
  138. package/script/lib/ast/node.d.ts +15 -0
  139. package/script/lib/ast/node.d.ts.map +1 -0
  140. package/{cjs → script}/lib/ast/node.js +6 -0
  141. package/script/lib/codegen/config.d.ts +16 -0
  142. package/script/lib/codegen/config.d.ts.map +1 -0
  143. package/script/lib/codegen/config.js +11 -0
  144. package/script/lib/codegen/endpoints-generator.d.ts +18 -0
  145. package/script/lib/codegen/endpoints-generator.d.ts.map +1 -0
  146. package/{cjs → script}/lib/codegen/endpoints-generator.js +13 -8
  147. package/script/lib/codegen/generator.d.ts +39 -0
  148. package/script/lib/codegen/generator.d.ts.map +1 -0
  149. package/{cjs → script}/lib/codegen/generator.js +33 -19
  150. package/script/lib/codegen/index.d.ts +7 -0
  151. package/script/lib/codegen/index.d.ts.map +1 -0
  152. package/script/lib/codegen/index.js +9 -0
  153. package/script/lib/codegen/internal-utils.d.ts +2 -0
  154. package/script/lib/codegen/internal-utils.d.ts.map +1 -0
  155. package/script/lib/codegen/schemas-generator.d.ts +19 -0
  156. package/script/lib/codegen/schemas-generator.d.ts.map +1 -0
  157. package/{cjs → script}/lib/codegen/schemas-generator.js +17 -11
  158. package/script/lib/codegen/services-generator.d.ts +18 -0
  159. package/script/lib/codegen/services-generator.d.ts.map +1 -0
  160. package/{cjs → script}/lib/codegen/services-generator.js +13 -8
  161. package/script/lib/codegen/types.d.ts +19 -0
  162. package/script/lib/codegen/types.d.ts.map +1 -0
  163. package/script/lib/collect/collector.d.ts +4 -0
  164. package/script/lib/collect/collector.d.ts.map +1 -0
  165. package/{cjs → script}/lib/collect/collector.js +28 -28
  166. package/script/lib/collect/helpers.d.ts +5 -0
  167. package/script/lib/collect/helpers.d.ts.map +1 -0
  168. package/{cjs → script}/lib/collect/helpers.js +2 -2
  169. package/script/lib/collect/index.d.ts +4 -0
  170. package/script/lib/collect/index.d.ts.map +1 -0
  171. package/script/lib/collect/index.js +6 -0
  172. package/script/lib/collect/types.d.ts +13 -0
  173. package/script/lib/collect/types.d.ts.map +1 -0
  174. package/script/lib/internal-utils.d.ts +2 -0
  175. package/script/lib/internal-utils.d.ts.map +1 -0
  176. package/script/lib/parse/deref-proxy.d.ts +4 -0
  177. package/script/lib/parse/deref-proxy.d.ts.map +1 -0
  178. package/{cjs → script}/lib/parse/deref-proxy.js +21 -6
  179. package/script/lib/parse/index.d.ts +4 -0
  180. package/script/lib/parse/index.d.ts.map +1 -0
  181. package/script/lib/parse/index.js +6 -0
  182. package/script/lib/parse/openapi-types.d.ts +898 -0
  183. package/script/lib/parse/openapi-types.d.ts.map +1 -0
  184. package/script/lib/parse/parser.d.ts +19 -0
  185. package/script/lib/parse/parser.d.ts.map +1 -0
  186. package/{cjs → script}/lib/parse/parser.js +32 -21
  187. package/script/lib/parse/types.d.ts +24 -0
  188. package/script/lib/parse/types.d.ts.map +1 -0
  189. package/script/lib/parse/types.js +5 -0
  190. package/script/lib/transform/api-types.d.ts +195 -0
  191. package/script/lib/transform/api-types.d.ts.map +1 -0
  192. package/script/lib/transform/helpers.d.ts +51 -0
  193. package/script/lib/transform/helpers.d.ts.map +1 -0
  194. package/{cjs → script}/lib/transform/helpers.js +16 -10
  195. package/script/lib/transform/index.d.ts +3 -0
  196. package/script/lib/transform/index.d.ts.map +1 -0
  197. package/script/lib/transform/index.js +5 -0
  198. package/script/lib/transform/transform-document.d.ts +4 -0
  199. package/script/lib/transform/transform-document.d.ts.map +1 -0
  200. package/{cjs → script}/lib/transform/transform-document.js +2 -2
  201. package/script/lib/transform/transform-endpoint.d.ts +5 -0
  202. package/script/lib/transform/transform-endpoint.d.ts.map +1 -0
  203. package/{cjs → script}/lib/transform/transform-endpoint.js +18 -18
  204. package/script/lib/transform/transform-schema.d.ts +5 -0
  205. package/script/lib/transform/transform-schema.d.ts.map +1 -0
  206. package/{cjs → script}/lib/transform/transform-schema.js +14 -12
  207. package/script/lib/transform/transformer.d.ts +5 -0
  208. package/script/lib/transform/transformer.d.ts.map +1 -0
  209. package/{cjs → script}/lib/transform/transformer.js +10 -10
  210. package/script/lib/transform/types.d.ts +36 -0
  211. package/script/lib/transform/types.d.ts.map +1 -0
  212. package/script/lib/utils/action-provider.d.ts +29 -0
  213. package/script/lib/utils/action-provider.d.ts.map +1 -0
  214. package/{cjs → script}/lib/utils/action-provider.js +6 -1
  215. package/script/lib/utils/array.utils.d.ts +2 -0
  216. package/script/lib/utils/array.utils.d.ts.map +1 -0
  217. package/script/lib/utils/asset-manager.d.ts +8 -0
  218. package/script/lib/utils/asset-manager.d.ts.map +1 -0
  219. package/script/lib/utils/asset-manager.js +54 -0
  220. package/script/lib/utils/class.utils.d.ts +8 -0
  221. package/script/lib/utils/class.utils.d.ts.map +1 -0
  222. package/script/lib/utils/common.utils.d.ts +16 -0
  223. package/script/lib/utils/common.utils.d.ts.map +1 -0
  224. package/script/lib/utils/condition.d.ts +4 -0
  225. package/script/lib/utils/condition.d.ts.map +1 -0
  226. package/script/lib/utils/endpoint.utils.d.ts +3 -0
  227. package/script/lib/utils/endpoint.utils.d.ts.map +1 -0
  228. package/script/lib/utils/error.utils.d.ts +2 -0
  229. package/script/lib/utils/error.utils.d.ts.map +1 -0
  230. package/script/lib/utils/factory.d.ts +21 -0
  231. package/script/lib/utils/factory.d.ts.map +1 -0
  232. package/{cjs → script}/lib/utils/factory.js +6 -1
  233. package/script/lib/utils/file-system.utils.d.ts +9 -0
  234. package/script/lib/utils/file-system.utils.d.ts.map +1 -0
  235. package/{cjs → script}/lib/utils/file-system.utils.js +2 -2
  236. package/script/lib/utils/generator.utils.d.ts +2 -0
  237. package/script/lib/utils/generator.utils.d.ts.map +1 -0
  238. package/script/lib/utils/index.d.ts +16 -0
  239. package/script/lib/utils/index.d.ts.map +1 -0
  240. package/script/lib/utils/index.js +18 -0
  241. package/script/lib/utils/object.utils.d.ts +3 -0
  242. package/script/lib/utils/object.utils.d.ts.map +1 -0
  243. package/{cjs → script}/lib/utils/object.utils.js +6 -1
  244. package/script/lib/utils/schema.utils.d.ts +11 -0
  245. package/script/lib/utils/schema.utils.d.ts.map +1 -0
  246. package/{cjs → script}/lib/utils/schema.utils.js +2 -2
  247. package/script/lib/utils/source-builder.d.ts +233 -0
  248. package/script/lib/utils/source-builder.d.ts.map +1 -0
  249. package/{cjs → script}/lib/utils/source-builder.js +59 -26
  250. package/script/lib/utils/string-builder/index.d.ts +4 -0
  251. package/script/lib/utils/string-builder/index.d.ts.map +1 -0
  252. package/script/lib/utils/string-builder/index.js +8 -0
  253. package/script/lib/utils/string-builder/options.d.ts +15 -0
  254. package/script/lib/utils/string-builder/options.d.ts.map +1 -0
  255. package/{cjs → script}/lib/utils/string-builder/options.js +2 -2
  256. package/script/lib/utils/string-builder/string-builder.d.ts +73 -0
  257. package/script/lib/utils/string-builder/string-builder.d.ts.map +1 -0
  258. package/{cjs → script}/lib/utils/string-builder/string-builder.js +17 -6
  259. package/script/lib/utils/string-builder/utils.d.ts +22 -0
  260. package/script/lib/utils/string-builder/utils.d.ts.map +1 -0
  261. package/{cjs → script}/lib/utils/string-builder/utils.js +4 -4
  262. package/script/lib/utils/string.utils.d.ts +130 -0
  263. package/script/lib/utils/string.utils.d.ts.map +1 -0
  264. package/{cjs → script}/lib/utils/string.utils.js +2 -2
  265. package/script/lib/utils/string.utils.types.d.ts +150 -0
  266. package/script/lib/utils/string.utils.types.d.ts.map +1 -0
  267. package/script/lib/utils/type.utils.d.ts +57 -0
  268. package/script/lib/utils/type.utils.d.ts.map +1 -0
  269. package/script/package.json +3 -0
  270. package/cjs/index.js +0 -8
  271. package/cjs/lib/codegen/config.js +0 -11
  272. package/cjs/lib/codegen/index.js +0 -9
  273. package/cjs/lib/collect/index.js +0 -6
  274. package/cjs/lib/parse/index.js +0 -6
  275. package/cjs/lib/parse/types.js +0 -5
  276. package/cjs/lib/transform/index.js +0 -5
  277. package/cjs/lib/utils/index.js +0 -17
  278. package/cjs/lib/utils/string-builder/index.js +0 -8
  279. package/cjs/package.json +0 -1
  280. package/types/index.d.ts +0 -5
  281. package/types/lib/ast/index.d.ts +0 -1
  282. package/types/lib/codegen/index.d.ts +0 -6
  283. package/types/lib/collect/collector.d.ts +0 -3
  284. package/types/lib/collect/index.d.ts +0 -3
  285. package/types/lib/parse/deref-proxy.d.ts +0 -3
  286. package/types/lib/parse/index.d.ts +0 -3
  287. package/types/lib/transform/index.d.ts +0 -2
  288. package/types/lib/transform/transform-document.d.ts +0 -3
  289. package/types/lib/transform/transform-endpoint.d.ts +0 -4
  290. package/types/lib/transform/transform-schema.d.ts +0 -4
  291. package/types/lib/transform/transformer.d.ts +0 -4
  292. package/types/lib/utils/endpoint.utils.d.ts +0 -2
  293. package/types/lib/utils/index.d.ts +0 -14
  294. package/types/lib/utils/string-builder/index.d.ts +0 -3
  295. /package/{cjs → script}/lib/codegen/internal-utils.js +0 -0
  296. /package/{cjs → script}/lib/codegen/types.js +0 -0
  297. /package/{cjs → script}/lib/collect/types.js +0 -0
  298. /package/{cjs → script}/lib/internal-utils.js +0 -0
  299. /package/{cjs → script}/lib/parse/openapi-types.js +0 -0
  300. /package/{cjs → script}/lib/transform/api-types.js +0 -0
  301. /package/{cjs → script}/lib/transform/types.js +0 -0
  302. /package/{cjs → script}/lib/utils/array.utils.js +0 -0
  303. /package/{cjs → script}/lib/utils/class.utils.js +0 -0
  304. /package/{cjs → script}/lib/utils/common.utils.js +0 -0
  305. /package/{cjs → script}/lib/utils/condition.js +0 -0
  306. /package/{cjs → script}/lib/utils/endpoint.utils.js +0 -0
  307. /package/{cjs → script}/lib/utils/error.utils.js +0 -0
  308. /package/{cjs → script}/lib/utils/generator.utils.js +0 -0
  309. /package/{cjs → script}/lib/utils/string.utils.types.js +0 -0
  310. /package/{cjs → script}/lib/utils/type.utils.js +0 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./array.utils.js"), exports);
5
+ tslib_1.__exportStar(require("./asset-manager.js"), exports);
6
+ tslib_1.__exportStar(require("./class.utils.js"), exports);
7
+ tslib_1.__exportStar(require("./common.utils.js"), exports);
8
+ tslib_1.__exportStar(require("./endpoint.utils.js"), exports);
9
+ tslib_1.__exportStar(require("./error.utils.js"), exports);
10
+ tslib_1.__exportStar(require("./factory.js"), exports);
11
+ tslib_1.__exportStar(require("./generator.utils.js"), exports);
12
+ tslib_1.__exportStar(require("./object.utils.js"), exports);
13
+ tslib_1.__exportStar(require("./schema.utils.js"), exports);
14
+ tslib_1.__exportStar(require("./source-builder.js"), exports);
15
+ tslib_1.__exportStar(require("./string-builder/index.js"), exports);
16
+ tslib_1.__exportStar(require("./string.utils.js"), exports);
17
+ tslib_1.__exportStar(require("./string.utils.types.js"), exports);
18
+ tslib_1.__exportStar(require("./type.utils.js"), exports);
@@ -0,0 +1,3 @@
1
+ export declare function createOverwriteProxy<T extends object>(target: T, values?: Partial<T>): T;
2
+ export declare function getDeepProperty(obj: object, path: string[]): unknown;
3
+ //# sourceMappingURL=object.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/object.utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAMxF;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CASpE"}
@@ -21,7 +21,12 @@ function getDeepProperty(obj, path) {
21
21
  }
22
22
  class OverwriteProxyHandler {
23
23
  constructor() {
24
- this._overwrittenValues = {};
24
+ Object.defineProperty(this, "_overwrittenValues", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: {}
29
+ });
25
30
  }
26
31
  get(target, prop) {
27
32
  var _a;
@@ -0,0 +1,11 @@
1
+ import type { OpenApiSchema } from '../parse/index.js';
2
+ import type { ApiSchema } from '../transform/index.js';
3
+ export declare function resolveAnyOfAndAllOf(schema: ApiSchema<'combined' | 'object'>, ignoreNonObjectParts: boolean): ApiSchema<'object'> | undefined;
4
+ /**
5
+ * Retrieves the first schema reference and the reference chain of a given schema that
6
+ * defines some schema properties. (e.g. schemas with just "$ref" are skipped)
7
+ * @param schema The schema to retrieve the reference from.
8
+ * @param propertiesToIgnore The properties to ignore when checking for a schema definition.
9
+ */
10
+ export declare function getSchemaReference(schema: ApiSchema, propertiesToIgnore: (keyof OpenApiSchema)[]): ApiSchema;
11
+ //# sourceMappingURL=schema.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/schema.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAA0C,MAAM,uBAAuB,CAAC;AAE/F,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,CAAC,UAAU,GAAG,QAAQ,CAAC,EACxC,oBAAoB,EAAE,OAAO,GAC5B,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAS,CAgCjC;AA0FD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,MAAM,aAAa,CAAC,EAAE,GAAG,SAAS,CAM5G"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveAnyOfAndAllOf = resolveAnyOfAndAllOf;
4
4
  exports.getSchemaReference = getSchemaReference;
5
- const internal_utils_1 = require("../internal-utils");
5
+ const internal_utils_js_1 = require("../internal-utils.js");
6
6
  function resolveAnyOfAndAllOf(schema, ignoreNonObjectParts) {
7
7
  if (!ignoreNonObjectParts && (hasInvalidSubSchema(schema.anyOf) || hasInvalidSubSchema(schema.allOf))) {
8
8
  return undefined;
@@ -115,6 +115,6 @@ function hasInvalidSubSchema(subSchemas) {
115
115
  function getSchemaReference(schema, propertiesToIgnore) {
116
116
  if (!schema.$ref)
117
117
  return schema;
118
- const hasPropertiesDefined = Object.keys(schema.$src.originalComponent).some((key) => (0, internal_utils_1.isOpenApiObjectProperty)(key) && !propertiesToIgnore.includes(key));
118
+ const hasPropertiesDefined = Object.keys(schema.$src.originalComponent).some((key) => (0, internal_utils_js_1.isOpenApiObjectProperty)(key) && !propertiesToIgnore.includes(key));
119
119
  return hasPropertiesDefined ? schema : getSchemaReference(schema.$ref, propertiesToIgnore);
120
120
  }
@@ -0,0 +1,233 @@
1
+ import { type Condition } from './condition.js';
2
+ import { type AppendParam, type AppendValue, StringBuilder, type StringBuilderOptions } from './string-builder/index.js';
3
+ import type { BuilderFn } from './string-builder/string-builder.js';
4
+ import type { Nullable } from './type.utils.js';
5
+ export type IndentOptions = {
6
+ readonly type: 'tabs';
7
+ } | {
8
+ readonly type: 'spaces';
9
+ readonly count: number;
10
+ };
11
+ /**
12
+ * Options for the `SourceBuilder` class.
13
+ */
14
+ export type SourceBuilderOptions = StringBuilderOptions & {
15
+ /**
16
+ * The type of indentation to use.
17
+ * @default { type: 'spaces', count: 2 }
18
+ */
19
+ indent: IndentOptions;
20
+ };
21
+ /**
22
+ * Default options for the `SourceBuilder` class.
23
+ */
24
+ export declare const defaultSourceBuilderOptions: SourceBuilderOptions;
25
+ type KnownParatheses = '()' | '[]' | '{}' | '<>';
26
+ export type Paratheses<TBuilder extends StringBuilder> = KnownParatheses | Omit<string, KnownParatheses> | [open: Nullable<AppendValue<TBuilder>>, close: Nullable<AppendValue<TBuilder>>];
27
+ export type SeparatorBuidlerFn<TBuilder, TItem> = (builder: TBuilder, previousItem: TItem, nextItem: TItem, previousItemIndex: number, nextItemIndex: number) => void;
28
+ export type Separator<TBuilder, TItem> = string | SeparatorBuidlerFn<TBuilder, TItem>;
29
+ /**
30
+ * Options for the `parenthesize` methods of the `SourceBuilder`.
31
+ * @see SourceBuilder.parenthesize
32
+ * @see SourceBuilder.parenthesizeIf
33
+ */
34
+ export type ParenthesizeOptions = {
35
+ /**
36
+ * Whether to add line breaks after start and before end of the parentheses.
37
+ * @default false
38
+ */
39
+ readonly multiline?: boolean;
40
+ /**
41
+ * Whether to indent the content inside parentheses.
42
+ * @default true
43
+ */
44
+ readonly indent?: boolean;
45
+ /**
46
+ * Whether to pretend that the current line and the one before is empty or consists only of whitespace characters.
47
+ * This is useful when the parentheses are used as a block and `ensurePreviousLineEmpty` is used.
48
+ * @default true
49
+ */
50
+ readonly pretendEmpty?: boolean;
51
+ };
52
+ /**
53
+ * Options for the `forEach` methods of the `SourceBuilder`.
54
+ * @see SourceBuilder.forEach
55
+ * @see SourceBuilder.forEachIf
56
+ */
57
+ export type ForEachOptions<TBuilder, TItem> = {
58
+ /**
59
+ * The condition to check before adding content for each item. Defaults to `true`.
60
+ */
61
+ readonly condition?: Condition<TItem>;
62
+ /**
63
+ * The seperator to add between items. Default to `undefined`.
64
+ */
65
+ readonly separator?: Separator<TBuilder, TItem>;
66
+ };
67
+ type SwitchCase<TValue, TBuilder extends StringBuilder> = {
68
+ case: TValue;
69
+ value: AppendValue<TBuilder>;
70
+ };
71
+ /**
72
+ * Represents an in-memory source file.
73
+ */
74
+ export declare class SourceBuilder<TAdditionalAppends = never> extends StringBuilder<TAdditionalAppends> {
75
+ private readonly __options;
76
+ private readonly _indentString;
77
+ private _isLineIndented;
78
+ private _isLastLineEmpty;
79
+ private _isCurrentLineEmpty;
80
+ private _linePrefixNodes;
81
+ /**
82
+ * Gets the options used by this instance.
83
+ */
84
+ get options(): SourceBuilderOptions;
85
+ /**
86
+ * Initializes a new instance of the SourceBuilder class.
87
+ * @param options The options to use for this instance.
88
+ */
89
+ constructor(options?: Partial<SourceBuilderOptions>);
90
+ /**
91
+ * Creates a new instance of the SourceBuilder class from a string.
92
+ * @param str The string to use as the initial content of the builder.
93
+ * @param options The options to use for this instance.
94
+ * @returns A new instance of the SourceBuilder class.
95
+ */
96
+ static fromString(str: string, options?: Partial<SourceBuilderOptions>): SourceBuilder;
97
+ /**
98
+ * Builds a string using a callback function that receives a `SourceBuilder` instance.
99
+ * @param buildAction The callback function that receives a `SourceBuilder` instance to build the string.
100
+ * @param options The options to use for the `SourceBuilder` instance.
101
+ * @returns The string built by the `SourceBuilder` instance.
102
+ */
103
+ static build(buildAction: AppendParam<SourceBuilder, never>, options?: Partial<SourceBuilderOptions>): string;
104
+ protected appendSingle(value: AppendParam<this, TAdditionalAppends>): void;
105
+ /**
106
+ * Appends one or more strings to the end of the current SourceBuilder if the specified condition is true.
107
+ * @param condition The condition to check before appending the specified value.
108
+ * @param value The string(s) to append.
109
+ * @returns The current SourceBuilder.
110
+ */
111
+ appendIf(condition: Condition, ...value: AppendParam<this, TAdditionalAppends>[]): this;
112
+ /**
113
+ * Appends one or more strings to the end of the current SourceBuilder, followed by a line terminator.
114
+ * @param value The string(s) to append.
115
+ * @returns The current SourceBuilder.
116
+ */
117
+ appendLine(...value: AppendParam<this, TAdditionalAppends>[]): this;
118
+ /**
119
+ * Appends one or more strings to the end of the current SourceBuilder, followed by a line terminator, if the specified condition is true.
120
+ * @param condition The condition to check before appending the specified value.
121
+ * @param value The string(s) to append.
122
+ * @returns The current SourceBuilder.
123
+ */
124
+ appendLineIf(condition: Condition, ...value: AppendParam<this, TAdditionalAppends>[]): this;
125
+ /**
126
+ * Appends the specified values to this source builder with the specified line prefix.
127
+ * @param {string} prefix - The line prefix to use.
128
+ * @param {...(string|null|undefined)} value - The values to append.
129
+ * @returns {SourceBuilder} This source builder instance.
130
+ */
131
+ appendWithLinePrefix(prefix: string, ...value: AppendParam<this, TAdditionalAppends>[]): this;
132
+ /**
133
+ * Appends the specified values to this source builder as a new line with the specified line prefix.
134
+ * @param {string} prefix - The line prefix to use.
135
+ * @param {...(string|null|undefined)} value - The values to append.
136
+ * @returns {SourceBuilder} This source builder instance.
137
+ */
138
+ appendLineWithLinePrefix(prefix: string, ...value: AppendParam<this, TAdditionalAppends>[]): this;
139
+ /**
140
+ * Prepends one or more strings to the beginning of the current SourceBuilder if the specified condition is true.
141
+ * @param condition The condition to check before prepending the specified value.
142
+ * @param value The string(s) to prepend.
143
+ * @returns The current SourceBuilder.
144
+ */
145
+ prependIf(condition: Condition, ...value: AppendParam<StringBuilder, never>[]): this;
146
+ /**
147
+ * Prepends one or more strings to the beginning of the current SourceBuilder, followed by a line terminator, if the specified condition is true.
148
+ * @param condition The condition to check before appending the specified value.
149
+ * @param value The string(s) to prepend.
150
+ * @returns The current SourceBuilder.
151
+ */
152
+ prependLineIf(condition: Condition, ...value: AppendParam<StringBuilder, never>[]): this;
153
+ /**
154
+ * Ensures that the current line and the one before is empty or consists only of whitespace characters.
155
+ * @returns A reference to this instance.
156
+ */
157
+ ensurePreviousLineEmpty(): this;
158
+ /**
159
+ * Ensures that the current line is empty or consists only of whitespace characters.
160
+ * @returns A reference to this instance.
161
+ */
162
+ ensureCurrentLineEmpty(): this;
163
+ /**
164
+ * Pretends that the current line and the one before is empty or consists only of whitespace characters.
165
+ * @returns A reference to this instance.
166
+ */
167
+ pretendPreviousLineEmpty(): this;
168
+ /**
169
+ * Pretends that the current line is empty or consists only of whitespace characters.
170
+ * @returns A reference to this instance.
171
+ */
172
+ pretendCurrentLineEmpty(): this;
173
+ /**
174
+ * Inserts specified content if the specified condition is true.
175
+ * @param condition The condition to check before inserting content.
176
+ * @param builderFn The function to add content if the condition is true.
177
+ * @param elseBuilderFn The function to add content if the condition is false.
178
+ * @returns A reference to this instance.
179
+ */
180
+ if(condition: Condition, builderFn: AppendParam<this, TAdditionalAppends>, elseBuilderFn?: AppendParam<this, TAdditionalAppends>): this;
181
+ switch<T extends string | number>(value: T, cases: Record<T, AppendParam<this, TAdditionalAppends>>, defaultBuilderFn?: AppendParam<this, TAdditionalAppends>): this;
182
+ switch<T>(value: T, cases: SwitchCase<T, this>[], defaultBuilderFn?: AppendParam<this, TAdditionalAppends>, equals?: (a: T, b: T) => boolean): this;
183
+ /**
184
+ * Adds one indentation level. If the current line already contains characters, only subsequent lines are affected.
185
+ * @param builderFn The function to add indented content or the content itself.
186
+ * @param condition The condition to check before adding indentation.
187
+ * @returns A reference to this instance.
188
+ */
189
+ indent(value: AppendParam<this, TAdditionalAppends>): this;
190
+ /**
191
+ * Adds one indentation level if the specified condition is true. If the current line already contains characters, only subsequent lines are affected.
192
+ * @param builderFn The function to add indented content or the content itself.
193
+ * @param condition The condition to check before adding indentation.
194
+ * @returns A reference to this instance.
195
+ */
196
+ indentIf(condition: Condition, value: AppendParam<this, TAdditionalAppends>): this;
197
+ /**
198
+ * Adds parentheses around the specified content.
199
+ * @param brackets The brackets to use.
200
+ * @param value The function to add content inside parentheses or one string that should be parenthesized.
201
+ * @param options Options for the parentheses.
202
+ * @returns A reference to this instance.
203
+ */
204
+ parenthesize(brackets: Paratheses<this>, value: AppendParam<this, TAdditionalAppends>, options?: ParenthesizeOptions): this;
205
+ /**
206
+ * Adds parentheses around the specified content if the specified condition is true.
207
+ * @param condition The condition to check before adding parentheses.
208
+ * @param brackets The brackets to use.
209
+ * @param value The function to add content inside parentheses or one string that should be parenthesized.
210
+ * @param options Options for the parentheses.
211
+ * @returns A reference to this instance.
212
+ */
213
+ parenthesizeIf(condition: Condition, brackets: Paratheses<this>, value: AppendParam<this, TAdditionalAppends>, options?: ParenthesizeOptions): this;
214
+ /**
215
+ * Adds content for each item in the specified array.
216
+ * @param items The items to add content for.
217
+ * @param builderFn The function to add content for each item.
218
+ * @param options The options for the loop.
219
+ * @returns A reference to this instance.
220
+ */
221
+ forEach<T>(items: Iterable<T>, builderFn: (builder: this, item: T, index: number) => void, options?: ForEachOptions<this, T>): this;
222
+ forEachIf<T>(condition: Condition, items: Iterable<T>, builderFn: (builder: this, item: T, index: number) => void, options?: ForEachOptions<this, T>): this;
223
+ appendSeparated(items: Iterable<AppendParam<this, TAdditionalAppends>>, separator: string): this;
224
+ appendSeparatedIf(condition: Condition, items: Iterable<AppendParam<this, TAdditionalAppends>>, separator: string): this;
225
+ private appendIndent;
226
+ }
227
+ declare function _builderTemplate<T extends SourceBuilder>(template: readonly string[] | ArrayLike<string>, ...substitutions: AppendValue<T>[]): BuilderFn<T>;
228
+ declare const _builderTemplateExtensions: {
229
+ readonly indent: <T extends SourceBuilder>(template: readonly string[] | ArrayLike<string>, ...substitutions: AppendValue<T>[]) => BuilderFn<T>;
230
+ };
231
+ export declare const builderTemplate: typeof _builderTemplate & typeof _builderTemplateExtensions;
232
+ export {};
233
+ //# sourceMappingURL=source-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-builder.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/source-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,WAAW,EAEhB,aAAa,EACb,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5G;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IACxD;;;OAGG;IACH,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,oBAIzC,CAAC;AAEF,KAAK,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACjD,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,aAAa,IACjD,eAAe,GACf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GAAG,IAAI;IAIhG,iBAAiB,CACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,EACtD,SAAS,EAAE,MAAM,GAChB,IAAI;IAOP,OAAO,CAAC,YAAY;CAGrB;AAED,iBAAS,gBAAgB,CAAC,CAAC,SAAS,aAAa,EAC/C,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,EAC/C,GAAG,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GACjC,SAAS,CAAC,CAAC,CAAC,CAiBd;AAED,QAAA,MAAM,0BAA0B;sBACrB,CAAC,SAAS,aAAa,YACpB,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,oBAC7B,WAAW,CAAC,CAAC,CAAC,EAAE,KACjC,SAAS,CAAC,CAAC,CAAC;CAGP,CAAC;AAEX,eAAO,MAAM,eAAe,EAAE,OAAO,gBAAgB,GAAG,OAAO,0BAG9D,CAAC"}
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.builderTemplate = exports.SourceBuilder = exports.defaultSourceBuilderOptions = void 0;
4
- const common_utils_1 = require("./common.utils");
5
- const condition_1 = require("./condition");
6
- const string_builder_1 = require("./string-builder");
7
- const string_utils_1 = require("./string.utils");
4
+ const common_utils_js_1 = require("./common.utils.js");
5
+ const condition_js_1 = require("./condition.js");
6
+ const index_js_1 = require("./string-builder/index.js");
7
+ const string_utils_js_1 = require("./string.utils.js");
8
8
  /**
9
9
  * Default options for the `SourceBuilder` class.
10
10
  */
11
11
  exports.defaultSourceBuilderOptions = {
12
- ...string_builder_1.defaultStringBuilderOptions,
12
+ ...index_js_1.defaultStringBuilderOptions,
13
13
  indent: { type: 'spaces', count: 2 },
14
14
  };
15
15
  /**
16
16
  * Represents an in-memory source file.
17
17
  */
18
- class SourceBuilder extends string_builder_1.StringBuilder {
18
+ class SourceBuilder extends index_js_1.StringBuilder {
19
19
  /**
20
20
  * Gets the options used by this instance.
21
21
  */
@@ -28,10 +28,42 @@ class SourceBuilder extends string_builder_1.StringBuilder {
28
28
  */
29
29
  constructor(options) {
30
30
  super(options);
31
- this._isLineIndented = false;
32
- this._isLastLineEmpty = true;
33
- this._isCurrentLineEmpty = true;
34
- this._linePrefixNodes = [];
31
+ Object.defineProperty(this, "__options", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ Object.defineProperty(this, "_indentString", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: void 0
42
+ });
43
+ Object.defineProperty(this, "_isLineIndented", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: false
48
+ });
49
+ Object.defineProperty(this, "_isLastLineEmpty", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: true
54
+ });
55
+ Object.defineProperty(this, "_isCurrentLineEmpty", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: true
60
+ });
61
+ Object.defineProperty(this, "_linePrefixNodes", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: []
66
+ });
35
67
  this.__options = { ...exports.defaultSourceBuilderOptions, ...options };
36
68
  this._indentString = this.__options.indent.type === 'tabs' ? '\t' : ' '.repeat(this.__options.indent.count);
37
69
  }
@@ -59,7 +91,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
59
91
  }
60
92
  appendSingle(value) {
61
93
  var _a;
62
- if ((0, common_utils_1.isNullish)(value))
94
+ if ((0, common_utils_js_1.isNullish)(value))
63
95
  return;
64
96
  if (Array.isArray(value)) {
65
97
  for (const part of value) {
@@ -94,13 +126,13 @@ class SourceBuilder extends string_builder_1.StringBuilder {
94
126
  if (!this._isLineIndented) {
95
127
  this.appendIndent();
96
128
  }
97
- this.str += (0, string_utils_1.removeStr)(value.substring(lineStartIndex, i), '\r');
129
+ this.str += (0, string_utils_js_1.removeStr)(value.substring(lineStartIndex, i), '\r');
98
130
  }
99
131
  this._isLastLineEmpty = this._isCurrentLineEmpty;
100
132
  if (this._isCurrentLineEmpty && this._linePrefixNodes.some((x) => x.kind !== 'indent')) {
101
133
  this.appendIndent();
102
134
  }
103
- this.str = (0, string_utils_1.trimEnd)(this.str, false) + '\n';
135
+ this.str = (0, string_utils_js_1.trimEnd)(this.str, false) + '\n';
104
136
  this._isLineIndented = false;
105
137
  this._isCurrentLineEmpty = true;
106
138
  lineStartIndex = i + 1;
@@ -113,7 +145,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
113
145
  this.appendIndent();
114
146
  this._isLineIndented = true;
115
147
  }
116
- this.str += (0, string_utils_1.removeStr)(value.substring(lineStartIndex), '\r');
148
+ this.str += (0, string_utils_js_1.removeStr)(value.substring(lineStartIndex), '\r');
117
149
  }
118
150
  /**
119
151
  * Appends one or more strings to the end of the current SourceBuilder if the specified condition is true.
@@ -122,7 +154,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
122
154
  * @returns The current SourceBuilder.
123
155
  */
124
156
  appendIf(condition, ...value) {
125
- if ((0, condition_1.evalCondition)(condition)) {
157
+ if ((0, condition_js_1.evalCondition)(condition)) {
126
158
  return this.append(...value);
127
159
  }
128
160
  return this;
@@ -142,7 +174,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
142
174
  * @returns The current SourceBuilder.
143
175
  */
144
176
  appendLineIf(condition, ...value) {
145
- if ((0, condition_1.evalCondition)(condition)) {
177
+ if ((0, condition_js_1.evalCondition)(condition)) {
146
178
  return this.appendLine(...value);
147
179
  }
148
180
  return this;
@@ -179,7 +211,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
179
211
  * @returns The current SourceBuilder.
180
212
  */
181
213
  prependIf(condition, ...value) {
182
- if ((0, condition_1.evalCondition)(condition)) {
214
+ if ((0, condition_js_1.evalCondition)(condition)) {
183
215
  this.prepend(...value);
184
216
  }
185
217
  return this;
@@ -191,7 +223,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
191
223
  * @returns The current SourceBuilder.
192
224
  */
193
225
  prependLineIf(condition, ...value) {
194
- if ((0, condition_1.evalCondition)(condition)) {
226
+ if ((0, condition_js_1.evalCondition)(condition)) {
195
227
  this.prependLine(...value);
196
228
  }
197
229
  return this;
@@ -244,7 +276,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
244
276
  * @returns A reference to this instance.
245
277
  */
246
278
  if(condition, builderFn, elseBuilderFn) {
247
- return (0, condition_1.evalCondition)(condition) ? this.append(builderFn) : this.append(elseBuilderFn);
279
+ return (0, condition_js_1.evalCondition)(condition) ? this.append(builderFn) : this.append(elseBuilderFn);
248
280
  }
249
281
  switch(value, cases, defaultBuilderFn, equals) {
250
282
  var _a;
@@ -284,7 +316,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
284
316
  * @returns A reference to this instance.
285
317
  */
286
318
  indentIf(condition, value) {
287
- return (0, condition_1.evalCondition)(condition) ? this.indent(value) : this.append(value);
319
+ return (0, condition_js_1.evalCondition)(condition) ? this.indent(value) : this.append(value);
288
320
  }
289
321
  /**
290
322
  * Adds parentheses around the specified content.
@@ -326,7 +358,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
326
358
  * @returns A reference to this instance.
327
359
  */
328
360
  parenthesizeIf(condition, brackets, value, options) {
329
- if ((0, condition_1.evalCondition)(condition)) {
361
+ if ((0, condition_js_1.evalCondition)(condition)) {
330
362
  return this.parenthesize(brackets, value, options);
331
363
  }
332
364
  else if (options === null || options === void 0 ? void 0 : options.indent) {
@@ -354,7 +386,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
354
386
  let previousItem = undefined;
355
387
  let index = 0;
356
388
  for (const item of items) {
357
- if ((0, condition_1.evalCondition)(condition, item)) {
389
+ if ((0, condition_js_1.evalCondition)(condition, item)) {
358
390
  if (previousIndex >= 0 && seperator) {
359
391
  if (typeof seperator === 'string') {
360
392
  this.append(seperator);
@@ -372,7 +404,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
372
404
  return this;
373
405
  }
374
406
  forEachIf(condition, items, builderFn, options) {
375
- if ((0, condition_1.evalCondition)(condition)) {
407
+ if ((0, condition_js_1.evalCondition)(condition)) {
376
408
  return this.forEach(items, builderFn, options);
377
409
  }
378
410
  return this;
@@ -381,7 +413,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
381
413
  return this.forEach(items, (builder, item) => builder.append(item), { separator });
382
414
  }
383
415
  appendSeparatedIf(condition, items, separator) {
384
- if ((0, condition_1.evalCondition)(condition)) {
416
+ if ((0, condition_js_1.evalCondition)(condition)) {
385
417
  return this.appendSeparated(items, separator);
386
418
  }
387
419
  return this;
@@ -410,8 +442,9 @@ function _builderTemplate(template, ...substitutions) {
410
442
  }
411
443
  };
412
444
  }
413
- exports.builderTemplate = Object.assign(_builderTemplate, {
445
+ const _builderTemplateExtensions = {
414
446
  indent: (template, ...substitutions) => {
415
447
  return (b) => b.indent(_builderTemplate(template, ...substitutions));
416
448
  },
417
- });
449
+ };
450
+ exports.builderTemplate = Object.assign(_builderTemplate, _builderTemplateExtensions);
@@ -0,0 +1,4 @@
1
+ export * from './options.js';
2
+ export { type AppendParam, StringBuilder } from './string-builder.js';
3
+ export * from './utils.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/string-builder/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,cAAc,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringBuilder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./options.js"), exports);
6
+ var string_builder_js_1 = require("./string-builder.js");
7
+ Object.defineProperty(exports, "StringBuilder", { enumerable: true, get: function () { return string_builder_js_1.StringBuilder; } });
8
+ tslib_1.__exportStar(require("./utils.js"), exports);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Options for the `StringBuilder` class.
3
+ */
4
+ export type StringBuilderOptions = {
5
+ /**
6
+ * The string to use for new lines.
7
+ * @default os.EOL
8
+ */
9
+ readonly newLine: string;
10
+ };
11
+ /**
12
+ * Default options for the `StringBuilder` class.
13
+ */
14
+ export declare const defaultStringBuilderOptions: StringBuilderOptions;
15
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/string-builder/options.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,oBAEzC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultStringBuilderOptions = void 0;
4
- const os_1 = require("os");
4
+ const node_os_1 = require("node:os");
5
5
  /**
6
6
  * Default options for the `StringBuilder` class.
7
7
  */
8
8
  exports.defaultStringBuilderOptions = {
9
- newLine: os_1.EOL,
9
+ newLine: node_os_1.EOL,
10
10
  };
@@ -0,0 +1,73 @@
1
+ import { type StringBuilderOptions } from './options.js';
2
+ import type { Nullable, SingleOrMultiple } from '../type.utils.js';
3
+ export type BuilderFn<TBuilder extends StringBuilder> = (builder: TBuilder) => void;
4
+ export type Primitive = string | number | boolean;
5
+ export type AppendParam<TBuilder extends StringBuilder, TAdditionalAppends> = SingleOrMultiple<Primitive | null | undefined | BuilderFn<TBuilder> | TAdditionalAppends | {
6
+ __type: 'append-value-group';
7
+ values: AppendParam<TBuilder, TAdditionalAppends>[];
8
+ separator: string | null;
9
+ }>;
10
+ export declare const AdditionalAppendsSymbol: unique symbol;
11
+ /**
12
+ * Represents a mutable string of characters.
13
+ */
14
+ export declare class StringBuilder<TAdditionalAppends = never> {
15
+ private readonly _options;
16
+ protected str: string;
17
+ [AdditionalAppendsSymbol](_: TAdditionalAppends): void;
18
+ get options(): StringBuilderOptions;
19
+ /**
20
+ * Initializes a new instance of the StringBuilder class.
21
+ * @param options The options.
22
+ */
23
+ constructor(options?: Partial<StringBuilderOptions>);
24
+ /**
25
+ * Creates a new StringBuilder instance and appends the specified string to it.
26
+ * @param str The string to append.
27
+ * @param options The options.
28
+ * @returns A new StringBuilder instance.
29
+ */
30
+ static fromString(str: string, options?: Partial<StringBuilderOptions>): StringBuilder;
31
+ /**
32
+ * Builds a string using a StringBuilder build action.
33
+ * @param buildAction The build action to perform on the StringBuilder instance.
34
+ * @param options The options for the StringBuilder instance.
35
+ * @returns The built string.
36
+ */
37
+ static build(buildAction: AppendParam<StringBuilder, never>, options?: Partial<StringBuilderOptions>): string;
38
+ protected appendSingle(value: AppendParam<this, TAdditionalAppends>): void;
39
+ /**
40
+ * Appends one or more strings to the end of the current StringBuilder.
41
+ * @param value The string(s) to append.
42
+ * @returns The current StringBuilder.
43
+ */
44
+ append(...value: AppendParam<this, TAdditionalAppends>[]): this;
45
+ /**
46
+ * Appends one or more strings to the end of the current StringBuilder, followed by a line terminator.
47
+ * @param value
48
+ * @returns
49
+ */
50
+ appendLine(...value: Nullable<AppendParam<this, TAdditionalAppends>>[]): this;
51
+ /**
52
+ * Prepends one or more strings to the beginning of the current StringBuilder.
53
+ * @param value The string(s) to prepend.
54
+ * @returns The current StringBuilder.
55
+ */
56
+ prepend(...value: AppendParam<StringBuilder, never>[]): this;
57
+ /**
58
+ * Prepends one or more strings to the beginning of the current StringBuilder, followed by a line terminator.
59
+ * @param value The string(s) to prepend.
60
+ * @returns The current StringBuilder.
61
+ */
62
+ prependLine(...value: AppendParam<StringBuilder, never>[]): this;
63
+ /**
64
+ * Converts the value of this instance to a string.
65
+ * @returns A string whose value is the same as this instance.
66
+ */
67
+ toString(): string;
68
+ /**
69
+ * Removes all characters from the current StringBuilder.
70
+ */
71
+ clear(): void;
72
+ }
73
+ //# sourceMappingURL=string-builder.d.ts.map