@skmtc/core 0.0.800 → 0.0.803

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 (291) hide show
  1. package/esm/context/CoreContext.d.ts +2 -2
  2. package/esm/context/CoreContext.d.ts.map +1 -1
  3. package/esm/context/GenerateContext.d.ts +16 -3
  4. package/esm/context/GenerateContext.d.ts.map +1 -1
  5. package/esm/context/ParseContext.d.ts +3 -3
  6. package/esm/context/ParseContext.d.ts.map +1 -1
  7. package/esm/context/RenderContext.d.ts +153 -1
  8. package/esm/context/RenderContext.d.ts.map +1 -1
  9. package/esm/context/RenderContext.js +179 -0
  10. package/esm/context/types.d.ts +30 -0
  11. package/esm/context/types.d.ts.map +1 -1
  12. package/esm/dsl/model/ModelBase.d.ts +1 -1
  13. package/esm/dsl/model/ModelBase.d.ts.map +1 -1
  14. package/esm/dsl/model/ModelDriver.d.ts +62 -0
  15. package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
  16. package/esm/dsl/model/ModelDriver.js +63 -1
  17. package/esm/dsl/model/toModelBase.d.ts +66 -0
  18. package/esm/dsl/model/toModelBase.d.ts.map +1 -1
  19. package/esm/dsl/model/toModelBase.js +46 -0
  20. package/esm/dsl/model/toModelEntry.d.ts +63 -0
  21. package/esm/dsl/model/toModelEntry.d.ts.map +1 -1
  22. package/esm/dsl/model/toModelEntry.js +63 -0
  23. package/esm/dsl/operation/OperationBase.d.ts +3 -3
  24. package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
  25. package/esm/dsl/operation/OperationDriver.d.ts +84 -0
  26. package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
  27. package/esm/dsl/operation/OperationDriver.js +85 -1
  28. package/esm/dsl/operation/toOperationBase.d.ts +58 -0
  29. package/esm/dsl/operation/toOperationBase.d.ts.map +1 -1
  30. package/esm/dsl/operation/toOperationBase.js +46 -0
  31. package/esm/dsl/operation/toOperationEntry.d.ts +37 -0
  32. package/esm/dsl/operation/toOperationEntry.d.ts.map +1 -1
  33. package/esm/dsl/operation/toOperationEntry.js +28 -0
  34. package/esm/helpers/isEmpty.d.ts +1 -1
  35. package/esm/helpers/isEmpty.d.ts.map +1 -1
  36. package/esm/helpers/tracer.d.ts +1 -1
  37. package/esm/helpers/tracer.d.ts.map +1 -1
  38. package/esm/helpers/tracer.js +1 -1
  39. package/esm/mod.d.ts +52 -0
  40. package/esm/mod.d.ts.map +1 -1
  41. package/esm/mod.js +52 -0
  42. package/esm/oas/array/Array.d.ts +26 -0
  43. package/esm/oas/array/Array.d.ts.map +1 -1
  44. package/esm/oas/array/Array.js +26 -0
  45. package/esm/oas/array/array-types.d.ts +32 -11
  46. package/esm/oas/array/array-types.d.ts.map +1 -1
  47. package/esm/oas/array/array-types.js +16 -0
  48. package/esm/oas/array/toArray.d.ts +111 -0
  49. package/esm/oas/array/toArray.d.ts.map +1 -1
  50. package/esm/oas/array/toArray.js +115 -3
  51. package/esm/oas/boolean/Boolean.d.ts +26 -0
  52. package/esm/oas/boolean/Boolean.d.ts.map +1 -1
  53. package/esm/oas/boolean/Boolean.js +26 -0
  54. package/esm/oas/boolean/boolean-types.d.ts +1 -7
  55. package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
  56. package/esm/oas/boolean/toBoolean.d.ts +57 -0
  57. package/esm/oas/boolean/toBoolean.d.ts.map +1 -1
  58. package/esm/oas/boolean/toBoolean.js +57 -0
  59. package/esm/oas/components/components-types.d.ts +19 -0
  60. package/esm/oas/components/components-types.d.ts.map +1 -0
  61. package/esm/oas/components/components-types.js +21 -0
  62. package/esm/oas/contact/contact-types.d.ts +9 -0
  63. package/esm/oas/contact/contact-types.d.ts.map +1 -0
  64. package/esm/oas/contact/contact-types.js +7 -0
  65. package/esm/oas/discriminator/discriminator-types.d.ts +1 -5
  66. package/esm/oas/discriminator/discriminator-types.d.ts.map +1 -1
  67. package/esm/oas/document/document-types.d.ts +16 -0
  68. package/esm/oas/document/document-types.d.ts.map +1 -0
  69. package/esm/oas/document/document-types.js +18 -0
  70. package/esm/oas/example/example-types.d.ts +1 -6
  71. package/esm/oas/example/example-types.d.ts.map +1 -1
  72. package/esm/oas/header/header-types.d.ts +50 -0
  73. package/esm/oas/header/header-types.d.ts.map +1 -0
  74. package/esm/oas/header/header-types.js +30 -0
  75. package/esm/oas/info/info-types.d.ts +14 -0
  76. package/esm/oas/info/info-types.d.ts.map +1 -0
  77. package/esm/oas/info/info-types.js +13 -0
  78. package/esm/oas/integer/integer-types.d.ts +3 -17
  79. package/esm/oas/integer/integer-types.d.ts.map +1 -1
  80. package/esm/oas/license/license-types.d.ts +9 -0
  81. package/esm/oas/license/license-types.d.ts.map +1 -0
  82. package/esm/oas/license/license-types.js +7 -0
  83. package/esm/oas/mediaType/mediaType-types.d.ts +1 -11
  84. package/esm/oas/mediaType/mediaType-types.d.ts.map +1 -1
  85. package/esm/oas/number/number-types.d.ts +2 -16
  86. package/esm/oas/number/number-types.d.ts.map +1 -1
  87. package/esm/oas/number/toNumber.d.ts +62 -0
  88. package/esm/oas/number/toNumber.d.ts.map +1 -1
  89. package/esm/oas/number/toNumber.js +62 -0
  90. package/esm/oas/operation/operation-types.d.ts +22 -0
  91. package/esm/oas/operation/operation-types.d.ts.map +1 -0
  92. package/esm/oas/operation/operation-types.js +35 -0
  93. package/esm/oas/parameter/Parameter.d.ts +47 -0
  94. package/esm/oas/parameter/Parameter.d.ts.map +1 -1
  95. package/esm/oas/parameter/Parameter.js +47 -0
  96. package/esm/oas/parameter/parameter-types.d.ts +3 -58
  97. package/esm/oas/parameter/parameter-types.d.ts.map +1 -1
  98. package/esm/oas/pathItem/pathItem-types.d.ts +12 -0
  99. package/esm/oas/pathItem/pathItem-types.d.ts.map +1 -0
  100. package/esm/oas/pathItem/pathItem-types.js +12 -0
  101. package/esm/oas/requestBody/requestBody-types.d.ts +10 -0
  102. package/esm/oas/requestBody/requestBody-types.d.ts.map +1 -0
  103. package/esm/oas/requestBody/requestBody-types.js +9 -0
  104. package/esm/oas/response/response-types.d.ts +12 -0
  105. package/esm/oas/response/response-types.d.ts.map +1 -0
  106. package/esm/oas/response/response-types.js +11 -0
  107. package/esm/oas/schema/toSchemasV3.js +2 -2
  108. package/esm/oas/server/toServerV3.d.ts.map +1 -1
  109. package/esm/oas/string/string-types.d.ts +2 -29
  110. package/esm/oas/string/string-types.d.ts.map +1 -1
  111. package/esm/oas/string/toString.d.ts +125 -1
  112. package/esm/oas/string/toString.d.ts.map +1 -1
  113. package/esm/oas/string/toString.js +119 -0
  114. package/esm/oas/tag/tag-types.d.ts +8 -0
  115. package/esm/oas/tag/tag-types.d.ts.map +1 -0
  116. package/esm/oas/tag/tag-types.js +8 -0
  117. package/esm/oas/union/union-types.d.ts +1 -12
  118. package/esm/oas/union/union-types.d.ts.map +1 -1
  119. package/esm/oas/unknown/unknown-types.d.ts +1 -7
  120. package/esm/oas/unknown/unknown-types.d.ts.map +1 -1
  121. package/esm/types/CustomValue.d.ts +58 -0
  122. package/esm/types/CustomValue.d.ts.map +1 -1
  123. package/esm/types/CustomValue.js +58 -0
  124. package/esm/types/DenoJson.d.ts +24 -0
  125. package/esm/types/DenoJson.d.ts.map +1 -1
  126. package/esm/types/DenoJson.js +12 -0
  127. package/esm/types/Enrichments.d.ts +103 -0
  128. package/esm/types/Enrichments.d.ts.map +1 -1
  129. package/esm/types/Enrichments.js +52 -0
  130. package/esm/types/GeneratedValue.d.ts +17 -0
  131. package/esm/types/GeneratedValue.d.ts.map +1 -1
  132. package/esm/types/Logger.d.ts +9 -0
  133. package/esm/types/Logger.d.ts.map +1 -0
  134. package/esm/types/Logger.js +1 -0
  135. package/esm/types/Preview.d.ts +37 -0
  136. package/esm/types/Preview.d.ts.map +1 -1
  137. package/esm/types/Preview.js +37 -0
  138. package/esm/types/Settings.d.ts +35 -0
  139. package/esm/types/Settings.d.ts.map +1 -1
  140. package/esm/types/Settings.js +27 -0
  141. package/esm/typescript/FunctionParameter.d.ts +4 -4
  142. package/esm/typescript/FunctionParameter.d.ts.map +1 -1
  143. package/esm/typescript/List.d.ts +40 -2
  144. package/esm/typescript/List.d.ts.map +1 -1
  145. package/esm/typescript/List.js +32 -0
  146. package/package.json +1 -1
  147. package/script/context/CoreContext.d.ts +2 -2
  148. package/script/context/CoreContext.d.ts.map +1 -1
  149. package/script/context/GenerateContext.d.ts +16 -3
  150. package/script/context/GenerateContext.d.ts.map +1 -1
  151. package/script/context/ParseContext.d.ts +3 -3
  152. package/script/context/ParseContext.d.ts.map +1 -1
  153. package/script/context/RenderContext.d.ts +153 -1
  154. package/script/context/RenderContext.d.ts.map +1 -1
  155. package/script/context/RenderContext.js +179 -0
  156. package/script/context/types.d.ts +30 -0
  157. package/script/context/types.d.ts.map +1 -1
  158. package/script/dsl/model/ModelBase.d.ts +1 -1
  159. package/script/dsl/model/ModelBase.d.ts.map +1 -1
  160. package/script/dsl/model/ModelDriver.d.ts +62 -0
  161. package/script/dsl/model/ModelDriver.d.ts.map +1 -1
  162. package/script/dsl/model/ModelDriver.js +63 -1
  163. package/script/dsl/model/toModelBase.d.ts +66 -0
  164. package/script/dsl/model/toModelBase.d.ts.map +1 -1
  165. package/script/dsl/model/toModelBase.js +46 -0
  166. package/script/dsl/model/toModelEntry.d.ts +63 -0
  167. package/script/dsl/model/toModelEntry.d.ts.map +1 -1
  168. package/script/dsl/model/toModelEntry.js +63 -0
  169. package/script/dsl/operation/OperationBase.d.ts +3 -3
  170. package/script/dsl/operation/OperationBase.d.ts.map +1 -1
  171. package/script/dsl/operation/OperationDriver.d.ts +84 -0
  172. package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
  173. package/script/dsl/operation/OperationDriver.js +85 -1
  174. package/script/dsl/operation/toOperationBase.d.ts +58 -0
  175. package/script/dsl/operation/toOperationBase.d.ts.map +1 -1
  176. package/script/dsl/operation/toOperationBase.js +46 -0
  177. package/script/dsl/operation/toOperationEntry.d.ts +37 -0
  178. package/script/dsl/operation/toOperationEntry.d.ts.map +1 -1
  179. package/script/dsl/operation/toOperationEntry.js +28 -0
  180. package/script/helpers/isEmpty.d.ts +1 -1
  181. package/script/helpers/isEmpty.d.ts.map +1 -1
  182. package/script/helpers/tracer.d.ts +1 -1
  183. package/script/helpers/tracer.d.ts.map +1 -1
  184. package/script/helpers/tracer.js +1 -1
  185. package/script/mod.d.ts +52 -0
  186. package/script/mod.d.ts.map +1 -1
  187. package/script/mod.js +52 -0
  188. package/script/oas/array/Array.d.ts +26 -0
  189. package/script/oas/array/Array.d.ts.map +1 -1
  190. package/script/oas/array/Array.js +26 -0
  191. package/script/oas/array/array-types.d.ts +32 -11
  192. package/script/oas/array/array-types.d.ts.map +1 -1
  193. package/script/oas/array/array-types.js +17 -1
  194. package/script/oas/array/toArray.d.ts +111 -0
  195. package/script/oas/array/toArray.d.ts.map +1 -1
  196. package/script/oas/array/toArray.js +114 -2
  197. package/script/oas/boolean/Boolean.d.ts +26 -0
  198. package/script/oas/boolean/Boolean.d.ts.map +1 -1
  199. package/script/oas/boolean/Boolean.js +26 -0
  200. package/script/oas/boolean/boolean-types.d.ts +1 -7
  201. package/script/oas/boolean/boolean-types.d.ts.map +1 -1
  202. package/script/oas/boolean/toBoolean.d.ts +57 -0
  203. package/script/oas/boolean/toBoolean.d.ts.map +1 -1
  204. package/script/oas/boolean/toBoolean.js +57 -0
  205. package/script/oas/components/components-types.d.ts +19 -0
  206. package/script/oas/components/components-types.d.ts.map +1 -0
  207. package/script/oas/components/components-types.js +57 -0
  208. package/script/oas/contact/contact-types.d.ts +9 -0
  209. package/script/oas/contact/contact-types.d.ts.map +1 -0
  210. package/script/oas/contact/contact-types.js +43 -0
  211. package/script/oas/discriminator/discriminator-types.d.ts +1 -5
  212. package/script/oas/discriminator/discriminator-types.d.ts.map +1 -1
  213. package/script/oas/document/document-types.d.ts +16 -0
  214. package/script/oas/document/document-types.d.ts.map +1 -0
  215. package/script/oas/document/document-types.js +54 -0
  216. package/script/oas/example/example-types.d.ts +1 -6
  217. package/script/oas/example/example-types.d.ts.map +1 -1
  218. package/script/oas/header/header-types.d.ts +50 -0
  219. package/script/oas/header/header-types.d.ts.map +1 -0
  220. package/script/oas/header/header-types.js +66 -0
  221. package/script/oas/info/info-types.d.ts +14 -0
  222. package/script/oas/info/info-types.d.ts.map +1 -0
  223. package/script/oas/info/info-types.js +49 -0
  224. package/script/oas/integer/integer-types.d.ts +3 -17
  225. package/script/oas/integer/integer-types.d.ts.map +1 -1
  226. package/script/oas/license/license-types.d.ts +9 -0
  227. package/script/oas/license/license-types.d.ts.map +1 -0
  228. package/script/oas/license/license-types.js +43 -0
  229. package/script/oas/mediaType/mediaType-types.d.ts +1 -11
  230. package/script/oas/mediaType/mediaType-types.d.ts.map +1 -1
  231. package/script/oas/number/number-types.d.ts +2 -16
  232. package/script/oas/number/number-types.d.ts.map +1 -1
  233. package/script/oas/number/toNumber.d.ts +62 -0
  234. package/script/oas/number/toNumber.d.ts.map +1 -1
  235. package/script/oas/number/toNumber.js +62 -0
  236. package/script/oas/operation/operation-types.d.ts +22 -0
  237. package/script/oas/operation/operation-types.d.ts.map +1 -0
  238. package/script/oas/operation/operation-types.js +71 -0
  239. package/script/oas/parameter/Parameter.d.ts +47 -0
  240. package/script/oas/parameter/Parameter.d.ts.map +1 -1
  241. package/script/oas/parameter/Parameter.js +47 -0
  242. package/script/oas/parameter/parameter-types.d.ts +3 -58
  243. package/script/oas/parameter/parameter-types.d.ts.map +1 -1
  244. package/script/oas/pathItem/pathItem-types.d.ts +12 -0
  245. package/script/oas/pathItem/pathItem-types.d.ts.map +1 -0
  246. package/script/oas/pathItem/pathItem-types.js +48 -0
  247. package/script/oas/requestBody/requestBody-types.d.ts +10 -0
  248. package/script/oas/requestBody/requestBody-types.d.ts.map +1 -0
  249. package/script/oas/requestBody/requestBody-types.js +45 -0
  250. package/script/oas/response/response-types.d.ts +12 -0
  251. package/script/oas/response/response-types.d.ts.map +1 -0
  252. package/script/oas/response/response-types.js +47 -0
  253. package/script/oas/schema/toSchemasV3.js +2 -2
  254. package/script/oas/server/toServerV3.d.ts.map +1 -1
  255. package/script/oas/string/string-types.d.ts +2 -29
  256. package/script/oas/string/string-types.d.ts.map +1 -1
  257. package/script/oas/string/toString.d.ts +125 -1
  258. package/script/oas/string/toString.d.ts.map +1 -1
  259. package/script/oas/string/toString.js +119 -0
  260. package/script/oas/tag/tag-types.d.ts +8 -0
  261. package/script/oas/tag/tag-types.d.ts.map +1 -0
  262. package/script/oas/tag/tag-types.js +44 -0
  263. package/script/oas/union/union-types.d.ts +1 -12
  264. package/script/oas/union/union-types.d.ts.map +1 -1
  265. package/script/oas/unknown/unknown-types.d.ts +1 -7
  266. package/script/oas/unknown/unknown-types.d.ts.map +1 -1
  267. package/script/types/CustomValue.d.ts +58 -0
  268. package/script/types/CustomValue.d.ts.map +1 -1
  269. package/script/types/CustomValue.js +58 -0
  270. package/script/types/DenoJson.d.ts +24 -0
  271. package/script/types/DenoJson.d.ts.map +1 -1
  272. package/script/types/DenoJson.js +12 -0
  273. package/script/types/Enrichments.d.ts +103 -0
  274. package/script/types/Enrichments.d.ts.map +1 -1
  275. package/script/types/Enrichments.js +52 -0
  276. package/script/types/GeneratedValue.d.ts +17 -0
  277. package/script/types/GeneratedValue.d.ts.map +1 -1
  278. package/script/types/Logger.d.ts +9 -0
  279. package/script/types/Logger.d.ts.map +1 -0
  280. package/script/types/Logger.js +2 -0
  281. package/script/types/Preview.d.ts +37 -0
  282. package/script/types/Preview.d.ts.map +1 -1
  283. package/script/types/Preview.js +37 -0
  284. package/script/types/Settings.d.ts +35 -0
  285. package/script/types/Settings.d.ts.map +1 -1
  286. package/script/types/Settings.js +27 -0
  287. package/script/typescript/FunctionParameter.d.ts +4 -4
  288. package/script/typescript/FunctionParameter.d.ts.map +1 -1
  289. package/script/typescript/List.d.ts +40 -2
  290. package/script/typescript/List.d.ts.map +1 -1
  291. package/script/typescript/List.js +32 -0
