envapt 6.0.2 → 7.0.0-next.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 (354) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +5 -8
  3. package/dist/browser/converters/BuiltInConverters.mjs +1 -1
  4. package/dist/browser/converters/BuiltInConverters.mjs.map +1 -1
  5. package/dist/browser/converters/ValueConverter.d.mts +1 -1
  6. package/dist/browser/converters/ValueConverter.mjs +1 -1
  7. package/dist/browser/converters/ValueConverter.mjs.map +1 -1
  8. package/dist/browser/core/AdvancedMethods.d.mts +1 -1
  9. package/dist/browser/core/AdvancedMethods.mjs +1 -1
  10. package/dist/browser/core/AdvancedMethods.mjs.map +1 -1
  11. package/dist/browser/core/EnvapterBase.d.mts +2 -2
  12. package/dist/browser/core/EnvapterBase.mjs +1 -1
  13. package/dist/browser/core/EnvapterBase.mjs.map +1 -1
  14. package/dist/browser/core/EnvironmentMethods.mjs +1 -1
  15. package/dist/browser/core/EnvironmentMethods.mjs.map +1 -1
  16. package/dist/browser/core/PrimitiveMethods.d.mts +1 -1
  17. package/dist/browser/core/PrimitiveMethods.mjs +1 -1
  18. package/dist/browser/core/PrimitiveMethods.mjs.map +1 -1
  19. package/dist/browser/decorators/{Envapt.d.mts → legacy/Envapt.d.mts} +59 -49
  20. package/dist/browser/decorators/legacy/Envapt.mjs +2 -0
  21. package/dist/browser/decorators/legacy/Envapt.mjs.map +1 -0
  22. package/dist/browser/decorators/legacy/SugarDecorators.d.mts +40 -0
  23. package/dist/browser/decorators/legacy/SugarDecorators.mjs +2 -0
  24. package/dist/browser/decorators/legacy/SugarDecorators.mjs.map +1 -0
  25. package/dist/browser/decorators/legacy/createPropertyDecorator.mjs +2 -0
  26. package/dist/browser/decorators/legacy/createPropertyDecorator.mjs.map +1 -0
  27. package/dist/browser/decorators/modern/Envapt.d.mts +218 -0
  28. package/dist/browser/decorators/modern/Envapt.mjs +2 -0
  29. package/dist/browser/decorators/modern/Envapt.mjs.map +1 -0
  30. package/dist/browser/decorators/modern/SugarDecorators.d.mts +40 -0
  31. package/dist/browser/decorators/modern/SugarDecorators.mjs +2 -0
  32. package/dist/browser/decorators/modern/SugarDecorators.mjs.map +1 -0
  33. package/dist/browser/decorators/modern/createAccessorDecorator.mjs +2 -0
  34. package/dist/browser/decorators/modern/createAccessorDecorator.mjs.map +1 -0
  35. package/dist/browser/decorators/parseEnvaptOptions.mjs +2 -0
  36. package/dist/browser/decorators/parseEnvaptOptions.mjs.map +1 -0
  37. package/dist/browser/decorators/resolveDecoratorValue.mjs +2 -0
  38. package/dist/browser/decorators/resolveDecoratorValue.mjs.map +1 -0
  39. package/dist/browser/{Envapter.d.mts → engine/Envapter.d.mts} +3 -3
  40. package/dist/browser/engine/Envapter.mjs +2 -0
  41. package/dist/browser/engine/Envapter.mjs.map +1 -0
  42. package/dist/browser/{TemplateResolver.d.mts → engine/TemplateResolver.d.mts} +2 -2
  43. package/dist/browser/engine/TemplateResolver.mjs +2 -0
  44. package/dist/browser/engine/TemplateResolver.mjs.map +1 -0
  45. package/dist/browser/engine/Validators.mjs +2 -0
  46. package/dist/browser/engine/Validators.mjs.map +1 -0
  47. package/dist/browser/engine/installFileApiStubs.mjs +2 -0
  48. package/dist/browser/engine/installFileApiStubs.mjs.map +1 -0
  49. package/dist/browser/index.d.mts +9 -8
  50. package/dist/browser/index.mjs +1 -1
  51. package/dist/browser/index.mjs.map +1 -1
  52. package/dist/browser/{Debug.d.mts → infra/Debug.d.mts} +1 -1
  53. package/dist/browser/infra/Debug.mjs.map +1 -0
  54. package/dist/{workerd → browser/infra}/Dotenv.d.mts +1 -1
  55. package/dist/browser/infra/Dotenv.mjs.map +1 -0
  56. package/dist/browser/{Error.d.mts → infra/Error.d.mts} +1 -1
  57. package/dist/browser/infra/Error.mjs.map +1 -0
  58. package/dist/browser/{StandardSchema.d.mts → infra/StandardSchema.d.mts} +1 -1
  59. package/dist/browser/infra/runtime.mjs.map +1 -0
  60. package/dist/browser/legacy.d.mts +4 -0
  61. package/dist/browser/legacy.mjs +1 -0
  62. package/dist/browser/sources/UnboundEnvSource.mjs +1 -1
  63. package/dist/browser/sources/UnboundEnvSource.mjs.map +1 -1
  64. package/dist/browser/types/Decorator.d.mts +26 -0
  65. package/dist/browser/types/Schema.d.mts +1 -1
  66. package/dist/node/config.cjs +1 -1
  67. package/dist/node/config.cjs.map +1 -1
  68. package/dist/node/config.mjs +1 -1
  69. package/dist/node/config.mjs.map +1 -1
  70. package/dist/node/converters/BuiltInConverters.cjs +1 -1
  71. package/dist/node/converters/BuiltInConverters.cjs.map +1 -1
  72. package/dist/node/converters/BuiltInConverters.mjs +1 -1
  73. package/dist/node/converters/BuiltInConverters.mjs.map +1 -1
  74. package/dist/node/converters/ValueConverter.cjs +1 -1
  75. package/dist/node/converters/ValueConverter.cjs.map +1 -1
  76. package/dist/node/converters/ValueConverter.d.cts +1 -1
  77. package/dist/node/converters/ValueConverter.d.mts +1 -1
  78. package/dist/node/converters/ValueConverter.mjs +1 -1
  79. package/dist/node/converters/ValueConverter.mjs.map +1 -1
  80. package/dist/node/core/AdvancedMethods.cjs +1 -1
  81. package/dist/node/core/AdvancedMethods.cjs.map +1 -1
  82. package/dist/node/core/AdvancedMethods.d.cts +1 -1
  83. package/dist/node/core/AdvancedMethods.d.mts +1 -1
  84. package/dist/node/core/AdvancedMethods.mjs +1 -1
  85. package/dist/node/core/AdvancedMethods.mjs.map +1 -1
  86. package/dist/node/core/EnvapterBase.cjs +1 -1
  87. package/dist/node/core/EnvapterBase.cjs.map +1 -1
  88. package/dist/node/core/EnvapterBase.d.cts +2 -2
  89. package/dist/node/core/EnvapterBase.d.mts +2 -2
  90. package/dist/node/core/EnvapterBase.mjs +1 -1
  91. package/dist/node/core/EnvapterBase.mjs.map +1 -1
  92. package/dist/node/core/EnvironmentMethods.cjs +1 -1
  93. package/dist/node/core/EnvironmentMethods.cjs.map +1 -1
  94. package/dist/node/core/EnvironmentMethods.d.cts +1 -1
  95. package/dist/node/core/EnvironmentMethods.d.mts +1 -1
  96. package/dist/node/core/EnvironmentMethods.mjs +1 -1
  97. package/dist/node/core/EnvironmentMethods.mjs.map +1 -1
  98. package/dist/node/core/PrimitiveMethods.cjs +1 -1
  99. package/dist/node/core/PrimitiveMethods.cjs.map +1 -1
  100. package/dist/node/core/PrimitiveMethods.d.cts +1 -1
  101. package/dist/node/core/PrimitiveMethods.d.mts +1 -1
  102. package/dist/node/core/PrimitiveMethods.mjs +1 -1
  103. package/dist/node/core/PrimitiveMethods.mjs.map +1 -1
  104. package/dist/node/decorators/legacy/Envapt.cjs +2 -0
  105. package/dist/node/decorators/legacy/Envapt.cjs.map +1 -0
  106. package/dist/node/decorators/{Envapt.d.cts → legacy/Envapt.d.cts} +59 -49
  107. package/dist/node/decorators/{Envapt.d.mts → legacy/Envapt.d.mts} +59 -49
  108. package/dist/node/decorators/legacy/Envapt.mjs +2 -0
  109. package/dist/node/decorators/legacy/Envapt.mjs.map +1 -0
  110. package/dist/node/decorators/legacy/SugarDecorators.cjs +2 -0
  111. package/dist/node/decorators/legacy/SugarDecorators.cjs.map +1 -0
  112. package/dist/node/decorators/legacy/SugarDecorators.d.cts +40 -0
  113. package/dist/node/decorators/legacy/SugarDecorators.d.mts +42 -0
  114. package/dist/node/decorators/legacy/SugarDecorators.mjs +2 -0
  115. package/dist/node/decorators/legacy/SugarDecorators.mjs.map +1 -0
  116. package/dist/node/decorators/legacy/createPropertyDecorator.cjs +2 -0
  117. package/dist/node/decorators/legacy/createPropertyDecorator.cjs.map +1 -0
  118. package/dist/node/decorators/legacy/createPropertyDecorator.mjs +2 -0
  119. package/dist/node/decorators/legacy/createPropertyDecorator.mjs.map +1 -0
  120. package/dist/node/decorators/modern/Envapt.cjs +2 -0
  121. package/dist/node/decorators/modern/Envapt.cjs.map +1 -0
  122. package/dist/node/decorators/modern/Envapt.d.cts +218 -0
  123. package/dist/node/decorators/modern/Envapt.d.mts +220 -0
  124. package/dist/node/decorators/modern/Envapt.mjs +2 -0
  125. package/dist/node/decorators/modern/Envapt.mjs.map +1 -0
  126. package/dist/node/decorators/modern/SugarDecorators.cjs +2 -0
  127. package/dist/node/decorators/modern/SugarDecorators.cjs.map +1 -0
  128. package/dist/node/decorators/modern/SugarDecorators.d.cts +40 -0
  129. package/dist/node/decorators/modern/SugarDecorators.d.mts +42 -0
  130. package/dist/node/decorators/modern/SugarDecorators.mjs +2 -0
  131. package/dist/node/decorators/modern/SugarDecorators.mjs.map +1 -0
  132. package/dist/node/decorators/modern/createAccessorDecorator.cjs +2 -0
  133. package/dist/node/decorators/modern/createAccessorDecorator.cjs.map +1 -0
  134. package/dist/node/decorators/modern/createAccessorDecorator.mjs +2 -0
  135. package/dist/node/decorators/modern/createAccessorDecorator.mjs.map +1 -0
  136. package/dist/node/decorators/parseEnvaptOptions.cjs +2 -0
  137. package/dist/node/decorators/parseEnvaptOptions.cjs.map +1 -0
  138. package/dist/node/decorators/parseEnvaptOptions.mjs +2 -0
  139. package/dist/node/decorators/parseEnvaptOptions.mjs.map +1 -0
  140. package/dist/node/decorators/resolveDecoratorValue.cjs +2 -0
  141. package/dist/node/decorators/resolveDecoratorValue.cjs.map +1 -0
  142. package/dist/node/decorators/resolveDecoratorValue.mjs +2 -0
  143. package/dist/node/decorators/resolveDecoratorValue.mjs.map +1 -0
  144. package/dist/node/engine/Envapter.cjs +2 -0
  145. package/dist/node/engine/Envapter.cjs.map +1 -0
  146. package/dist/node/{Envapter.d.cts → engine/Envapter.d.cts} +3 -3
  147. package/dist/node/{Envapter.d.mts → engine/Envapter.d.mts} +3 -3
  148. package/dist/node/engine/Envapter.mjs +2 -0
  149. package/dist/node/engine/Envapter.mjs.map +1 -0
  150. package/dist/node/engine/NodeEnvapter.cjs +2 -0
  151. package/dist/node/engine/NodeEnvapter.cjs.map +1 -0
  152. package/dist/node/{NodeEnvapter.d.cts → engine/NodeEnvapter.d.cts} +3 -3
  153. package/dist/node/{NodeEnvapter.d.mts → engine/NodeEnvapter.d.mts} +3 -3
  154. package/dist/node/engine/NodeEnvapter.mjs +2 -0
  155. package/dist/node/engine/NodeEnvapter.mjs.map +1 -0
  156. package/dist/node/engine/TemplateResolver.cjs +2 -0
  157. package/dist/node/engine/TemplateResolver.cjs.map +1 -0
  158. package/dist/node/{TemplateResolver.d.cts → engine/TemplateResolver.d.cts} +2 -2
  159. package/dist/node/{TemplateResolver.d.mts → engine/TemplateResolver.d.mts} +2 -2
  160. package/dist/node/engine/TemplateResolver.mjs +2 -0
  161. package/dist/node/engine/TemplateResolver.mjs.map +1 -0
  162. package/dist/node/engine/Validators.cjs +2 -0
  163. package/dist/node/engine/Validators.cjs.map +1 -0
  164. package/dist/node/engine/Validators.mjs +2 -0
  165. package/dist/node/engine/Validators.mjs.map +1 -0
  166. package/dist/node/index.cjs +1 -1
  167. package/dist/node/index.d.cts +9 -8
  168. package/dist/node/index.d.mts +9 -8
  169. package/dist/node/index.mjs +1 -1
  170. package/dist/node/infra/Debug.cjs.map +1 -0
  171. package/dist/node/{Debug.d.cts → infra/Debug.d.cts} +1 -1
  172. package/dist/node/{Debug.d.mts → infra/Debug.d.mts} +1 -1
  173. package/dist/node/infra/Debug.mjs.map +1 -0
  174. package/dist/node/infra/Dotenv.cjs.map +1 -0
  175. package/dist/node/{Dotenv.d.cts → infra/Dotenv.d.cts} +1 -1
  176. package/dist/node/{Dotenv.d.mts → infra/Dotenv.d.mts} +1 -1
  177. package/dist/node/infra/Dotenv.mjs.map +1 -0
  178. package/dist/node/infra/Error.cjs.map +1 -0
  179. package/dist/node/{Error.d.cts → infra/Error.d.cts} +1 -1
  180. package/dist/node/{Error.d.mts → infra/Error.d.mts} +1 -1
  181. package/dist/node/infra/Error.mjs.map +1 -0
  182. package/dist/node/{StandardSchema.d.cts → infra/StandardSchema.d.cts} +1 -1
  183. package/dist/node/{StandardSchema.d.mts → infra/StandardSchema.d.mts} +1 -1
  184. package/dist/node/infra/runtime.cjs.map +1 -0
  185. package/dist/node/infra/runtime.mjs.map +1 -0
  186. package/dist/node/legacy.cjs +1 -0
  187. package/dist/node/legacy.d.cts +4 -0
  188. package/dist/node/legacy.d.mts +6 -0
  189. package/dist/node/legacy.mjs +1 -0
  190. package/dist/node/sources/UnboundEnvSource.cjs +1 -1
  191. package/dist/node/sources/UnboundEnvSource.cjs.map +1 -1
  192. package/dist/node/sources/UnboundEnvSource.mjs +1 -1
  193. package/dist/node/sources/UnboundEnvSource.mjs.map +1 -1
  194. package/dist/node/types/Decorator.d.cts +26 -0
  195. package/dist/node/types/Decorator.d.mts +28 -0
  196. package/dist/node/types/Schema.d.cts +1 -1
  197. package/dist/node/types/Schema.d.mts +1 -1
  198. package/dist/workerd/converters/BuiltInConverters.mjs +1 -1
  199. package/dist/workerd/converters/BuiltInConverters.mjs.map +1 -1
  200. package/dist/workerd/converters/ValueConverter.d.mts +1 -1
  201. package/dist/workerd/converters/ValueConverter.mjs +1 -1
  202. package/dist/workerd/converters/ValueConverter.mjs.map +1 -1
  203. package/dist/workerd/core/AdvancedMethods.d.mts +1 -1
  204. package/dist/workerd/core/AdvancedMethods.mjs +1 -1
  205. package/dist/workerd/core/AdvancedMethods.mjs.map +1 -1
  206. package/dist/workerd/core/EnvapterBase.d.mts +2 -2
  207. package/dist/workerd/core/EnvapterBase.mjs +1 -1
  208. package/dist/workerd/core/EnvapterBase.mjs.map +1 -1
  209. package/dist/workerd/core/EnvironmentMethods.d.mts +1 -1
  210. package/dist/workerd/core/EnvironmentMethods.mjs +1 -1
  211. package/dist/workerd/core/EnvironmentMethods.mjs.map +1 -1
  212. package/dist/workerd/core/PrimitiveMethods.d.mts +1 -1
  213. package/dist/workerd/core/PrimitiveMethods.mjs +1 -1
  214. package/dist/workerd/core/PrimitiveMethods.mjs.map +1 -1
  215. package/dist/workerd/decorators/{Envapt.d.mts → legacy/Envapt.d.mts} +59 -49
  216. package/dist/workerd/decorators/legacy/Envapt.mjs +2 -0
  217. package/dist/workerd/decorators/legacy/Envapt.mjs.map +1 -0
  218. package/dist/workerd/decorators/legacy/SugarDecorators.d.mts +40 -0
  219. package/dist/workerd/decorators/legacy/SugarDecorators.mjs +2 -0
  220. package/dist/workerd/decorators/legacy/SugarDecorators.mjs.map +1 -0
  221. package/dist/workerd/decorators/legacy/createPropertyDecorator.mjs +2 -0
  222. package/dist/workerd/decorators/legacy/createPropertyDecorator.mjs.map +1 -0
  223. package/dist/workerd/decorators/modern/Envapt.d.mts +218 -0
  224. package/dist/workerd/decorators/modern/Envapt.mjs +2 -0
  225. package/dist/workerd/decorators/modern/Envapt.mjs.map +1 -0
  226. package/dist/workerd/decorators/modern/SugarDecorators.d.mts +40 -0
  227. package/dist/workerd/decorators/modern/SugarDecorators.mjs +2 -0
  228. package/dist/workerd/decorators/modern/SugarDecorators.mjs.map +1 -0
  229. package/dist/workerd/decorators/modern/createAccessorDecorator.mjs +2 -0
  230. package/dist/workerd/decorators/modern/createAccessorDecorator.mjs.map +1 -0
  231. package/dist/workerd/decorators/parseEnvaptOptions.mjs +2 -0
  232. package/dist/workerd/decorators/parseEnvaptOptions.mjs.map +1 -0
  233. package/dist/workerd/decorators/resolveDecoratorValue.mjs +2 -0
  234. package/dist/workerd/decorators/resolveDecoratorValue.mjs.map +1 -0
  235. package/dist/workerd/{Envapter.d.mts → engine/Envapter.d.mts} +3 -3
  236. package/dist/workerd/engine/Envapter.mjs +2 -0
  237. package/dist/workerd/engine/Envapter.mjs.map +1 -0
  238. package/dist/workerd/{TemplateResolver.d.mts → engine/TemplateResolver.d.mts} +2 -2
  239. package/dist/workerd/engine/TemplateResolver.mjs +2 -0
  240. package/dist/workerd/engine/TemplateResolver.mjs.map +1 -0
  241. package/dist/workerd/engine/Validators.mjs +2 -0
  242. package/dist/workerd/engine/Validators.mjs.map +1 -0
  243. package/dist/workerd/engine/installFileApiStubs.mjs +2 -0
  244. package/dist/workerd/engine/installFileApiStubs.mjs.map +1 -0
  245. package/dist/workerd/index.d.mts +9 -8
  246. package/dist/workerd/index.mjs +1 -1
  247. package/dist/workerd/index.mjs.map +1 -1
  248. package/dist/workerd/{Debug.d.mts → infra/Debug.d.mts} +1 -1
  249. package/dist/workerd/infra/Debug.mjs.map +1 -0
  250. package/dist/{browser → workerd/infra}/Dotenv.d.mts +1 -1
  251. package/dist/workerd/infra/Dotenv.mjs.map +1 -0
  252. package/dist/workerd/{Error.d.mts → infra/Error.d.mts} +1 -1
  253. package/dist/workerd/infra/Error.mjs.map +1 -0
  254. package/dist/workerd/{StandardSchema.d.mts → infra/StandardSchema.d.mts} +1 -1
  255. package/dist/workerd/infra/runtime.mjs.map +1 -0
  256. package/dist/workerd/legacy.d.mts +4 -0
  257. package/dist/workerd/legacy.mjs +1 -0
  258. package/dist/workerd/sources/UnboundEnvSource.mjs +1 -1
  259. package/dist/workerd/sources/UnboundEnvSource.mjs.map +1 -1
  260. package/dist/workerd/types/Decorator.d.mts +26 -0
  261. package/dist/workerd/types/Schema.d.mts +1 -1
  262. package/package.json +34 -3
  263. package/dist/browser/Debug.mjs.map +0 -1
  264. package/dist/browser/Dotenv.mjs.map +0 -1
  265. package/dist/browser/Envapter.mjs +0 -2
  266. package/dist/browser/Envapter.mjs.map +0 -1
  267. package/dist/browser/Error.mjs.map +0 -1
  268. package/dist/browser/TemplateResolver.mjs +0 -2
  269. package/dist/browser/TemplateResolver.mjs.map +0 -1
  270. package/dist/browser/Validators.mjs +0 -2
  271. package/dist/browser/Validators.mjs.map +0 -1
  272. package/dist/browser/decorators/Envapt.mjs +0 -2
  273. package/dist/browser/decorators/Envapt.mjs.map +0 -1
  274. package/dist/browser/decorators/SugarDecorators.d.mts +0 -34
  275. package/dist/browser/decorators/SugarDecorators.mjs +0 -2
  276. package/dist/browser/decorators/SugarDecorators.mjs.map +0 -1
  277. package/dist/browser/decorators/createPropertyDecorator.mjs +0 -2
  278. package/dist/browser/decorators/createPropertyDecorator.mjs.map +0 -1
  279. package/dist/browser/installFileApiStubs.mjs +0 -2
  280. package/dist/browser/installFileApiStubs.mjs.map +0 -1
  281. package/dist/browser/runtime.mjs.map +0 -1
  282. package/dist/node/Debug.cjs.map +0 -1
  283. package/dist/node/Debug.mjs.map +0 -1
  284. package/dist/node/Dotenv.cjs.map +0 -1
  285. package/dist/node/Dotenv.mjs.map +0 -1
  286. package/dist/node/Envapter.cjs +0 -2
  287. package/dist/node/Envapter.cjs.map +0 -1
  288. package/dist/node/Envapter.mjs +0 -2
  289. package/dist/node/Envapter.mjs.map +0 -1
  290. package/dist/node/Error.cjs.map +0 -1
  291. package/dist/node/Error.mjs.map +0 -1
  292. package/dist/node/NodeEnvapter.cjs +0 -2
  293. package/dist/node/NodeEnvapter.cjs.map +0 -1
  294. package/dist/node/NodeEnvapter.mjs +0 -2
  295. package/dist/node/NodeEnvapter.mjs.map +0 -1
  296. package/dist/node/TemplateResolver.cjs +0 -2
  297. package/dist/node/TemplateResolver.cjs.map +0 -1
  298. package/dist/node/TemplateResolver.mjs +0 -2
  299. package/dist/node/TemplateResolver.mjs.map +0 -1
  300. package/dist/node/Validators.cjs +0 -2
  301. package/dist/node/Validators.cjs.map +0 -1
  302. package/dist/node/Validators.mjs +0 -2
  303. package/dist/node/Validators.mjs.map +0 -1
  304. package/dist/node/decorators/Envapt.cjs +0 -2
  305. package/dist/node/decorators/Envapt.cjs.map +0 -1
  306. package/dist/node/decorators/Envapt.mjs +0 -2
  307. package/dist/node/decorators/Envapt.mjs.map +0 -1
  308. package/dist/node/decorators/SugarDecorators.cjs +0 -2
  309. package/dist/node/decorators/SugarDecorators.cjs.map +0 -1
  310. package/dist/node/decorators/SugarDecorators.d.cts +0 -34
  311. package/dist/node/decorators/SugarDecorators.d.mts +0 -36
  312. package/dist/node/decorators/SugarDecorators.mjs +0 -2
  313. package/dist/node/decorators/SugarDecorators.mjs.map +0 -1
  314. package/dist/node/decorators/createPropertyDecorator.cjs +0 -2
  315. package/dist/node/decorators/createPropertyDecorator.cjs.map +0 -1
  316. package/dist/node/decorators/createPropertyDecorator.mjs +0 -2
  317. package/dist/node/decorators/createPropertyDecorator.mjs.map +0 -1
  318. package/dist/node/runtime.cjs.map +0 -1
  319. package/dist/node/runtime.mjs.map +0 -1
  320. package/dist/workerd/Debug.mjs.map +0 -1
  321. package/dist/workerd/Dotenv.mjs.map +0 -1
  322. package/dist/workerd/Envapter.mjs +0 -2
  323. package/dist/workerd/Envapter.mjs.map +0 -1
  324. package/dist/workerd/Error.mjs.map +0 -1
  325. package/dist/workerd/TemplateResolver.mjs +0 -2
  326. package/dist/workerd/TemplateResolver.mjs.map +0 -1
  327. package/dist/workerd/Validators.mjs +0 -2
  328. package/dist/workerd/Validators.mjs.map +0 -1
  329. package/dist/workerd/decorators/Envapt.mjs +0 -2
  330. package/dist/workerd/decorators/Envapt.mjs.map +0 -1
  331. package/dist/workerd/decorators/SugarDecorators.d.mts +0 -34
  332. package/dist/workerd/decorators/SugarDecorators.mjs +0 -2
  333. package/dist/workerd/decorators/SugarDecorators.mjs.map +0 -1
  334. package/dist/workerd/decorators/createPropertyDecorator.mjs +0 -2
  335. package/dist/workerd/decorators/createPropertyDecorator.mjs.map +0 -1
  336. package/dist/workerd/installFileApiStubs.mjs +0 -2
  337. package/dist/workerd/installFileApiStubs.mjs.map +0 -1
  338. package/dist/workerd/runtime.mjs.map +0 -1
  339. /package/dist/browser/{Debug.mjs → infra/Debug.mjs} +0 -0
  340. /package/dist/browser/{Dotenv.mjs → infra/Dotenv.mjs} +0 -0
  341. /package/dist/browser/{Error.mjs → infra/Error.mjs} +0 -0
  342. /package/dist/browser/{runtime.mjs → infra/runtime.mjs} +0 -0
  343. /package/dist/node/{Debug.cjs → infra/Debug.cjs} +0 -0
  344. /package/dist/node/{Debug.mjs → infra/Debug.mjs} +0 -0
  345. /package/dist/node/{Dotenv.cjs → infra/Dotenv.cjs} +0 -0
  346. /package/dist/node/{Dotenv.mjs → infra/Dotenv.mjs} +0 -0
  347. /package/dist/node/{Error.cjs → infra/Error.cjs} +0 -0
  348. /package/dist/node/{Error.mjs → infra/Error.mjs} +0 -0
  349. /package/dist/node/{runtime.cjs → infra/runtime.cjs} +0 -0
  350. /package/dist/node/{runtime.mjs → infra/runtime.mjs} +0 -0
  351. /package/dist/workerd/{Debug.mjs → infra/Debug.mjs} +0 -0
  352. /package/dist/workerd/{Dotenv.mjs → infra/Dotenv.mjs} +0 -0
  353. /package/dist/workerd/{Error.mjs → infra/Error.mjs} +0 -0
  354. /package/dist/workerd/{runtime.mjs → infra/runtime.mjs} +0 -0
