@mionjs/run-types 0.13.2 → 0.14.0

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 (337) hide show
  1. package/README.md +3 -3
  2. package/dist/builders/atomic.js.map +1 -1
  3. package/dist/builders/compose.js.map +1 -1
  4. package/dist/builders/index.js.map +1 -1
  5. package/dist/builders/static.js.map +1 -1
  6. package/dist/builders/utility.js.map +1 -1
  7. package/dist/createRTFunctions.js.map +1 -1
  8. package/dist/enrich/createFriendlyText.js.map +1 -1
  9. package/dist/enrich/friendlyText.js.map +1 -1
  10. package/dist/enrich/mockData.js.map +1 -1
  11. package/dist/fnHash.js.map +1 -1
  12. package/dist/formats/bigintFormats.js.map +1 -1
  13. package/dist/formats/datetime/dateFormats.js.map +1 -1
  14. package/dist/formats/datetime/dateTime-pure-fns.d.ts +21 -21
  15. package/dist/formats/datetime/dateTime-pure-fns.js +7 -0
  16. package/dist/formats/datetime/dateTime-pure-fns.js.map +1 -1
  17. package/dist/formats/datetime/dateTimeParams.js.map +1 -1
  18. package/dist/formats/datetime/stringDateTimeFormats.js.map +1 -1
  19. package/dist/formats/datetime/temporalFormats.js.map +1 -1
  20. package/dist/formats/index.js.map +1 -1
  21. package/dist/formats/numberFormats.js.map +1 -1
  22. package/dist/formats/refineFormat.js.map +1 -1
  23. package/dist/formats/scalars.js.map +1 -1
  24. package/dist/formats/string/credit-card-pure-fns.d.ts +4 -4
  25. package/dist/formats/string/credit-card-pure-fns.js.map +1 -1
  26. package/dist/formats/string/string-formats-pure-fns.d.ts +12 -12
  27. package/dist/formats/string/string-formats-pure-fns.js +9 -0
  28. package/dist/formats/string/string-formats-pure-fns.js.map +1 -1
  29. package/dist/formats/string/string-patterns.js.map +1 -1
  30. package/dist/formats/string/stringFormats.js.map +1 -1
  31. package/dist/formats/structural.js.map +1 -1
  32. package/dist/getRunType.js.map +1 -1
  33. package/dist/go-generated/fnHashes.generated.js.map +1 -1
  34. package/dist/go-generated/formatErrorKeys.generated.js.map +1 -1
  35. package/dist/go-generated/runTypeKind.generated.js.map +1 -1
  36. package/dist/go-generated/typeFormats.generated.js.map +1 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/markers.js.map +1 -1
  39. package/dist/mion-pure-fns/_rt/-yTRFuK01Y.js +2 -0
  40. package/dist/mion-pure-fns/_rt/0yJQ37XnmN.js +2 -0
  41. package/dist/mion-pure-fns/_rt/2xtQHAMu-y.js +1 -0
  42. package/dist/mion-pure-fns/_rt/3RndhrueRD.js +2 -0
  43. package/dist/mion-pure-fns/_rt/5oCqd7YyfA.js +1 -0
  44. package/dist/mion-pure-fns/_rt/6E7qWsIwaF.js +1 -0
  45. package/dist/mion-pure-fns/_rt/8AgZCCAhyw.js +1 -0
  46. package/dist/mion-pure-fns/_rt/AmEsDA-eXW.js +2 -0
  47. package/dist/mion-pure-fns/_rt/D503ooPt08.js +2 -0
  48. package/dist/mion-pure-fns/_rt/GA20s6bj41.js +1 -0
  49. package/dist/mion-pure-fns/_rt/GaLOTE4b_F.js +2 -0
  50. package/dist/mion-pure-fns/_rt/ICDNQUtC8e.js +1 -0
  51. package/dist/mion-pure-fns/_rt/IyjvBbz0zS.js +1 -0
  52. package/dist/mion-pure-fns/_rt/Nnf7kyDfjI.js +2 -0
  53. package/dist/mion-pure-fns/_rt/OCJ1B0-ZCA.js +1 -0
  54. package/dist/mion-pure-fns/_rt/OXVO2EpSFv.js +1 -0
  55. package/dist/mion-pure-fns/_rt/PZzwu-J2YB.js +2 -0
  56. package/dist/mion-pure-fns/_rt/Qd_9GJQlOC.js +1 -0
  57. package/dist/mion-pure-fns/_rt/T48n0wyjPx.js +2 -0
  58. package/dist/mion-pure-fns/_rt/VJiknJ2exR.js +1 -0
  59. package/dist/mion-pure-fns/_rt/Z2sc5xQPKB.js +1 -0
  60. package/dist/mion-pure-fns/_rt/ZPLfUKoTJQ.js +1 -0
  61. package/dist/mion-pure-fns/_rt/_abcB3do2M.js +1 -0
  62. package/dist/mion-pure-fns/_rt/cK87_2eKQW.js +1 -0
  63. package/dist/mion-pure-fns/_rt/cgwpjq6rGs.js +1 -0
  64. package/dist/mion-pure-fns/_rt/d8U9HjmMsN.js +1 -0
  65. package/dist/mion-pure-fns/_rt/eglb1lzTW9.js +1 -0
  66. package/dist/mion-pure-fns/_rt/eupKgBrCGt.js +2 -0
  67. package/dist/mion-pure-fns/_rt/gNpMnJMAUE.js +4 -0
  68. package/dist/mion-pure-fns/_rt/hiotRbfSKF.js +1 -0
  69. package/dist/mion-pure-fns/_rt/i-jWpjiwhL.js +1 -0
  70. package/dist/mion-pure-fns/_rt/iFXkEtW54e.js +1 -0
  71. package/dist/mion-pure-fns/_rt/jKlKNzqG2-.js +1 -0
  72. package/dist/mion-pure-fns/_rt/kSLD_nEHux.js +1 -0
  73. package/dist/mion-pure-fns/_rt/lBHf1kg5nQ.js +1 -0
  74. package/dist/mion-pure-fns/_rt/lFYcgG5ZSI.js +1 -0
  75. package/dist/mion-pure-fns/_rt/nLaf1XVvS4.js +2 -0
  76. package/dist/mion-pure-fns/_rt/n_ZOWff4X3.js +1 -0
  77. package/dist/mion-pure-fns/_rt/nsU8QeJCuC.js +1 -0
  78. package/dist/mion-pure-fns/_rt/oUfCfYMODo.js +2 -0
  79. package/dist/mion-pure-fns/_rt/t3CflNaUUJ.js +2 -0
  80. package/dist/mion-pure-fns/_rt/tfRjnFZVF8.js +1 -0
  81. package/dist/mion-pure-fns/_rt/u0Mw9bizvB.js +1 -0
  82. package/dist/mion-pure-fns/_rt/vPNeWxcCkj.js +3 -0
  83. package/dist/mion-pure-fns/_rt/wSBaXrUNw9.js +1 -0
  84. package/dist/mion-pure-fns/_rt/zaCgqTB_lJ.js +5 -0
  85. package/dist/mion-pure-fns/index.json +114 -114
  86. package/dist/mocking/childMatch.js.map +1 -1
  87. package/dist/mocking/constants.mock.d.ts +0 -1
  88. package/dist/mocking/constants.mock.js +0 -1
  89. package/dist/mocking/constants.mock.js.map +1 -1
  90. package/dist/mocking/createMockData.js.map +1 -1
  91. package/dist/mocking/index.js.map +1 -1
  92. package/dist/mocking/isMultipleOf.js.map +1 -1
  93. package/dist/mocking/mockBigIntFormat.js.map +1 -1
  94. package/dist/mocking/mockDateTimeBounds.js.map +1 -1
  95. package/dist/mocking/mockInvalid.js.map +1 -1
  96. package/dist/mocking/mockNumberFormat.js.map +1 -1
  97. package/dist/mocking/mockRandom.js.map +1 -1
  98. package/dist/mocking/mockRegistry.js.map +1 -1
  99. package/dist/mocking/mockStringFormat.js +1 -1
  100. package/dist/mocking/mockStringFormat.js.map +1 -1
  101. package/dist/mocking/mockTemporal.js.map +1 -1
  102. package/dist/mocking/mockType.js.map +1 -1
  103. package/dist/mocking/mockTypes.js.map +1 -1
  104. package/dist/mocking/structuralFormat.js.map +1 -1
  105. package/dist/modelTypes.js.map +1 -1
  106. package/dist/overrideRTFunctions.js.map +1 -1
  107. package/dist/runtime/index.js.map +1 -1
  108. package/dist/runtypes/builderCore.js.map +1 -1
  109. package/dist/runtypes/builderTypes.js.map +1 -1
  110. package/dist/runtypes/circular-pure-fns.d.ts +1 -1
  111. package/dist/runtypes/circular-pure-fns.js.map +1 -1
  112. package/dist/runtypes/circular.js.map +1 -1
  113. package/dist/runtypes/classSerializerRegistry.js.map +1 -1
  114. package/dist/runtypes/dataOnly.js.map +1 -1
  115. package/dist/runtypes/entryTuple.js +30 -3
  116. package/dist/runtypes/entryTuple.js.map +1 -1
  117. package/dist/runtypes/formatAnnotation.js.map +1 -1
  118. package/dist/runtypes/formatErrors.js.map +1 -1
  119. package/dist/runtypes/formatPattern.js.map +1 -1
  120. package/dist/runtypes/jsonShape.js.map +1 -1
  121. package/dist/runtypes/pure-fn-ids.generated.d.ts +47 -47
  122. package/dist/runtypes/pure-fn-ids.generated.js +47 -47
  123. package/dist/runtypes/pure-fn-ids.generated.js.map +1 -1
  124. package/dist/runtypes/pure-fns-utils.d.ts +8 -8
  125. package/dist/runtypes/pure-fns-utils.js +0 -1
  126. package/dist/runtypes/pure-fns-utils.js.map +1 -1
  127. package/dist/runtypes/pureFn.js.map +1 -1
  128. package/dist/runtypes/rtUtils.js +16 -3
  129. package/dist/runtypes/rtUtils.js.map +1 -1
  130. package/dist/runtypes/sentinelKeys.js.map +1 -1
  131. package/dist/runtypes/stripRunTypeMeta.js.map +1 -1
  132. package/dist/runtypes/typeFormat.js.map +1 -1
  133. package/dist/runtypes/types.js.map +1 -1
  134. package/dist/standard/createJsonSchemaFn.js.map +1 -1
  135. package/dist/standard/createStandardSchema.js.map +1 -1
  136. package/dist/standard/issueMapping.js +2 -0
  137. package/dist/standard/issueMapping.js.map +1 -1
  138. package/dist/standard/jsonSchemaDoc.js.map +1 -1
  139. package/dist/standard/spec.js.map +1 -1
  140. package/package.json +21 -58
  141. package/dist/cjs/builders/atomic.d.ts +0 -12
  142. package/dist/cjs/builders/atomic.js +0 -43
  143. package/dist/cjs/builders/compose.d.ts +0 -60
  144. package/dist/cjs/builders/compose.js +0 -122
  145. package/dist/cjs/builders/index.d.ts +0 -5
  146. package/dist/cjs/builders/index.js +0 -48
  147. package/dist/cjs/builders/static.d.ts +0 -137
  148. package/dist/cjs/builders/static.js +0 -2
  149. package/dist/cjs/builders/utility.d.ts +0 -12
  150. package/dist/cjs/builders/utility.js +0 -43
  151. package/dist/cjs/createRTFunctions.d.ts +0 -90
  152. package/dist/cjs/createRTFunctions.js +0 -38
  153. package/dist/cjs/enrich/createFriendlyText.d.ts +0 -25
  154. package/dist/cjs/enrich/createFriendlyText.js +0 -275
  155. package/dist/cjs/enrich/friendlyText.d.ts +0 -56
  156. package/dist/cjs/enrich/friendlyText.js +0 -2
  157. package/dist/cjs/enrich/mockData.d.ts +0 -53
  158. package/dist/cjs/enrich/mockData.js +0 -2
  159. package/dist/cjs/fnHash.d.ts +0 -8
  160. package/dist/cjs/fnHash.js +0 -41
  161. package/dist/cjs/formats/bigintFormats.d.ts +0 -41
  162. package/dist/cjs/formats/bigintFormats.js +0 -10
  163. package/dist/cjs/formats/datetime/dateFormats.d.ts +0 -10
  164. package/dist/cjs/formats/datetime/dateFormats.js +0 -2
  165. package/dist/cjs/formats/datetime/dateTime-pure-fns.d.ts +0 -21
  166. package/dist/cjs/formats/datetime/dateTime-pure-fns.js +0 -405
  167. package/dist/cjs/formats/datetime/dateTimeParams.d.ts +0 -14
  168. package/dist/cjs/formats/datetime/dateTimeParams.js +0 -2
  169. package/dist/cjs/formats/datetime/stringDateTimeFormats.d.ts +0 -33
  170. package/dist/cjs/formats/datetime/stringDateTimeFormats.js +0 -2
  171. package/dist/cjs/formats/datetime/temporalFormats.d.ts +0 -84
  172. package/dist/cjs/formats/datetime/temporalFormats.js +0 -23
  173. package/dist/cjs/formats/index.d.ts +0 -18
  174. package/dist/cjs/formats/index.js +0 -88
  175. package/dist/cjs/formats/numberFormats.d.ts +0 -82
  176. package/dist/cjs/formats/numberFormats.js +0 -16
  177. package/dist/cjs/formats/refineFormat.d.ts +0 -24
  178. package/dist/cjs/formats/refineFormat.js +0 -2
  179. package/dist/cjs/formats/scalars.d.ts +0 -32
  180. package/dist/cjs/formats/scalars.js +0 -30
  181. package/dist/cjs/formats/string/credit-card-pure-fns.d.ts +0 -26
  182. package/dist/cjs/formats/string/credit-card-pure-fns.js +0 -151
  183. package/dist/cjs/formats/string/string-formats-pure-fns.d.ts +0 -12
  184. package/dist/cjs/formats/string/string-formats-pure-fns.js +0 -517
  185. package/dist/cjs/formats/string/string-patterns.d.ts +0 -111
  186. package/dist/cjs/formats/string/string-patterns.js +0 -115
  187. package/dist/cjs/formats/string/stringFormats.d.ts +0 -489
  188. package/dist/cjs/formats/string/stringFormats.js +0 -84
  189. package/dist/cjs/formats/structural.d.ts +0 -105
  190. package/dist/cjs/formats/structural.js +0 -7
  191. package/dist/cjs/getRunType.d.ts +0 -4
  192. package/dist/cjs/getRunType.js +0 -20
  193. package/dist/cjs/go-generated/fnHashes.generated.d.ts +0 -196
  194. package/dist/cjs/go-generated/fnHashes.generated.js +0 -78
  195. package/dist/cjs/go-generated/formatErrorKeys.generated.d.ts +0 -78
  196. package/dist/cjs/go-generated/formatErrorKeys.generated.js +0 -40
  197. package/dist/cjs/go-generated/runTypeKind.generated.d.ts +0 -62
  198. package/dist/cjs/go-generated/runTypeKind.generated.js +0 -61
  199. package/dist/cjs/go-generated/typeFormats.generated.d.ts +0 -104
  200. package/dist/cjs/go-generated/typeFormats.generated.js +0 -30
  201. package/dist/cjs/index.d.ts +0 -28
  202. package/dist/cjs/index.js +0 -47
  203. package/dist/cjs/markers.d.ts +0 -33
  204. package/dist/cjs/markers.js +0 -14
  205. package/dist/cjs/mocking/childMatch.d.ts +0 -3
  206. package/dist/cjs/mocking/childMatch.js +0 -357
  207. package/dist/cjs/mocking/constants.mock.d.ts +0 -7
  208. package/dist/cjs/mocking/constants.mock.js +0 -87
  209. package/dist/cjs/mocking/createMockData.d.ts +0 -8
  210. package/dist/cjs/mocking/createMockData.js +0 -53
  211. package/dist/cjs/mocking/index.d.ts +0 -4
  212. package/dist/cjs/mocking/index.js +0 -9
  213. package/dist/cjs/mocking/isMultipleOf.d.ts +0 -2
  214. package/dist/cjs/mocking/isMultipleOf.js +0 -11
  215. package/dist/cjs/mocking/mockBigIntFormat.d.ts +0 -1
  216. package/dist/cjs/mocking/mockBigIntFormat.js +0 -38
  217. package/dist/cjs/mocking/mockDateTimeBounds.d.ts +0 -13
  218. package/dist/cjs/mocking/mockDateTimeBounds.js +0 -277
  219. package/dist/cjs/mocking/mockInvalid.d.ts +0 -15
  220. package/dist/cjs/mocking/mockInvalid.js +0 -233
  221. package/dist/cjs/mocking/mockNumberFormat.d.ts +0 -1
  222. package/dist/cjs/mocking/mockNumberFormat.js +0 -56
  223. package/dist/cjs/mocking/mockRandom.d.ts +0 -20
  224. package/dist/cjs/mocking/mockRandom.js +0 -106
  225. package/dist/cjs/mocking/mockRegistry.d.ts +0 -7
  226. package/dist/cjs/mocking/mockRegistry.js +0 -11
  227. package/dist/cjs/mocking/mockStringFormat.d.ts +0 -5
  228. package/dist/cjs/mocking/mockStringFormat.js +0 -238
  229. package/dist/cjs/mocking/mockTemporal.d.ts +0 -13
  230. package/dist/cjs/mocking/mockTemporal.js +0 -233
  231. package/dist/cjs/mocking/mockType.d.ts +0 -3
  232. package/dist/cjs/mocking/mockType.js +0 -810
  233. package/dist/cjs/mocking/mockTypes.d.ts +0 -54
  234. package/dist/cjs/mocking/mockTypes.js +0 -2
  235. package/dist/cjs/mocking/structuralFormat.d.ts +0 -5
  236. package/dist/cjs/mocking/structuralFormat.js +0 -82
  237. package/dist/cjs/modelTypes.d.ts +0 -11
  238. package/dist/cjs/modelTypes.js +0 -2
  239. package/dist/cjs/overrideRTFunctions.d.ts +0 -9
  240. package/dist/cjs/overrideRTFunctions.js +0 -20
  241. package/dist/cjs/package.json +0 -3
  242. package/dist/cjs/runtime/index.d.ts +0 -10
  243. package/dist/cjs/runtime/index.js +0 -25
  244. package/dist/cjs/runtypes/builderCore.d.ts +0 -7
  245. package/dist/cjs/runtypes/builderCore.js +0 -39
  246. package/dist/cjs/runtypes/builderTypes.d.ts +0 -51
  247. package/dist/cjs/runtypes/builderTypes.js +0 -2
  248. package/dist/cjs/runtypes/circular-pure-fns.d.ts +0 -11
  249. package/dist/cjs/runtypes/circular-pure-fns.js +0 -117
  250. package/dist/cjs/runtypes/circular.d.ts +0 -6
  251. package/dist/cjs/runtypes/circular.js +0 -25
  252. package/dist/cjs/runtypes/classSerializerRegistry.d.ts +0 -28
  253. package/dist/cjs/runtypes/classSerializerRegistry.js +0 -141
  254. package/dist/cjs/runtypes/dataOnly.d.ts +0 -29
  255. package/dist/cjs/runtypes/dataOnly.js +0 -2
  256. package/dist/cjs/runtypes/entryTuple.d.ts +0 -101
  257. package/dist/cjs/runtypes/entryTuple.js +0 -395
  258. package/dist/cjs/runtypes/formatAnnotation.d.ts +0 -4
  259. package/dist/cjs/runtypes/formatAnnotation.js +0 -2
  260. package/dist/cjs/runtypes/formatErrors.d.ts +0 -18
  261. package/dist/cjs/runtypes/formatErrors.js +0 -2
  262. package/dist/cjs/runtypes/formatPattern.d.ts +0 -20
  263. package/dist/cjs/runtypes/formatPattern.js +0 -17
  264. package/dist/cjs/runtypes/jsonShape.d.ts +0 -22
  265. package/dist/cjs/runtypes/jsonShape.js +0 -2
  266. package/dist/cjs/runtypes/pure-fn-ids.generated.d.ts +0 -47
  267. package/dist/cjs/runtypes/pure-fn-ids.generated.js +0 -50
  268. package/dist/cjs/runtypes/pure-fns-utils.d.ts +0 -8
  269. package/dist/cjs/runtypes/pure-fns-utils.js +0 -147
  270. package/dist/cjs/runtypes/pureFn.d.ts +0 -7
  271. package/dist/cjs/runtypes/pureFn.js +0 -52
  272. package/dist/cjs/runtypes/rtUtils.d.ts +0 -45
  273. package/dist/cjs/runtypes/rtUtils.js +0 -218
  274. package/dist/cjs/runtypes/sentinelKeys.d.ts +0 -7
  275. package/dist/cjs/runtypes/sentinelKeys.js +0 -2
  276. package/dist/cjs/runtypes/stripRunTypeMeta.d.ts +0 -53
  277. package/dist/cjs/runtypes/stripRunTypeMeta.js +0 -2
  278. package/dist/cjs/runtypes/typeFormat.d.ts +0 -14
  279. package/dist/cjs/runtypes/typeFormat.js +0 -2
  280. package/dist/cjs/runtypes/types.d.ts +0 -114
  281. package/dist/cjs/runtypes/types.js +0 -2
  282. package/dist/cjs/standard/createJsonSchemaFn.d.ts +0 -8
  283. package/dist/cjs/standard/createJsonSchemaFn.js +0 -16
  284. package/dist/cjs/standard/createStandardSchema.d.ts +0 -18
  285. package/dist/cjs/standard/createStandardSchema.js +0 -30
  286. package/dist/cjs/standard/issueMapping.d.ts +0 -12
  287. package/dist/cjs/standard/issueMapping.js +0 -36
  288. package/dist/cjs/standard/jsonSchemaDoc.d.ts +0 -7
  289. package/dist/cjs/standard/jsonSchemaDoc.js +0 -95
  290. package/dist/cjs/standard/spec.d.ts +0 -47
  291. package/dist/cjs/standard/spec.js +0 -2
  292. package/dist/mion-pure-fns/@mionjs/run-types/-y__pOnrgnvRMz.js +0 -2
  293. package/dist/mion-pure-fns/@mionjs/run-types/0ofEnb55W0BDIY.js +0 -2
  294. package/dist/mion-pure-fns/@mionjs/run-types/18wDCH5CXZoQKV.js +0 -2
  295. package/dist/mion-pure-fns/@mionjs/run-types/2xtQHAMu-yOBo6.js +0 -1
  296. package/dist/mion-pure-fns/@mionjs/run-types/5oCqd7YyfA9rEw.js +0 -1
  297. package/dist/mion-pure-fns/@mionjs/run-types/6E7qWsIwaFRGn6.js +0 -1
  298. package/dist/mion-pure-fns/@mionjs/run-types/6xkN1Qfs9nqO79.js +0 -1
  299. package/dist/mion-pure-fns/@mionjs/run-types/8Mj42N3ytEEn67.js +0 -1
  300. package/dist/mion-pure-fns/@mionjs/run-types/A3KjzpjelkcBST.js +0 -2
  301. package/dist/mion-pure-fns/@mionjs/run-types/AgOXcprpjsrTKk.js +0 -1
  302. package/dist/mion-pure-fns/@mionjs/run-types/E29ul2pUOyD_Ay.js +0 -1
  303. package/dist/mion-pure-fns/@mionjs/run-types/EG8OkOOSnT9bZn.js +0 -1
  304. package/dist/mion-pure-fns/@mionjs/run-types/EYsxRHRDgAykA_.js +0 -3
  305. package/dist/mion-pure-fns/@mionjs/run-types/Eube1z0GFHuqlM.js +0 -2
  306. package/dist/mion-pure-fns/@mionjs/run-types/GA20s6bj41GC1A.js +0 -1
  307. package/dist/mion-pure-fns/@mionjs/run-types/GfQK19ktpvibuZ.js +0 -2
  308. package/dist/mion-pure-fns/@mionjs/run-types/IyjvBbz0zSlgCJ.js +0 -1
  309. package/dist/mion-pure-fns/@mionjs/run-types/LqTR2O-h6MYq9J.js +0 -4
  310. package/dist/mion-pure-fns/@mionjs/run-types/MnJ72PqkyXHiSP.js +0 -1
  311. package/dist/mion-pure-fns/@mionjs/run-types/NJ9TCGDnkv_9Mn.js +0 -2
  312. package/dist/mion-pure-fns/@mionjs/run-types/OCJ1B0-ZCAwagS.js +0 -1
  313. package/dist/mion-pure-fns/@mionjs/run-types/PQVLEBllZckw8I.js +0 -2
  314. package/dist/mion-pure-fns/@mionjs/run-types/Qd_9GJQlOCVqDe.js +0 -1
  315. package/dist/mion-pure-fns/@mionjs/run-types/R0IFkkw4SM2gvv.js +0 -2
  316. package/dist/mion-pure-fns/@mionjs/run-types/THkAA-KNR1HeAe.js +0 -1
  317. package/dist/mion-pure-fns/@mionjs/run-types/VJiknJ2exR2oMF.js +0 -1
  318. package/dist/mion-pure-fns/@mionjs/run-types/XYGjy-tcgDROBw.js +0 -2
  319. package/dist/mion-pure-fns/@mionjs/run-types/Z2sc5xQPKB0oav.js +0 -1
  320. package/dist/mion-pure-fns/@mionjs/run-types/_3Pmrr5aNmyNi4.js +0 -2
  321. package/dist/mion-pure-fns/@mionjs/run-types/cgwpjq6rGsI8jb.js +0 -1
  322. package/dist/mion-pure-fns/@mionjs/run-types/d8U9HjmMsNFd6Z.js +0 -1
  323. package/dist/mion-pure-fns/@mionjs/run-types/fL3v1v6aVZwJ7-.js +0 -1
  324. package/dist/mion-pure-fns/@mionjs/run-types/gFl-yXbCxJqWgQ.js +0 -2
  325. package/dist/mion-pure-fns/@mionjs/run-types/hiotRbfSKFAuK4.js +0 -1
  326. package/dist/mion-pure-fns/@mionjs/run-types/lFYcgG5ZSI-8em.js +0 -1
  327. package/dist/mion-pure-fns/@mionjs/run-types/n_ZOWff4X3qBMQ.js +0 -1
  328. package/dist/mion-pure-fns/@mionjs/run-types/ndkQPoji6DFHx2.js +0 -2
  329. package/dist/mion-pure-fns/@mionjs/run-types/nsU8QeJCuCF8Kr.js +0 -1
  330. package/dist/mion-pure-fns/@mionjs/run-types/qMsNYN8hy_sC8i.js +0 -1
  331. package/dist/mion-pure-fns/@mionjs/run-types/rXVwGkGDX08BsQ.js +0 -1
  332. package/dist/mion-pure-fns/@mionjs/run-types/rgWveqNi_HeFF8.js +0 -5
  333. package/dist/mion-pure-fns/@mionjs/run-types/s-tZDRlQfCG5m2.js +0 -1
  334. package/dist/mion-pure-fns/@mionjs/run-types/t-ntJ9S0FuxkC2.js +0 -1
  335. package/dist/mion-pure-fns/@mionjs/run-types/tfRjnFZVF8lqI_.js +0 -1
  336. package/dist/mion-pure-fns/@mionjs/run-types/vLId7t0J8HNWlN.js +0 -1
  337. package/dist/mion-pure-fns/@mionjs/run-types/zXMPEMyjGR4ZRc.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pureFn.js","sourceRoot":"","sources":["../../src/runtypes/pureFn.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AAiB7E,SAAS,SAAS,CAAC,EAA0B,EAAE,IAAa;IAC1D,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,EAAY,CAAC,CAAC,CAAE,EAAoB,CAAC;AAC3D,CAAC;AAMD,SAAS,YAAY,CAAC,MAAc,EAAE,GAAY,EAAE,EAAsB,EAAE,IAAa;IAKvF,IAAI,GAAG,IAAI,IAAI;QAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAa,CAAC;IAC/C,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,UAAU,MAAM,8DAA8D;YAC5E,4EAA4E;YAC5E,qBAAqB,CACxB,CAAC;IACJ,CAAC;IACD,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,aAAa,CAAC,GAAiB,CAAC,CAAC;QACjC,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;QAC3D,IAAI,UAAU;YAAE,OAAO,EAAc,CAAC;QAEtC,MAAM,IAAI,KAAK,CAAC,UAAU,MAAM,0BAA0B,EAAE,wBAAwB,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACzD,IAAI,QAAQ,EAAE,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OAAO,EAAc,CAAC;AACxB,CAAC;AAKD,MAAM,UAAU,qBAAqB,CACnC,YAAiD,EACjD,EAA2B;IAE3B,OAAO,YAAY,CAAC,uBAAuB,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,CAAiB,CAAC;AACxF,CAAC;AAID,MAAM,UAAU,cAAc,CAC5B,EAAgC,EAChC,EAA2B;IAE3B,OAAO,YAAY,CAAC,gBAAgB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,CAAiB,CAAC;AACtE,CAAC","sourcesContent":["/* ########\n * 2026 ma-jerez\n * Author: Ma-jerez\n * License: MIT, see LICENSE\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {CompiledPureFunction, PureFunction as PureFn, PureFunctionFactory as PureFnFactory} from './types.ts';\nimport {getRTUtils} from './rtUtils.ts';\nimport {initFromTuple, isEntryTuple, type EntryTuple} from './entryTuple.ts';\nimport type {\n InjectPureFnId,\n PureFunction as PureFunctionMarker,\n PureFunctionFactory as PureFunctionFactoryMarker,\n} from '../markers.ts';\n\n/** A pure function's identity: owning package plus a hash of the shipped body, like `'@acme/text:9Zt1bRm4cV'`. */\n// A move or a rename keeps the id; a change to the body, or to the id of a helper it reaches, changes it.\n// The brand means only a value a registrar returned type-checks where an id is asked for, so a body reaches another pure fn by importing it.\nexport type PureFnId<ID extends string = string> = ID & {readonly __rtPureFnIdBrand: true};\n\n/** TWO authoring forms, one runtime shape: the cache always stores a factory `(utl) => fn` for lazy materialisation. */\n// FACTORY: the argument IS the factory, emitted as-is, so it can do one-time setup + `utl` composition.\n// DIRECT: the argument IS the pure fn and the compiler wraps it into `() => fn`, so `inputFrom(t => t.id)` works.\n// That wrap is a BUILD-TIME concern (the Go extractor synthesises the factory), so both registrars share the core below.\n// `wrap` only matters on the dev-override path, where the argument is the live function rather than a tuple.\nfunction asFactory(fn: PureFn | PureFnFactory, wrap: boolean): PureFnFactory {\n return wrap ? () => fn as PureFn : (fn as PureFnFactory);\n}\n\n/** Shared registration core, and the one place the three shapes of `arg` are told apart. */\n// Entry-module tuple: the normal, build-rewritten case, where calling this at module load IS the registration.\n// Live function: the dev-tool override path, where `wrap` says whether it is the pure fn or the factory. `null`: body ships elsewhere.\n// A missing `id` is the one hard error: no build processed this file, so there is no identity to register under.\nfunction registerCore(caller: string, arg: unknown, id: string | undefined, wrap: boolean): PureFnId {\n // Hollowed registration: a package build stripped the body, which now travels on demand through the pure-fn cache.\n // Nothing is cached here: an empty entry would mask the real tuple whenever this call wins the load order.\n // Nothing ever invokes it either, because a body only reaches a pure fn the build demanded, served and registered before it runs.\n // The id is not needed: a consumer's build lowers an imported id to a literal from the `.d.ts`, so the generated id module tree-shakes out.\n if (arg == null) return (id ?? '') as PureFnId;\n if (id === undefined) {\n throw new Error(\n `[mion] ${caller}: no id injected. The build plugin must process this file — ` +\n `check that @mionjs/devtools is installed and the dev server has restarted ` +\n `after recent edits.`\n );\n }\n if (isEntryTuple(arg)) {\n initFromTuple(arg as EntryTuple);\n const registered = getRTUtils().getCompiledPureFnByKey(id);\n if (registered) return id as PureFnId;\n // An entry tuple that doesn't register its own id is an emitter bug, louder here than a lookup miss much later.\n throw new Error(`[mion] ${caller}: the entry tuple for \"${id}\" did not register it.`);\n }\n // Untracked: `id` is whatever this function was called with, so the build has no consumer reference to track.\n const existing = getRTUtils().getCompiledPureFnByKey(id);\n if (existing) {\n if (arg) {\n // Manual override — dev-tool only. The build rewrite injects the tuple.\n existing.createPureFn = asFactory(arg as PureFn | PureFnFactory, wrap);\n existing.fn = undefined;\n }\n return id as PureFnId;\n }\n if (typeof arg === 'function') {\n // No-transform fallback (a dev-tool override, or a file the build skipped): the function is right here.\n // Build-time metadata (id hash, stripped code, static dep extraction) is build-only; behaviour is identical because the function IS the body.\n const compiled: CompiledPureFunction = {\n id,\n paramNames: [],\n code: '',\n pureFnDependencies: [],\n createPureFn: asFactory(arg as PureFn | PureFnFactory, wrap),\n fn: undefined,\n };\n getRTUtils().addPureFn(id, compiled);\n return id as PureFnId;\n }\n return id as PureFnId;\n}\n\n/** FACTORY registration: `createPureFn` is emitted as-is, so it can compile one-time setup and compose other pure fns through `utl.usePureFn(otherId)`. */\n// Returns the id the build computed, the value other pure fns import to reach this one; `null` registers a hollowed pure fn.\n// The contract is encoded in the parameter brands, so the Go scanner discovers calls by brand and a library can wrap this registrar by forwarding both.\nexport function registerPureFnFactory<F extends PureFnFactory, ID extends string = string>(\n createPureFn: PureFunctionFactoryMarker<F> | null,\n id?: InjectPureFnId<F> & ID\n): PureFnId<ID> {\n return registerCore('registerPureFnFactory', createPureFn, id, false) as PureFnId<ID>;\n}\n\n/** DIRECT registration: `fn` is the pure function ITSELF and the compiler wraps it into `() => fn`. */\n// Use `registerPureFnFactory` instead when the pure fn needs one-time setup or `utl` composition.\nexport function registerPureFn<F extends PureFn, ID extends string = string>(\n fn: PureFunctionMarker<F> | null,\n id?: InjectPureFnId<F> & ID\n): PureFnId<ID> {\n return registerCore('registerPureFn', fn, id, true) as PureFnId<ID>;\n}\n"]}