@@ -5,6 +5,65 @@ type ToArrayArgs = {
5
5
  value: OpenAPIV3.ArraySchemaObject;
6
6
  context: ParseContext;
7
7
  };
8
+ /**
9
+ * Transforms an OpenAPI v3 array schema object into an internal OAS array representation.
10
+ *
11
+ * This function processes OpenAPI array schemas by extracting and parsing nullable values,
12
+ * examples, enumerations, and default values. It handles the complete transformation from
13
+ * raw OpenAPI JSON to the SKMTC internal array representation with proper type safety.
14
+ *
15
+ * The transformation follows a pipeline approach:
16
+ * 1. Parse nullable flag and extract base value
17
+ * 2. Parse example values with nullable support
18
+ * 3. Parse enumeration constraints
19
+ * 4. Parse default values
20
+ * 5. Create final OasArray instance
21
+ *
22
+ * @param args - Transformation arguments
23
+ * @param args.value - The OpenAPI v3 array schema object to transform
24
+ * @param args.context - Parse context providing utilities and tracing
25
+ * @returns Transformed OAS array object with parsed properties
26
+ *
27
+ * @example Basic array transformation
28
+ * ```typescript
29
+ * import { toArray } from '@skmtc/core';
30
+ *
31
+ * const openApiArray = {
32
+ * type: 'array',
33
+ * items: { type: 'string' },
34
+ * maxItems: 10,
35
+ * uniqueItems: true
36
+ * };
37
+ *
38
+ * const oasArray = toArray({
39
+ * value: openApiArray,
40
+ * context: parseContext
41
+ * });
42
+ *
43
+ * console.log(oasArray.maxItems); // 10
44
+ * console.log(oasArray.uniqueItems); // true
45
+ * ```
46
+ *
47
+ * @example Array with nullable and examples
48
+ * ```typescript
49
+ * const complexArray = {
50
+ * type: 'array',
51
+ * items: { type: 'number' },
52
+ * nullable: true,
53
+ * example: [1, 2, 3],
54
+ * default: [],
55
+ * enum: [[1, 2], [3, 4], null]
56
+ * };
57
+ *
58
+ * const oasArray = toArray({
59
+ * value: complexArray,
60
+ * context: parseContext
61
+ * });
62
+ *
63
+ * console.log(oasArray.nullable); // true
64
+ * console.log(oasArray.example); // [1, 2, 3]
65
+ * ```
66
+ */
8
67
  export declare const toArray: ({ value, context }: ToArrayArgs) => OasArray;