@@ -1,15 +1,15 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
- import { ArrayOf } from "../converters/Converters.mjs";
4
- import { BuiltInConverter, ConverterFunction, InferConverterFallbackType, InferPrimitiveReturnType, PrimitiveConstructor } from "../types/Conversion.mjs";
5
- import { InferSchemaOutput, StandardSchemaV1 } from "../StandardSchema.mjs";
6
- import { SchemaConstraint } from "../types/Schema.mjs";
7
- import { EnvKeyInput } from "../types/Env.mjs";
3
+ import { ArrayOf } from "../../converters/Converters.mjs";
4
+ import { BuiltInConverter, ConverterFunction, InferConverterFallbackType, InferConverterReturnType, InferPrimitiveReturnType, PrimitiveConstructor } from "../../types/Conversion.mjs";
5
+ import { InferSchemaOutput, StandardSchemaV1 } from "../../infra/StandardSchema.mjs";
6
+ import { SchemaConstraint } from "../../types/Schema.mjs";
7
+ import { EnvKeyInput } from "../../types/Env.mjs";
8
+ import { EnvaptFieldDecorator } from "../../types/Decorator.mjs";
8
9
 
9
- //#region src/decorators/Envapt.d.ts
10
+ //#region src/decorators/legacy/Envapt.d.ts
10
11
  /**
11
- * Usage 1: Either a custom converter function + fallback (both required), OR a fallback
12
- * only (no converter).
12
+ * A custom converter function with a fallback (both required), or a fallback only.
13
13
  *
14
14
  * @param key - Environment variable name(s) to load
15
15
  * @param options - Configuration options
@@ -17,7 +17,6 @@ import { EnvKeyInput } from "../types/Env.mjs";
17
17
  * @example
18
18
  * ```ts
19
19
  * class Config extends Envapter {
20
- * // Custom converter that validates a non-empty API key
21
20
  * \@Envapt('API_KEY', {
22
21
  * fallback: 'default-key',
23
22
  * converter(raw, _fallback) {
@@ -27,30 +26,32 @@ import { EnvKeyInput } from "../types/Env.mjs";
27
26
  * })
28
27
  * static readonly apiKey: string;
29
28
  *
30
- * // Fallback-only (no converter): string fallback
31
29
  * \@Envapt('LOG_FILE', { fallback: '/var/log/app.log' })
32
30
  * static readonly logFile: string;
33
31
  *
34
- * // Fallback-only: arbitrary object fallback
35
32
  * \@Envapt('RETRY_POLICY', { fallback: { retries: 3, backoff: 'exponential' } })
36
33
  * static readonly retryPolicy: unknown;
37
34
  * }
38
35
  * ```
39
36
  */