@@ -166,7 +166,7 @@ function initPureFunction(compiled) {
166
166
  return;
167
167
  let factory = compiled.createPureFn;
168
168
  if (!factory) {
169
- factory = buildPureFnFactoryFromCode(compiled.paramNames, compiled.code ?? '');
169
+ factory = buildOrNameEntry(() => buildPureFnFactoryFromCode(compiled.paramNames, compiled.code ?? ''), `pure fn "${compiled.id}"`);
170
170
  compiled.createPureFn = factory;
171
171
  }
172
172
  compiled.fn = factory(rtUtils);
@@ -174,6 +174,17 @@ function initPureFunction(compiled) {
174
174
  export function buildPureFnFactoryFromCode(paramNames, code) {
175
175
  return new Function(...paramNames, `'use strict'; ${code}`);
176
176
  }
177
+ function buildOrNameEntry(build, label) {
178
+ try {
179
+ return build();
180
+ }
181
+ catch (error) {
182
+ if (!(error instanceof EvalError))
183
+ throw error;
184
+ throw new Error(`${error.message}: ${label} has no live function, only a code string. ` +
185
+ `Generated modules built with emitMode 'code' (your app's or a dependency's) ship it that way: search the bundle for that id.`, { cause: error });
186
+ }
187
+ }
177
188
  export function buildFactoryFromCode(code) {
178
189
  return new Function('utl', `'use strict'; ${code}`);
179
190
  }
@@ -200,8 +211,10 @@ function materializeRTFn(entry) {
200
211
  return;
201
212
  materializing.add(entry.rtFnHash);
202
213
  try {
203
- if (!entry.createRTFn)
204
- entry.createRTFn = buildFactoryFromCode(entryCode(entry));
214
+ if (!entry.createRTFn) {
215
+ const label = `compiled fn "${entry.rtFnHash}" (${entry.typeName})`;
216
+ entry.createRTFn = buildOrNameEntry(() => buildFactoryFromCode(entryCode(entry)), label);
217
+ }
205
218
  entry.fn = entry.createRTFn(rtUtils);
206
219
  }
207
220
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"rtUtils.js","sourceRoot":"","sources":["../../src/runtypes/rtUtils.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,kBAAkB,IAAI,sBAAsB,EAC5C,gBAAgB,IAAI,oBAAoB,EACxC,oBAAoB,IAAI,wBAAwB,GACjD,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAarD,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,OAAQ,GAAe,CAAC,EAAE,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,CAAC;AAC7G,CAAC;AAED,MAAM,UAAU,GAAwB,EAAE,CAAC;AAC3C,MAAM,YAAY,GAAuB,EAAE,CAAC;AAC5C,MAAM,aAAa,GAAkB,EAAE,CAAC;AAKxC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAiC,CAAC;AAEnE,MAAM,OAAO,GAAG;IACd,YAAY,CAAC,IAAoB;QAC/B,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;QACjC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IACD,iBAAiB,CAAC,IAAoB;QACpC,IAAI,CA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AAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;AACH,CAAC","sourcesContent":["/* ########\n * 2024 ma-jerez\n * Author: Ma-jerez\n\n * License: MIT, see LICENSE\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n// ⚠️ `rtUtils` is the runtime SERVICE object handed to every emitted factory (`utl`): caches, registries, the\n// class-serializer lookup, the circular-reference guard. It is NOT a bag of helpers — a pure function (one that\n// only looks at its arguments) belongs inline in the generated code, or under `pure-fns/` reached through\n// `getPureFn`. Anything added here bloats the surface every generated module closes over.\nimport type {\n AnyFn,\n CompiledTypeFn,\n TypesFunctionsCache,\n PureFunctionsCache,\n CompiledPureFunction,\n PureFunction,\n PureFunctionFactory,\n RunType,\n RunTypesCache,\n InitializedTypeFn,\n Mutable,\n} from './types.ts';\nimport {\n getClassSerializer as getClassSerializerImpl,\n deserializeClass as deserializeClassImpl,\n classSerializerEpoch as classSerializerEpochImpl,\n} from './classSerializerRegistry.ts';\nimport {CircularReferenceError} from './circular.ts';\nimport type {CircularPath} from './circular.ts';\nimport type {ClassSerializerEntry} from './classSerializerRegistry.ts';\nimport type {DataOnly} from './dataOnly.ts';\nimport type {CompTimeArgs} from '../markers.ts';\nimport type {PureFnId} from './pureFn.ts';\n\n/** Shape of rtUtils. Must be defined as a type — `typeof rtUtils` breaks reflection. */\nexport type RTUtils = typeof rtUtils;\n\n/** Runtime guard for the RUN-TYPE overload shared by every `createXxx` factory: the run-type a builder returns\n * carries both a string `id` and a `kind`. Plain reflected values (the value/static form) don't carry `kind`,\n * so they fall through to the plugin-injected id. **/\nexport function isRunTypeValue(val: unknown): val is RunType {\n return typeof val === 'object' && val !== null && typeof (val as RunType).id === 'string' && 'kind' in val;\n}\n\nconst rtFnsCache: TypesFunctionsCache = {};\nconst pureFnsCache: PureFunctionsCache = {};\nconst runTypesCache: RunTypesCache = {};\n\n// Memo for findRTForType, negative results included (`null` = scanned, no entry). Cleared whenever rtFnsCache\n// mutates, so a hit is always as fresh as a scan. Without it the O(cache) scan runs per format-annotated MOCK\n// NODE (~10^5 for one generated value), which turned a 35ms fuzz-soak iteration into 300+ seconds.\nconst findRTForTypeMemo = new Map<string, CompiledTypeFn | null>();\n\nconst rtUtils = {\n addToRTCache(comp: CompiledTypeFn) {\n rtFnsCache[comp.rtFnHash] = comp;\n findRTForTypeMemo.clear();\n },\n removeFromRTCache(comp: CompiledTypeFn) {\n if (!rtFnsCache[comp.rtFnHash]) return;\n (rtFnsCache[comp.rtFnHash] as any) = undefined;\n findRTForTypeMemo.clear();\n },\n // Fn types the entry for typed callers (emitMode ts factories); the cache itself is untyped.\n getRT<Fn extends AnyFn = AnyFn>(rtFnHash: string): InitializedTypeFn<Fn> | undefined {\n const entry = rtFnsCache[rtFnHash];\n if (!entry) return undefined;\n materializeRTFn(entry);\n return entry as InitializedTypeFn<Fn>;\n },\n // Find a family's compiled entry for a TYPE id without knowing the family's opaque fnHash prefix (cache keys\n // are `<fnHash>_<typeId>`, and the hash folds the binary version, so the runtime can never hardcode it). Cold\n // path (mock generation), but called once per format-annotated node of a generated value, so the repeats must\n // be O(1) — hence the memo.\n findRTForType(familyTag: string, typeId: string): InitializedTypeFn | undefined {\n const memoKey = familyTag + '\\u0000' + typeId;\n const hit = findRTForTypeMemo.get(memoKey);\n if (hit !== undefined) {\n if (hit === null) return undefined;\n materializeRTFn(hit);\n return hit as InitializedTypeFn;\n }\n const suffix = '_' + typeId;\n for (const key of Object.keys(rtFnsCache)) {\n if (!key.endsWith(suffix)) continue;\n const entry = rtFnsCache[key];\n if (!entry || entry.familyTag !== familyTag) continue;\n materializeRTFn(entry);\n findRTForTypeMemo.set(memoKey, entry);\n return entry;\n }\n findRTForTypeMemo.set(memoKey, null);\n return undefined;\n },\n getRTFn(rtFnHash: string): (...args: any[]) => any {\n const entry = rtFnsCache[rtFnHash];\n if (!entry) throw new Error(`RT function not found for rtFnHash ${rtFnHash}`);\n materializeRTFn(entry);\n return entry.fn;\n },\n hasRTFn(rtFnHash: string) {\n return !!rtFnsCache[rtFnHash];\n },\n addPureFn(id: string, compiledFn: CompiledPureFunction): CompiledPureFunction {\n if (!id) throw new Error('Pure function id must be a non-empty string');\n const key = id;\n // An id is the hash of the body that ships, so one key is one body: a\n // repeat is the same function arriving twice, never a different version.\n const existing = pureFnsCache[key];\n if (existing) return existing;\n pureFnsCache[key] = compiledFn;\n return compiledFn;\n },\n // CompTimeArgs ensures dependencies are tracked inside pure functions\n usePureFn(key: CompTimeArgs<PureFnId>): PureFunction {\n const compiled = pureFnsCache[key];\n if (!compiled) throw new Error(`Pure function not found for key \"${key}\"`);\n initPureFunction(compiled);\n return compiled.fn;\n },\n // CompTimeArgs ensures dependencies are tracked inside pure functions\n getPureFn<Fn extends PureFunction = PureFunction>(key: CompTimeArgs<PureFnId>): Fn | undefined {\n const compiled = pureFnsCache[key];\n if (!compiled) return;\n initPureFunction(compiled);\n return compiled.fn as Fn | undefined;\n },\n // CompTimeArgs ensures dependencies are tracked inside pure functions\n getCompiledPureFn(key: CompTimeArgs<PureFnId>): CompiledPureFunction | undefined {\n return pureFnsCache[key];\n },\n // CompTimeArgs ensures dependencies are tracked inside pure functions\n hasPureFn(key: CompTimeArgs<PureFnId>): boolean {\n return !!pureFnsCache[key];\n },\n // Runtime-key lookup — the UNTRACKED companion to usePureFn/getPureFn/hasPureFn. The plain `string` param (NOT\n // `CompTimeArgs<string>`) keeps the scanner from demand-checking it, which is the door for a framework\n // dispatching on a pure-fn id received over the WIRE. It drives no purefn-not-registered check\n // and no pure-fn dependency edges; use the CompTimeArgs forms when you want that tracking.\n getPureFnByKey(key: string): PureFunction | undefined {\n const compiled = pureFnsCache[key];\n if (!compiled) return;\n initPureFunction(compiled);\n return compiled.fn;\n },\n // Untracked existence check keyed by a runtime string (see getPureFnByKey).\n hasPureFnByKey(key: string): boolean {\n return !!pureFnsCache[key];\n },\n // Untracked record lookup keyed by a runtime string (see getPureFnByKey). The registration path uses this one:\n // it is handed an id it was called with, so there is no reference for the build to track.\n getCompiledPureFnByKey(key: string): CompiledPureFunction | undefined {\n return pureFnsCache[key];\n },\n addRunType(id: string, runType: RunType): RunType {\n if (!id) throw new Error('Run-type id must be a non-empty string');\n runTypesCache[id] = runType;\n return runType;\n },\n removeRunType(id: string) {\n if (!runTypesCache[id]) return;\n (runTypesCache[id] as any) = undefined;\n },\n getRunType(id: string): RunType | undefined {\n return runTypesCache[id];\n },\n useRunType(id: string): RunType {\n const rt = runTypesCache[id];\n if (!rt) throw new Error(`Run-type not found for id \"${id}\"`);\n return rt;\n },\n hasRunType(id: string): boolean {\n return !!runTypesCache[id];\n },\n // \"Does the build know this type at all?\" — the degrade-vs-throw signal for a compiled-fn key miss\n // (resolveEntryTupleFn): a known type degrades to the family identity, a wholly unknown id throws. The runtype\n // graph is demand-driven (reflection sites only), so ANY registered fn entry for the id counts as knowledge\n // too; otherwise a createX-only type would flip from degrade to throw depending on whether some unrelated file\n // happens to reflect it. Miss paths only, so the linear key scan needs no memo.\n knowsType(typeId: string): boolean {\n if (runTypesCache[typeId]) return true;\n const suffix = '_' + typeId;\n for (const key of Object.keys(rtFnsCache)) {\n if (key.endsWith(suffix) && rtFnsCache[key]) return true;\n }\n return false;\n },\n alwaysThrowFactory(message: string): () => never {\n return () => {\n throw new Error(message);\n };\n },\n // Constructs the CircularReferenceError an armed encoder body throws when its inline guard (findCycle) detects\n // a cycle. Kept on rtUtils so the body — rebuilt via `new Function('utl', code)` — can reach the class.\n circularError(path: CircularPath): CircularReferenceError {\n return new CircularReferenceError(path);\n },\n // Custom user-class (de)serializer lookup, called by emitted bodies with the class node's `rt.ID` plus its\n // build-time class name: exact instantiation ids match first, then the class-name fallback lane (one\n // registration covers every generic instantiation, since generics are erased at runtime). Without an entry the\n // factory uses its structural fallback. See classSerializerRegistry.ts.\n getClassSerializer(typeId: string, className?: string): ClassSerializerEntry | undefined {\n return getClassSerializerImpl(typeId, className);\n },\n // Registry epoch — emitted bodies cache their getClassSerializer(<id>) result in the closure and re-look-up\n // only when this moves, so the steady-state hot path is one int compare, not a Map lookup.\n csEpoch(): number {\n return classSerializerEpochImpl();\n },\n // Reconstruct a live instance from decoded data: prefers the registered `deserialize`, else auto-instantiates\n // a zero-arg class and sets its declared properties (surfacing data-class-constructor-failed when the bare `new cls()` throws).\n deserializeClass<T>(entry: ClassSerializerEntry<T>, data: DataOnly<T>, keys: readonly string[]): T {\n return deserializeClassImpl(entry, data, keys);\n },\n};\n\nexport function getRTUtils(): RTUtils {\n return rtUtils;\n}\n\n/** Returns the RT and pure-function caches. DO NOT MODIFY — the returned\n * objects are the originals used by RT functions. */\nexport function getRTFnCaches() {\n return {\n rtFnsCache: rtFnsCache as Readonly<TypesFunctionsCache>,\n pureFnsCache: pureFnsCache as Readonly<PureFunctionsCache>,\n };\n}\n\n/** Lazily materialize a pure function's `.fn` (symmetric with materializeRTFn). In `functions`/`both` mode\n * `createPureFn` is the embedded closure; in `code` mode (default) it is absent, so it is rebuilt from `code` +\n * `paramNames` and cached on the entry so the reconstruction runs once. **/\nfunction initPureFunction(compiled: CompiledPureFunction): asserts compiled is CompiledPureFunction & {fn: PureFunction} {\n if (compiled.fn) return;\n let factory = compiled.createPureFn;\n if (!factory) {\n factory = buildOrNameEntry(\n () => buildPureFnFactoryFromCode(compiled.paramNames, compiled.code ?? ''),\n `pure fn \"${compiled.id}\"`\n );\n (compiled as Mutable<CompiledPureFunction>).createPureFn = factory;\n }\n compiled.fn = factory(rtUtils);\n}\n\n/** Rebuilds a pure-fn factory from its serialized `code` body. Forces strict mode so the result matches the\n * always-strict ESM literal shipped in `functions`/`both` mode. Contrast `buildFactoryFromCode` (type fns): a\n * pure fn's params are its recorded `paramNames`, not a fixed `utl`. **/\nexport function buildPureFnFactoryFromCode(paramNames: string[], code: string): PureFunctionFactory {\n // oxlint-disable-next-line typescript/no-implied-eval\n return new Function(...paramNames, `'use strict'; ${code}`) as PureFunctionFactory;\n}\n\n/** Names the code-only entry in the error when the host forbids `new Function` (an EvalError). **/\nfunction buildOrNameEntry<F>(build: () => F, label: string): F {\n try {\n return build();\n } catch (error) {\n if (!(error instanceof EvalError)) throw error;\n throw new Error(\n `${error.message}: ${label} has no live function, only a code string. ` +\n `Generated modules built with emitMode 'code' (your app's or a dependency's) ship it that way: search the bundle for that id.`,\n {cause: error}\n );\n }\n}\n\n/** Builds a fresh factory closure from a serialized code body. Forces strict mode. **/\nexport function buildFactoryFromCode(code: string): (utl: RTUtils) => (...args: any[]) => any {\n // oxlint-disable-next-line typescript/no-implied-eval\n return new Function('utl', `'use strict'; ${code}`) as (utl: RTUtils) => (...args: any[]) => any;\n}\n\n/** Returns the entry's factory body `code`. Present verbatim in `code`/`both` modes; in `functions` mode it is\n * derived from `createRTFn.toString()` — the factory prints as `function g_<hash>(utl){<body>}`, so the body is\n * the slice between the first `{` and the last `}`. Memoized onto the entry so the derivation runs once. **/\nexport function entryCode(entry: CompiledTypeFn): string {\n if (entry.code !== undefined) return entry.code;\n if (entry.createRTFn) {\n const src = entry.createRTFn.toString();\n const open = src.indexOf('{');\n const close = src.lastIndexOf('}');\n const derived = open >= 0 && close > open ? src.slice(open + 1, close) : '';\n (entry as Mutable<CompiledTypeFn>).code = derived;\n return derived;\n }\n return '';\n}\n\n/** Cycle guard: when A's createRTFn invokes `getRT('B')` and B's invokes `getRT('A')`, the second call would\n * re-enter materializeRTFn for A while A is still materializing. The marker short-circuits that re-entry —\n * getRT still returns A's entry with `fn` undefined, and the inner closure reads `A.fn` later at call time. **/\nconst materializing = new Set<string>();\n\n/** Lazily populate an entry's `createRTFn` + `fn`. Cache modules register entries without eager materialization\n * so cross-cache `getRT()` lookups inside a closure resolve to entries that already exist. In `functions`/`both`\n * mode `createRTFn` is the embedded closure; in `code` mode it is rebuilt from `entry.code`. Noop entries skip\n * via the `entry.fn` guard (pre-populated with the family identity at register time), and an alwaysThrow\n * entry's `createRTFn` is the throwing closure from `alwaysThrowFactory(message)`. **/\nfunction materializeRTFn(entry: CompiledTypeFn): asserts entry is InitializedTypeFn {\n if (entry.fn) return;\n if (materializing.has(entry.rtFnHash)) return;\n if (!entry.createRTFn && !entry.code) return;\n materializing.add(entry.rtFnHash);\n try {\n // entryCode === entry.code here, since createRTFn is absent.\n if (!entry.createRTFn) {\n const label = `compiled fn \"${entry.rtFnHash}\" (${entry.typeName})`;\n (entry as Mutable<CompiledTypeFn>).createRTFn = buildOrNameEntry(() => buildFactoryFromCode(entryCode(entry)), label);\n }\n (entry as Mutable<CompiledTypeFn>).fn = (entry as InitializedTypeFn).createRTFn(rtUtils);\n } finally {\n materializing.delete(entry.rtFnHash);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sentinelKeys.js","sourceRoot":"","sources":["../../src/runtypes/sentinelKeys.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"sentinelKeys.js","sourceRoot":"","sources":["../../src/runtypes/sentinelKeys.ts"],"names":[],"mappings":"","sourcesContent":["// The sentinel KEYS every RunTypes brand rides, as `unique symbol`s so branding a type never pollutes its STRING keys: with string\n// keys, `Extract<keyof …, string>`, an object spread and every string-constrained mapped type surfaced `__rtFormatName` alongside\n// the user's own members. A property cannot be hidden from `keyof` at all, so the bare `keyof` still yields these symbols; every\n// operation that iterates STRING keys no longer sees them.\n// Zero runtime footprint by construction: `declare const` emits nothing and every use site imports them with `import type`.\n// ⚠️ These NAMES are a wire contract with the resolver: `isSentinelProp`\n// (ts-go-runtypes/internal/cachegen/runtype/typeid/formats.go) matches on the declaration name, so renaming one here means renaming\n// its constant there, or the brand stops being recognised and silently degrades to its base type.\n// The plain string spelling stays recognised on the Go side on purpose: it lets a hand-written `.d.ts` fixture and the fuzz suites'\n// INDEPENDENT type-first oracle spell a sentinel without importing this module. Both spellings fold to the same structural id, the\n// property name never reaching the hash.\n\n// #region sentinel-keys-extract — sliced verbatim by test/types/substituteSelfHarness.ts, which puts it first because the\n// SubstituteSelf region it appends names these symbols; the snippet has no imports.\n// A locally declared symbol of the same NAME is recognised exactly like the shipped one, so the slice is a faithful stand-in.\nexport declare const __rtFormatName: unique symbol;\nexport declare const __rtFormatParams: unique symbol;\nexport declare const __rtFormatBrand: unique symbol;\nexport declare const __rtContains: unique symbol;\nexport declare const __rtPatternProps: unique symbol;\nexport declare const __rtPropNames: unique symbol;\nexport declare const __rtLabels: unique symbol;\n// #endregion sentinel-keys-extract\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stripRunTypeMeta.js","sourceRoot":"","sources":["../../src/runtypes/stripRunTypeMeta.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"stripRunTypeMeta.js","sourceRoot":"","sources":["../../src/runtypes/stripRunTypeMeta.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n __rtFormatName,\n __rtFormatParams,\n __rtFormatBrand,\n __rtContains,\n __rtPatternProps,\n __rtPropNames,\n} from './sentinelKeys.ts';\n\n/* ########\n * 2024 ma-jerez\n * Author: Ma-jerez\n * License: MIT, see LICENSE\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\n/** `StripRunTypeMeta<T>` is the ANNOTATION-grade projection of a type: every RunTypes sentinel (format brands,\n * contains / patternProperties / propertyNames slots) is removed and the plain data shape survives. Use it\n * where a CLEAN TypeScript type is the deliverable — editor hovers, generated documentation, assignability\n * gates over external data. ⚠️ NEVER REFLECT the stripped type: the metadata IS the validation contract, so\n * `createValidateFn<StripRunTypeMeta<T>>()` silently builds a validator with every constraint deleted;\n * `DataOnly<T>` is the reflection-safe projection, and the same applies to `JsonSchemaType`. Lossy edges: a\n * REQUIRED nominal brand (`__rtFormatBrand`) collapses with its format, so the stripped type is assignable\n * FROM the branded one but not back (wide, optional-sentinel brands stay mutually assignable); an index\n * signature beside named properties widens its value to `unknown`; Temporal formats, `Map` / `Set` and\n * function shapes pass through untouched. The `#region stripmeta-extract` block is sliced VERBATIM by\n * test/types/stripMetaHarness.ts into the per-branch budget test, so keep it self-contained: lib types and its\n * own declarations only. **/\n\n// #region stripmeta-extract — StripRunTypeMeta machinery; sliced verbatim\n// between these markers by test/types/stripMetaHarness.ts.\n\n/** Every sentinel key the RunTypes encodings ride, the nominal brand key included. **/\ntype StripMetaSentinelKeys =\n | typeof __rtFormatName\n | typeof __rtFormatParams\n | typeof __rtFormatBrand\n | typeof __rtContains\n | typeof __rtPatternProps\n | typeof __rtPropNames;\n\n/** The platform `URL` instance, `never` without `dom` or `@types/node`. **/\ntype StripMetaUrl = typeof globalThis extends {URL: {prototype: infer I}} ? I : never;\n\n/** Recursion-budget decrement, same discipline as `DataOnly`: bounded depth lets circular types resolve\n * finitely, and the floor keeps the remaining sub-tree verbatim instead of tripping TS2589. **/\ntype _StripMetaDepth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8];\n\n/** Any JSON value — the domain of a schema that constrains no type. The alias exists so the many places that\n * recover \"any JSON value\" (a bare `pattern`, a lone `minimum`) display one readable name instead of a six-arm\n * anonymous union. The array and object arms are deliberately LOOSE (`unknown[]`, not `JsonValue[]`): that is\n * exactly the shape those recoveries produce, which is what lets the canonicalisation below recognise them. **/\nexport type JsonValue = string | number | boolean | unknown[] | {[key: string]: unknown} | null;\n\n/** True when some union arm of T is an OBJECT with declared literal keys — a structured alternative worth\n * displaying even when the union is VALUE-equivalent to the any-JSON domain, since the arms are the\n * documentation. Primitives are excluded FIRST: a branded string arm is `string & {…}`, which `extends\n * object`, and its apparent keys (`length`, …) would read as structure. Arrays are excluded for the same\n * reason. **/\ntype StripMetaHasStructuredArm<T> = true extends (\n T extends string | number | bigint | boolean | null | undefined\n ? false\n : T extends readonly unknown[]\n ? false\n : T extends object\n ? StripMetaNoNamedKeys<T> extends true\n ? false\n : true\n : false\n)\n ? true\n : false;\n\n/** The sentinel-carrying constituents of `T`, rebuilt ONE PER CONSTITUENT. TypeScript's intersection subtraction\n * lives in INFERENCE, not in any type operator: when an inference target is an intersection, the checker\n * matches its constituents pairwise against the SOURCE's under type IDENTITY, deletes the matched pairs from\n * both sides, and infers what remains into the naked `infer U` (checker `inferFromMatchingTypes`; tsgo ports it\n * verbatim in internal/checker/inference.go, so both compilers agree). Identity is why the residual must be\n * spelled the way the ENCODINGS spell it — TypeFormat's two keys as ONE object (adaptively, so a one-key\n * hand-written brand matches too), and every slot sentinel as its own; merging them into a single object is\n * identical to none of them and silently subtracts nothing. ⚠️ Adding a new sentinel that can ride a PRIMITIVE\n * base means adding its part here, or its literals quietly start widening again. **/\ntype StripMetaFmtPart<T> = typeof __rtFormatName extends keyof T\n ? typeof __rtFormatParams extends keyof T\n ? {\n readonly [__rtFormatName]?: T[typeof __rtFormatName & keyof T];\n readonly [__rtFormatParams]?: T[typeof __rtFormatParams & keyof T];\n }\n : {readonly [__rtFormatName]?: T[typeof __rtFormatName & keyof T]}\n : unknown;\n// The STRUCTURAL slots (formats/structural.ts) ride array / object bases only, so the literal path never pays\n// for them — only the branded-tuple path below models them.\ntype StripMetaContainsPart<T> = typeof __rtContains extends keyof T\n ? {readonly [__rtContains]?: T[typeof __rtContains & keyof T]}\n : unknown;\ntype StripMetaPatternPropsPart<T> = typeof __rtPatternProps extends keyof T\n ? {readonly [__rtPatternProps]?: T[typeof __rtPatternProps & keyof T]}\n : unknown;\ntype StripMetaPropNamesPart<T> = typeof __rtPropNames extends keyof T\n ? {readonly [__rtPropNames]?: T[typeof __rtPropNames & keyof T]}\n : unknown;\n\n/** A branded literal → its bare literal, or `Base` when the subtraction did not fully clear. The `keyof U`\n * re-check is the safety net: an unmatched constituent leaves `U` as `T` verbatim, which still carries its\n * sentinels and so widens — degradation, never a wrong answer. `__rtContains` / `__rtPatternProps` /\n * `__rtPropNames` are deliberately not modelled (they ride array / object bases only, so a literal never\n * carries one, and anything that somehow does trips the re-check), and `__rtFormatBrand` never reaches here —\n * the required-nominal-brand arm returns `Base` before this is consulted. **/\ntype StripMetaUnbrandLit<T, Base> = T extends (infer U) & StripMetaFmtPart<T>\n ? [Extract<keyof U, StripMetaSentinelKeys>] extends [never]\n ? U\n : Base\n : Base;\n\n/** A branded Map / Set (`FormattedMap` / `FormattedSet`) → the bare collection, rebuilt from its inferred key /\n * value types so every sentinel member drops at once. The key and value types stay as written, exactly like\n * the unbranded arm keeps `Map<string, Email>` verbatim. **/\ntype StripMetaUnbrandCollection<T> =\n T extends ReadonlyMap<infer K, infer V>\n ? T extends Map<any, any>\n ? Map<K, V>\n : ReadonlyMap<K, V>\n : T extends ReadonlySet<infer U>\n ? T extends Set<any>\n ? Set<U>\n : ReadonlySet<U>\n : T;\n\n/** A branded TUPLE → the bare tuple, elements stripped; `T` verbatim when the subtraction did not fully clear.\n * Same mechanism as StripMetaUnbrandLit, with the STRUCTURAL slots modelled too: an array brand is\n * `Base & StructuralBrand<'formattedArray', …> & ContainsSlot` (formats/structural.ts), so leaving any of them\n * out would match nothing and subtract nothing. A tuple needs its own path instead of the element-inference the\n * plain-array arm uses, because `T extends readonly (infer E)[]` collapses the slots to a single element type\n * and destroys the very structure the hover exists to show. Once the brand is off, the ordinary homomorphic\n * map recurses the elements, so a tuple OF branded elements strips all the way down. **/\ntype StripMetaUnbrandTuple<T, Depth extends number> = T extends (infer U) &\n StripMetaFmtPart<T> &\n StripMetaContainsPart<T> &\n StripMetaPatternPropsPart<T> &\n StripMetaPropNamesPart<T>\n ? [Extract<keyof U, StripMetaSentinelKeys>] extends [never]\n ? U extends readonly unknown[]\n ? {[K in keyof U]: StripRunTypeMeta<U[K], _StripMetaDepth[Depth]>}\n : T\n : T\n : T;\n\nexport type StripRunTypeMeta<T, Depth extends number = 8> = Depth extends 0\n ? unknown // budget exhausted — widen: an annotation admits everything rather than leak metadata\n : unknown extends T\n ? T // any / unknown — keep the broad kinds\n : [JsonValue] extends [T]\n ? [T] extends [JsonValue]\n ? StripMetaHasStructuredArm<T> extends true\n ? StripMetaNode<T, Depth> // equivalent to any-JSON, but the arms carry structure — keep them\n : JsonValue // the any-JSON domain, in any arm order / brand dressing — one name\n : StripMetaNode<T, Depth>\n : StripMetaNode<T, Depth>;\n\ntype StripMetaNode<T, Depth extends number> = T extends string\n ? string extends T\n ? string // wide brand (Email, StringFormat<…>) — collapse to the base\n : T extends {readonly [__rtFormatBrand]: string}\n ? string // required nominal brand — collapse one-way to the base\n : Extract<keyof T, StripMetaSentinelKeys> extends never\n ? T // plain literal — keep verbatim\n : StripMetaUnbrandLit<T, string> // branded literal — subtract the brand, else widen to the base\n : T extends number\n ? number extends T\n ? number\n : T extends {readonly [__rtFormatBrand]: string}\n ? number\n : Extract<keyof T, StripMetaSentinelKeys> extends never\n ? T\n : StripMetaUnbrandLit<T, number> // branded numeric (impossible-arm junk included)\n : T extends bigint\n ? bigint extends T\n ? bigint\n : T extends {readonly [__rtFormatBrand]: string}\n ? bigint\n : Extract<keyof T, StripMetaSentinelKeys> extends never\n ? T\n : StripMetaUnbrandLit<T, bigint>\n : T extends boolean\n ? Extract<keyof T, StripMetaSentinelKeys> extends never\n ? T\n : T extends true\n ? true // a boolean literal survives its brand — extends-testing recovers it\n : T extends false\n ? false\n : boolean\n : T extends null | undefined\n ? T\n : T extends Date\n ? Date // FormatDate<…> — collapse to the bare class\n : T extends (...args: never[]) => unknown\n ? T // functions stay functions — this is not DataOnly\n : T extends readonly unknown[]\n ? StripMetaArray<T, Depth>\n : T extends object\n ? StripMetaObject<T, Depth>\n : T;\n\n/** Arrays + tuples. An UNBRANDED array-like recurses homomorphically (tuple slots, rest tails and modifiers all\n * survive the mapped type). A BRANDED plain array recovers its element by inference, dropping every slot the\n * brand rode; a branded TUPLE cannot use that inference (it would collapse the slots), so it subtracts the\n * brand instead and then recurses normally. **/\ntype StripMetaArray<T extends readonly unknown[], Depth extends number> =\n Extract<keyof T, StripMetaSentinelKeys> extends never\n ? {[K in keyof T]: StripRunTypeMeta<T[K], _StripMetaDepth[Depth]>}\n : number extends T['length']\n ? T extends readonly (infer E)[]\n ? T extends unknown[]\n ? StripRunTypeMeta<E, _StripMetaDepth[Depth]>[]\n : readonly StripRunTypeMeta<E, _StripMetaDepth[Depth]>[]\n : T\n : StripMetaUnbrandTuple<T, Depth>;\n\n/** The declared literal-key surface of an object — index-signature slots filtered out, `-?` so an all-optional\n * surface still registers. \"No named properties\" is what decides whether an index signature's value may stay\n * exact (below). The homomorphic shape matters: a bare `keyof` NORMALIZES `'foo' | string` down to `string` and\n * loses the named keys, while a `[K in keyof T as …]` map sees them per-constituent, even through the\n * `Props & Record<…>` intersections the schema door produces. **/\ntype StripMetaLiteralKeys<T> = {\n [K in keyof T as string extends K ? never : number extends K ? never : K extends symbol ? never : K]-?: 0;\n};\n\n/** \"T declares no named properties\" — the empty-object probe over the literal key surface, spelled\n * `Record<never, never>` so it does not read as \"anything non-nullish\" the way a bare `{}` would. **/\ntype StripMetaNoNamedKeys<T> = Record<never, never> extends StripMetaLiteralKeys<T> ? true : false;\n\n/** Objects: drop every symbol key (the sentinels are symbol-keyed; symbol members are never data anyway) and\n * recurse the values, preserving the `readonly` / `?` modifiers via the homomorphic `as` filter. `Map` / `Set`\n * and the truly broad `object` pass through verbatim — probed via `keyof`, NOT `object extends T`, because the\n * latter is also true of every all-optional object and would silently keep weak types (and the metadata inside\n * them) verbatim. Sentinel presence is probed FIRST: a bare carrier is an all-optional object, and once every\n * key is a sentinel the honest clean type is the `unknown` the base was. Index signatures beside NAMED\n * properties widen their value to `unknown`, because TypeScript cannot spell \"this value type for every key\n * except the named ones\" and an exact index would reject valid data mixing named-key and additional-key value\n * types, against the clean type's contract that every valid value assigns. An index signature standing ALONE\n * keeps its exact value type. **/\ntype StripMetaObject<T extends object, Depth extends number> =\n Extract<keyof T, StripMetaSentinelKeys> extends never\n ? keyof T extends never\n ? T // the broad `object` — nothing to map\n : T extends ReadonlyMap<any, any> | ReadonlySet<any> | StripMetaUrl\n ? T\n : {\n // Inline on purpose: an ANONYMOUS mapped type is displayed expanded,\n // while a named helper defers behind its own name in hovers.\n [K in keyof T as K extends symbol ? never : K]: string extends K\n ? StripMetaNoNamedKeys<T> extends true\n ? StripRunTypeMeta<T[K], _StripMetaDepth[Depth]>\n : unknown // index beside named properties — widen so mixed valid data assigns\n : number extends K\n ? StripMetaNoNamedKeys<T> extends true\n ? StripRunTypeMeta<T[K], _StripMetaDepth[Depth]>\n : unknown\n : StripRunTypeMeta<T[K], _StripMetaDepth[Depth]>;\n }\n : T extends ReadonlyMap<any, any> | ReadonlySet<any>\n ? StripMetaUnbrandCollection<T> // a FormattedMap / FormattedSet → the bare collection\n : T extends StripMetaUrl\n ? StripMetaUrl // a Url<…> → the bare URL\n : Exclude<keyof T, StripMetaSentinelKeys | symbol> extends never\n ? unknown // every key was metadata — the base was the broad kind\n : {\n [K in keyof T as K extends symbol ? never : K]: string extends K\n ? StripMetaNoNamedKeys<T> extends true\n ? StripRunTypeMeta<T[K], _StripMetaDepth[Depth]>\n : unknown\n : number extends K\n ? StripMetaNoNamedKeys<T> extends true\n ? StripRunTypeMeta<T[K], _StripMetaDepth[Depth]>\n : unknown\n : StripRunTypeMeta<T[K], _StripMetaDepth[Depth]>;\n };\n// #endregion stripmeta-extract\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"typeFormat.js","sourceRoot":"","sources":["../../src/runtypes/typeFormat.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"typeFormat.js","sourceRoot":"","sources":["../../src/runtypes/typeFormat.ts"],"names":[],"mappings":"","sourcesContent":["import type {__rtFormatName, __rtFormatParams, __rtFormatBrand} from './sentinelKeys.ts';\n\n// TypeFormat is the brand marker for runtype-format types (String, UUIDv4, Email, …); the concrete formats live under `src/formats/`.\n// The brand is a plain two-property object, `__rtFormatName` + `__rtFormatParams`, both SYMBOL keys so branding leaves a type's string keys untouched.\n// The tsgo-backed format scanner (ts-go-runtypes/internal/cachegen/runtype/typeid/formats.go) looks for exactly those two and lifts them\n// into the RunType's FormatAnnotation field.\n\n// Primitives plus native `Date`: the Go-side scanner lifts the brand off a `Date & {brand}` intersection the same way it does for `string & {brand}`.\nexport type TypeFormatBase = string | number | bigint | Date;\n\n// The JSON-serialisable shape every format's params object must satisfy; `unknown` over `any` so consumers can still narrow at the call site.\nexport type TypeFormatParams = Record<string, unknown>;\n\n// TypeFormat tags a base primitive with a name+params pair the Go-side scanner can detect.\n// The sentinels are `readonly` so the tag survives `as const` widening and excess-property checks don't mistake them for regular properties.\n// They are OPTIONAL by default, so an unbranded format stays mutually assignable with its base: formats are RUNTIME contracts\n// enforced by the generated validator, not compile-time guards.\n// (tsgo widens the optional props to `Name | undefined`; the scanner strips the `undefined` — see internal/cachegen/runtype/typeid/formats.go.)\n// Passing `BrandName` opts INTO a REQUIRED `__rtFormatBrand` marker, no longer assignable from a bare primitive, so values must pass a\n// validation/cast boundary; the Go-side detection ignores it, so branding stays a pure TS-level discriminator.\nexport type TypeFormat<\n Base extends TypeFormatBase,\n Name extends string,\n // `object`, not Record<string, unknown>: interface-typed params (StringParams, …) have no index signature, and primitives are still excluded.\n Params extends object,\n BrandName extends string = never,\n> = Base & FormatBrand<Name, Params> & ([BrandName] extends [never] ? unknown : NominalBrand<BrandName>);\n\n/** A NAMED interface, not an inline object: a symbol-keyed property only prints into a `.d.ts` when the emitting file can name the symbol. **/\n// A type that loses the format alias through a mapped type (a mion router's public API did) prints structurally, hits the bare\n// `[__rtFormatName]` key and fails the whole emit with TS4023; behind an interface the expansion prints a reference to THIS name.\n// Structurally identical to the inline object it replaces, so detection is unchanged: the declaration NAMES are what the Go resolver matches on.\nexport interface FormatBrand<Name extends string, Params extends object> {\n readonly [__rtFormatName]?: Name;\n readonly [__rtFormatParams]?: Params;\n}\n\n/** The opt-in nominal marker, named for the same declaration-emit reason. **/\nexport interface NominalBrand<BrandName extends string> {\n readonly [__rtFormatBrand]: BrandName;\n}\n\n// Type-level format introspection for downstream packages (e.g. a column mapper that picks a database column per format).\n// The sentinels are unique symbols, so without these helpers a consumer cannot replicate the detection: a locally declared symbol of the\n// same name only helps the Go scanner, never TS type matching.\n// Detection is by KEY PRESENCE, never a required-prop `extends` check: the sentinels are OPTIONAL, and an optional prop satisfies no\n// required-prop constraint, but the key is still present in `keyof`.\n\n/** The format name carried by `T` (`FormatNameOf<Email>` is `'email'`), or `never` when `T` carries no format tag. */\nexport type FormatNameOf<T> = typeof __rtFormatName extends keyof T\n ? NonNullable<T[typeof __rtFormatName & keyof T]> & string\n : never;\n\n/** The format params carried by `T` (`FormatParamsOf<UUIDv7>` is `{version: '7'}`), or `never` when `T` carries no format tag. */\nexport type FormatParamsOf<T> = typeof __rtFormatParams extends keyof T\n ? NonNullable<T[typeof __rtFormatParams & keyof T]>\n : never;\n\n/** The nominal brand name carried by `T`, or `never` for a transparent format or no format at all. */\nexport type FormatBrandNameOf<T> = typeof __rtFormatBrand extends keyof T ? T[typeof __rtFormatBrand & keyof T] & string : never;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtypes/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtypes/types.ts"],"names":[],"mappings":"","sourcesContent":["/* ########\n * 2024 ma-jerez\n * Author: Ma-jerez\n * License: MIT, see LICENSE\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\n// Local type surface for the RT utils, kept dependency-free: only the symbols `rtUtils.ts` reaches.\n\nimport type {RTUtils} from './rtUtils.ts';\nimport type {FormatAnnotation} from './formatAnnotation.ts';\n// Type-only (no runtime cycle): each family's fn signature comes from the module that owns it, so the\n// cache-entry typedefs below stay a single source of truth.\nimport type {\n ValidateFn,\n GetValidationErrorsFn,\n RemoveUnknownKeysFn,\n PrepareForJsonFn,\n RestoreFromJsonFn,\n} from '../createRTFunctions.ts';\n\n// ########################################### Pure functions #########################################\n\nexport type PureFunction = (...args: any[]) => any;\n\nexport type PureFunctionFactory = (rtUtils: RTUtils) => PureFunction;\n\nexport interface PureFunctionData {\n /** Package plus shipped-body hash (`@acme/text:Kq3f_xN9pQ`), computed by the build; the cache key. */\n readonly id: string;\n readonly paramNames: string[];\n /** The factory body string: present in `code`/`both` emit modes, undefined in `functions` mode where the live\n * `createPureFn` ships instead (mirrors the type-fn `CompiledFnData.code`). */\n readonly code?: string;\n /** Ids of every pure function this one and its children use. */\n readonly pureFnDependencies?: Array<string>;\n}\n\nexport interface CompiledPureFunction extends PureFunctionData {\n /** Factory closure `(utl) => fn`. Optional: in `code` mode (default) the Go renderer drops it and\n * `initPureFunction` rebuilds it on first lookup; `functions`/`both` ship the live literal for runtimes that\n * can't use `new Function` (mirrors the type-fn `createRTFn` slot). */\n createPureFn?: PureFunctionFactory;\n fn?: PureFunction;\n}\n\n// ########################################### Run types ##############################################\n\n/** The sentinel-lifted structural constraint checks a RunType can carry — the runtime mirror of the Go-side\n * SchemaChecks group (internal/reflection/runtype.go). Every member comes from a `__rt…` sentinel, folds into\n * the structural id, and drives validate/validationErrors only; the runtime cache also reads them for mocking.\n * Declaration-level grouping only: RunType extends this, so the runtime objects stay flat. */\nexport interface SchemaChecks {\n /** Contains assertions (the `__rtContains` sentinel): at least `min`, and at most `max` when `max` ≥ 0, of\n * the array's items validate against `child`. Mocking splices `min` child mocks among non-matching fillers. */\n contains?: {child: RunType; min: number; max: number}[];\n /** patternProperties entries: keys matching `source` must have values valid against `value`; `key` is the\n * pattern-branded string child whose build-time sample pool powers key mocking. */\n patternProps?: {source: string; key?: RunType; value: RunType}[];\n /** propertyNames children: every key validates as a string against EVERY entry (allOf-stacked propertyNames\n * conjoin, matching the id fold). */\n propNames?: RunType[];\n}\n\n/** Runtime representation of a reflected type. Identification fields are set at construction; ref slots\n * (`child`, `parameters`, …) start as `undefined` and are patched afterwards by the emitter's footer\n * assignments. Fields are typed permissively — the concrete schema lives on the Go side. `T` is a PHANTOM type\n * parameter (carried on the never-set `__rtType`, erased at runtime) so a value-first builder can return\n * `RunType<String<P>>` and `InferType<…>` can recover the original type; it defaults to `unknown`, so every\n * plain `RunType` reference is unaffected. */\nexport interface RunType<T = unknown> extends SchemaChecks {\n id: string;\n kind: unknown;\n subKind?: unknown;\n typeName?: unknown;\n name?: unknown;\n literal?: unknown;\n optional?: unknown;\n readonly?: unknown;\n /** True when this property's by-name serialization is gated by a runtime own-enumerability check: a member\n * inherited from a default-lib global type (Error's name/message/stack, …) or one tagged `@nonEnumerable` in\n * JSDoc. Such a member is also `optional` in the projected shape — the wire may omit it. */\n nonEnumerable?: boolean;\n isAbstract?: unknown;\n isStatic?: unknown;\n visibility?: unknown;\n isSafeName?: unknown;\n position?: unknown;\n isCircular?: boolean;\n /** Kinds validation and the JSON round trip skip (function-like, symbol, never, non-serialisable class), not their children.\n * Kept in the tree so reflection stays complete. */\n notSupported?: boolean;\n /** The largest compact-JSON byte size a valid value of this type can have, computed at build time (the Go\n * `jsonsize` walk). Present only on a reflection ROOT whose type is fully bounded (every string, array, Map\n * and Set carries a maximum); absent on nested nodes and on any type with an unbounded part. The mion router\n * derives per-route request and response limits from it. */\n jsonMaxBytes?: number;\n flags?: unknown;\n description?: unknown;\n defaultVal?: unknown;\n enumVal?: unknown;\n values?: unknown;\n child?: RunType;\n index?: RunType;\n return?: RunType;\n indexType?: RunType;\n parameters?: RunType[];\n children?: RunType[];\n safeUnionChildren?: RunType[];\n unionDiscriminators?: unknown;\n /** The OPEN metadata extension point: user-space annotation objects from an `atomic & { obj }` intersection\n * (e.g. `number & {dbIndex: true}`), carried through reflection untouched so consumers can read their own\n * metadata back at runtime. The engine NEVER acts on its contents — engine-recognised behavior lives only\n * behind the symbol-keyed sentinels (`formatAnnotation` below, the SchemaChecks members above). */\n typeMeta?: unknown;\n /** Populated for a TypeFormat-branded primitive; drives mock generation and format-formatter lookup. The\n * CLOSED counterpart of `typeMeta`: only a real TypeFormat brand (the `__rtFormatName` / `__rtFormatParams`\n * sentinels) produces it, and the engine acts on it. */\n formatAnnotation?: FormatAnnotation;\n typeArguments?: RunType[];\n arguments?: RunType[];\n extendsArguments?: RunType[];\n implements?: RunType[];\n extends?: RunType;\n /** The built-in class constructor (`Date`, `Map`, …) a platform-class node stands for, wired by the bundle ini. */\n classType?: object;\n /** Phantom carrier of the source TS type `T`. Never set at runtime; exists only so `InferType<RunType<T>>`\n * recovers `T` by indexed access (no `infer`). `T` rides INSIDE a `{t: T}` wrapper so the optional `?` adds\n * `| undefined` to the WRAPPER, not to `T`, preserving an intentional `null`/`undefined` `T` (a bare-`T`\n * carrier + `NonNullable` would collapse those to `never`, dropping e.g. a `literal(null)` arm from a\n * composed union). The explicit member wins over the index signature below. */\n readonly __rtType?: {t: T};\n [extra: string]: unknown;\n}\n\n/** Flat run-type cache keyed by canonical type id. */\nexport type RunTypesCache = Record<string, RunType>;\n\n// ########################################### RT functions ##########################################\n\nexport type AnyFn = (...args: any[]) => any;\n\n/** Slot (`vλl`, `pλth`, `εrr`, …) → a JS-SOURCE fragment spliced into `new Function(...)`; mirrors Go's `ArgSpec`.\n * ⚠️ Never a runtime value: a real `undefined` / `[]` / `{}` here makes `CompiledFnData` invalid JSON. **/\nexport type CompiledFnArgs = {\n /** The value parameter — present in every family. */\n vλl: string;\n /** The remaining slots, family-dependent. */\n [key: string]: string;\n};\n\nexport interface CompiledFnData {\n readonly typeName: string;\n /** The operation family (`it`, `te`, `pj`, `rj`, …). */\n readonly fnID: string;\n /** The exact slot-0 emitting family (`pj`, `jeMU`, …); unlike `fnID`, a composite keeps its own tag. */\n readonly familyTag?: string;\n readonly rtFnHash: string;\n /** Slot → the JS IDENTIFIER it takes in the emitted signature (`{vλl: 'v', pλth: 'pth', εrr: 'er'}` →\n * `function verr_x(v, pth, er)`). */\n readonly args: CompiledFnArgs;\n /** Slot → that parameter's DEFAULT EXPRESSION as JS source, `''` when it has none: `{vλl: '', pλth: '[]',\n * εrr: '[]'}` is what makes the emitted `function verr_x(v, pth=[], er=[])`. Text, not values — see the\n * CompiledFnArgs contract above. */\n readonly defaultParamValues: CompiledFnArgs;\n /** True for collapsed-to-identity compilations. */\n readonly isNoop?: boolean;\n /** The factory body string: present in `code`/`both` emit modes, undefined in `functions` mode where the live\n * `createRTFn` ships instead and `code` is derived lazily from it (see `entryCode`) only if read. **/\n readonly code?: string;\n /** Sibling rt-fn hashes this entry calls into. */\n readonly rtDependencies?: Array<string>;\n /** Ids of the pure functions this entry reaches. */\n readonly pureFnDependencies?: Array<string>;\n paramNames?: string[];\n /** Complete runtime throw message (`[code] headline (at file:line:col)`) when this entry is an alwaysThrow\n * factory: the Go compiler reached an unsupported leaf and rendered the message at build time, and the JS\n * side throws it verbatim with no diagnostic catalog of its own. Undefined for normal and noop entries. */\n readonly alwaysThrowMessage?: string;\n}\n\nexport interface CompiledTypeFn<Fn extends AnyFn = AnyFn> extends CompiledFnData {\n /** Factory closure wrapping the rt function with its context-code prologue. Optional: in `code` mode (default)\n * the Go renderer emits `undefined` and `materializeRTFn` rebuilds it on first lookup, while\n * `--emit-mode functions|both` emits the closure eagerly for runtimes that can't use `new Function`. Always\n * set on alwaysThrow entries; always undefined on noop entries. **/\n readonly createRTFn?: (utl: RTUtils) => Fn;\n /** The materialised RT function. */\n readonly fn?: Fn;\n}\n\n/** `CompiledTypeFn` after `materializeRTFn` — `createRTFn` and `fn` are\n * guaranteed to be set. */\nexport type InitializedTypeFn<Fn extends AnyFn = AnyFn> = CompiledTypeFn<Fn> &\n Required<Pick<CompiledTypeFn<Fn>, 'createRTFn' | 'fn'>>;\n\n// ############################# RT CACHES ###################################\n\n// Per-family aliases. Several families share an fn shape but occupy distinct cache slots (`pjs` vs `pj`).\n\nexport type ValidateRTFn = CompiledTypeFn<ValidateFn>;\nexport type GetValidationErrorsRTFn = CompiledTypeFn<GetValidationErrorsFn>;\nexport type RemoveUnknownKeysRTFn = CompiledTypeFn<RemoveUnknownKeysFn>;\nexport type PrepareForJsonRTFn = CompiledTypeFn<PrepareForJsonFn>;\nexport type PrepareForJsonSafeRTFn = CompiledTypeFn<PrepareForJsonFn>;\nexport type RestoreFromJsonRTFn = CompiledTypeFn<RestoreFromJsonFn>;\n\nexport type TypesFunctionsCache = Record<string, CompiledTypeFn>;\n/** Flat pure-function cache keyed by pure-fn id. */\nexport type PureFunctionsCache = Record<string, CompiledPureFunction>;\n\n// ########################################### Classes / helpers #########################################\n\n// `AnyClass`, `SerializableClass` and `DeserializeClassFn` live next to the public registry in\n// ./classSerializerRegistry.ts.\n\nexport type Mutable<T> = {\n -readonly [K in keyof T]: T[K];\n};\n\nexport type DeepRequired<T> = T extends object\n ? {\n [P in keyof T]?: DeepRequired<T[P]>;\n }\n : T;\n\nexport type DeepPartial<T> = T extends object\n ? {\n [P in keyof T]?: DeepPartial<T[P]>;\n }\n : T;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createJsonSchemaFn.js","sourceRoot":"","sources":["../../src/standard/createJsonSchemaFn.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAC;AAK9D,OAAO,EAAC,wBAAwB,EAAC,MAAM,oBAAoB,CAAC;AAQ5D,MAAM,CAAC,MAAM,qBAAqB,GAAoB,GAAG,EAAE;IACzD,MAAM,IAAI,KAAK,CACb,6HAA6H,CAC9H,CAAC;AACJ,CAAC,CAAC;AAKF,MAAM,UAAU,kBAAkB,CAAI,WAA4B,EAAE,GAAuC;IAEzG,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,MAAM,KAAK,GAAG,mBAAmB,CAC/B,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,GAA4B,CAC7B,CAAC;IACF,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC"}
1
+ {"version":3,"file":"createJsonSchemaFn.js","sourceRoot":"","sources":["../../src/standard/createJsonSchemaFn.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAC;AAK9D,OAAO,EAAC,wBAAwB,EAAC,MAAM,oBAAoB,CAAC;AAQ5D,MAAM,CAAC,MAAM,qBAAqB,GAAoB,GAAG,EAAE;IACzD,MAAM,IAAI,KAAK,CACb,6HAA6H,CAC9H,CAAC;AACJ,CAAC,CAAC;AAKF,MAAM,UAAU,kBAAkB,CAAI,WAA4B,EAAE,GAAuC;IAEzG,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,MAAM,KAAK,GAAG,mBAAmB,CAC/B,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,GAA4B,CAC7B,CAAC;IACF,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC","sourcesContent":["// `createJsonSchemaFn<T>()` — returns a function producing the JSON Schema document for `T`. The\n// document is rendered at BUILD time by the Go schemadoc renderer and ships as the `jsonSchema` (jsc)\n// cache entry this factory resolves; the runtime only post-processes it (see jsonSchemaDoc.ts). The\n// returned callable takes the same options as the `~standard.jsonSchema` converter methods and returns\n// the identical document.\n\nimport {isRunTypeValue} from '../runtypes/rtUtils.ts';\nimport {resolveEntryTupleFn} from '../runtypes/entryTuple.ts';\nimport type {EntryTuple} from '../runtypes/entryTuple.ts';\nimport type {RunType} from '../runtypes/types.ts';\nimport type {InjectTypeFnArgs} from '../markers.ts';\nimport type {StandardJSONSchemaOptions} from './spec.ts';\nimport {buildJsonSchemaConverter} from './jsonSchemaDoc.ts';\nimport type {JsonSchemaDocFn} from './jsonSchemaDoc.ts';\n\n/** The callable `createJsonSchemaFn<T>()` returns. **/\nexport type JsonSchemaFn = (options?: StandardJSONSchemaOptions) => Record<string, unknown>;\n\n// No-plugin fallback: with no reflection graph injected for T there is nothing to derive a document\n// from, so this throws with the standard guidance instead of returning a silently-wrong `{}`.\nexport const jsonSchemaDocFallback: JsonSchemaDocFn = () => {\n throw new Error(\n 'createJsonSchemaFn(): no compiled schema document. @mionjs/devtools must be active for the jsonSchema cache entry to exist.'\n );\n};\n\n/** Accepts either a value-first `RunType` schema or the type/value reflection form, like `createValidateFn`. **/\nexport function createJsonSchemaFn<T>(runType: RunType<T>, ids?: InjectTypeFnArgs<T, 'jsonSchema'>): JsonSchemaFn;\nexport function createJsonSchemaFn<T>(val?: T, ids?: InjectTypeFnArgs<T, 'jsonSchema'>): JsonSchemaFn;\nexport function createJsonSchemaFn<T>(valOrSchema?: T | RunType<T>, ids?: InjectTypeFnArgs<T, 'jsonSchema'>): JsonSchemaFn {\n // A value-first schema's runtime `.id` overrides the injected type id, correct even for recursive schemas.\n const runTypeId = isRunTypeValue(valOrSchema) ? valOrSchema.id : undefined;\n const docFn = resolveEntryTupleFn<JsonSchemaDocFn>(\n 'createJsonSchemaFn',\n jsonSchemaDocFallback,\n runTypeId,\n ids as unknown as EntryTuple\n );\n return buildJsonSchemaConverter(docFn).input;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createStandardSchema.js","sourceRoot":"","sources":["../../src/standard/createStandardSchema.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,2BAA2B,CAAC;AAM5E,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAC,wBAAwB,EAAC,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAoB9D,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAA0B,CAAC;AAC/D,MAAM,cAAc,GAAiC,GAAG,EAAE,CAAC,EAAE,CAAC;AAe9D,MAAM,UAAU,oBAAoB,CAClC,WAA4B,EAC5B,OAAyC,EACzC,GAAuE;IAGvE,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE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ent":["// `createStandardSchema<T>()` — adapts RunTypes validation to the Standard Schema v1 interop contract\n// (https://github.com/standard-schema/standard-schema). A thin layer over the existing validators: ONE\n// trailing marker injects an entry tuple per family for the same `T`, and the produced `validate` is\n// synchronous and two-tier, running the cheap boolean validator first. The returned object is\n// structurally a Standard Schema, but its `validate` advertises the richer RTValidationResult, so a\n// generic consumer sees the plain spec shape while a RunTypes-aware one gets the structured issue\n// data with no extra call.\n\nimport {isRunTypeValue} from '../runtypes/rtUtils.ts';\nimport {entryTupleAt, resolveEntryTupleFn} from '../runtypes/entryTuple.ts';\nimport type {RunType} from '../runtypes/types.ts';\nimport type {DataOnly} from '../runtypes/dataOnly.ts';\nimport type {ValidateFn, GetValidationErrorsFn, ValidateOptions} from '../createRTFunctions.ts';\nimport type {FormatErrorsOf} from '../runtypes/formatErrors.ts';\nimport type {CompTimeFnArgs, InjectTypeFnArgs} from '../markers.ts';\nimport {runTypeErrorsToIssues} from './issueMapping.ts';\nimport type {RTValidationIssue} from './issueMapping.ts';\nimport type {StandardSchemaSuccessResult, StandardSchemaProps, StandardJSONSchemaConverter} from './spec.ts';\nimport {buildJsonSchemaConverter} from './jsonSchemaDoc.ts';\nimport type {JsonSchemaDocFn} from './jsonSchemaDoc.ts';\nimport {jsonSchemaDocFallback} from './createJsonSchemaFn.ts';\n\n/** Assignable to the spec FailureResult, since RTValidationIssue extends StandardSchemaIssue. **/\nexport interface RTValidationFailureResult {\n readonly issues: ReadonlyArray<RTValidationIssue>;\n}\n\n/** Structurally a Standard Schema Result<Output>, with the richer issues on the failure side. **/\nexport type RTValidationResult<Output> = StandardSchemaSuccessResult<Output> | RTValidationFailureResult;\n\n/** ONE object satisfying both spec interfaces: structurally assignable to StandardSchemaV1 and to\n * StandardJSONSchemaV1, while exposing the structured issue data at the type level. **/\nexport interface RTStandardSchemaV1<Input = unknown, Output = Input> {\n readonly '~standard': Omit<StandardSchemaProps<Input, Output>, 'validate'> & {\n readonly validate: (value: unknown) => RTValidationResult<Output> | Promise<RTValidationResult<Output>>;\n readonly jsonSchema: StandardJSONSchemaConverter;\n };\n}\n\n// Fallbacks for the no-plugin case, mirroring createValidateFn / createGetValidationErrorsFn.\nconst validateFallback = (() => true) as unknown as ValidateFn;\nconst errorsFallback: GetValidationErrorsFn<never> = () => [];\n\n/** Returns a Standard Schema v1 object for `T`, synchronous and `vendor: 'mion'`. On success the input\n * is narrowed to `DataOnly<T>`, since RunTypes validates the serialisable projection. Accepts either a\n * value-first `RunType` schema or the type/value reflection form, mirroring `createValidateFn`. **/\nexport function createStandardSchema<T>(\n runType: RunType<T>,\n options?: CompTimeFnArgs<ValidateOptions>,\n ids?: InjectTypeFnArgs<T, 'validate', 'validationErrors', 'jsonSchema'>\n): RTStandardSchemaV1<DataOnly<T>>;\nexport function createStandardSchema<T>(\n val?: T,\n options?: CompTimeFnArgs<ValidateOptions>,\n ids?: InjectTypeFnArgs<T, 'validate', 'validationErrors', 'jsonSchema'>\n): RTStandardSchemaV1<DataOnly<T>>;\nexport function createStandardSchema<T>(\n valOrSchema?: T | RunType<T>,\n options?: CompTimeFnArgs<ValidateOptions>,\n ids?: InjectTypeFnArgs<T, 'validate', 'validationErrors', 'jsonSchema'>\n): RTStandardSchemaV1<DataOnly<T>> {\n // A value-first schema's runtime `.id` overrides the injected type id, correct even for recursive schemas.\n const runTypeId = isRunTypeValue(valOrSchema) ? valOrSchema.id : undefined;\n // The marker injects the tuples in the Fn-arg order 'validate', 'validationErrors', 'jsonSchema'.\n const valInjected = entryTupleAt(ids, 0);\n const verrInjected = entryTupleAt(ids, 1);\n const jscInjected = entryTupleAt(ids, 2);\n // Resolve each under its own family fnName. The circular-reference guard is compile-time:\n // `{rejectCircularRefs: true}` forked each family's fnHash, so the armed tuples self-guard.\n const validate = resolveEntryTupleFn<ValidateFn<T>>(\n 'createValidateFn',\n validateFallback as ValidateFn<T>,\n runTypeId,\n valInjected\n );\n const getErrors = resolveEntryTupleFn<GetValidationErrorsFn<FormatErrorsOf<T>>>(\n 'createGetValidationErrorsFn',\n errorsFallback,\n runTypeId,\n verrInjected\n );\n const docFn = resolveEntryTupleFn<JsonSchemaDocFn>('createJsonSchemaFn', jsonSchemaDocFallback, runTypeId, jscInjected);\n const props: RTStandardSchemaV1<DataOnly<T>>['~standard'] = {\n version: 1,\n vendor: 'mion',\n // One document for both sides (see jsonSchemaDoc.ts).\n jsonSchema: buildJsonSchemaConverter(docFn),\n // Cheap boolean first: zero allocation on the valid path.\n validate(value: unknown): RTValidationResult<DataOnly<T>> {\n if (validate(value)) return {value: value as DataOnly<T>};\n return {issues: runTypeErrorsToIssues(getErrors(value))};\n },\n // `types` is PHANTOM: never assigned at runtime, the declared return type carries it for inference.\n };\n return {'~standard': props};\n}\n"]}
@@ -12,6 +12,8 @@ function primitiveBound(val) {
12
12
  function defaultMessage(err) {
13
13
  if (err.expected === 'circular')
14
14
  return 'Circular reference';
15
+ if (err.expected === 'tooManyUnknownKeys')
16
+ return 'Too many unknown keys';
15
17
  if (!err.format)
16
18
  return `Expected ${err.expected}`;
17
19
  const constraint = constraintName(err.format);
@@ -1 +1 @@
1
- {"version":3,"file":"issueMapping.js","sourceRoot":"","sources":["../../src/standard/issueMapping.ts"],"names":[],"mappings":"AAwBA,SAAS,cAAc,CAAC,MAAmC;IACzD,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7D,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;AACzD,CAAC;AAID,SAAS,cAAc,CAAC,GAA2B;IACjD,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS;QA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,qBAAqB,CACnC,IAAiC,EACjC,OAA6B;IAE7B,MAAM,MAAM,GAAG,OAAO,EAAE,OAAO,IAAI,cAAc,CAAC;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC;QACpB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC,CAAC,CAAC;AACN,CAAC","sourcesContent":["// Maps RunTypes validation errors to Standard Schema issues for `createStandardSchema`'s validate. No\n// plugin and no rtUtils, just a function over an in-memory array, so it is independently unit-testable.\n// The mapping is LOSSLESS and recreates no path: a RTValidationError path is ALREADY a valid Standard\n// Schema path, so `err.path` passes straight through and only the `message` is built.\n\nimport type {RTValidationError, RTPathSegment, TypeFormatError} from '../createRTFunctions.ts';\nimport type {StandardSchemaIssue} from './spec.ts';\n\n/** A Standard Schema Issue that ALSO carries the full RTValidationError structure, with no duplication:\n * `expected` + `format` are the structured fields the spec `message` otherwise only encodes as text.\n * It extends StandardSchemaIssue, so an array of these stays assignable for a generic consumer. **/\nexport interface RTValidationIssue<Format extends TypeFormatError = TypeFormatError> extends StandardSchemaIssue {\n readonly message: string;\n readonly path: ReadonlyArray<PropertyKey | RTPathSegment>;\n readonly expected: string;\n readonly format?: Format;\n}\n\n/** The `message` hook replaces the default mechanical derivation: the seam a friendly renderer plugs into. **/\nexport interface IssueMappingOptions {\n message?: (err: RTValidationError) => string;\n}\n\n// constraintName mirrors createFriendlyText's `constraintKey`.\nfunction constraintName(format: TypeFormatError | undefined): string {\n if (!format) return 'type';\n const tail = format.formatPath[format.formatPath.length - 1];\n return tail !== undefined ? String(tail) : format.name;\n}\n\n// primitiveBound degrades an array / object bound to undefined, so the message omits it rather than\n// printing `[object Object]`.\nfunction primitiveBound(val: TypeFormatError['val']): string | number | bigint | boolean | undefined {\n return typeof val === 'string' || typeof val === 'number' || typeof val === 'bigint' || typeof val === 'boolean'\n ? val\n : undefined;\n}\n\n// defaultMessage derives a mechanical, dependency-free message; human-readable phrasing is the\n// friendly-map's job, wired through IssueMappingOptions.message. The parenthesized bound appears only\n// when it informs: a WILDCARD 'any' bound means the FORMAT itself failed, so the format name replaces\n// the sub-constraint, and a bound that merely echoes the constraint name is dropped too.\nfunction defaultMessage(err: RTValidationError): string {\n if (err.expected === 'circular') return 'Circular reference';\n if (err.expected === 'tooManyUnknownKeys') return 'Too many unknown keys';\n if (!err.format) return `Expected ${err.expected}`;\n const constraint = constraintName(err.format);\n const bound = primitiveBound(err.format.val);\n if (bound === 'any') return `Failed ${err.format.name} constraint`;\n if (bound === undefined || String(bound) === constraint) return `Failed ${constraint} constraint`;\n return `Failed ${constraint} constraint (${String(bound)})`;\n}\n\n/** One issue per error: the path passes through unchanged, `expected` / `format` are preserved, and\n * only `message` is derived (override it via `options.message`). **/\nexport function runTypeErrorsToIssues<Format extends TypeFormatError>(\n errs: RTValidationError<Format>[],\n options?: IssueMappingOptions\n): RTValidationIssue<Format>[] {\n const render = options?.message ?? defaultMessage;\n return errs.map((err) => ({\n message: render(err),\n path: err.path,\n expected: err.expected,\n ...(err.format ? {format: err.format} : {}),\n }));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSchemaDoc.js","sourceRoot":"","sources":["../../src/standard/jsonSchemaDoc.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAKlD,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,QAAQ;CACA,CAAC;AAEX,MA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IAAI,KAAK,QAAQ,IAAI,MAAM,IAAK,IAAe,EAAE,CAAC;QAC5E,OAAO,YAAY,CAAE,IAAwB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IACD,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QACvC,GAAG,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAGD,MAAM,UAAU,wBAAwB,CAAC,KAAsB;IAC7D,MAAM,IAAI,GAAG,CAAC,OAAmC,EAA2B,EAAE;QAC5E,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,GAAG,GAAY,KAAK,EAAE,CAAC;QAG3B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,GAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,UAAU,CAAC,OAAO,CAAC;YAAE,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACjD,OAAO,GAA8B,CAAC;IACxC,CAAC,CAAC;IACF,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;AACrC,CAAC","sourcesContent":["// The runtime half of the `jsonSchema` (jsc) cache family: everything the converters do at runtime to\n// the document the compiled entry returns (the target check, the portable strip, the encoder-strategy\n// closedness stamp). ONE document serves both converter sides — the standard keywords describe the JSON\n// wire, the dialect keywords annotate what that JSON becomes in JS — so `input()` and `output()` return\n// the SAME document: RunTypes validates without transforming, the non-transforming shape the Standard\n// Schema spec permits. `encoderStrategy` follows the same rule, an explicit caller declaration of the\n// wire the paired JSON encoder produces.\n\nimport type {StandardJSONSchemaConverter, StandardJSONSchemaOptions} from './spec.ts';\nimport type {JsonEncoderStrategy} from '../createRTFunctions.ts';\n\nexport type JsonSchemaDocFn = () => Record<string, unknown>;\n\n/** The one target this library emits; other dialects throw. **/\nexport const JSON_SCHEMA_TARGET = 'draft-2020-12';\n\n/** The JS-extension rows the Go renderer can emit beside the standard vocabulary; `{portable: true}`\n * strips exactly these. A keyword added on the Go side without a row here survives the strip and fails\n * the doc-suite's portable assertions. **/\nexport const JSON_SCHEMA_DIALECT_KEYWORDS = [\n 'jsType',\n 'jsResolved',\n 'rtFormat',\n 'rtFormatParams',\n 'tsIndexes',\n 'tsFunction',\n 'tsTemplate',\n 'tsLabels',\n 'tsReadonly',\n 'tsMeta',\n] as const;\n\nconst DIALECT_KEY_SET = new Set<string>(JSON_SCHEMA_DIALECT_KEYWORDS);\n\nfunction assertTarget(options?: StandardJSONSchemaOptions): void {\n const target = options?.target;\n if (target !== undefined && target !== JSON_SCHEMA_TARGET) {\n throw new RangeError(`mion emits '${JSON_SCHEMA_TARGET}' JSON Schema documents; target '${target}' is not supported`);\n }\n}\n\nfunction isPortable(options?: StandardJSONSchemaOptions): boolean {\n return options?.libraryOptions?.portable === true;\n}\n\n// Closedness follows the strategy (only `clone` drops undeclared keys); no additionalProperties option may contradict it.\nconst ENCODER_STRATEGIES = new Set<JsonEncoderStrategy>(['clone', 'mutate', 'compact']);\n\n/** `'compact'` throws: its wire is positional arrays, which this keyed document does not describe. **/\nfunction encoderStrategyOf(options?: StandardJSONSchemaOptions): JsonEncoderStrategy | undefined {\n const raw = options?.libraryOptions?.encoderStrategy;\n if (raw === undefined) return undefined;\n if (!ENCODER_STRATEGIES.has(raw as JsonEncoderStrategy)) {\n const shown = typeof raw === 'string' ? `'${raw}'` : `a ${typeof raw}`;\n throw new RangeError(`unknown encoderStrategy ${shown} (expected 'clone' | 'mutate')`);\n }\n if (raw === 'compact') {\n throw new RangeError(\n \"the 'compact' wire is positional arrays, which this keyed document does not describe; no JSON Schema is emitted for it\"\n );\n }\n return raw as JsonEncoderStrategy;\n}\n\n// Keys whose values are JSON DATA, not subschemas: the closedness walk must not descend into them, as a\n// literal value could coincidentally look like an object schema. `tsMeta` is NOT here, its halves are real schemas.\nconst VALUE_POSITION_KEYS = new Set(['const', 'enum', 'default', 'examples', 'rtFormatParams']);\n\n/** Deep-stamps `additionalProperties: false` onto every KEYED object node. Records (whose\n * `additionalProperties` carries the index schema) and the bare `object` keyword are left alone:\n * closing a node with no `properties` would read as \"no keys at all\". **/\nexport function closeDeclaredObjects(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(closeDeclaredObjects);\n if (value === null || typeof value !== 'object') return value;\n const node = value as Record<string, unknown>;\n const out: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(node)) {\n out[key] = VALUE_POSITION_KEYS.has(key) ? child : closeDeclaredObjects(child);\n }\n const declaredProperties = out.properties;\n if (\n out.type === 'object' &&\n declaredProperties !== null &&\n typeof declaredProperties === 'object' &&\n !('additionalProperties' in out)\n ) {\n out.additionalProperties = false;\n }\n return out;\n}\n\n/** Deep-strips the dialect keywords, returning plain 2020-12. A `tsMeta` node collapses to its stripped\n * base (the metadata halves are annotation-only), and a node left empty reads as `{}`, any value. **/\nexport function stripDialect(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(stripDialect);\n if (value === null || typeof value !== 'object') return value;\n const node = value as Record<string, unknown>;\n const meta = node.tsMeta;\n if (meta !== null && typeof meta === 'object' && 'base' in (meta as object)) {\n return stripDialect((meta as {base: unknown}).base);\n }\n const out: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(node)) {\n if (DIALECT_KEY_SET.has(key)) continue;\n out[key] = stripDialect(child);\n }\n return out;\n}\n\n/** Both sides return the same document (see the module doc). **/\nexport function buildJsonSchemaConverter(docFn: JsonSchemaDocFn): StandardJSONSchemaConverter {\n const read = (options?: StandardJSONSchemaOptions): Record<string, unknown> => {\n assertTarget(options);\n let doc: unknown = docFn();\n // The stamp runs BEFORE the portable strip: additionalProperties is standard vocabulary, so a\n // portable closed document keeps it.\n const strategy = encoderStrategyOf(options);\n if (strategy === 'clone') {\n doc = closeDeclaredObjects(doc);\n }\n if (isPortable(options)) doc = stripDialect(doc);\n return doc as Record<string, unknown>;\n };\n return {input: read, output: read};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/standard/spec.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/standard/spec.ts"],"names":[],"mappings":"","sourcesContent":["// Standard Schema v1 interface — copied from `@standard-schema/spec` (MIT) to keep this package free of\n// runtime dependencies, with the upstream `StandardSchemaV1` namespace flattened to top-level aliases\n// (the repo's eslint forbids `namespace` in `.ts`). The SHAPES are byte-identical, so an object produced\n// here is structurally assignable to a consumer's `StandardSchemaV1` from the real spec package.\n// See https://github.com/standard-schema/standard-schema.\n\n/** The Standard Schema interface. */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly '~standard': StandardSchemaProps<Input, Output>;\n}\n\n/** The Standard Schema properties interface. */\nexport interface StandardSchemaProps<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Validates unknown input values. */\n readonly validate: (value: unknown) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;\n /** Inferred types associated with the schema. */\n readonly types?: StandardSchemaTypes<Input, Output> | undefined;\n}\n\n/** The result interface of the validate function. */\nexport type StandardSchemaResult<Output> = StandardSchemaSuccessResult<Output> | StandardSchemaFailureResult;\n\n/** The result interface if validation succeeds. */\nexport interface StandardSchemaSuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** A falsy value for `issues` indicates success. */\n readonly issues?: undefined;\n}\n\n/** The result interface if validation fails. */\nexport interface StandardSchemaFailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<StandardSchemaIssue>;\n}\n\n/** The issue interface of the failure output. */\nexport interface StandardSchemaIssue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | StandardSchemaPathSegment> | undefined;\n}\n\n/** The path segment interface of the issue. */\nexport interface StandardSchemaPathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n}\n\n/** The Standard Schema types interface. */\nexport interface StandardSchemaTypes<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n}\n\n/** Infers the input type of a Standard Schema. */\nexport type StandardSchemaInferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];\n\n/** Infers the output type of a Standard Schema. */\nexport type StandardSchemaInferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];\n\n// Standard JSON Schema v1 — the companion conversion interface, flattened like the ones above. A single\n// object may satisfy BOTH by carrying `validate` and `jsonSchema` under one `~standard`, which is what\n// `createStandardSchema` returns.\n\n/** The Standard JSON Schema interface. */\nexport interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n /** The Standard JSON Schema properties. */\n readonly '~standard': StandardJSONSchemaProps<Input, Output>;\n}\n\n/** The Standard JSON Schema properties interface. */\nexport interface StandardJSONSchemaProps<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Methods generating the input / output JSON Schema documents. */\n readonly jsonSchema: StandardJSONSchemaConverter;\n /** Inferred types associated with the schema. */\n readonly types?: StandardSchemaTypes<Input, Output> | undefined;\n}\n\n/** The input / output JSON Schema conversion methods. */\nexport interface StandardJSONSchemaConverter {\n /** Converts the input type to a JSON Schema document. */\n readonly input: (options?: StandardJSONSchemaOptions) => Record<string, unknown>;\n /** Converts the output type to a JSON Schema document. */\n readonly output: (options?: StandardJSONSchemaOptions) => Record<string, unknown>;\n}\n\n/** The conversion options. Only `'draft-2020-12'` is supported, and of the vendor-specific\n * `libraryOptions` mion reads `{portable: true}`, which strips its dialect keywords. */\nexport interface StandardJSONSchemaOptions {\n readonly target?: string;\n readonly libraryOptions?: Record<string, unknown> | undefined;\n}\n"]}
package/package.json CHANGED
@@ -1,85 +1,45 @@
1
1
  {
2
2
  "name": "@mionjs/run-types",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "description": "Sentinel marker + canonical reflection helper for mion RunTypes. The vite plugin rewrites every call of a function whose trailing parameter type is InjectRunTypeId<T> exported from this package.",
5
5
  "type": "module",
6
6
  "sideEffects": [
7
7
  "./src/formats/**",
8
8
  "./dist/formats/**",
9
- "./dist/cjs/formats/**",
10
9
  "./src/runtypes/**",
11
10
  "./dist/runtypes/**",
12
- "./dist/cjs/runtypes/**",
13
11
  "./src/builders/**",
14
12
  "./dist/builders/**",
15
- "./dist/cjs/builders/**",
16
13
  "./src/createRTFunctions.ts",
17
- "./dist/createRTFunctions.js",
18
- "./dist/cjs/createRTFunctions.js"
14
+ "./dist/createRTFunctions.js"
19
15
  ],
20
16
  "license": "MIT",
21
17
  "module": "./dist/index.js",
22
18
  "types": "./dist/index.d.ts",
23
19
  "exports": {
24
20
  ".": {
25
- "import": {
26
- "types": "./dist/index.d.ts",
27
- "default": "./dist/index.js"
28
- },
29
- "require": {
30
- "types": "./dist/cjs/index.d.ts",
31
- "default": "./dist/cjs/index.js"
32
- }
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
33
23
  },
34
24
  "./formats": {
35
- "import": {
36
- "types": "./dist/formats/index.d.ts",
37
- "default": "./dist/formats/index.js"
38
- },
39
- "require": {
40
- "types": "./dist/cjs/formats/index.d.ts",
41
- "default": "./dist/cjs/formats/index.js"
42
- }
25
+ "types": "./dist/formats/index.d.ts",
26
+ "default": "./dist/formats/index.js"
43
27
  },
44
28
  "./formats/temporal": {
45
- "import": {
46
- "types": "./dist/formats/datetime/temporalFormats.d.ts",
47
- "default": "./dist/formats/datetime/temporalFormats.js"
48
- },
49
- "require": {
50
- "types": "./dist/cjs/formats/datetime/temporalFormats.d.ts",
51
- "default": "./dist/cjs/formats/datetime/temporalFormats.js"
52
- }
29
+ "types": "./dist/formats/datetime/temporalFormats.d.ts",
30
+ "default": "./dist/formats/datetime/temporalFormats.js"
53
31
  },
54
32
  "./mocking": {
55
- "import": {
56
- "types": "./dist/mocking/index.d.ts",
57
- "default": "./dist/mocking/index.js"
58
- },
59
- "require": {
60
- "types": "./dist/cjs/mocking/index.d.ts",
61
- "default": "./dist/cjs/mocking/index.js"
62
- }
33
+ "types": "./dist/mocking/index.d.ts",
34
+ "default": "./dist/mocking/index.js"
63
35
  },
64
36
  "./runtime": {
65
- "import": {
66
- "types": "./dist/runtime/index.d.ts",
67
- "default": "./dist/runtime/index.js"
68
- },
69
- "require": {
70
- "types": "./dist/cjs/runtime/index.d.ts",
71
- "default": "./dist/cjs/runtime/index.js"
72
- }
37
+ "types": "./dist/runtime/index.d.ts",
38
+ "default": "./dist/runtime/index.js"
73
39
  },
74
40
  "./builders": {
75
- "import": {
76
- "types": "./dist/builders/index.d.ts",
77
- "default": "./dist/builders/index.js"
78
- },
79
- "require": {
80
- "types": "./dist/cjs/builders/index.d.ts",
81
- "default": "./dist/cjs/builders/index.js"
82
- }
41
+ "types": "./dist/builders/index.d.ts",
42
+ "default": "./dist/builders/index.js"
83
43
  }
84
44
  },
85
45
  "bin": {
@@ -96,7 +56,7 @@
96
56
  "publishConfig": {
97
57
  "access": "public"
98
58
  },
99
- "homepage": "https://mion.pages.dev/runtypes",
59
+ "homepage": "https://mion.io/runtypes",
100
60
  "bugs": {
101
61
  "url": "https://github.com/MionKit/mion/issues"
102
62
  },
@@ -106,11 +66,14 @@
106
66
  "directory": "packages/run-types"
107
67
  },
108
68
  "devDependencies": {
109
- "@mionjs/bin-compiler": "0.13.2",
110
- "@mionjs/devtools": "0.13.2"
69
+ "@mionjs/bin-compiler": "0.14.0",
70
+ "@mionjs/devtools": "0.14.0"
71
+ },
72
+ "engines": {
73
+ "node": ">=24"
111
74
  },
112
75
  "scripts": {
113
- "build": "mion compile --tsconfig tsconfig.build.json --gen-dir .mion-build && tsc -p tsconfig.cjs.json && node ../../scripts/lib/emit-cjs-pkg.mjs dist/cjs && node ../../scripts/core/hollow-builtin-purefns.mjs",
76
+ "build": "mion compile --tsconfig tsconfig.build.json --gen-dir .mion-build && node ../../scripts/core/hollow-builtin-purefns.mjs",
114
77
  "typecheck:test": "tsc -p tsconfig.json --noEmit",
115
78
  "pretest": "node ../../scripts/miondevx.mjs core build --trust-stamp",
116
79
  "test": "vitest run",
@@ -1,12 +0,0 @@
1
- import type { RunType } from '../runtypes/types.ts';
2
- import type { InjectRunTypeId } from '../markers.ts';
3
- export declare function boolean(id?: InjectRunTypeId<boolean>): RunType<boolean>;
4
- export declare function literal<const V extends string | number | bigint | boolean | null | undefined>(value: V, id?: InjectRunTypeId<V>): RunType<V>;
5
- export declare function regexp(id?: InjectRunTypeId<RegExp>): RunType<RegExp>;
6
- export declare function symbol(id?: InjectRunTypeId<symbol>): RunType<symbol>;
7
- export declare function any(id?: InjectRunTypeId<any>): RunType<any>;
8
- export declare function unknown(id?: InjectRunTypeId<unknown>): RunType<unknown>;
9
- export declare function never(id?: InjectRunTypeId<never>): RunType<never>;
10
- export declare function voidType(id?: InjectRunTypeId<void>): RunType<void>;
11
- export declare function classType<Instance>(ctor: abstract new (...args: any[]) => Instance, id?: InjectRunTypeId<Instance>): RunType<Instance>;
12
- export declare function enumType<const E extends Record<string, string | number>>(enumObject: E, id?: InjectRunTypeId<E[keyof E]>): RunType<E[keyof E]>;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.boolean = boolean;
4
- exports.literal = literal;
5
- exports.regexp = regexp;
6
- exports.symbol = symbol;
7
- exports.any = any;
8
- exports.unknown = unknown;
9
- exports.never = never;
10
- exports.voidType = voidType;
11
- exports.classType = classType;
12
- exports.enumType = enumType;
13
- const builderCore_ts_1 = require("../runtypes/builderCore.js");
14
- function boolean(id) {
15
- return (0, builderCore_ts_1.builderResult)(id, { type: 'boolean', formatParams: {} });
16
- }
17
- function literal(value, id) {
18
- return (0, builderCore_ts_1.builderResult)(id, { type: 'literal', literal: value });
19
- }
20
- function regexp(id) {
21
- return (0, builderCore_ts_1.builderResult)(id, { type: 'regexp', formatParams: {} });
22
- }
23
- function symbol(id) {
24
- return (0, builderCore_ts_1.builderResult)(id, { type: 'symbol', formatParams: {} });
25
- }
26
- function any(id) {
27
- return (0, builderCore_ts_1.builderResult)(id, { type: 'any', formatParams: {} });
28
- }
29
- function unknown(id) {
30
- return (0, builderCore_ts_1.builderResult)(id, { type: 'unknown', formatParams: {} });
31
- }
32
- function never(id) {
33
- return (0, builderCore_ts_1.builderResult)(id, { type: 'never', formatParams: {} });
34
- }
35
- function voidType(id) {
36
- return (0, builderCore_ts_1.builderResult)(id, { type: 'void', formatParams: {} });
37
- }
38
- function classType(ctor, id) {
39
- return (0, builderCore_ts_1.builderResult)(id, { type: 'class', ctor });
40
- }
41
- function enumType(enumObject, id) {
42
- return (0, builderCore_ts_1.builderResult)(id, { type: 'enum', members: enumObject });
43
- }