9
68
  type ToParsedArrayArgs<Nullable extends boolean | undefined> = {
10
69
  value: Omit<OpenAPIV3.ArraySchemaObject, 'nullable' | 'example' | 'enums' | 'default'>;
@@ -14,6 +73,58 @@ type ToParsedArrayArgs<Nullable extends boolean | undefined> = {
14
73
  enums: Nullable extends true ? (unknown[] | null)[] | undefined : unknown[] | undefined;
15
74
  defaultValue: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined;
16
75
  };
76
+ /**
77
+ * Creates an OAS array instance from pre-parsed array schema components.
78
+ *
79
+ * This function is the final step in the array transformation pipeline, taking
80
+ * already-parsed nullable, example, enum, and default values and combining them
81
+ * with the remaining array properties to create the complete OasArray instance.
82
+ *
83
+ * The function handles type-safe nullable parsing, items schema resolution,
84
+ * and specification extension processing. It uses Valibot for schema validation
85
+ * and maintains proper type relationships between nullable flags and value types.
86
+ *
87
+ * @template Nullable - Boolean type indicating if the array can be null
88
+ * @param args - Pre-parsed array components
89
+ * @param args.value - OpenAPI array object without parsed fields
90
+ * @param args.context - Parse context for tracing and utilities
91
+ * @param args.nullable - Parsed nullable flag
92
+ * @param args.example - Parsed example value (type-safe with nullable)
93
+ * @param args.enums - Parsed enumeration constraints (type-safe with nullable)
94
+ * @param args.defaultValue - Parsed default value (type-safe with nullable)
95
+ * @returns Complete OAS array instance with all properties
96
+ *
97
+ * @example Type-safe nullable array
98
+ * ```typescript
99
+ * const nullableArray = toParsedArray({
100
+ * context: parseContext,
101
+ * nullable: true,
102
+ * example: [1, 2, 3], // Can be null due to nullable: true
103
+ * enums: [[1], [2], null], // Null allowed in enums
104
+ * defaultValue: null,
105
+ * value: {
106
+ * type: 'array',
107
+ * items: { type: 'number' },
108
+ * maxItems: 5
109
+ * }
110
+ * });
111
+ * ```
112
+ *
113
+ * @example Non-nullable array
114
+ * ```typescript
115
+ * const regularArray = toParsedArray({
116
+ * context: parseContext,
117
+ * nullable: false,
118
+ * example: ['a', 'b'], // Cannot be null
119
+ * enums: [['x'], ['y']], // No null values allowed
120
+ * defaultValue: [],
121
+ * value: {
122
+ * type: 'array',
123
+ * items: { type: 'string' }
124
+ * }
125
+ * });
126
+ * ```
127
+ */
17
128
  export declare const toParsedArray: <Nullable extends boolean | undefined>({ context, nullable, example, enums, defaultValue, value }: ToParsedArrayArgs<Nullable>) => OasArray<Nullable>;
18
129
  export {};
19
130
  //# sourceMappingURL=toArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toArray.d.ts","sourceRoot":"","sources":["../../../src/oas/array/toArray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,oBAAoB,WAAW,KAAG,QAmCzD,CAAA;AAED,KAAK,iBAAiB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC7D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACtF,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACrF,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACvF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;CAC3F,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS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;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,EAAE,4DAOjE,iBAAiB,CAAC,QAAQ,CAAC,KAAG,QAAQ,CAAC,QAAQ,CAyCjD,CAAA"}
@@ -43,6 +43,65 @@ const parseEnum_js_1 = require("../_helpers/parseEnum.js");
43
43
  const v = __importStar(require("valibot"));
44
44
  const array_types_js_1 = require("./array-types.js");
45
45
  const parseDefault_js_1 = require("../_helpers/parseDefault.js");
46
+ /**
47
+ * Transforms an OpenAPI v3 array schema object into an internal OAS array representation.
48
+ *
49
+ * This function processes OpenAPI array schemas by extracting and parsing nullable values,
50
+ * examples, enumerations, and default values. It handles the complete transformation from
51
+ * raw OpenAPI JSON to the SKMTC internal array representation with proper type safety.
52
+ *
53
+ * The transformation follows a pipeline approach:
54
+ * 1. Parse nullable flag and extract base value
55
+ * 2. Parse example values with nullable support
56
+ * 3. Parse enumeration constraints
57
+ * 4. Parse default values
58
+ * 5. Create final OasArray instance
59
+ *
60
+ * @param args - Transformation arguments
61
+ * @param args.value - The OpenAPI v3 array schema object to transform
62
+ * @param args.context - Parse context providing utilities and tracing
63
+ * @returns Transformed OAS array object with parsed properties
64
+ *
65
+ * @example Basic array transformation
66
+ * ```typescript
67
+ * import { toArray } from '@skmtc/core';
68
+ *
69
+ * const openApiArray = {
70
+ * type: 'array',
71
+ * items: { type: 'string' },
72
+ * maxItems: 10,
73
+ * uniqueItems: true
74
+ * };
75
+ *
76
+ * const oasArray = toArray({
77
+ * value: openApiArray,
78
+ * context: parseContext
79
+ * });
80
+ *
81
+ * console.log(oasArray.maxItems); // 10
82
+ * console.log(oasArray.uniqueItems); // true
83
+ * ```
84
+ *
85
+ * @example Array with nullable and examples
86
+ * ```typescript
87
+ * const complexArray = {
88
+ * type: 'array',
89
+ * items: { type: 'number' },
90
+ * nullable: true,
91
+ * example: [1, 2, 3],
92
+ * default: [],
93
+ * enum: [[1, 2], [3, 4], null]
94
+ * };
95
+ *
96
+ * const oasArray = toArray({
97
+ * value: complexArray,
98
+ * context: parseContext
99
+ * });
100
+ *
101
+ * console.log(oasArray.nullable); // true
102
+ * console.log(oasArray.example); // [1, 2, 3]
103
+ * ```
104
+ */
46
105
  const toArray = ({ value, context }) => {
47
106
  const { nullable, value: valueWithoutNullable } = (0, parseNullable_js_1.parseNullable)({
48
107
  value,
@@ -76,11 +135,64 @@ const toArray = ({ value, context }) => {
76
135
  });
77
136
  };
78
137
  exports.toArray = toArray;
138
+ /**
139
+ * Creates an OAS array instance from pre-parsed array schema components.
140
+ *
141
+ * This function is the final step in the array transformation pipeline, taking
142
+ * already-parsed nullable, example, enum, and default values and combining them
143
+ * with the remaining array properties to create the complete OasArray instance.
144
+ *
145
+ * The function handles type-safe nullable parsing, items schema resolution,
146
+ * and specification extension processing. It uses Valibot for schema validation
147
+ * and maintains proper type relationships between nullable flags and value types.
148
+ *
149
+ * @template Nullable - Boolean type indicating if the array can be null
150
+ * @param args - Pre-parsed array components
151
+ * @param args.value - OpenAPI array object without parsed fields
152
+ * @param args.context - Parse context for tracing and utilities
153
+ * @param args.nullable - Parsed nullable flag
154
+ * @param args.example - Parsed example value (type-safe with nullable)
155
+ * @param args.enums - Parsed enumeration constraints (type-safe with nullable)
156
+ * @param args.defaultValue - Parsed default value (type-safe with nullable)
157
+ * @returns Complete OAS array instance with all properties
158
+ *
159
+ * @example Type-safe nullable array
160
+ * ```typescript
161
+ * const nullableArray = toParsedArray({
162
+ * context: parseContext,
163
+ * nullable: true,
164
+ * example: [1, 2, 3], // Can be null due to nullable: true
165
+ * enums: [[1], [2], null], // Null allowed in enums
166
+ * defaultValue: null,
167
+ * value: {
168
+ * type: 'array',
169
+ * items: { type: 'number' },
170
+ * maxItems: 5
171
+ * }
172
+ * });
173
+ * ```
174
+ *
175
+ * @example Non-nullable array
176
+ * ```typescript
177
+ * const regularArray = toParsedArray({
178
+ * context: parseContext,
179
+ * nullable: false,
180
+ * example: ['a', 'b'], // Cannot be null
181
+ * enums: [['x'], ['y']], // No null values allowed
182
+ * defaultValue: [],
183
+ * value: {
184
+ * type: 'array',
185
+ * items: { type: 'string' }
186
+ * }
187
+ * });
188
+ * ```
189
+ */
79
190
  const toParsedArray = ({ context, nullable, example, enums, defaultValue, value }) => {
80
191
  // We only want parse non-items fields here since items is handled below
81
192
  const { items, ...rest } = value;
82
- const oasArrayDataSchemaWithItems = v.omit(array_types_js_1.oasArrayData, ['items']);
83
- const { type: _type, title, description, uniqueItems, maxItems, minItems, ...skipped } = v.parse(oasArrayDataSchemaWithItems, rest);
193
+ // Parse the object without items field
194
+ const parsed = v.parse(array_types_js_1.oasArrayDataWithoutItems, rest);
195
+ const { type: _type, title, description, uniqueItems, maxItems, minItems, ...skipped } = parsed;
84
196
  const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
85
197
  skipped,
86
198
  parent: value,
@@ -191,10 +191,36 @@ export declare class OasBoolean<Nullable extends boolean | undefined = boolean |
191
191
  * The default value of the boolean.
192
192
  */
193
193
  default: Nullable extends true ? boolean | null | undefined : boolean | undefined;
194
+ /**
195
+ * Creates a new OasBoolean instance.
196
+ *
197
+ * @param fields - Boolean configuration fields including validation constraints and metadata
198
+ */
194
199
  constructor(fields?: BooleanFields<Nullable>);
200
+ /**
201
+ * Determines if this boolean is a reference object.
202
+ *
203
+ * @returns Always returns false since this is a concrete boolean instance, not a reference
204
+ */
195
205
  isRef(): this is OasRef<'schema'>;
206
+ /**
207
+ * Resolves this boolean object.
208
+ *
209
+ * @returns The boolean instance itself since it's already a concrete object, not a reference
210
+ */
196
211
  resolve(): OasBoolean<Nullable>;
212
+ /**
213
+ * Resolves this boolean object one level.
214
+ *
215
+ * @returns The boolean instance itself since it's already a concrete object, not a reference
216
+ */
197
217
  resolveOnce(): OasBoolean<Nullable>;
218
+ /**
219
+ * Converts this OAS boolean to an OpenAPI v3 JSON schema representation.
220
+ *
221
+ * @param options - Conversion options (currently unused for boolean schemas)
222
+ * @returns OpenAPI v3 boolean schema object with type and all validation constraints
223
+ */
198
224
  toJsonSchema(options?: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject;
199
225
  }
200
226
  //# sourceMappingURL=Boolean.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Boolean.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/Boolean.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAChE,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,uEAAuE;IACvE,OAAO,CAAC,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IAClF,oFAAoF;IACpF,KAAK,CAAC,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACtF,uEAAuE;IACvE,OAAO,CAAC,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;CACnF,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAG,QAAQ,CAAS;IAC3B;;OAEG;IACH,IAAI,EAAG,SAAS,CAAS;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAA;IAE9B,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD;;OAEG;IACH,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IAEjF;;OAEG;IACH,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACrF;;OAEG;IACH,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IAEjF;;;;OAIG;gBACS,MAAM,GAAE,aAAa,CAAC,QAAQ,CAAM;IAUhD;;;;OAIG;IACH,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC;;;;OAIG;IACH,OAAO,IAAI,UAAU,CAAC,QAAQ,CAAC;IAI/B;;;;OAIG;IACH,WAAW,IAAI,UAAU,CAAC,QAAQ,CAAC;IAInC;;;;;OAKG;IAEH,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC,oBAAoB;CAW5E"}
@@ -135,6 +135,11 @@ require("../../_dnt.polyfills.js");
135
135
  * ```
136
136
  */
137
137
  class OasBoolean {
138
+ /**
139
+ * Creates a new OasBoolean instance.
140
+ *
141
+ * @param fields - Boolean configuration fields including validation constraints and metadata
142
+ */
138
143
  constructor(fields = {}) {
139
144
  /**
140
145
  * Object is part the 'schema' set which is used
@@ -224,15 +229,36 @@ class OasBoolean {
224
229
  this.enums = fields.enums;
225
230
  this.default = fields.default;
226
231
  }
232
+ /**
233
+ * Determines if this boolean is a reference object.
234
+ *
235
+ * @returns Always returns false since this is a concrete boolean instance, not a reference
236
+ */
227
237
  isRef() {
228
238
  return false;
229
239
  }
240
+ /**
241
+ * Resolves this boolean object.
242
+ *
243
+ * @returns The boolean instance itself since it's already a concrete object, not a reference
244
+ */
230
245
  resolve() {
231
246
  return this;
232
247
  }
248
+ /**
249
+ * Resolves this boolean object one level.
250
+ *
251
+ * @returns The boolean instance itself since it's already a concrete object, not a reference
252
+ */
233
253
  resolveOnce() {
234
254
  return this;
235
255
  }
256
+ /**
257
+ * Converts this OAS boolean to an OpenAPI v3 JSON schema representation.
258
+ *
259
+ * @param options - Conversion options (currently unused for boolean schemas)
260
+ * @returns OpenAPI v3 boolean schema object with type and all validation constraints
261
+ */
236
262
  // deno-lint-ignore no-unused-vars
237
263
  toJsonSchema(options) {
238
264
  return {
@@ -5,13 +5,7 @@ import * as v from 'valibot';
5
5
  * Validates boolean schemas including default values and enumeration
6
6
  * constraints. Boolean enums typically contain [true, false] or single values.
7
7
  */
8
- export declare const oasBooleanData: v.ObjectSchema<{
9
- readonly type: v.LiteralSchema<"boolean", undefined>;
10
- readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
11
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
12
- readonly default: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
13
- readonly enum: v.OptionalSchema<v.ArraySchema<v.BooleanSchema<undefined>, undefined>, undefined>;
14
- }, undefined>;
8
+ export declare const oasBooleanData: v.GenericSchema<OasBooleanData>;
15
9
  /**
16
10
  * Data type for OpenAPI boolean schema objects.
17
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"boolean-types.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/boolean-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;aAMzB,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAA;IACf,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kFAAkF;IAClF,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB,CAAA"}
1
+ {"version":3,"file":"boolean-types.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/boolean-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAMzD,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAA;IACf,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kFAAkF;IAClF,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB,CAAA"}
@@ -5,6 +5,63 @@ type ToBooleanArgs = {
5
5
  value: OpenAPIV3.SchemaObject;
6
6
  context: ParseContext;
7
7
  };
8
+ /**
9
+ * Transforms an OpenAPI v3 boolean schema object into an internal OAS boolean representation.
10
+ *
11
+ * This function processes OpenAPI boolean schemas by extracting and parsing nullable values,
12
+ * examples, enumerations, and default values. It handles the complete transformation from
13
+ * raw OpenAPI JSON to the SKMTC internal boolean representation with proper validation.
14
+ *
15
+ * The transformation follows a pipeline approach:
16
+ * 1. Parse nullable flag and extract base value
17
+ * 2. Parse example values with nullable support
18
+ * 3. Parse enumeration constraints (typically [true], [false], or [true, false])
19
+ * 4. Parse default values
20
+ * 5. Create final OasBoolean instance
21
+ *
22
+ * @param args - Transformation arguments
23
+ * @param args.value - The OpenAPI v3 boolean schema object to transform
24
+ * @param args.context - Parse context providing utilities and tracing
25
+ * @returns Transformed OAS boolean object with parsed properties
26
+ *
27
+ * @example Basic boolean transformation
28
+ * ```typescript
29
+ * import { toBoolean } from '@skmtc/core';
30
+ *
31
+ * const openApiBoolean = {
32
+ * type: 'boolean',
33
+ * default: false
34
+ * };
35
+ *
36
+ * const oasBoolean = toBoolean({
37
+ * value: openApiBoolean,
38
+ * context: parseContext
39
+ * });
40
+ *
41
+ * console.log(oasBoolean.default); // false
42
+ * ```
43
+ *
44
+ * @example Boolean with nullable and enum
45
+ * ```typescript
46
+ * const flagBoolean = {
47
+ * type: 'boolean',
48
+ * nullable: true,
49
+ * enum: [true, null],
50
+ * default: null,
51
+ * example: true,
52
+ * title: 'Feature Flag',
53
+ * description: 'Whether the feature is enabled'
54
+ * };
55
+ *
56
+ * const oasBoolean = toBoolean({
57
+ * value: flagBoolean,
58
+ * context: parseContext
59
+ * });
60
+ *
61
+ * console.log(oasBoolean.nullable); // true
62
+ * console.log(oasBoolean.enums); // [true, null]
63
+ * ```
64
+ */
8
65
  export declare const toBoolean: ({ value, context }: ToBooleanArgs) => OasBoolean;
9
66
  type ToParsedBooleanArgs<Nullable extends boolean | undefined> = {
10
67
  value: Omit<OpenAPIV3.SchemaObject, 'nullable' | 'example' | 'enums'>;
@@ -1 +1 @@
1
- {"version":3,"file":"toBoolean.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/toBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,UAA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OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,eAAO,MAAM,SAAS,GAAI,oBAAoB,aAAa,KAAG,UAmC7D,CAAA;AAED,KAAK,mBAAmB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC/D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAA;IACrE,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IACjF,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACrF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;CACvF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,EAAE,4DAOnE,mBAAmB,CAAC,QAAQ,CAAC,KAAG,UAAU,CAAC,QAAQ,CAmBrD,CAAA"}
@@ -42,6 +42,63 @@ const parseNullable_js_1 = require("../_helpers/parseNullable.js");
42
42
  const parseExample_js_1 = require("../_helpers/parseExample.js");
43
43
  const parseEnum_js_1 = require("../_helpers/parseEnum.js");
44
44
  const parseDefault_js_1 = require("../_helpers/parseDefault.js");
45
+ /**
46
+ * Transforms an OpenAPI v3 boolean schema object into an internal OAS boolean representation.
47
+ *
48
+ * This function processes OpenAPI boolean schemas by extracting and parsing nullable values,
49
+ * examples, enumerations, and default values. It handles the complete transformation from
50
+ * raw OpenAPI JSON to the SKMTC internal boolean representation with proper validation.
51
+ *
52
+ * The transformation follows a pipeline approach:
53
+ * 1. Parse nullable flag and extract base value
54
+ * 2. Parse example values with nullable support
55
+ * 3. Parse enumeration constraints (typically [true], [false], or [true, false])
56
+ * 4. Parse default values
57
+ * 5. Create final OasBoolean instance
58
+ *
59
+ * @param args - Transformation arguments
60
+ * @param args.value - The OpenAPI v3 boolean schema object to transform
61
+ * @param args.context - Parse context providing utilities and tracing
62
+ * @returns Transformed OAS boolean object with parsed properties
63
+ *
64
+ * @example Basic boolean transformation
65
+ * ```typescript
66
+ * import { toBoolean } from '@skmtc/core';
67
+ *
68
+ * const openApiBoolean = {
69
+ * type: 'boolean',
70
+ * default: false
71
+ * };
72
+ *
73
+ * const oasBoolean = toBoolean({
74
+ * value: openApiBoolean,
75
+ * context: parseContext
76
+ * });
77
+ *
78
+ * console.log(oasBoolean.default); // false
79
+ * ```
80
+ *
81
+ * @example Boolean with nullable and enum
82
+ * ```typescript
83
+ * const flagBoolean = {
84
+ * type: 'boolean',
85
+ * nullable: true,
86
+ * enum: [true, null],
87
+ * default: null,
88
+ * example: true,
89
+ * title: 'Feature Flag',
90
+ * description: 'Whether the feature is enabled'
91
+ * };
92
+ *
93
+ * const oasBoolean = toBoolean({
94
+ * value: flagBoolean,
95
+ * context: parseContext
96
+ * });
97
+ *
98
+ * console.log(oasBoolean.nullable); // true
99
+ * console.log(oasBoolean.enums); // [true, null]
100
+ * ```
101
+ */
45
102
  const toBoolean = ({ value, context }) => {
46
103
  const { nullable, value: valueWithoutNullable } = (0, parseNullable_js_1.parseNullable)({
47
104
  value,
@@ -0,0 +1,19 @@
1
+ import { type OasExampleData } from '../example/example-types.js';
2
+ import { type OasHeaderData } from '../header/header-types.js';
3
+ import { type OasParameterData } from '../parameter/parameter-types.js';
4
+ import type { OasExampleRefData, OasHeaderRefData, OasParameterRefData, OasRequestBodyRefData, OasResponseRefData, OasSchemaRefData } from '../ref/ref-types.js';
5
+ import { type OasRequestBodyData } from '../requestBody/requestBody-types.js';
6
+ import { type OasResponseData } from '../response/response-types.js';
7
+ import { type OasSchemaData } from '../schema/schema-types.js';
8
+ import * as v from 'valibot';
9
+ export type OasComponentsData = {
10
+ oasType: 'components';
11
+ schemas?: Record<string, OasSchemaData | OasSchemaRefData>;
12
+ responses?: Record<string, OasResponseData | OasResponseRefData>;
13
+ parameters?: Record<string, OasParameterData | OasParameterRefData>;
14
+ examples?: Record<string, OasExampleData | OasExampleRefData>;
15
+ requestBodies?: Record<string, OasRequestBodyData | OasRequestBodyRefData>;
16
+ headers?: Record<string, OasHeaderData | OasHeaderRefData>;
17
+ };
18
+ export declare const oasComponentsData: v.GenericSchema<OasComponentsData>;
19
+ //# sourceMappingURL=components-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-types.d.ts","sourceRoot":"","sources":["../../../src/oas/components/components-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AACjF,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAS5B,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,qCAAqC,CAAA;AACjG,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,YAAY,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC,CAAA;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC,CAAA;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,CAAA;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAC,CAAA;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,qBAAqB,CAAC,CAAA;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC,CAAA;CAC3D,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAc/D,CAAA"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.oasComponentsData = void 0;
37
+ const example_types_js_1 = require("../example/example-types.js");
38
+ const header_types_js_1 = require("../header/header-types.js");
39
+ const parameter_types_js_1 = require("../parameter/parameter-types.js");
40
+ const ref_types_js_1 = require("../ref/ref-types.js");
41
+ const requestBody_types_js_1 = require("../requestBody/requestBody-types.js");
42
+ const response_types_js_1 = require("../response/response-types.js");
43
+ const schema_types_js_1 = require("../schema/schema-types.js");
44
+ const v = __importStar(require("valibot"));
45
+ exports.oasComponentsData = v.object({
46
+ oasType: v.literal('components'),
47
+ schemas: v.optional(v.record(v.string(), v.union([schema_types_js_1.oasSchemaData, ref_types_js_1.oasSchemaRefData]))),
48
+ responses: v.optional(v.record(v.string(), v.union([response_types_js_1.oasResponseData, ref_types_js_1.oasResponseRefData]))),
49
+ parameters: v.optional(v.record(v.string(), v.union([parameter_types_js_1.oasParameterData, ref_types_js_1.oasParameterRefData]))),
50
+ examples: v.optional(v.record(v.string(), v.union([example_types_js_1.oasExampleData, ref_types_js_1.oasExampleRefData]))),
51
+ requestBodies: v.optional(v.record(v.string(), v.union([requestBody_types_js_1.oasRequestBodyData, ref_types_js_1.oasRequestBodyRefData]))),
52
+ headers: v.optional(v.record(v.string(), v.union([header_types_js_1.oasHeaderData, ref_types_js_1.oasHeaderRefData])))
53
+ // securitySchemes: z.record(z.union([securityScheme, ref])),
54
+ // links: z.record(z.union([link, ref])),
55
+ // callbacks: z.never(),
56
+ // pathItems: z.record(z.union([oasPathItemData, oasPathItemRefData])).optional()
57
+ });
@@ -0,0 +1,9 @@
1
+ import * as v from 'valibot';
2
+ export type OasContactData = {
3
+ oasType: 'contact';
4
+ name?: string;
5
+ url?: string;
6
+ email?: string;
7
+ };
8
+ export declare const oasContactData: v.GenericSchema<OasContactData>;
9
+ //# sourceMappingURL=contact-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-types.d.ts","sourceRoot":"","sources":["../../../src/oas/contact/contact-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAKzD,CAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.oasContactData = void 0;
37
+ const v = __importStar(require("valibot"));
38
+ exports.oasContactData = v.object({
39
+ oasType: v.literal('contact'),
40
+ name: v.optional(v.string()),
41
+ url: v.optional(v.string()),
42
+ email: v.optional(v.string())
43
+ });