37
+ declare function Envapt(key: EnvKeyInput, options: {
38
+ fallback: undefined;
39
+ converter?: undefined;
40
+ }): EnvaptFieldDecorator<string | undefined>;
40
41
  declare function Envapt<TFallback>(key: EnvKeyInput, options: {
41
42
  converter: (raw: string | undefined, fallback: TFallback) => TFallback;
42
43
  fallback: TFallback;
43
44
  } | {
44
45
  fallback: TFallback;
45
46
  converter?: undefined;
46
- }): PropertyDecorator;
47
+ }): EnvaptFieldDecorator<TFallback>;
47
48
  /**
48
- * Usage 2: Custom converter function without fallback. Either omit `required` (returns the
49
- * converter's output, possibly `undefined`) or pass `required: true` to throw `MissingEnvValue`
50
- * on missing/empty values.
49
+ * A custom converter function without a fallback. Omit `required` to return the converter's
50
+ * output (possibly `undefined`), or pass `required: true` to throw `MissingEnvValue` on
51
+ * missing or empty values.
51
52
  *
52
53
  * @param key - Environment variable name(s) to load
53
- * @param options - Configuration options with custom converter only, with optional `required: true`
54
+ * @param options - Configuration options
54
55
  * @public
55
56
  * @example
56
57
  * ```ts
@@ -74,15 +75,11 @@ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
74
75
  } | {
75
76
  converter: ConverterFunction<TReturnType>;
76
77
  required: true;
77
- }): PropertyDecorator;
78
+ }): EnvaptFieldDecorator<TReturnType>;
78
79
  /**
79
- * Usage 3: Built-in or array converter with optional fallback OR `required: true`.
80
- *
81
- * `InferConverterFallbackType` handles asymmetric cases: scalar `Converters.Time` accepts
82
- * `TimeFallback`, and `ArrayOf<'time'>` accepts `TimeFallback[]`. Every other converter
83
- * reduces to `InferConverterReturnType`. The two object-shape branches are mutually
84
- * exclusive: either provide a `fallback`, or pass `required: true` to throw
85
- * `MissingEnvValue` on missing/empty values.
80
+ * A built-in or array converter with a fallback, or `required: true`. The fallback type tracks
81
+ * the converter, so `Converters.Time` takes a number or time-string and `Converters.Url` takes
82
+ * a `URL` instance.
86
83
  *
87
84
  * @param key - Environment variable name(s) to load
88
85
  * @param options - Configuration options
@@ -92,23 +89,21 @@ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
92
89
  * import { Converters } from 'envapt';
93
90
  *
94
91
  * class Config extends Envapter {
95
- * // Use built-in Number converter with a numeric fallback
96
92
  * \@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })
97
93
  * static readonly port: number;
98
94
  *
99
- * // Url converter: the fallback is a URL instance, not a string
95
+ * // the Url fallback is a URL instance, not a string
100
96
  * \@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })
101
97
  * static readonly url: URL;
102
98
  *
103
- * // Prefer CANARY_URL when present, otherwise fall back to APP_URL
99
+ * // prefers CANARY_URL when present, otherwise APP_URL
104
100
  * \@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })
105
101
  * static readonly canaryUrl: URL | null;
106
102
  *
107
- * // `Converters.Time` accepts either a number (milliseconds) or a time-string fallback (`<number><unit>`).
103
+ * // Time takes a number (milliseconds) or a time-string fallback (`<number><unit>`)
108
104
  * \@Envapt('REQUEST_TIMEOUT', { converter: Converters.Time, fallback: '10s' })
109
105
  * static readonly requestTimeout: number;
110
106
  *
111
- * // Array converter: comma-separated list of origins -> string[]
112
107
  * \@Envapt('ALLOWED_ORIGINS', {
113
108
  * converter: Converters.array({ of: Converters.String }),
114
109
  * fallback: ['https://example.com']
@@ -122,21 +117,29 @@ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
122
117
  */
123
118
  declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
124
119
  converter: TConverter;
125
- fallback?: InferConverterFallbackType<TConverter> | undefined;
120
+ fallback: InferConverterFallbackType<TConverter>;
126
121
  required?: false;
127
122
  } | {
128
123
  converter: TConverter;
129
124
  required: true;
130
- }): PropertyDecorator;
125
+ }): EnvaptFieldDecorator<InferConverterReturnType<TConverter>>;
126
+ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
127
+ converter: TConverter;
128
+ fallback: undefined;
129
+ required?: false;
130
+ }): EnvaptFieldDecorator<InferConverterReturnType<TConverter> | undefined>;
131
+ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
132
+ converter: TConverter;
133
+ required?: false;
134
+ }): EnvaptFieldDecorator<InferConverterReturnType<TConverter> | null>;
131
135
  /**
132
- * Usage 4: Primitive constructor with optional fallback
136
+ * A primitive constructor (`Number`, `Boolean`) with an optional fallback.
133
137
  *
134
138
  * @param key - Environment variable name(s) to load
135
- * @param options - Configuration options with primitive constructor
139
+ * @param options - Configuration options
136
140
  * @public
137
141
  * @example
138
142
  * ```ts
139
- * // Use primitive constructors to coerce values
140
143
  * class Config extends Envapter {
141
144
  * \@Envapt('MAX_CONNECTIONS', { converter: Number, fallback: 100 })
142
145
  * static readonly maxConnections: number;
@@ -148,17 +151,26 @@ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvK
148
151
  */
149
152
  declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
150
153
  converter: TConstructor;
151
- fallback?: InferPrimitiveReturnType<TConstructor>;
154
+ fallback: InferPrimitiveReturnType<TConstructor>;
152
155
  required?: false;
153
156
  } | {
154
157
  converter: TConstructor;
155
158
  required: true;
156
- }): PropertyDecorator;
159
+ }): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor>>;
160
+ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
161
+ converter: TConstructor;
162
+ fallback: undefined;
163
+ required?: false;
164
+ }): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;
165
+ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
166
+ converter: TConstructor;
167
+ required?: false;
168
+ }): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor> | null>;
157
169
  /**
158
- * Usage 5: Required, no converter (raw string). Throws `MissingEnvValue` on first access if
159
- * the env value is missing or empty (post-trim). Independent of global `Envapter.strict`.
160
- * Combining `required: true` with `fallback` fails to match any overload at compile time;
161
- * the runtime Validator catches dynamic objects that bypass the types.
170
+ * Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env
171
+ * value is missing or empty after trimming, independent of the global `Envapter.strict` flag.
172
+ * Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime
173
+ * Validator rejects dynamic objects that bypass the types.
162
174
  *
163
175
  * @param key - Environment variable name(s) to load
164
176
  * @param options - `{ required: true }`
@@ -173,7 +185,7 @@ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyIn
173
185
  */
174
186
  declare function Envapt(key: EnvKeyInput, options: {
175
187
  required: true;
176
- }): PropertyDecorator;
188
+ }): EnvaptFieldDecorator<string>;
177
189
  /**
178
190
  * No-fallback form. The property resolves from env or `null`.
179
191
  *
@@ -181,20 +193,18 @@ declare function Envapt(key: EnvKeyInput, options: {
181
193
  * @public
182
194
  * @example
183
195
  * ```ts
184
- * // Classic API: no fallback — property will resolve from env or be null
185
196
  * class Config extends Envapter {
186
197
  * \@Envapt('SIMPLE_VALUE')
187
198
  * static readonly simple?: string | null;
188
199
  * }
189
200
  * ```
190
201
  */
191
- declare function Envapt<_TReturnType = string | null>(key: EnvKeyInput): PropertyDecorator;
202
+ declare function Envapt(key: EnvKeyInput): EnvaptFieldDecorator<string | null>;
192
203
  /**
193
- * Usage 6: Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous
194
- * schemas only; a Promise-returning `validate` triggers a runtime
195
- * `InvalidUserDefinedConfig` throw. Combining `schema` with `converter` fails to match any
196
- * overload at compile time; the runtime Validator catches dynamic objects that bypass the
197
- * types.
204
+ * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,
205
+ * so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing
206
+ * `schema` with `converter` matches no overload at compile time, and the runtime Validator
207
+ * rejects dynamic objects that bypass the types.
198
208
  * @public
199
209
  */
200
210
  declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
@@ -204,7 +214,7 @@ declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, optio
204
214
  } | {
205
215
  schema: SchemaConstraint<Schema>;
206
216
  required: true;
207
- }): PropertyDecorator;
217
+ }): EnvaptFieldDecorator<InferSchemaOutput<Schema>>;
208
218
  //#endregion
209
219
  export { Envapt };
210
220
  //# sourceMappingURL=Envapt.d.mts.map
@@ -0,0 +1,2 @@
1
+ import"node:path";import"node:url";import.meta.url;import{parseEnvaptOptions as e}from"../parseEnvaptOptions.mjs";import{createPropertyDecorator as t}from"./createPropertyDecorator.mjs";function n(n,r){return t(n,e(r))}export{n as Envapt};
2
+ //# sourceMappingURL=Envapt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Envapt.mjs","names":[],"sources":["../../../../src/decorators/legacy/Envapt.ts"],"sourcesContent":["import { createPropertyDecorator } from './createPropertyDecorator';\nimport { parseEnvaptOptions } from '../parseEnvaptOptions';\n\nimport type { ArrayOf } from '../../converters';\nimport type { InferSchemaOutput, StandardSchemaV1 } from '../../infra/StandardSchema';\nimport type {\n BuiltInConverter,\n ConverterFunction,\n EnvaptFieldDecorator,\n EnvKeyInput,\n InferConverterFallbackType,\n InferConverterReturnType,\n InferPrimitiveReturnType,\n PrimitiveConstructor,\n SchemaConstraint\n} from '../../types';\n\n/**\n * A custom converter function with a fallback (both required), or a fallback only.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * class Config extends Envapter {\n * \\@Envapt('API_KEY', {\n * fallback: 'default-key',\n * converter(raw, _fallback) {\n * if (!raw || raw.trim() === '') throw new Error('API_KEY required');\n * return raw.trim();\n * }\n * })\n * static readonly apiKey: string;\n *\n * \\@Envapt('LOG_FILE', { fallback: '/var/log/app.log' })\n * static readonly logFile: string;\n *\n * \\@Envapt('RETRY_POLICY', { fallback: { retries: 3, backoff: 'exponential' } })\n * static readonly retryPolicy: unknown;\n * }\n * ```\n */\nexport function Envapt(\n key: EnvKeyInput,\n options: { fallback: undefined; converter?: undefined }\n): EnvaptFieldDecorator<string | undefined>;\nexport function Envapt<TFallback>(\n key: EnvKeyInput,\n options:\n | { converter: (raw: string | undefined, fallback: TFallback) => TFallback; fallback: TFallback }\n | { fallback: TFallback; converter?: undefined }\n): EnvaptFieldDecorator<TFallback>;\n\n/**\n * A custom converter function without a fallback. Omit `required` to return the converter's\n * output (possibly `undefined`), or pass `required: true` to throw `MissingEnvValue` on\n * missing or empty values.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * class Config extends Envapter {\n * \\@Envapt('FEATURE_FLAGS', { converter(raw) {\n * return raw ? raw.split('|').map(s => s.trim()) : [];\n * } })\n * static readonly featureFlags: string[];\n *\n * \\@Envapt('JWT_SECRET', {\n * converter: (raw) => Buffer.from(raw ?? '', 'base64'),\n * required: true\n * })\n * static readonly jwtSecret: Buffer;\n * }\n * ```\n */\nexport function Envapt<TReturnType>(\n key: EnvKeyInput,\n options:\n | { converter: ConverterFunction<TReturnType>; required?: false }\n | { converter: ConverterFunction<TReturnType>; required: true }\n): EnvaptFieldDecorator<TReturnType>;\n\n/**\n * A built-in or array converter with a fallback, or `required: true`. The fallback type tracks\n * the converter, so `Converters.Time` takes a number or time-string and `Converters.Url` takes\n * a `URL` instance.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * import { Converters } from 'envapt';\n *\n * class Config extends Envapter {\n * \\@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })\n * static readonly port: number;\n *\n * // the Url fallback is a URL instance, not a string\n * \\@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })\n * static readonly url: URL;\n *\n * // prefers CANARY_URL when present, otherwise APP_URL\n * \\@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })\n * static readonly canaryUrl: URL | null;\n *\n * // Time takes a number (milliseconds) or a time-string fallback (`<number><unit>`)\n * \\@Envapt('REQUEST_TIMEOUT', { converter: Converters.Time, fallback: '10s' })\n * static readonly requestTimeout: number;\n *\n * \\@Envapt('ALLOWED_ORIGINS', {\n * converter: Converters.array({ of: Converters.String }),\n * fallback: ['https://example.com']\n * })\n * static readonly allowedOrigins: string[];\n *\n * \\@Envapt('DATABASE_URL', { converter: Converters.Url, required: true })\n * static readonly databaseUrl: URL;\n * }\n * ```\n */\nexport function Envapt<TConverter extends BuiltInConverter | ArrayOf>(\n key: EnvKeyInput,\n options:\n | { converter: TConverter; fallback: InferConverterFallbackType<TConverter>; required?: false }\n | { converter: TConverter; required: true }\n): EnvaptFieldDecorator<InferConverterReturnType<TConverter>>;\nexport function Envapt<TConverter extends BuiltInConverter | ArrayOf>(\n key: EnvKeyInput,\n options: { converter: TConverter; fallback: undefined; required?: false }\n): EnvaptFieldDecorator<InferConverterReturnType<TConverter> | undefined>;\nexport function Envapt<TConverter extends BuiltInConverter | ArrayOf>(\n key: EnvKeyInput,\n options: { converter: TConverter; required?: false }\n): EnvaptFieldDecorator<InferConverterReturnType<TConverter> | null>;\n\n/**\n * A primitive constructor (`Number`, `Boolean`) with an optional fallback.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * class Config extends Envapter {\n * \\@Envapt('MAX_CONNECTIONS', { converter: Number, fallback: 100 })\n * static readonly maxConnections: number;\n *\n * \\@Envapt('FEATURE_ENABLED', { converter: Boolean, fallback: false })\n * static readonly featureEnabled: boolean;\n * }\n * ```\n */\nexport function Envapt<TConstructor extends PrimitiveConstructor>(\n key: EnvKeyInput,\n options:\n | { converter: TConstructor; fallback: InferPrimitiveReturnType<TConstructor>; required?: false }\n | { converter: TConstructor; required: true }\n): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor>>;\nexport function Envapt<TConstructor extends PrimitiveConstructor>(\n key: EnvKeyInput,\n options: { converter: TConstructor; fallback: undefined; required?: false }\n): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;\nexport function Envapt<TConstructor extends PrimitiveConstructor>(\n key: EnvKeyInput,\n options: { converter: TConstructor; required?: false }\n): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor> | null>;\n\n/**\n * Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env\n * value is missing or empty after trimming, independent of the global `Envapter.strict` flag.\n * Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime\n * Validator rejects dynamic objects that bypass the types.\n *\n * @param key - Environment variable name(s) to load\n * @param options - `{ required: true }`\n * @public\n * @example\n * ```ts\n * class Config extends Envapter {\n * \\@Envapt('API_KEY', { required: true })\n * static readonly apiKey: string;\n * }\n * ```\n */\nexport function Envapt(key: EnvKeyInput, options: { required: true }): EnvaptFieldDecorator<string>;\n\n/**\n * No-fallback form. The property resolves from env or `null`.\n *\n * @param key - Environment variable name(s) to load\n * @public\n * @example\n * ```ts\n * class Config extends Envapter {\n * \\@Envapt('SIMPLE_VALUE')\n * static readonly simple?: string | null;\n * }\n * ```\n */\nexport function Envapt(key: EnvKeyInput): EnvaptFieldDecorator<string | null>;\n\n/**\n * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,\n * so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing\n * `schema` with `converter` matches no overload at compile time, and the runtime Validator\n * rejects dynamic objects that bypass the types.\n * @public\n */\nexport function Envapt<Schema extends StandardSchemaV1>(\n key: EnvKeyInput,\n options:\n | { schema: SchemaConstraint<Schema>; fallback?: InferSchemaOutput<Schema>; required?: false }\n | { schema: SchemaConstraint<Schema>; required: true }\n): EnvaptFieldDecorator<InferSchemaOutput<Schema>>;\n\n/**\n * Instance or static property decorator that loads and converts an environment variable.\n */\nexport function Envapt<TFallback = unknown>(key: EnvKeyInput, options?: unknown): EnvaptFieldDecorator<unknown> {\n return createPropertyDecorator(key, parseEnvaptOptions<TFallback>(options)) as EnvaptFieldDecorator<unknown>;\n}\n"],"mappings":"0LA8NA,SAAgB,EAA4B,EAAkB,EAAkD,CAC5G,OAAO,EAAwB,EAAK,EAA8B,CAAO,CAAC,CAC9E"}
@@ -0,0 +1,2 @@
1
+ import"node:path";import"node:url";import.meta.url;const e=require("../../converters/Converters.cjs"),t=require("./createPropertyDecorator.cjs");function n(e,n,r){return t.createPropertyDecorator(n,{converter:e,fallback:r,hasFallback:r!==void 0,required:!1,schema:void 0})}function r(t,r){return n(e.Converters.Boolean,t,r)}function i(t,r){return n(e.Converters.Number,t,r)}function a(t,r){return n(e.Converters.String,t,r)}function o(t,r){return n(e.Converters.Time,t,r)}function s(t,r){return n(e.Converters.Url,t,r)}exports.EnvBool=r,exports.EnvNum=i,exports.EnvStr=a,exports.EnvTime=o,exports.EnvUrl=s;
2
+ //# sourceMappingURL=SugarDecorators.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SugarDecorators.cjs","names":["createPropertyDecorator","Converters"],"sources":["../../../../src/decorators/legacy/SugarDecorators.ts"],"sourcesContent":["import { createPropertyDecorator } from './createPropertyDecorator';\nimport { Converters } from '../../converters';\n\nimport type { ConverterToken } from '../../converters';\nimport type { EnvaptFieldDecorator, EnvKeyInput, TimeFallback } from '../../types';\n\nfunction sugar<TFallback>(\n converter: ConverterToken,\n key: EnvKeyInput,\n fallback: TFallback | undefined\n): EnvaptFieldDecorator<TFallback> {\n // the runtime installer is a plain (target, key) decorator, so the cast only adds a\n // compile-time field-type constraint with no runtime counterpart\n return createPropertyDecorator<TFallback>(key, {\n converter,\n fallback,\n hasFallback: fallback !== undefined,\n required: false,\n schema: undefined\n }) as EnvaptFieldDecorator<TFallback>;\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Boolean, fallback })`.\n * @public\n */\nexport function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptFieldDecorator<boolean>;\nexport function EnvBool(key: EnvKeyInput): EnvaptFieldDecorator<boolean | null>;\nexport function EnvBool(key: EnvKeyInput, fallback?: boolean): EnvaptFieldDecorator<boolean | null> {\n return sugar(Converters.Boolean, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.\n * @public\n */\nexport function EnvNum(key: EnvKeyInput, fallback: number): EnvaptFieldDecorator<number>;\nexport function EnvNum(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;\nexport function EnvNum(key: EnvKeyInput, fallback?: number): EnvaptFieldDecorator<number | null> {\n return sugar(Converters.Number, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.\n * @public\n */\nexport function EnvStr(key: EnvKeyInput, fallback: string): EnvaptFieldDecorator<string>;\nexport function EnvStr(key: EnvKeyInput): EnvaptFieldDecorator<string | null>;\nexport function EnvStr(key: EnvKeyInput, fallback?: string): EnvaptFieldDecorator<string | null> {\n return sugar(Converters.String, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a\n * millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.\n * @public\n */\nexport function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptFieldDecorator<number>;\nexport function EnvTime(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;\nexport function EnvTime(key: EnvKeyInput, fallback?: TimeFallback): EnvaptFieldDecorator<number | null> {\n return sugar(Converters.Time, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`\n * instance, not a URL string.\n * @public\n */\nexport function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptFieldDecorator<URL>;\nexport function EnvUrl(key: EnvKeyInput): EnvaptFieldDecorator<URL | null>;\nexport function EnvUrl(key: EnvKeyInput, fallback?: URL): EnvaptFieldDecorator<URL | null> {\n return sugar(Converters.Url, key, fallback);\n}\n"],"mappings":"iJAMA,SAAS,EACL,EACA,EACA,EAC+B,CAG/B,OAAOA,EAAAA,wBAAmC,EAAK,CAC3C,YACA,WACA,YAAa,IAAa,IAAA,GAC1B,SAAU,GACV,OAAQ,IAAA,EACZ,CAAC,CACL,CAQA,SAAgB,EAAQ,EAAkB,EAA0D,CAChG,OAAO,EAAMC,EAAAA,WAAW,QAAS,EAAK,CAAQ,CAClD,CAQA,SAAgB,EAAO,EAAkB,EAAwD,CAC7F,OAAO,EAAMA,EAAAA,WAAW,OAAQ,EAAK,CAAQ,CACjD,CAQA,SAAgB,EAAO,EAAkB,EAAwD,CAC7F,OAAO,EAAMA,EAAAA,WAAW,OAAQ,EAAK,CAAQ,CACjD,CASA,SAAgB,EAAQ,EAAkB,EAA8D,CACpG,OAAO,EAAMA,EAAAA,WAAW,KAAM,EAAK,CAAQ,CAC/C,CASA,SAAgB,EAAO,EAAkB,EAAkD,CACvF,OAAO,EAAMA,EAAAA,WAAW,IAAK,EAAK,CAAQ,CAC9C"}
@@ -0,0 +1,40 @@
1
+ import { TimeFallback } from "../../types/Conversion.cjs";
2
+ import { EnvKeyInput } from "../../types/Env.cjs";
3
+ import { EnvaptFieldDecorator } from "../../types/Decorator.cjs";
4
+
5
+ //#region src/decorators/legacy/SugarDecorators.d.ts
6
+ /**
7
+ * Shorthand for `@Envapt(key, { converter: Converters.Boolean, fallback })`.
8
+ * @public
9
+ */
10
+ declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptFieldDecorator<boolean>;
11
+ declare function EnvBool(key: EnvKeyInput): EnvaptFieldDecorator<boolean | null>;
12
+ /**
13
+ * Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.
14
+ * @public
15
+ */
16
+ declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptFieldDecorator<number>;
17
+ declare function EnvNum(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;
18
+ /**
19
+ * Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.
20
+ * @public
21
+ */
22
+ declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptFieldDecorator<string>;
23
+ declare function EnvStr(key: EnvKeyInput): EnvaptFieldDecorator<string | null>;
24
+ /**
25
+ * Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a
26
+ * millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.
27
+ * @public
28
+ */
29
+ declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptFieldDecorator<number>;
30
+ declare function EnvTime(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;
31
+ /**
32
+ * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`
33
+ * instance, not a URL string.
34
+ * @public
35
+ */
36
+ declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptFieldDecorator<URL>;
37
+ declare function EnvUrl(key: EnvKeyInput): EnvaptFieldDecorator<URL | null>;
38
+ //#endregion
39
+ export { EnvBool, EnvNum, EnvStr, EnvTime, EnvUrl };
40
+ //# sourceMappingURL=SugarDecorators.d.cts.map
@@ -0,0 +1,42 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { TimeFallback } from "../../types/Conversion.mjs";
4
+ import { EnvKeyInput } from "../../types/Env.mjs";
5
+ import { EnvaptFieldDecorator } from "../../types/Decorator.mjs";
6
+
7
+ //#region src/decorators/legacy/SugarDecorators.d.ts
8
+ /**
9
+ * Shorthand for `@Envapt(key, { converter: Converters.Boolean, fallback })`.
10
+ * @public
11
+ */
12
+ declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptFieldDecorator<boolean>;
13
+ declare function EnvBool(key: EnvKeyInput): EnvaptFieldDecorator<boolean | null>;
14
+ /**
15
+ * Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.
16
+ * @public
17
+ */
18
+ declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptFieldDecorator<number>;
19
+ declare function EnvNum(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;
20
+ /**
21
+ * Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.
22
+ * @public
23
+ */
24
+ declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptFieldDecorator<string>;
25
+ declare function EnvStr(key: EnvKeyInput): EnvaptFieldDecorator<string | null>;
26
+ /**
27
+ * Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a
28
+ * millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.
29
+ * @public
30
+ */
31
+ declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptFieldDecorator<number>;
32
+ declare function EnvTime(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;
33
+ /**
34
+ * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`
35
+ * instance, not a URL string.
36
+ * @public
37
+ */
38
+ declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptFieldDecorator<URL>;
39
+ declare function EnvUrl(key: EnvKeyInput): EnvaptFieldDecorator<URL | null>;
40
+ //#endregion
41
+ export { EnvBool, EnvNum, EnvStr, EnvTime, EnvUrl };
42
+ //# sourceMappingURL=SugarDecorators.d.mts.map
@@ -0,0 +1,2 @@
1
+ import"node:path";import"node:url";import.meta.url;import{Converters as e}from"../../converters/Converters.mjs";import{createPropertyDecorator as t}from"./createPropertyDecorator.mjs";function n(e,n,r){return t(n,{converter:e,fallback:r,hasFallback:r!==void 0,required:!1,schema:void 0})}function r(t,r){return n(e.Boolean,t,r)}function i(t,r){return n(e.Number,t,r)}function a(t,r){return n(e.String,t,r)}function o(t,r){return n(e.Time,t,r)}function s(t,r){return n(e.Url,t,r)}export{r as EnvBool,i as EnvNum,a as EnvStr,o as EnvTime,s as EnvUrl};
2
+ //# sourceMappingURL=SugarDecorators.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SugarDecorators.mjs","names":[],"sources":["../../../../src/decorators/legacy/SugarDecorators.ts"],"sourcesContent":["import { createPropertyDecorator } from './createPropertyDecorator';\nimport { Converters } from '../../converters';\n\nimport type { ConverterToken } from '../../converters';\nimport type { EnvaptFieldDecorator, EnvKeyInput, TimeFallback } from '../../types';\n\nfunction sugar<TFallback>(\n converter: ConverterToken,\n key: EnvKeyInput,\n fallback: TFallback | undefined\n): EnvaptFieldDecorator<TFallback> {\n // the runtime installer is a plain (target, key) decorator, so the cast only adds a\n // compile-time field-type constraint with no runtime counterpart\n return createPropertyDecorator<TFallback>(key, {\n converter,\n fallback,\n hasFallback: fallback !== undefined,\n required: false,\n schema: undefined\n }) as EnvaptFieldDecorator<TFallback>;\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Boolean, fallback })`.\n * @public\n */\nexport function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptFieldDecorator<boolean>;\nexport function EnvBool(key: EnvKeyInput): EnvaptFieldDecorator<boolean | null>;\nexport function EnvBool(key: EnvKeyInput, fallback?: boolean): EnvaptFieldDecorator<boolean | null> {\n return sugar(Converters.Boolean, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.\n * @public\n */\nexport function EnvNum(key: EnvKeyInput, fallback: number): EnvaptFieldDecorator<number>;\nexport function EnvNum(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;\nexport function EnvNum(key: EnvKeyInput, fallback?: number): EnvaptFieldDecorator<number | null> {\n return sugar(Converters.Number, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.\n * @public\n */\nexport function EnvStr(key: EnvKeyInput, fallback: string): EnvaptFieldDecorator<string>;\nexport function EnvStr(key: EnvKeyInput): EnvaptFieldDecorator<string | null>;\nexport function EnvStr(key: EnvKeyInput, fallback?: string): EnvaptFieldDecorator<string | null> {\n return sugar(Converters.String, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a\n * millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.\n * @public\n */\nexport function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptFieldDecorator<number>;\nexport function EnvTime(key: EnvKeyInput): EnvaptFieldDecorator<number | null>;\nexport function EnvTime(key: EnvKeyInput, fallback?: TimeFallback): EnvaptFieldDecorator<number | null> {\n return sugar(Converters.Time, key, fallback);\n}\n\n/**\n * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`\n * instance, not a URL string.\n * @public\n */\nexport function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptFieldDecorator<URL>;\nexport function EnvUrl(key: EnvKeyInput): EnvaptFieldDecorator<URL | null>;\nexport function EnvUrl(key: EnvKeyInput, fallback?: URL): EnvaptFieldDecorator<URL | null> {\n return sugar(Converters.Url, key, fallback);\n}\n"],"mappings":"wLAMA,SAAS,EACL,EACA,EACA,EAC+B,CAG/B,OAAO,EAAmC,EAAK,CAC3C,YACA,WACA,YAAa,IAAa,IAAA,GAC1B,SAAU,GACV,OAAQ,IAAA,EACZ,CAAC,CACL,CAQA,SAAgB,EAAQ,EAAkB,EAA0D,CAChG,OAAO,EAAM,EAAW,QAAS,EAAK,CAAQ,CAClD,CAQA,SAAgB,EAAO,EAAkB,EAAwD,CAC7F,OAAO,EAAM,EAAW,OAAQ,EAAK,CAAQ,CACjD,CAQA,SAAgB,EAAO,EAAkB,EAAwD,CAC7F,OAAO,EAAM,EAAW,OAAQ,EAAK,CAAQ,CACjD,CASA,SAAgB,EAAQ,EAAkB,EAA8D,CACpG,OAAO,EAAM,EAAW,KAAM,EAAK,CAAQ,CAC/C,CASA,SAAgB,EAAO,EAAkB,EAAkD,CACvF,OAAO,EAAM,EAAW,IAAK,EAAK,CAAQ,CAC9C"}
@@ -0,0 +1,2 @@
1
+ import"node:path";import"node:url";import.meta.url;const e=require("../../infra/Error.cjs"),t=require("../resolveDecoratorValue.cjs");function n(n,r){return function(i,a){let o=String(a),s=typeof i==`function`,c=t.decoratorCacheKey(s?i:i.constructor,s,o);Object.defineProperty(i,o,{get:function(){return t.resolveDecoratorValue(n,r,c)},set(){throw new e.EnvaptError(302,`Cannot assign to "${o}". @Envapt properties resolve from the environment and are read-only.`)},configurable:!1,enumerable:!0})}}exports.createPropertyDecorator=n;
2
+ //# sourceMappingURL=createPropertyDecorator.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPropertyDecorator.cjs","names":["decoratorCacheKey","resolveDecoratorValue","EnvaptError"],"sources":["../../../../src/decorators/legacy/createPropertyDecorator.ts"],"sourcesContent":["import { EnvaptError, EnvaptErrorCodes } from '../../infra/Error';\nimport { decoratorCacheKey, resolveDecoratorValue } from '../resolveDecoratorValue';\n\nimport type { EnvKeyInput } from '../../types';\nimport type { DecoratorConfig } from '../resolveDecoratorValue';\n\nexport function createPropertyDecorator<TFallback>(\n key: EnvKeyInput,\n config: DecoratorConfig<TFallback>\n): PropertyDecorator {\n return function (target: object, prop: string | symbol): void {\n const propKey = String(prop);\n const isStatic = typeof target === 'function';\n const owner = isStatic ? target : target.constructor;\n const cacheKey = decoratorCacheKey(owner, isStatic, propKey);\n\n Object.defineProperty(target, propKey, {\n get: function () {\n return resolveDecoratorValue(key, config, cacheKey);\n },\n set(): void {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Cannot assign to \"${propKey}\". @Envapt properties resolve from the environment and are read-only.`\n );\n },\n configurable: false,\n enumerable: true\n });\n };\n}\n"],"mappings":"sIAMA,SAAgB,EACZ,EACA,EACiB,CACjB,OAAO,SAAU,EAAgB,EAA6B,CAC1D,IAAM,EAAU,OAAO,CAAI,EACrB,EAAW,OAAO,GAAW,WAE7B,EAAWA,EAAAA,kBADH,EAAW,EAAS,EAAO,YACC,EAAU,CAAO,EAE3D,OAAO,eAAe,EAAQ,EAAS,CACnC,IAAK,UAAY,CACb,OAAOC,EAAAA,sBAAsB,EAAK,EAAQ,CAAQ,CACtD,EACA,KAAY,CACR,MAAM,IAAIC,EAAAA,YAAAA,IAEN,qBAAqB,EAAQ,sEACjC,CACJ,EACA,aAAc,GACd,WAAY,EAChB,CAAC,CACL,CACJ"}
@@ -0,0 +1,2 @@
1
+ import"node:path";import"node:url";import.meta.url;import{EnvaptError as e}from"../../infra/Error.mjs";import{decoratorCacheKey as t,resolveDecoratorValue as n}from"../resolveDecoratorValue.mjs";function r(r,i){return function(a,o){let s=String(o),c=typeof a==`function`,l=t(c?a:a.constructor,c,s);Object.defineProperty(a,s,{get:function(){return n(r,i,l)},set(){throw new e(302,`Cannot assign to "${s}". @Envapt properties resolve from the environment and are read-only.`)},configurable:!1,enumerable:!0})}}export{r as createPropertyDecorator};
2
+ //# sourceMappingURL=createPropertyDecorator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPropertyDecorator.mjs","names":[],"sources":["../../../../src/decorators/legacy/createPropertyDecorator.ts"],"sourcesContent":["import { EnvaptError, EnvaptErrorCodes } from '../../infra/Error';\nimport { decoratorCacheKey, resolveDecoratorValue } from '../resolveDecoratorValue';\n\nimport type { EnvKeyInput } from '../../types';\nimport type { DecoratorConfig } from '../resolveDecoratorValue';\n\nexport function createPropertyDecorator<TFallback>(\n key: EnvKeyInput,\n config: DecoratorConfig<TFallback>\n): PropertyDecorator {\n return function (target: object, prop: string | symbol): void {\n const propKey = String(prop);\n const isStatic = typeof target === 'function';\n const owner = isStatic ? target : target.constructor;\n const cacheKey = decoratorCacheKey(owner, isStatic, propKey);\n\n Object.defineProperty(target, propKey, {\n get: function () {\n return resolveDecoratorValue(key, config, cacheKey);\n },\n set(): void {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Cannot assign to \"${propKey}\". @Envapt properties resolve from the environment and are read-only.`\n );\n },\n configurable: false,\n enumerable: true\n });\n };\n}\n"],"mappings":"mMAMA,SAAgB,EACZ,EACA,EACiB,CACjB,OAAO,SAAU,EAAgB,EAA6B,CAC1D,IAAM,EAAU,OAAO,CAAI,EACrB,EAAW,OAAO,GAAW,WAE7B,EAAW,EADH,EAAW,EAAS,EAAO,YACC,EAAU,CAAO,EAE3D,OAAO,eAAe,EAAQ,EAAS,CACnC,IAAK,UAAY,CACb,OAAO,EAAsB,EAAK,EAAQ,CAAQ,CACtD,EACA,KAAY,CACR,MAAM,IAAI,EAAA,IAEN,qBAAqB,EAAQ,sEACjC,CACJ,EACA,aAAc,GACd,WAAY,EAChB,CAAC,CACL,CACJ"}
@@ -0,0 +1,2 @@
1
+ import"node:path";import"node:url";import.meta.url;const e=require("./createAccessorDecorator.cjs"),t=require("../parseEnvaptOptions.cjs");function n(n,r){return e.createAccessorDecorator(n,t.parseEnvaptOptions(r))}exports.Envapt=n;
2
+ //# sourceMappingURL=Envapt.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Envapt.cjs","names":["createAccessorDecorator","parseEnvaptOptions"],"sources":["../../../../src/decorators/modern/Envapt.ts"],"sourcesContent":["import { createAccessorDecorator } from './createAccessorDecorator';\nimport { parseEnvaptOptions } from '../parseEnvaptOptions';\n\nimport type { ArrayOf } from '../../converters';\nimport type { InferSchemaOutput, StandardSchemaV1 } from '../../infra/StandardSchema';\nimport type {\n BuiltInConverter,\n ConverterFunction,\n EnvaptAccessorDecorator,\n EnvKeyInput,\n InferConverterFallbackType,\n InferConverterReturnType,\n InferPrimitiveReturnType,\n PrimitiveConstructor,\n SchemaConstraint\n} from '../../types';\n\n/**\n * A custom converter function with a fallback (both required), or a fallback only.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * class Config {\n * \\@Envapt('API_KEY', {\n * fallback: 'default-key',\n * converter(raw, _fallback) {\n * if (!raw || raw.trim() === '') throw new Error('API_KEY required');\n * return raw.trim();\n * }\n * })\n * static accessor apiKey: string;\n *\n * \\@Envapt('LOG_FILE', { fallback: '/var/log/app.log' })\n * static accessor logFile: string;\n *\n * \\@Envapt('RETRY_POLICY', { fallback: { retries: 3, backoff: 'exponential' } })\n * static accessor retryPolicy: unknown;\n * }\n * ```\n */\nexport function Envapt(\n key: EnvKeyInput,\n options: { fallback: undefined; converter?: undefined }\n): EnvaptAccessorDecorator<string | undefined>;\nexport function Envapt<TFallback>(\n key: EnvKeyInput,\n options:\n | { converter: (raw: string | undefined, fallback: TFallback) => TFallback; fallback: TFallback }\n | { fallback: TFallback; converter?: undefined }\n): EnvaptAccessorDecorator<TFallback>;\n\n/**\n * A custom converter function without a fallback. Omit `required` to return the converter's\n * output (possibly `undefined`), or pass `required: true` to throw `MissingEnvValue` on\n * missing or empty values.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * class Config {\n * \\@Envapt('FEATURE_FLAGS', { converter(raw) {\n * return raw ? raw.split('|').map(s => s.trim()) : [];\n * } })\n * static accessor featureFlags: string[];\n *\n * \\@Envapt('JWT_SECRET', {\n * converter: (raw) => Buffer.from(raw ?? '', 'base64'),\n * required: true\n * })\n * static accessor jwtSecret: Buffer;\n * }\n * ```\n */\nexport function Envapt<TReturnType>(\n key: EnvKeyInput,\n options:\n | { converter: ConverterFunction<TReturnType>; required?: false }\n | { converter: ConverterFunction<TReturnType>; required: true }\n): EnvaptAccessorDecorator<TReturnType>;\n\n/**\n * A built-in or array converter with a fallback, or `required: true`. The fallback type tracks\n * the converter, so `Converters.Time` takes a number or time-string and `Converters.Url` takes\n * a `URL` instance.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * import { Converters } from 'envapt';\n *\n * class Config {\n * \\@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })\n * static accessor port: number;\n *\n * // the Url fallback is a URL instance, not a string\n * \\@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })\n * static accessor url: URL;\n *\n * // prefers CANARY_URL when present, otherwise APP_URL\n * \\@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })\n * static accessor canaryUrl: URL | null;\n *\n * // Time takes a number (milliseconds) or a time-string fallback (`<number><unit>`)\n * \\@Envapt('REQUEST_TIMEOUT', { converter: Converters.Time, fallback: '10s' })\n * static accessor requestTimeout: number;\n *\n * \\@Envapt('ALLOWED_ORIGINS', {\n * converter: Converters.array({ of: Converters.String }),\n * fallback: ['https://example.com']\n * })\n * static accessor allowedOrigins: string[];\n *\n * \\@Envapt('DATABASE_URL', { converter: Converters.Url, required: true })\n * static accessor databaseUrl: URL;\n * }\n * ```\n */\nexport function Envapt<TConverter extends BuiltInConverter | ArrayOf>(\n key: EnvKeyInput,\n options:\n | { converter: TConverter; fallback: InferConverterFallbackType<TConverter>; required?: false }\n | { converter: TConverter; required: true }\n): EnvaptAccessorDecorator<InferConverterReturnType<TConverter>>;\nexport function Envapt<TConverter extends BuiltInConverter | ArrayOf>(\n key: EnvKeyInput,\n options: { converter: TConverter; fallback: undefined; required?: false }\n): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | undefined>;\nexport function Envapt<TConverter extends BuiltInConverter | ArrayOf>(\n key: EnvKeyInput,\n options: { converter: TConverter; required?: false }\n): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | null>;\n\n/**\n * A primitive constructor (`Number`, `Boolean`) with an optional fallback.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Configuration options\n * @public\n * @example\n * ```ts\n * class Config {\n * \\@Envapt('MAX_CONNECTIONS', { converter: Number, fallback: 100 })\n * static accessor maxConnections: number;\n *\n * \\@Envapt('FEATURE_ENABLED', { converter: Boolean, fallback: false })\n * static accessor featureEnabled: boolean;\n * }\n * ```\n */\nexport function Envapt<TConstructor extends PrimitiveConstructor>(\n key: EnvKeyInput,\n options:\n | { converter: TConstructor; fallback: InferPrimitiveReturnType<TConstructor>; required?: false }\n | { converter: TConstructor; required: true }\n): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor>>;\nexport function Envapt<TConstructor extends PrimitiveConstructor>(\n key: EnvKeyInput,\n options: { converter: TConstructor; fallback: undefined; required?: false }\n): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;\nexport function Envapt<TConstructor extends PrimitiveConstructor>(\n key: EnvKeyInput,\n options: { converter: TConstructor; required?: false }\n): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | null>;\n\n/**\n * Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env\n * value is missing or empty after trimming, independent of the global `Envapter.strict` flag.\n * Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime\n * Validator rejects dynamic objects that bypass the types.\n *\n * @param key - Environment variable name(s) to load\n * @param options - `{ required: true }`\n * @public\n * @example\n * ```ts\n * class Config {\n * \\@Envapt('API_KEY', { required: true })\n * static accessor apiKey: string;\n * }\n * ```\n */\nexport function Envapt(key: EnvKeyInput, options: { required: true }): EnvaptAccessorDecorator<string>;\n\n/**\n * No-fallback form. The property resolves from env or `null`.\n *\n * @param key - Environment variable name(s) to load\n * @public\n * @example\n * ```ts\n * class Config {\n * \\@Envapt('SIMPLE_VALUE')\n * static accessor simple: string | null;\n * }\n * ```\n */\nexport function Envapt(key: EnvKeyInput): EnvaptAccessorDecorator<string | null>;\n\n/**\n * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,\n * so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing\n * `schema` with `converter` matches no overload at compile time, and the runtime Validator\n * rejects dynamic objects that bypass the types.\n * @public\n */\nexport function Envapt<Schema extends StandardSchemaV1>(\n key: EnvKeyInput,\n options:\n | { schema: SchemaConstraint<Schema>; fallback?: InferSchemaOutput<Schema>; required?: false }\n | { schema: SchemaConstraint<Schema>; required: true }\n): EnvaptAccessorDecorator<InferSchemaOutput<Schema>>;\n\n/**\n * Modern (TC39 Stage 3) accessor decorator that loads and converts an environment variable. The\n * decorated property uses the `accessor` keyword and needs no `experimentalDecorators` flag.\n * Instance accessors need the definite-assignment `!`, static accessors do not.\n *\n * @param key - Environment variable name(s) to load\n * @param options - Converter, fallback, `required`, or `schema`. See the overloads.\n * @public\n * @example\n * ```ts\n * import { Envapt, Converters } from 'envapt';\n *\n * class Config {\n * \\@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })\n * static accessor port: number;\n *\n * \\@Envapt('DATABASE_URL', { converter: Converters.Url, required: true })\n * accessor databaseUrl!: URL;\n * }\n * ```\n */\n/* v8 ignore start -- @preserve oxc (vitest's transform) breaks modern accessor decorators (context.name unset), so the tsc stage3-emit harness covers these, not vitest */\nexport function Envapt<TFallback = unknown>(key: EnvKeyInput, options?: unknown): EnvaptAccessorDecorator<unknown> {\n return createAccessorDecorator(key, parseEnvaptOptions<TFallback>(options)) as EnvaptAccessorDecorator<unknown>;\n}\n/* v8 ignore stop */\n"],"mappings":"2IAiPA,SAAgB,EAA4B,EAAkB,EAAqD,CAC/G,OAAOA,EAAAA,wBAAwB,EAAKC,EAAAA,mBAA8B,CAAO,CAAC,CAC9E"}
@@ -0,0 +1,218 @@
1
+ import { ArrayOf } from "../../converters/Converters.cjs";
2
+ import { BuiltInConverter, ConverterFunction, InferConverterFallbackType, InferConverterReturnType, InferPrimitiveReturnType, PrimitiveConstructor } from "../../types/Conversion.cjs";
3
+ import { InferSchemaOutput, StandardSchemaV1 } from "../../infra/StandardSchema.cjs";
4
+ import { SchemaConstraint } from "../../types/Schema.cjs";
5
+ import { EnvKeyInput } from "../../types/Env.cjs";
6
+ import { EnvaptAccessorDecorator } from "../../types/Decorator.cjs";
7
+
8
+ //#region src/decorators/modern/Envapt.d.ts
9
+ /**
10
+ * A custom converter function with a fallback (both required), or a fallback only.
11
+ *
12
+ * @param key - Environment variable name(s) to load
13
+ * @param options - Configuration options
14
+ * @public
15
+ * @example
16
+ * ```ts
17
+ * class Config {
18
+ * \@Envapt('API_KEY', {
19
+ * fallback: 'default-key',
20
+ * converter(raw, _fallback) {
21
+ * if (!raw || raw.trim() === '') throw new Error('API_KEY required');
22
+ * return raw.trim();
23
+ * }
24
+ * })
25
+ * static accessor apiKey: string;
26
+ *
27
+ * \@Envapt('LOG_FILE', { fallback: '/var/log/app.log' })
28
+ * static accessor logFile: string;
29
+ *
30
+ * \@Envapt('RETRY_POLICY', { fallback: { retries: 3, backoff: 'exponential' } })
31
+ * static accessor retryPolicy: unknown;
32
+ * }
33
+ * ```
34
+ */
35
+ declare function Envapt(key: EnvKeyInput, options: {
36
+ fallback: undefined;
37
+ converter?: undefined;
38
+ }): EnvaptAccessorDecorator<string | undefined>;
39
+ declare function Envapt<TFallback>(key: EnvKeyInput, options: {
40
+ converter: (raw: string | undefined, fallback: TFallback) => TFallback;
41
+ fallback: TFallback;
42
+ } | {
43
+ fallback: TFallback;
44
+ converter?: undefined;
45
+ }): EnvaptAccessorDecorator<TFallback>;
46
+ /**
47
+ * A custom converter function without a fallback. Omit `required` to return the converter's
48
+ * output (possibly `undefined`), or pass `required: true` to throw `MissingEnvValue` on
49
+ * missing or empty values.
50
+ *
51
+ * @param key - Environment variable name(s) to load
52
+ * @param options - Configuration options
53
+ * @public
54
+ * @example
55
+ * ```ts
56
+ * class Config {
57
+ * \@Envapt('FEATURE_FLAGS', { converter(raw) {
58
+ * return raw ? raw.split('|').map(s => s.trim()) : [];
59
+ * } })
60
+ * static accessor featureFlags: string[];
61
+ *
62
+ * \@Envapt('JWT_SECRET', {
63
+ * converter: (raw) => Buffer.from(raw ?? '', 'base64'),
64
+ * required: true
65
+ * })
66
+ * static accessor jwtSecret: Buffer;
67
+ * }
68
+ * ```
69
+ */
70
+ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
71
+ converter: ConverterFunction<TReturnType>;
72
+ required?: false;
73
+ } | {
74
+ converter: ConverterFunction<TReturnType>;
75
+ required: true;
76
+ }): EnvaptAccessorDecorator<TReturnType>;
77
+ /**
78
+ * A built-in or array converter with a fallback, or `required: true`. The fallback type tracks
79
+ * the converter, so `Converters.Time` takes a number or time-string and `Converters.Url` takes
80
+ * a `URL` instance.
81
+ *
82
+ * @param key - Environment variable name(s) to load
83
+ * @param options - Configuration options
84
+ * @public
85
+ * @example
86
+ * ```ts
87
+ * import { Converters } from 'envapt';
88
+ *
89
+ * class Config {
90
+ * \@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })
91
+ * static accessor port: number;
92
+ *
93
+ * // the Url fallback is a URL instance, not a string
94
+ * \@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })
95
+ * static accessor url: URL;
96
+ *
97
+ * // prefers CANARY_URL when present, otherwise APP_URL
98
+ * \@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })
99
+ * static accessor canaryUrl: URL | null;
100
+ *
101
+ * // Time takes a number (milliseconds) or a time-string fallback (`<number><unit>`)
102
+ * \@Envapt('REQUEST_TIMEOUT', { converter: Converters.Time, fallback: '10s' })
103
+ * static accessor requestTimeout: number;
104
+ *
105
+ * \@Envapt('ALLOWED_ORIGINS', {
106
+ * converter: Converters.array({ of: Converters.String }),
107
+ * fallback: ['https://example.com']
108
+ * })
109
+ * static accessor allowedOrigins: string[];
110
+ *
111
+ * \@Envapt('DATABASE_URL', { converter: Converters.Url, required: true })
112
+ * static accessor databaseUrl: URL;
113
+ * }
114
+ * ```
115
+ */
116
+ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
117
+ converter: TConverter;
118
+ fallback: InferConverterFallbackType<TConverter>;
119
+ required?: false;
120
+ } | {
121
+ converter: TConverter;
122
+ required: true;
123
+ }): EnvaptAccessorDecorator<InferConverterReturnType<TConverter>>;
124
+ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
125
+ converter: TConverter;
126
+ fallback: undefined;
127
+ required?: false;
128
+ }): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | undefined>;
129
+ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
130
+ converter: TConverter;
131
+ required?: false;
132
+ }): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | null>;
133
+ /**
134
+ * A primitive constructor (`Number`, `Boolean`) with an optional fallback.
135
+ *
136
+ * @param key - Environment variable name(s) to load
137
+ * @param options - Configuration options
138
+ * @public
139
+ * @example
140
+ * ```ts
141
+ * class Config {
142
+ * \@Envapt('MAX_CONNECTIONS', { converter: Number, fallback: 100 })
143
+ * static accessor maxConnections: number;
144
+ *
145
+ * \@Envapt('FEATURE_ENABLED', { converter: Boolean, fallback: false })
146
+ * static accessor featureEnabled: boolean;
147
+ * }
148
+ * ```
149
+ */
150
+ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
151
+ converter: TConstructor;
152
+ fallback: InferPrimitiveReturnType<TConstructor>;
153
+ required?: false;
154
+ } | {
155
+ converter: TConstructor;
156
+ required: true;
157
+ }): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor>>;
158
+ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
159
+ converter: TConstructor;
160
+ fallback: undefined;
161
+ required?: false;
162
+ }): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;
163
+ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
164
+ converter: TConstructor;
165
+ required?: false;
166
+ }): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | null>;
167
+ /**
168
+ * Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env
169
+ * value is missing or empty after trimming, independent of the global `Envapter.strict` flag.
170
+ * Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime
171
+ * Validator rejects dynamic objects that bypass the types.
172
+ *
173
+ * @param key - Environment variable name(s) to load
174
+ * @param options - `{ required: true }`
175
+ * @public
176
+ * @example
177
+ * ```ts
178
+ * class Config {
179
+ * \@Envapt('API_KEY', { required: true })
180
+ * static accessor apiKey: string;
181
+ * }
182
+ * ```
183
+ */
184
+ declare function Envapt(key: EnvKeyInput, options: {
185
+ required: true;
186
+ }): EnvaptAccessorDecorator<string>;
187
+ /**
188
+ * No-fallback form. The property resolves from env or `null`.
189
+ *
190
+ * @param key - Environment variable name(s) to load
191
+ * @public
192
+ * @example
193
+ * ```ts
194
+ * class Config {
195
+ * \@Envapt('SIMPLE_VALUE')
196
+ * static accessor simple: string | null;
197
+ * }
198
+ * ```
199
+ */
200
+ declare function Envapt(key: EnvKeyInput): EnvaptAccessorDecorator<string | null>;
201
+ /**
202
+ * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,
203
+ * so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing
204
+ * `schema` with `converter` matches no overload at compile time, and the runtime Validator
205
+ * rejects dynamic objects that bypass the types.
206
+ * @public
207
+ */
208
+ declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
209
+ schema: SchemaConstraint<Schema>;
210
+ fallback?: InferSchemaOutput<Schema>;
211
+ required?: false;
212
+ } | {
213
+ schema: SchemaConstraint<Schema>;
214
+ required: true;
215
+ }): EnvaptAccessorDecorator<InferSchemaOutput<Schema>>;
216
+ //#endregion
217
+ export { Envapt };
218
+ //# sourceMappingURL=Envapt.d.cts.map