inferred-types 0.44.0 → 0.45.2

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 (345) hide show
  1. package/dist/constants/Characters.d.ts +2 -0
  2. package/dist/constants/Characters.d.ts.map +1 -0
  3. package/dist/constants/Characters.js +5 -0
  4. package/dist/constants/NetworkConstants.d.ts +29 -0
  5. package/dist/constants/NetworkConstants.d.ts.map +1 -0
  6. package/dist/constants/NetworkConstants.js +83 -0
  7. package/dist/constants/Phone.d.ts +8 -0
  8. package/dist/constants/Phone.d.ts.map +1 -0
  9. package/dist/constants/Phone.js +262 -0
  10. package/dist/constants/ProxmoxConstants.d.ts +2 -0
  11. package/dist/constants/ProxmoxConstants.d.ts.map +1 -0
  12. package/dist/constants/ProxmoxConstants.js +3 -0
  13. package/dist/constants/index.d.ts +4 -1
  14. package/dist/constants/index.d.ts.map +1 -1
  15. package/dist/constants/index.js +4 -1
  16. package/dist/constants/tsconfig.tsbuildinfo +1 -1
  17. package/dist/inferred-types/index.cjs +1657 -1029
  18. package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
  19. package/dist/runtime/api/defineApi.d.ts +56 -0
  20. package/dist/runtime/api/defineApi.d.ts.map +1 -0
  21. package/dist/runtime/api/defineApi.js +97 -0
  22. package/dist/runtime/api/handleDoneFn.d.ts.map +1 -0
  23. package/dist/runtime/api/index.d.ts +3 -0
  24. package/dist/runtime/api/index.d.ts.map +1 -0
  25. package/dist/runtime/api/index.js +2 -0
  26. package/dist/runtime/boolean-logic/ifArrayPartial.d.ts +1 -1
  27. package/dist/runtime/boolean-logic/ifArrayPartial.d.ts.map +1 -1
  28. package/dist/runtime/boolean-logic/ifArrayPartial.js +1 -1
  29. package/dist/runtime/boolean-logic/ifLength.d.ts.map +1 -1
  30. package/dist/runtime/boolean-logic/ifScalar.d.ts.map +1 -1
  31. package/dist/runtime/boolean-logic/ifScalar.js +1 -1
  32. package/dist/runtime/boolean-logic/index.d.ts +0 -1
  33. package/dist/runtime/boolean-logic/index.d.ts.map +1 -1
  34. package/dist/runtime/boolean-logic/index.js +0 -1
  35. package/dist/runtime/dictionary/defineOptions.d.ts +26 -0
  36. package/dist/runtime/dictionary/defineOptions.d.ts.map +1 -0
  37. package/dist/runtime/dictionary/defineOptions.js +30 -0
  38. package/dist/runtime/dictionary/keysOf.d.ts +1 -1
  39. package/dist/runtime/dictionary/keysOf.d.ts.map +1 -1
  40. package/dist/runtime/dictionary/withKeys.d.ts +1 -1
  41. package/dist/runtime/errors/KindError.d.ts +2 -2
  42. package/dist/runtime/errors/KindError.d.ts.map +1 -1
  43. package/dist/runtime/functions/index.d.ts +1 -0
  44. package/dist/runtime/functions/index.d.ts.map +1 -1
  45. package/dist/runtime/functions/index.js +1 -0
  46. package/dist/runtime/functions/wrapFn.d.ts +2 -0
  47. package/dist/runtime/functions/wrapFn.d.ts.map +1 -0
  48. package/dist/runtime/functions/wrapFn.js +24 -0
  49. package/dist/runtime/index.d.ts +2 -1
  50. package/dist/runtime/index.d.ts.map +1 -1
  51. package/dist/runtime/index.js +2 -10
  52. package/dist/runtime/lists/find.d.ts +1 -1
  53. package/dist/runtime/lists/find.d.ts.map +1 -1
  54. package/dist/runtime/lists/intersection.d.ts.map +1 -1
  55. package/dist/runtime/lists/intersection.js +2 -1
  56. package/dist/runtime/literals/asPhoneNumber.d.ts +10 -0
  57. package/dist/runtime/literals/asPhoneNumber.d.ts.map +1 -0
  58. package/dist/runtime/literals/asPhoneNumber.js +62 -0
  59. package/dist/runtime/literals/index.d.ts +5 -0
  60. package/dist/runtime/literals/index.d.ts.map +1 -1
  61. package/dist/runtime/literals/index.js +5 -0
  62. package/dist/runtime/literals/retainChars.d.ts +16 -0
  63. package/dist/runtime/literals/retainChars.d.ts.map +1 -0
  64. package/dist/runtime/literals/retainChars.js +17 -0
  65. package/dist/runtime/literals/retainWhile.d.ts +11 -0
  66. package/dist/runtime/literals/retainWhile.d.ts.map +1 -0
  67. package/dist/runtime/literals/retainWhile.js +12 -0
  68. package/dist/runtime/literals/stripChars.d.ts +10 -0
  69. package/dist/runtime/literals/stripChars.d.ts.map +1 -0
  70. package/dist/runtime/literals/stripChars.js +11 -0
  71. package/dist/runtime/literals/stripLeading.d.ts +3 -3
  72. package/dist/runtime/literals/stripLeading.d.ts.map +1 -1
  73. package/dist/runtime/literals/stripLeading.js +5 -5
  74. package/dist/runtime/literals/takeNumericCharacters.d.ts +9 -0
  75. package/dist/runtime/literals/takeNumericCharacters.d.ts.map +1 -0
  76. package/dist/runtime/literals/takeNumericCharacters.js +12 -0
  77. package/dist/runtime/literals/unset.d.ts +8 -0
  78. package/dist/runtime/literals/unset.d.ts.map +1 -0
  79. package/dist/runtime/literals/unset.js +14 -0
  80. package/dist/runtime/meta/index.d.ts +3 -0
  81. package/dist/runtime/meta/index.d.ts.map +1 -0
  82. package/dist/runtime/meta/index.js +2 -0
  83. package/dist/runtime/meta/urlMeta.d.ts +52 -0
  84. package/dist/runtime/meta/urlMeta.d.ts.map +1 -0
  85. package/dist/runtime/meta/urlMeta.js +57 -0
  86. package/dist/runtime/meta/youtube-meta.d.ts +38 -0
  87. package/dist/runtime/meta/youtube-meta.d.ts.map +1 -0
  88. package/dist/runtime/meta/youtube-meta.js +67 -0
  89. package/dist/runtime/runtime-types/dict.d.ts +2 -2
  90. package/dist/runtime/runtime-types/dict.d.ts.map +1 -1
  91. package/dist/runtime/runtime-types/ip6Prefix.d.ts +1 -1
  92. package/dist/runtime/runtime-types/parse.d.ts +1 -1
  93. package/dist/runtime/runtime-types/shape-helpers/getTokenData.d.ts +1 -1
  94. package/dist/runtime/runtime-types/shape-helpers/getTokenName.d.ts +1 -1
  95. package/dist/runtime/runtime-types/shape-helpers/singletons.d.ts.map +1 -1
  96. package/dist/runtime/runtime-types/shape-helpers/singletons.js +1 -1
  97. package/dist/runtime/runtime-types/shape.d.ts +1 -1
  98. package/dist/runtime/runtime-types/shape.js +1 -1
  99. package/dist/runtime/tsconfig.tsbuildinfo +1 -1
  100. package/dist/runtime/type-conversion/asChars.d.ts +8 -0
  101. package/dist/runtime/type-conversion/asChars.d.ts.map +1 -0
  102. package/dist/runtime/type-conversion/asChars.js +8 -0
  103. package/dist/runtime/type-conversion/index.d.ts +2 -0
  104. package/dist/runtime/type-conversion/index.d.ts.map +1 -1
  105. package/dist/runtime/type-conversion/index.js +2 -0
  106. package/dist/runtime/type-conversion/ip6GroupExpansion.d.ts +14 -0
  107. package/dist/runtime/type-conversion/ip6GroupExpansion.d.ts.map +1 -0
  108. package/dist/runtime/type-conversion/ip6GroupExpansion.js +15 -0
  109. package/dist/runtime/type-guards/api-tg.d.ts +33 -0
  110. package/dist/runtime/type-guards/api-tg.d.ts.map +1 -0
  111. package/dist/runtime/type-guards/api-tg.js +38 -0
  112. package/dist/runtime/type-guards/hasWhitespace.d.ts +7 -0
  113. package/dist/runtime/type-guards/hasWhitespace.d.ts.map +1 -0
  114. package/dist/runtime/type-guards/hasWhitespace.js +11 -0
  115. package/dist/runtime/type-guards/index.d.ts +11 -0
  116. package/dist/runtime/type-guards/index.d.ts.map +1 -1
  117. package/dist/runtime/type-guards/index.js +11 -0
  118. package/dist/runtime/type-guards/isConstant.d.ts +6 -0
  119. package/dist/runtime/type-guards/isConstant.d.ts.map +1 -1
  120. package/dist/runtime/type-guards/isConstant.js +12 -2
  121. package/dist/runtime/type-guards/isEmail.d.ts +7 -0
  122. package/dist/runtime/type-guards/isEmail.d.ts.map +1 -0
  123. package/dist/runtime/type-guards/isEmail.js +11 -0
  124. package/dist/runtime/type-guards/isHexadecimal.d.ts +8 -0
  125. package/dist/runtime/type-guards/isHexadecimal.d.ts.map +1 -0
  126. package/dist/runtime/type-guards/isHexadecimal.js +13 -0
  127. package/dist/runtime/type-guards/isPhoneNumber.d.ts +14 -0
  128. package/dist/runtime/type-guards/isPhoneNumber.d.ts.map +1 -0
  129. package/dist/runtime/type-guards/isPhoneNumber.js +26 -0
  130. package/dist/runtime/type-guards/isSpecificConstant.js +2 -3
  131. package/dist/runtime/type-guards/isTrimmable.d.ts +7 -0
  132. package/dist/runtime/type-guards/isTrimmable.d.ts.map +1 -0
  133. package/dist/runtime/type-guards/isTrimmable.js +9 -0
  134. package/dist/runtime/type-guards/isUnset.d.ts +18 -0
  135. package/dist/runtime/type-guards/isUnset.d.ts.map +1 -0
  136. package/dist/runtime/type-guards/isUnset.js +23 -0
  137. package/dist/runtime/type-guards/isUrl.d.ts +2 -4
  138. package/dist/runtime/type-guards/isUrl.d.ts.map +1 -1
  139. package/dist/runtime/type-guards/isUrl.js +2 -3
  140. package/dist/runtime/type-guards/network-tg.d.ts +54 -0
  141. package/dist/runtime/type-guards/network-tg.d.ts.map +1 -0
  142. package/dist/runtime/type-guards/network-tg.js +94 -0
  143. package/dist/runtime/type-guards/repos.d.ts +6 -6
  144. package/dist/runtime/type-guards/repos.d.ts.map +1 -1
  145. package/dist/runtime/type-guards/youtube.d.ts +44 -0
  146. package/dist/runtime/type-guards/youtube.d.ts.map +1 -0
  147. package/dist/runtime/type-guards/youtube.js +84 -0
  148. package/dist/types/api/api.d.ts +96 -37
  149. package/dist/types/api/api.d.ts.map +1 -1
  150. package/dist/types/base-types/fns/EscapeFunction.d.ts +22 -0
  151. package/dist/types/base-types/fns/EscapeFunction.d.ts.map +1 -0
  152. package/dist/types/base-types/fns/OptionalParamFn.d.ts +30 -0
  153. package/dist/types/base-types/fns/OptionalParamFn.d.ts.map +1 -0
  154. package/dist/types/base-types/fns/index.d.ts +2 -0
  155. package/dist/types/base-types/fns/index.d.ts.map +1 -1
  156. package/dist/types/base-types/fns/index.js +2 -0
  157. package/dist/types/boolean-logic/branching/If.d.ts +2 -3
  158. package/dist/types/boolean-logic/branching/If.d.ts.map +1 -1
  159. package/dist/types/boolean-logic/branching/IfUnset.d.ts +12 -0
  160. package/dist/types/boolean-logic/branching/IfUnset.d.ts.map +1 -0
  161. package/dist/types/boolean-logic/branching/OnPass.d.ts +4 -3
  162. package/dist/types/boolean-logic/branching/OnPass.d.ts.map +1 -1
  163. package/dist/types/boolean-logic/branching/WhenNever.d.ts +11 -0
  164. package/dist/types/boolean-logic/branching/WhenNever.d.ts.map +1 -0
  165. package/dist/types/boolean-logic/branching/index.d.ts +2 -0
  166. package/dist/types/boolean-logic/branching/index.d.ts.map +1 -1
  167. package/dist/types/boolean-logic/branching/index.js +2 -0
  168. package/dist/types/boolean-logic/combinators/And.d.ts +1 -1
  169. package/dist/types/boolean-logic/combinators/And.d.ts.map +1 -1
  170. package/dist/types/boolean-logic/combinators/Compare.d.ts +3 -3
  171. package/dist/types/boolean-logic/combinators/Compare.d.ts.map +1 -1
  172. package/dist/types/boolean-logic/combinators/Not.d.ts +5 -6
  173. package/dist/types/boolean-logic/combinators/Not.d.ts.map +1 -1
  174. package/dist/types/boolean-logic/combinators/Some.d.ts +8 -0
  175. package/dist/types/boolean-logic/combinators/Some.d.ts.map +1 -0
  176. package/dist/types/boolean-logic/combinators/Some.js +1 -0
  177. package/dist/types/boolean-logic/combinators/index.d.ts +1 -0
  178. package/dist/types/boolean-logic/combinators/index.d.ts.map +1 -1
  179. package/dist/types/boolean-logic/combinators/index.js +1 -0
  180. package/dist/types/boolean-logic/narrowing/AsDoneFn.d.ts +2 -2
  181. package/dist/types/boolean-logic/narrowing/AsDoneFn.d.ts.map +1 -1
  182. package/dist/types/boolean-logic/operators/ApiOperators.d.ts +11 -0
  183. package/dist/types/boolean-logic/operators/ApiOperators.d.ts.map +1 -0
  184. package/dist/types/boolean-logic/operators/ApiOperators.js +1 -0
  185. package/dist/types/boolean-logic/operators/Extends.d.ts +2 -1
  186. package/dist/types/boolean-logic/operators/Extends.d.ts.map +1 -1
  187. package/dist/types/boolean-logic/operators/HasSameValues.d.ts +4 -3
  188. package/dist/types/boolean-logic/operators/HasSameValues.d.ts.map +1 -1
  189. package/dist/types/boolean-logic/operators/IsBoolean.d.ts +2 -1
  190. package/dist/types/boolean-logic/operators/IsBoolean.d.ts.map +1 -1
  191. package/dist/types/boolean-logic/operators/IsCssHexadecimal.d.ts +9 -0
  192. package/dist/types/boolean-logic/operators/IsCssHexadecimal.d.ts.map +1 -0
  193. package/dist/types/boolean-logic/operators/IsCssHexadecimal.js +1 -0
  194. package/dist/types/boolean-logic/operators/IsEqual.d.ts +7 -1
  195. package/dist/types/boolean-logic/operators/IsEqual.d.ts.map +1 -1
  196. package/dist/types/boolean-logic/operators/IsGreaterThan.d.ts +2 -2
  197. package/dist/types/boolean-logic/operators/IsGreaterThan.d.ts.map +1 -1
  198. package/dist/types/boolean-logic/operators/IsLessThan.d.ts +13 -0
  199. package/dist/types/boolean-logic/operators/IsLessThan.d.ts.map +1 -0
  200. package/dist/types/boolean-logic/operators/IsLessThan.js +1 -0
  201. package/dist/types/boolean-logic/operators/IsNever.d.ts +2 -1
  202. package/dist/types/boolean-logic/operators/IsNever.d.ts.map +1 -1
  203. package/dist/types/boolean-logic/operators/IsNumber.d.ts +2 -2
  204. package/dist/types/boolean-logic/operators/IsNumber.d.ts.map +1 -1
  205. package/dist/types/boolean-logic/operators/IsString.d.ts +2 -2
  206. package/dist/types/boolean-logic/operators/IsString.d.ts.map +1 -1
  207. package/dist/types/boolean-logic/operators/IsUnset.d.ts +9 -0
  208. package/dist/types/boolean-logic/operators/IsUnset.d.ts.map +1 -0
  209. package/dist/types/boolean-logic/operators/IsUnset.js +1 -0
  210. package/dist/types/boolean-logic/operators/IsUrl.d.ts +35 -0
  211. package/dist/types/boolean-logic/operators/IsUrl.d.ts.map +1 -0
  212. package/dist/types/boolean-logic/operators/IsUrl.js +1 -0
  213. package/dist/types/boolean-logic/operators/Network-operators.d.ts +71 -0
  214. package/dist/types/boolean-logic/operators/Network-operators.d.ts.map +1 -0
  215. package/dist/types/boolean-logic/operators/Network-operators.js +1 -0
  216. package/dist/types/boolean-logic/operators/PhoneOperators.d.ts +33 -0
  217. package/dist/types/boolean-logic/operators/PhoneOperators.d.ts.map +1 -0
  218. package/dist/types/boolean-logic/operators/PhoneOperators.js +1 -0
  219. package/dist/types/boolean-logic/operators/YouTube-operators.d.ts +32 -0
  220. package/dist/types/boolean-logic/operators/YouTube-operators.d.ts.map +1 -0
  221. package/dist/types/boolean-logic/operators/YouTube-operators.js +1 -0
  222. package/dist/types/boolean-logic/operators/index.d.ts +7 -1
  223. package/dist/types/boolean-logic/operators/index.d.ts.map +1 -1
  224. package/dist/types/boolean-logic/operators/index.js +7 -1
  225. package/dist/types/dictionary/Keys.d.ts +58 -4
  226. package/dist/types/dictionary/Keys.d.ts.map +1 -1
  227. package/dist/types/dictionary/KvFn.d.ts +2 -2
  228. package/dist/types/dictionary/KvFn.d.ts.map +1 -1
  229. package/dist/types/dictionary/MakeKeysOptional.d.ts +12 -3
  230. package/dist/types/dictionary/MakeKeysOptional.d.ts.map +1 -1
  231. package/dist/types/dictionary/MakeKeysRequired.d.ts +14 -0
  232. package/dist/types/dictionary/MakeKeysRequired.d.ts.map +1 -0
  233. package/dist/types/dictionary/MakeKeysRequired.js +1 -0
  234. package/dist/types/dictionary/OptionalKeys.d.ts +19 -4
  235. package/dist/types/dictionary/OptionalKeys.d.ts.map +1 -1
  236. package/dist/types/dictionary/OptionalKeys.js +1 -0
  237. package/dist/types/dictionary/RequiredKeys.d.ts +14 -6
  238. package/dist/types/dictionary/RequiredKeys.d.ts.map +1 -1
  239. package/dist/types/dictionary/Values.d.ts +2 -2
  240. package/dist/types/dictionary/Values.d.ts.map +1 -1
  241. package/dist/types/dictionary/index.d.ts +1 -2
  242. package/dist/types/dictionary/index.d.ts.map +1 -1
  243. package/dist/types/dictionary/index.js +1 -2
  244. package/dist/types/errors/KindError.d.ts +1 -1
  245. package/dist/types/errors/KindError.d.ts.map +1 -1
  246. package/dist/types/functions/FnFrom.d.ts +5 -0
  247. package/dist/types/functions/FnFrom.d.ts.map +1 -1
  248. package/dist/types/functions/{Fn.d.ts → FnWithDescription.d.ts} +2 -2
  249. package/dist/types/functions/FnWithDescription.d.ts.map +1 -0
  250. package/dist/types/functions/FnWithDescription.js +1 -0
  251. package/dist/types/functions/WrapperFn.d.ts +23 -0
  252. package/dist/types/functions/WrapperFn.d.ts.map +1 -0
  253. package/dist/types/functions/WrapperFn.js +1 -0
  254. package/dist/types/functions/index.d.ts +2 -1
  255. package/dist/types/functions/index.d.ts.map +1 -1
  256. package/dist/types/functions/index.js +2 -1
  257. package/dist/types/lists/ConvertSet.d.ts +2 -2
  258. package/dist/types/lists/ConvertSet.d.ts.map +1 -1
  259. package/dist/types/lists/Find.d.ts +7 -18
  260. package/dist/types/lists/Find.d.ts.map +1 -1
  261. package/dist/types/literals/DoneFnTuple.d.ts +3 -3
  262. package/dist/types/literals/DoneFnTuple.d.ts.map +1 -1
  263. package/dist/types/literals/Unset.d.ts +13 -0
  264. package/dist/types/literals/Unset.d.ts.map +1 -0
  265. package/dist/types/literals/Unset.js +1 -0
  266. package/dist/types/literals/index.d.ts +1 -0
  267. package/dist/types/literals/index.d.ts.map +1 -1
  268. package/dist/types/literals/index.js +1 -0
  269. package/dist/types/numeric-literals/NumberLike.d.ts +1 -1
  270. package/dist/types/numeric-literals/NumberLike.d.ts.map +1 -1
  271. package/dist/types/string-literals/Proxmox.d.ts +7 -0
  272. package/dist/types/string-literals/Proxmox.d.ts.map +1 -0
  273. package/dist/types/string-literals/Proxmox.js +1 -0
  274. package/dist/types/string-literals/RetainUntil.d.ts +33 -0
  275. package/dist/types/string-literals/RetainUntil.d.ts.map +1 -0
  276. package/dist/types/string-literals/RetainUntil.js +1 -0
  277. package/dist/types/string-literals/Split.d.ts +3 -3
  278. package/dist/types/string-literals/Split.d.ts.map +1 -1
  279. package/dist/types/string-literals/StripAfter.d.ts +2 -2
  280. package/dist/types/string-literals/StripAfter.d.ts.map +1 -1
  281. package/dist/types/string-literals/StripBefore.d.ts +2 -2
  282. package/dist/types/string-literals/StripBefore.d.ts.map +1 -1
  283. package/dist/types/string-literals/StripLeading.d.ts +2 -2
  284. package/dist/types/string-literals/StripLeading.d.ts.map +1 -1
  285. package/dist/types/string-literals/StripUntil.d.ts +18 -0
  286. package/dist/types/string-literals/StripUntil.d.ts.map +1 -0
  287. package/dist/types/string-literals/StripUntil.js +1 -0
  288. package/dist/types/string-literals/character-sets/DomainName.d.ts +17 -18
  289. package/dist/types/string-literals/character-sets/DomainName.d.ts.map +1 -1
  290. package/dist/types/string-literals/character-sets/IpAddress.d.ts +28 -4
  291. package/dist/types/string-literals/character-sets/IpAddress.d.ts.map +1 -1
  292. package/dist/types/string-literals/character-sets/Optional.d.ts +14 -0
  293. package/dist/types/string-literals/character-sets/Optional.d.ts.map +1 -0
  294. package/dist/types/string-literals/character-sets/Optional.js +1 -0
  295. package/dist/types/string-literals/character-sets/Repos.d.ts.map +1 -1
  296. package/dist/types/string-literals/character-sets/Url.d.ts +85 -37
  297. package/dist/types/string-literals/character-sets/Url.d.ts.map +1 -1
  298. package/dist/types/string-literals/character-sets/Url.js +1 -0
  299. package/dist/types/string-literals/character-sets/Whitespace.d.ts +3 -1
  300. package/dist/types/string-literals/character-sets/Whitespace.d.ts.map +1 -1
  301. package/dist/types/string-literals/character-sets/YouTube.d.ts +127 -0
  302. package/dist/types/string-literals/character-sets/YouTube.d.ts.map +1 -0
  303. package/dist/types/string-literals/character-sets/YouTube.js +1 -0
  304. package/dist/types/string-literals/character-sets/index.d.ts +3 -0
  305. package/dist/types/string-literals/character-sets/index.d.ts.map +1 -1
  306. package/dist/types/string-literals/character-sets/index.js +3 -0
  307. package/dist/types/string-literals/character-sets/phone.d.ts +192 -0
  308. package/dist/types/string-literals/character-sets/phone.d.ts.map +1 -0
  309. package/dist/types/string-literals/character-sets/phone.js +1 -0
  310. package/dist/types/string-literals/index.d.ts +2 -0
  311. package/dist/types/string-literals/index.d.ts.map +1 -1
  312. package/dist/types/string-literals/index.js +2 -0
  313. package/dist/types/tsconfig.tsbuildinfo +1 -1
  314. package/dist/types/type-conversion/ReduceValues.d.ts +19 -0
  315. package/dist/types/type-conversion/ReduceValues.d.ts.map +1 -0
  316. package/dist/types/type-conversion/ReduceValues.js +1 -0
  317. package/dist/types/type-conversion/ReturnValues.d.ts +10 -6
  318. package/dist/types/type-conversion/ReturnValues.d.ts.map +1 -1
  319. package/dist/types/type-conversion/Trim.d.ts +3 -1
  320. package/dist/types/type-conversion/Trim.d.ts.map +1 -1
  321. package/dist/types/type-conversion/UnionFilter.d.ts +2 -2
  322. package/dist/types/type-conversion/UnionFilter.d.ts.map +1 -1
  323. package/dist/types/type-conversion/form-fields.d.ts +5 -1
  324. package/dist/types/type-conversion/form-fields.d.ts.map +1 -1
  325. package/dist/types/type-conversion/index.d.ts +1 -0
  326. package/dist/types/type-conversion/index.d.ts.map +1 -1
  327. package/dist/types/type-conversion/index.js +1 -0
  328. package/package.json +17 -11
  329. package/dist/constants/Network.d.ts +0 -22
  330. package/dist/constants/Network.d.ts.map +0 -1
  331. package/dist/constants/Network.js +0 -21
  332. package/dist/runtime/boolean-logic/handleDoneFn.d.ts.map +0 -1
  333. package/dist/types/boolean-logic/operators/IsHexadecimal.d.ts +0 -9
  334. package/dist/types/boolean-logic/operators/IsHexadecimal.d.ts.map +0 -1
  335. package/dist/types/dictionary/PrivateKeys.d.ts +0 -17
  336. package/dist/types/dictionary/PrivateKeys.d.ts.map +0 -1
  337. package/dist/types/dictionary/PublicKeys.d.ts +0 -10
  338. package/dist/types/dictionary/PublicKeys.d.ts.map +0 -1
  339. package/dist/types/functions/Fn.d.ts.map +0 -1
  340. /package/dist/runtime/{boolean-logic → api}/handleDoneFn.d.ts +0 -0
  341. /package/dist/runtime/{boolean-logic → api}/handleDoneFn.js +0 -0
  342. /package/dist/types/{boolean-logic/operators/IsHexadecimal.js → base-types/fns/EscapeFunction.js} +0 -0
  343. /package/dist/types/{dictionary/PrivateKeys.js → base-types/fns/OptionalParamFn.js} +0 -0
  344. /package/dist/types/{dictionary/PublicKeys.js → boolean-logic/branching/IfUnset.js} +0 -0
  345. /package/dist/types/{functions/Fn.js → boolean-logic/branching/WhenNever.js} +0 -0
@@ -16,30 +16,30 @@ export declare const isRepoSource: <T>(v: T) => v is T & ("github" | "bitbucket"
16
16
  * `v 1.0.12` are allowed.
17
17
  * - by default the `allowPrefix` option is set to false
18
18
  */
19
- export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix?: P) => v is T & `${[P] extends [true] ? import("../../types/index").OptionalSpace | "v" | "v " : ""}${number}.${number}.${number}`;
19
+ export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix?: P) => v is T & `${[P] extends [true] ? "v" | import("../../types/index").OptionalSpace | "v " : ""}${number}.${number}.${number}`;
20
20
  /**
21
21
  * **isRepoUrl**`(val)`
22
22
  *
23
23
  * Type guard which validates that the value passed in is a valid Repo URL
24
24
  */
25
- export declare const isRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.io/${string}` | "https://github.io" | `https://bitbucket.com/${string}` | "https://bitbucket.com" | `https://gitlab.com/${string}` | "https://gitlab.com" | `https://aws.amazon.com/codecommit/${string}`);
25
+ export declare const isRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.com?${string}` | `https://github.io/${string}` | "https://github.io" | `https://github.io?${string}` | `https://bitbucket.com/${string}` | "https://bitbucket.com" | `https://bitbucket.com?${string}` | `https://gitlab.com/${string}` | "https://gitlab.com" | `https://gitlab.com?${string}` | `https://aws.amazon.com/codecommit/${string}` | `https://aws.amazon.com/codecommit/?${string}`);
26
26
  /**
27
27
  * **isGithubUrl**`(val)`
28
28
  *
29
29
  * Type guard which validates that the value passed in is a valid Github URL
30
30
  */
31
- export declare const isGithubUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.io/${string}` | "https://github.io");
32
- export declare const isGithubRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}/0${string}` | `https://github.com/${string}/1${string}` | `https://github.com/${string}/2${string}` | `https://github.com/${string}/3${string}` | `https://github.com/${string}/4${string}` | `https://github.com/${string}/5${string}` | `https://github.com/${string}/6${string}` | `https://github.com/${string}/7${string}` | `https://github.com/${string}/8${string}` | `https://github.com/${string}/9${string}` | `https://github.com/${string}/x${string}` | `https://github.com/${string}/E${string}` | `https://github.com/${string}/A${string}` | `https://github.com/${string}/B${string}` | `https://github.com/${string}/C${string}` | `https://github.com/${string}/D${string}` | `https://github.com/${string}/F${string}` | `https://github.com/${string}/G${string}` | `https://github.com/${string}/H${string}` | `https://github.com/${string}/I${string}` | `https://github.com/${string}/J${string}` | `https://github.com/${string}/K${string}` | `https://github.com/${string}/L${string}` | `https://github.com/${string}/M${string}` | `https://github.com/${string}/N${string}` | `https://github.com/${string}/O${string}` | `https://github.com/${string}/P${string}` | `https://github.com/${string}/Q${string}` | `https://github.com/${string}/R${string}` | `https://github.com/${string}/S${string}` | `https://github.com/${string}/T${string}` | `https://github.com/${string}/U${string}` | `https://github.com/${string}/V${string}` | `https://github.com/${string}/W${string}` | `https://github.com/${string}/X${string}` | `https://github.com/${string}/Y${string}` | `https://github.com/${string}/Z${string}` | `https://github.com/${string}/a${string}` | `https://github.com/${string}/b${string}` | `https://github.com/${string}/c${string}` | `https://github.com/${string}/d${string}` | `https://github.com/${string}/e${string}` | `https://github.com/${string}/f${string}` | `https://github.com/${string}/g${string}` | `https://github.com/${string}/h${string}` | `https://github.com/${string}/i${string}` | `https://github.com/${string}/j${string}` | `https://github.com/${string}/k${string}` | `https://github.com/${string}/l${string}` | `https://github.com/${string}/m${string}` | `https://github.com/${string}/n${string}` | `https://github.com/${string}/o${string}` | `https://github.com/${string}/p${string}` | `https://github.com/${string}/q${string}` | `https://github.com/${string}/r${string}` | `https://github.com/${string}/s${string}` | `https://github.com/${string}/t${string}` | `https://github.com/${string}/u${string}` | `https://github.com/${string}/v${string}` | `https://github.com/${string}/w${string}` | `https://github.com/${string}/y${string}` | `https://github.com/${string}/z${string}`);
31
+ export declare const isGithubUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.com?${string}` | `https://github.io/${string}` | "https://github.io" | `https://github.io?${string}`);
32
+ export declare const isGithubRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}/0${string}` | `https://github.com/${string}/1${string}` | `https://github.com/${string}/2${string}` | `https://github.com/${string}/3${string}` | `https://github.com/${string}/4${string}` | `https://github.com/${string}/5${string}` | `https://github.com/${string}/6${string}` | `https://github.com/${string}/7${string}` | `https://github.com/${string}/8${string}` | `https://github.com/${string}/9${string}` | `https://github.com/${string}/A${string}` | `https://github.com/${string}/B${string}` | `https://github.com/${string}/C${string}` | `https://github.com/${string}/D${string}` | `https://github.com/${string}/E${string}` | `https://github.com/${string}/F${string}` | `https://github.com/${string}/G${string}` | `https://github.com/${string}/H${string}` | `https://github.com/${string}/I${string}` | `https://github.com/${string}/J${string}` | `https://github.com/${string}/K${string}` | `https://github.com/${string}/L${string}` | `https://github.com/${string}/M${string}` | `https://github.com/${string}/N${string}` | `https://github.com/${string}/O${string}` | `https://github.com/${string}/P${string}` | `https://github.com/${string}/Q${string}` | `https://github.com/${string}/R${string}` | `https://github.com/${string}/S${string}` | `https://github.com/${string}/T${string}` | `https://github.com/${string}/U${string}` | `https://github.com/${string}/V${string}` | `https://github.com/${string}/W${string}` | `https://github.com/${string}/X${string}` | `https://github.com/${string}/Y${string}` | `https://github.com/${string}/Z${string}` | `https://github.com/${string}/a${string}` | `https://github.com/${string}/b${string}` | `https://github.com/${string}/c${string}` | `https://github.com/${string}/d${string}` | `https://github.com/${string}/e${string}` | `https://github.com/${string}/f${string}` | `https://github.com/${string}/g${string}` | `https://github.com/${string}/h${string}` | `https://github.com/${string}/i${string}` | `https://github.com/${string}/j${string}` | `https://github.com/${string}/k${string}` | `https://github.com/${string}/l${string}` | `https://github.com/${string}/m${string}` | `https://github.com/${string}/n${string}` | `https://github.com/${string}/o${string}` | `https://github.com/${string}/p${string}` | `https://github.com/${string}/q${string}` | `https://github.com/${string}/r${string}` | `https://github.com/${string}/s${string}` | `https://github.com/${string}/t${string}` | `https://github.com/${string}/u${string}` | `https://github.com/${string}/v${string}` | `https://github.com/${string}/w${string}` | `https://github.com/${string}/x${string}` | `https://github.com/${string}/y${string}` | `https://github.com/${string}/z${string}`);
33
33
  /**
34
34
  * **isBitbucketUrl**`(val)`
35
35
  *
36
36
  * Type guard which validates that the value passed in is a valid BitBucket URL
37
37
  */
38
- export declare const isBitbucketUrl: <T>(val: T) => val is T & (`https://bitbucket.com/${string}` | "https://bitbucket.com");
38
+ export declare const isBitbucketUrl: <T>(val: T) => val is T & (`https://bitbucket.com/${string}` | "https://bitbucket.com" | `https://bitbucket.com?${string}`);
39
39
  /**
40
40
  * **isCodeCommitUrl**`(val)`
41
41
  *
42
42
  * Type guard which validates that the value passed in is a valid AWS Code Commit URL
43
43
  */
44
- export declare const isCodeCommitUrl: <T>(val: T) => val is T & `https://aws.amazon.com/codecommit/${string}`;
44
+ export declare const isCodeCommitUrl: <T>(val: T) => val is T & (`https://aws.amazon.com/codecommit/${string}` | `https://aws.amazon.com/codecommit/?${string}`);
45
45
  //# sourceMappingURL=repos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/repos.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,SAAU,CAAC,0EAEnC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,4BAC1B,CAAC,gBACU,CAAC,gIAcf,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAY,CAAC,mSAMlC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,6HAMpC,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,CAAC,urFAMxC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,WAAY,CAAC,6EAMvC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,CAAC,6DAMxC,CAAA"}
1
+ {"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/repos.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,SAAU,CAAC,0EAEnC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,4BAC1B,CAAC,gBACU,CAAC,gIAcf,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAY,CAAC,0dAMlC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,8LAMpC,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,CAAC,urFAMxC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,WAAY,CAAC,iHAMvC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,CAAC,gHAMxC,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { YouTubeCreatorUrl, YouTubeFeedType, YouTubeFeedUrl, YouTubePlaylistUrl } from "../../types/index";
2
+ /**
3
+ * **isYouTubeUrl**`(val)`
4
+ *
5
+ * Type guard which checks whether the passed in value is a valid
6
+ * YouTube URL.
7
+ */
8
+ export declare const isYouTubeUrl: <T>(val: T) => val is T & (`https://www.youtube.com/${string}` | "https://www.youtube.com" | `https://www.youtube.com?${string}` | `https://youtube.com/${string}` | "https://youtube.com" | `https://youtube.com?${string}` | `https://youtu.be/${string}` | "https://youtu.be" | `https://youtu.be?${string}`);
9
+ /**
10
+ * **isYouTubeShareUrl**`(val)`
11
+ *
12
+ * Type guard which checks whether the passed in value is a URL
13
+ * from YouTube's _URL shortening_ site `https://youtu.be`.
14
+ */
15
+ export declare const isYouTubeShareUrl: <T>(val: T) => val is T & (`https://youtu.be/${string}` | "https://youtu.be" | `https://youtu.be?${string}`);
16
+ /**
17
+ * **isYouTubeVideoUrl**`(val)`
18
+ *
19
+ * Type guard which checks whether the passed in value is a valid
20
+ * YouTube URL _which plays video_.
21
+ */
22
+ export declare const isYouTubeVideoUrl: <T>(val: T) => val is T & (`https://www.youtube.com/${string}` | "https://www.youtube.com" | `https://www.youtube.com?${string}` | `https://youtube.com/${string}` | "https://youtube.com" | `https://youtube.com?${string}` | `https://youtu.be/${string}` | "https://youtu.be" | `https://youtu.be?${string}`);
23
+ /**
24
+ * **isYouTubePlaylistUrl**`(val)`
25
+ *
26
+ * Type guard which checks whether the passed in value is a valid
27
+ * YouTube URL which points to a "playlist" on the platform.
28
+ */
29
+ export declare const isYouTubePlaylistUrl: <T>(val: T) => val is T & YouTubePlaylistUrl;
30
+ /**
31
+ * **isYouTubeFeedUrl**`(val,[kind])**
32
+ *
33
+ * Type guard which checks whether the passed in value is a valid
34
+ * YouTube URL which responds with "feed" content. This is content
35
+ * which is available to a logged in user and helps them see lists
36
+ * of videos related to their settings.
37
+ *
38
+ * By default any "feed" URL is matched but you can narrow that down
39
+ * to a specific feed type by specifying the `kind` variable.
40
+ */
41
+ export declare const isYouTubeFeedUrl: <T, U extends YouTubeFeedType = YouTubeFeedType>(val: T, type?: U) => val is T & YouTubeFeedUrl<U>;
42
+ export declare const isYouTubeCreatorUrl: <T extends string>(url: T) => url is T & YouTubeCreatorUrl;
43
+ export declare const isYouTubeVideosInPlaylist: <T>(val: T) => val is T & `https://www.youtube.com/playlist?${string}list=${string}`;
44
+ //# sourceMappingURL=youtube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,kBAAkB,EAInB,0BAAwB;AAKzB;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,sSAMrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAC,kGAEzC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,CAAC,sSAM1C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WAAY,CAAC,kCAS7C,CAAA;AAeD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,wDAIvB,CAAC,SACC,CAAC,iCAMR,CAAA;AAED,eAAO,MAAM,mBAAmB,0BACzB,CAAC,iCAOP,CAAA;AAED,eAAO,MAAM,yBAAyB,WAAY,CAAC,0EAKlD,CAAA"}
@@ -0,0 +1,84 @@
1
+ import { isString } from "./isString.js";
2
+ import { isUndefined } from "./isUndefined.js";
3
+ import { hasUrlQueryParameter } from "./network-tg.js";
4
+ /**
5
+ * **isYouTubeUrl**`(val)`
6
+ *
7
+ * Type guard which checks whether the passed in value is a valid
8
+ * YouTube URL.
9
+ */
10
+ export const isYouTubeUrl = (val) => {
11
+ return isString(val) && (val.startsWith("https://www.youtube.com") ||
12
+ val.startsWith("https://youtube.com") ||
13
+ val.startsWith("https://youtu.be"));
14
+ };
15
+ /**
16
+ * **isYouTubeShareUrl**`(val)`
17
+ *
18
+ * Type guard which checks whether the passed in value is a URL
19
+ * from YouTube's _URL shortening_ site `https://youtu.be`.
20
+ */
21
+ export const isYouTubeShareUrl = (val) => {
22
+ return isString(val) && val.startsWith(`https://youtu.be`);
23
+ };
24
+ /**
25
+ * **isYouTubeVideoUrl**`(val)`
26
+ *
27
+ * Type guard which checks whether the passed in value is a valid
28
+ * YouTube URL _which plays video_.
29
+ */
30
+ export const isYouTubeVideoUrl = (val) => {
31
+ return isString(val) && (val.startsWith("https://www.youtube.com") ||
32
+ val.startsWith("https://youtube.com") ||
33
+ val.startsWith("https://youtu.be"));
34
+ };
35
+ /**
36
+ * **isYouTubePlaylistUrl**`(val)`
37
+ *
38
+ * Type guard which checks whether the passed in value is a valid
39
+ * YouTube URL which points to a "playlist" on the platform.
40
+ */
41
+ export const isYouTubePlaylistUrl = (val) => {
42
+ return isString(val) && (val === `https://www.youtube.com/feed/playlists` ||
43
+ val === `https://youtube.com/feed/playlists` ||
44
+ val === `https://www.youtube.com/channel/playlists` ||
45
+ val === `https://youtube.com/channel/playlists` ||
46
+ (val.startsWith(`https://www.youtube.com/@`) && val.endsWith(`/playlists`)) ||
47
+ (val.startsWith(`https://youtube.com/@`) && val.endsWith(`/playlists`)));
48
+ };
49
+ /**
50
+ * maps the "feed type" to a URL path
51
+ */
52
+ const feed_map = (type) => {
53
+ return isUndefined(type)
54
+ ? `/feed`
55
+ : type === "liked"
56
+ ? `/playlist?list=LL`
57
+ : ["history", "playlists", "trending", "subscriptions"].includes(type)
58
+ ? `/feed/${type}`
59
+ : `/feed/`;
60
+ };
61
+ /**
62
+ * **isYouTubeFeedUrl**`(val,[kind])**
63
+ *
64
+ * Type guard which checks whether the passed in value is a valid
65
+ * YouTube URL which responds with "feed" content. This is content
66
+ * which is available to a logged in user and helps them see lists
67
+ * of videos related to their settings.
68
+ *
69
+ * By default any "feed" URL is matched but you can narrow that down
70
+ * to a specific feed type by specifying the `kind` variable.
71
+ */
72
+ export const isYouTubeFeedUrl = (val, type = undefined) => {
73
+ return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) ||
74
+ val.startsWith(`https://youtube.com${feed_map(type)}`));
75
+ };
76
+ export const isYouTubeCreatorUrl = (url) => {
77
+ return isString(url) && (url.startsWith(`https://www.youtube.com/@`) ||
78
+ url.startsWith(`https://youtube.com/@`) ||
79
+ url.startsWith(`https://www.youtube.com/channel/`));
80
+ };
81
+ export const isYouTubeVideosInPlaylist = (val) => {
82
+ return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) ||
83
+ val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
84
+ };
@@ -1,4 +1,4 @@
1
- import { Dictionary, EmptyObject, TypedFunction, Contains, IsNever, Values, Throw, AfterFirst, First, FindExtends, ExpandRecursively, ShapeCallback, Scalar, TupleToUnion } from "../index";
1
+ import { Dictionary, EmptyObject, TypedFunction, Values, Throw, AfterFirst, First, ExpandRecursively, TupleToUnion, Unset, PublicKeyOf, IfUnset, KeyOf, Fail, Extends, UpsertKeyValue, Tuple, ReduceValues, IsEscapeFunction, RemoveNever, If, WhenNever, HasEscapeFunction, ErrorCondition } from "../index";
2
2
  /**
3
3
  * **ValueCallback**`<TVal, TReturn>`
4
4
  *
@@ -10,16 +10,16 @@ import { Dictionary, EmptyObject, TypedFunction, Contains, IsNever, Values, Thro
10
10
  * ```
11
11
  */
12
12
  export type ValueCallback<TVal, TReturn> = <V extends TVal>(v: V) => TReturn;
13
- export type EscapeFunction<T extends () => any = () => any> = T & {
14
- escape: true;
15
- };
13
+ type _GetEscapeFunction<T extends readonly unknown[]> = WhenNever<First<RemoveNever<{
14
+ [K in keyof T]: If<IsEscapeFunction<T[K]>, T[K], never>;
15
+ }>>, Throw<"no-escape-function">>;
16
16
  /**
17
- * **HasEscapeFunction**`<T>`
17
+ * **GetEscapeFunction**`<T>`
18
18
  *
19
- * Checks whether the API surface passed in has an escape function defined.
19
+ * Gets an escape function from an `Api` and from a `Dictionary | TypeFunction`
20
+ * if it exists. If it does not exist then returns an ErrorCondition.
20
21
  */
21
- export type HasEscapeFunction<T extends Dictionary | TypedFunction> = T extends Dictionary ? Contains<Values<T>, EscapeFunction> : T extends TypedFunction ? T extends EscapeFunction ? true : false : false;
22
- export type GetEscapeFunction<T extends Dictionary | TypedFunction> = T extends Dictionary ? FindExtends<Values<T>, EscapeFunction> extends TypedFunction ? FindExtends<Values<T>, EscapeFunction> : never : T extends TypedFunction ? T extends EscapeFunction ? T : never : never;
22
+ export type GetEscapeFunction<T extends Dictionary | TypedFunction | Api> = T extends Api ? _GetEscapeFunction<Values<T["surface"]>> : _GetEscapeFunction<Values<T>>;
23
23
  export type FluentState<T> = {
24
24
  state: T;
25
25
  config: {
@@ -39,28 +39,73 @@ type ExpandFluentFns<TFluentState extends FluentState<any>, TFns extends readonl
39
39
  * Defines the callback loop necessary to manage state via a
40
40
  * Fluent API.
41
41
  */
42
- type FluentApi<TSurface extends Dictionary | TypedFunction, TState, TFluentFns extends readonly FluentFn<TState, any, any>[]> = <T extends FluentState<TState>>(state: T) => ExpandRecursively<TSurface & ExpandFluentFns<FluentState<TState>, TFluentFns>>;
42
+ export type FluentApi<TSurface extends Dictionary | TypedFunction, TState, TFluentFns extends readonly FluentFn<TState, any, any>[]> = <T extends FluentState<TState>>(state: T) => ExpandRecursively<TSurface & ExpandFluentFns<FluentState<TState>, TFluentFns>>;
43
+ /**
44
+ * **ApiState**
45
+ *
46
+ * For API's which manage state, the state should be a Dictionary
47
+ * or Tuple in shape.
48
+ */
49
+ export type ApiState = Dictionary | Tuple;
43
50
  /**
44
- * **ToFluent**`<TSurface,TState,TUseOnce>`
51
+ * **ApiConfig**`<TSurface,TState>`
45
52
  *
46
- * Upgrades a base API to an API which supports state management
47
- * and a Fluent API style.
53
+ * The configuration of your API provides opportunities to
54
+ * show or mask various parts of your surface area based on
55
+ * the current _state_ you are in.
48
56
  */
49
- export type ToFluent<TSurface extends Dictionary | TypedFunction, TState, TFluentFns extends readonly FluentFn<TState, any, any>[] = []> = {
50
- addFluentFn: <TName extends string, TFn extends <TCb extends (<T extends FluentState<TState>>(state: T) => TypedFunction<TState>)>(cb: TCb) => void, TUse extends boolean = false>(name: TName, fn: TFn, useOnce?: TUse) => ToFluent<TSurface, TState, [
51
- ...TFluentFns,
52
- FluentFn<TState, TName, TFn>
53
- ]>;
54
- done: () => FluentApi<TSurface, TState, TFluentFns>;
57
+ export type ApiConfig<TSurface extends ApiSurface<Api> = ApiSurface<Api>, TState extends ApiState = ApiState> = {
58
+ callOnce: readonly string[];
59
+ called: readonly string[];
60
+ mask: ((state: TState, called: readonly string[]) => readonly (KeyOf<TSurface>)[]);
55
61
  };
56
- export type Api<TSurface extends Dictionary | TypedFunction, TState = never> = HasEscapeFunction<TSurface> extends true ? IsNever<TState> extends true ? TSurface : ToFluent<TSurface, TState> : Throw<"no-escape-function">;
57
- export type ApiCallbackOptions<TProxy extends readonly (Scalar | ShapeCallback)[] = readonly (Scalar | ShapeCallback)[]> = {
62
+ /**
63
+ * **ApiOptions**`<[TSurface]>`
64
+ *
65
+ * The _options_ which go into defining an API surface.
66
+ */
67
+ export type ApiOptions<TSurface extends Dictionary | TypedFunction | Unset = Unset> = {
58
68
  /**
59
- * Allow types _other_ than the callback API to be passed into this
60
- * function and have them proxied through.
69
+ * any _state_ which the API is managing (making it a `FluentApi`)
70
+ *
71
+ * @default Unset;
61
72
  */
62
- proxy?: TProxy;
73
+ state: Unset | Dictionary;
74
+ /**
75
+ * An array of _keys_ to the API surface which should only be allowed
76
+ * to be called once (and will be _masked_ thereafter from runtime).
77
+ *
78
+ * **Note:** _this only really makes sense when you're managing state_.
79
+ */
80
+ callOnce: IfUnset<TSurface, readonly PropertyKey[], readonly PublicKeyOf<AsApi<TSurface>>[]>;
63
81
  };
82
+ /**
83
+ * **Api**
84
+ *
85
+ * An API definition typically created via `AsApi<TSurface,TOpts>` which is
86
+ * not responsible for managing state.
87
+ *
88
+ * **Related:** `FluentApi`, `AsFluentApi`
89
+ */
90
+ export type Api<TSurface extends Dictionary | TypedFunction = Dictionary | TypedFunction> = {
91
+ _kind: "api";
92
+ surface: TSurface;
93
+ };
94
+ /**
95
+ * **ApiReturn**
96
+ *
97
+ * The expected/desired types that could result from calling the API's
98
+ * _endpoints_.
99
+ *
100
+ * Note: this does not consider the possibility of a user
101
+ */
102
+ export type ApiReturn<T extends Api> = "surface" extends keyof T ? T["surface"] extends Dictionary ? TupleToUnion<ReduceValues<T["surface"]>> : never : unknown;
103
+ /**
104
+ * **ApiSurface**`<T>`
105
+ *
106
+ * Extracts the API's surface area from an `Api`.
107
+ */
108
+ export type ApiSurface<T extends Api> = T["surface"];
64
109
  /**
65
110
  * **ApiCallback**`<TSurface,[TOpts]>`
66
111
  *
@@ -72,28 +117,42 @@ export type ApiCallbackOptions<TProxy extends readonly (Scalar | ShapeCallback)[
72
117
  *
73
118
  * **Related:** `HandleApiCallback`, `ApiCallbackInfo`
74
119
  */
75
- export type ApiCallback<TSurface extends Dictionary | TypedFunction, TOpts extends ApiCallbackOptions = ApiCallbackOptions> = HasEscapeFunction<TSurface> extends true ? <TCall extends ((api: ExpandRecursively<TSurface>) => unknown) | (TOpts["proxy"] extends readonly unknown[] ? TupleToUnion<TOpts["proxy"]> : never)>(cb: TCall) => HandleApiCallback<TCall extends TypedFunction ? ReturnType<TCall> : TCall> : Throw<"no-escape-function">;
120
+ export type ApiCallback<TApi extends Api> = <TCall extends (api: ApiSurface<TApi>) => unknown>(cb: TCall) => ReturnType<TCall>;
76
121
  /**
77
- * **ApiEscape**`<T>`
122
+ * **Api**`<TSurface>`
78
123
  *
79
- * Given a `T` which extends `Api` or `ApiCallback`, this utility will expose
80
- * the escape function.
124
+ * Validates a candidate for a _stateless_ API and returns it as an `Api<TSurface>`
125
+ * if valid. If not valid you'll get a `ErrorCondition`.
81
126
  */
82
- export type ApiEscape<T extends Dictionary | TypedFunction | ApiCallback<Dictionary | TypedFunction>> = T extends ApiCallback<Dictionary | TypedFunction> ? T extends TypedFunction ? Parameters<T>[0] extends Dictionary | TypedFunction ? GetEscapeFunction<Parameters<T>[0]> : never : never : GetEscapeFunction<T>;
127
+ export type AsApi<TSurface extends Dictionary | TypedFunction> = HasEscapeFunction<TSurface> extends true ? Api<TSurface> : Throw<"no-escape-function">;
128
+ export type ApiStateInitializer<TApi> = <T extends Dictionary>(state: T) => TApi;
83
129
  /**
84
- * **ApiReturn**`<T>`
130
+ * A builder API for defining _stateless_ API's.
85
131
  *
86
- * Given a `T` which extends `ApiCallback`, this utility will expose
87
- * the _default_ return value provided by the _escape function_.
132
+ * Note: ironically this is **not** a stateless API.
133
+ */
134
+ export type DefineStatelessApi<T extends Dictionary = EmptyObject, _C extends {
135
+ called: readonly KeyOf<T>[];
136
+ callOnce: ["escapeFunction"];
137
+ } = {
138
+ called: [];
139
+ callOnce: ["escapeFunction"];
140
+ }> = ({
141
+ escapeFunction: (state: T) => <TKey extends string, TFn extends () => unknown>(key: Fail<TKey, Extends<TKey, KeyOf<T>>>, fn: TFn) => ReturnType<TFn>;
142
+ addFn: (state: T) => <TKey extends string, TFn extends TypedFunction>(key: Fail<TKey, KeyOf<T>>, fn: TFn) => ExpandRecursively<T["surface"] & Record<TKey, TFn>> extends T["surface"] ? UpsertKeyValue<T, "surface", ExpandRecursively<T["surface"] & Record<TKey, TFn>>> : never;
143
+ });
144
+ /**
145
+ * **ApiEscape**`<T>`
146
+ *
147
+ * Given a `T` which extends `Api` or `ApiCallback`, this utility will expose
148
+ * the escape function.
88
149
  */
89
- export type ApiReturn<T extends Dictionary | TypedFunction> = ApiEscape<T> extends TypedFunction ? ReturnType<ApiEscape<T>> : Throw<"no-escape-function">;
150
+ export type ApiEscape<T extends Dictionary | TypedFunction | ApiCallback<Api>> = T extends ApiCallback<Api> ? T extends TypedFunction ? Parameters<T>[0] extends Dictionary | TypedFunction ? GetEscapeFunction<Parameters<T>[0]> : never : never : GetEscapeFunction<T>;
90
151
  /**
91
- * **HandleApiCallback**`<TReturn, TApi>`
152
+ * **ApiHandler**`<TApi,THandle>`
92
153
  *
93
- * Given a returned value `TReturn` from the callback,
94
- * it either proxies that value through if the user completed
95
- * the API calling, or calls the _escape function_ if not.
154
+ * An API handler for a specific API
96
155
  */
97
- export type HandleApiCallback<TReturn> = TReturn extends Dictionary | TypedFunction ? GetEscapeFunction<TReturn> extends TypedFunction ? ReturnType<GetEscapeFunction<TReturn>> : TReturn : TReturn;
156
+ export type ApiHandler<TApi extends Api, _THandle extends (t: unknown, e: ErrorCondition) => unknown> = (api: TApi) => <R>(result: R) => unknown;
98
157
  export {};
99
158
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/types/api/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,YAAY,EACb,iBAAwB;AAEzB;;;;;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AClC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GACnE,cAAc,CAAC,CAAC,EAAE,SAAS,EAAG,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,GACnF,KAAK,CAAA;CAEZ,CAAC,CAAC;AAIH;;;;;GAKG;AACH,MAAM,MAAM,SAAS,CACnB,CAAC,SAAS,UAAU,GAAG,aAAa,GAAG,WAAW,CAAC,GAAG,CAAC,IACrD,CAAC,SAAS,WAAW,CAAC,GAAG,CAAC,GAC5B,CAAC,SAAS,aAAa,GACrB,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,UAAU,GAAG,aAAa,GACjD,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACnC,KAAK,GACP,KAAK,GACP,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAkBvB;;;;GAIG;AACH,MAAM,MAAM,UAAU,CACpB,IAAI,SAAS,GAAG,EAChB,QAAQ,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,cAAc,KAAK,OAAO,IACzD,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { ExpandDictionary, ExpandRecursively, FnProps } from "../..";
2
+ /**
3
+ * **EscapeFunction**`<[T]>`
4
+ *
5
+ * An escape function is a function which takes no parameters and
6
+ * marks itself by setting the key `escape` to the value **true**.
7
+ *
8
+ * If this utility is used with a generic it will ensure that the function
9
+ * has the `escape` property set. If no generic is used then it will just
10
+ * present a generalized shape for escape functions.
11
+ * ```ts
12
+ * // () => string & {escape: true}
13
+ * type Esc = EscapeFunction<() => string>;
14
+ * // () => unknown & {escape: true}
15
+ * type Esc2 = EscapeFunction;
16
+ * ```
17
+ */
18
+ export type EscapeFunction = () => any & {
19
+ escape: true;
20
+ };
21
+ export type AsEscapeFunction<T> = T extends EscapeFunction ? ExpandRecursively<T & ExpandDictionary<Record<"escape", true> & FnProps<T>>> : never;
22
+ //# sourceMappingURL=EscapeFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EscapeFunction.d.ts","sourceRoot":"","sources":["../../../../src/types/base-types/fns/EscapeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,GAAG;IAAC,MAAM,EAAE,IAAI,CAAA;CAAC,CAAC;AAExD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,GACxD,iBAAiB,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAC3E,KAAK,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { If, Some, Throw, TypedFunction } from "../../index";
2
+ /**
3
+ * **OptionalParamFn**
4
+ *
5
+ * A function which either has _no_ parameters or any parameters it
6
+ * does have are _optional_ in a way that it is safe to call it without
7
+ * any parameters.
8
+ *
9
+ * To make the runtime aware of this flexibility, a property `optionalParams`
10
+ * must be set to **true**. To convert a regular function to be this kind of
11
+ * function you can use the `AsOptionalParamFn` utility.
12
+ */
13
+ export type OptionalParamFn = ((() => any) | ((p1?: any, p2?: any, p3?: any, p4?: any) => any)) & {
14
+ optionalParams: true;
15
+ };
16
+ /**
17
+ * **AsOptionalParamFn**`<T>`
18
+ *
19
+ * Converts the function passed in into a `OptionalParamFn` where possible and
20
+ * converts to `ErrorCondition<"invalid-conversion">` otherwise.
21
+ */
22
+ export type AsOptionalParamFn<T extends TypedFunction> = Parameters<T>["length"] extends 0 ? T & {
23
+ optionalParams: true;
24
+ } : If<Some<Parameters<T>, "extends", undefined>, Throw<"invalid-conversion", `To convert to a OptionalParamFn, a function must have _no_ required Parameters but required params were found!`, `AsOptionalParamFn`, {
25
+ library: "inferred-types";
26
+ params: Parameters<T>;
27
+ }>, T & {
28
+ optionalParams: true;
29
+ }>;
30
+ //# sourceMappingURL=OptionalParamFn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionalParamFn.d.ts","sourceRoot":"","sources":["../../../../src/types/base-types/fns/OptionalParamFn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,IAAI,EACJ,KAAK,EACL,aAAa,EACd,oBAAwB;AAGzB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAC,GAAG,KAAK,GAAG,CAAC,CAC/D,GAAG;IAAE,cAAc,EAAE,IAAI,CAAA;CAAE,CAAC;AAI7B;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACxF,CAAC,GAAG;IAAE,cAAc,EAAE,IAAI,CAAA;CAAE,GAC5B,EAAE,CACA,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,EACzC,KAAK,CACH,oBAAoB,EAAE,gHAAgH,EACtI,mBAAmB,EACnB;IAAE,OAAO,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;CAAE,CACrD,EACD,CAAC,GAAG;IAAE,cAAc,EAAE,IAAI,CAAA;CAAE,CAC7B,CAAC"}
@@ -5,4 +5,6 @@ export * from "./IdentityFunction";
5
5
  export * from "./AnyFunction";
6
6
  export * from "./TypedFunction";
7
7
  export * from "./AnyFnWithDict";
8
+ export * from "./OptionalParamFn";
9
+ export * from "./EscapeFunction";
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/base-types/fns/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/base-types/fns/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
@@ -5,3 +5,5 @@ export * from "./IdentityFunction.js";
5
5
  export * from "./AnyFunction.js";
6
6
  export * from "./TypedFunction.js";
7
7
  export * from "./AnyFnWithDict.js";
8
+ export * from "./OptionalParamFn.js";
9
+ export * from "./EscapeFunction.js";
@@ -1,14 +1,13 @@
1
- import { ErrorCondition, IsBoolean, IsBooleanLiteral, IsFalse, IsNever, IsTrue, LogicFunction, ProxyError, Throw } from "../../index";
1
+ import { ErrorCondition, IsBoolean, IsBooleanLiteral, IsFalse, IsNever, IsTrue, LogicFunction, Throw } from "../../index";
2
2
  type InvalidTest<TTest> = Throw<"invalid-test", `Call of If<TTest, ...> received an invalid TTest that does not evaluate to a boolean type!`, "If", {
3
3
  library: "inferred-types";
4
4
  test: TTest;
5
5
  }>;
6
- type ReceivedError<TTest extends ErrorCondition> = ProxyError<TTest, "If", "TTest">;
7
6
  /**
8
7
  * **If**`<TTest,[TIf],[TElse],[TMaybe]>`
9
8
  *
10
9
  * Branching utility which tests `TTest` for a boolean value.
11
10
  */
12
- export type If<TTest, TIf = true, TElse = false, TMaybe = TIf | TElse, TNever = never> = [IsNever<TTest>] extends [true] ? TNever : [TTest] extends [ErrorCondition] ? ReceivedError<TTest> : [TTest] extends [boolean] ? [IsTrue<TTest>] extends [true] ? TIf : [IsBooleanLiteral<TTest>] extends [true] ? TElse : TMaybe : [TTest] extends [LogicFunction] ? [IsTrue<ReturnType<TTest>>] extends [true] ? TIf : [IsFalse<ReturnType<TTest>>] extends [true] ? TElse : [IsBoolean<ReturnType<TTest>>] extends [true] ? TMaybe : never : InvalidTest<TTest>;
11
+ export type If<TTest, TIf = true, TElse = false, TMaybe = TIf | TElse, TNever = never, TError = never> = [IsNever<TTest>] extends [true] ? TNever : [TTest] extends [ErrorCondition] ? TError : [TTest] extends [boolean] ? [IsTrue<TTest>] extends [true] ? TIf : [IsBooleanLiteral<TTest>] extends [true] ? TElse : TMaybe : [TTest] extends [LogicFunction] ? [IsTrue<ReturnType<TTest>>] extends [true] ? TIf : [IsFalse<ReturnType<TTest>>] extends [true] ? TElse : [IsBoolean<ReturnType<TTest>>] extends [true] ? TMaybe : never : InvalidTest<TTest>;
13
12
  export {};
14
13
  //# sourceMappingURL=If.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"If.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/branching/If.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAG,oBAAwB;AAE3I,KAAK,WAAW,CAAC,KAAK,IAAI,KAAK,CAC7B,cAAc,EAC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/**
3
+ * **IfUnset**`<TTest,TElse,[TIf]>`
4
+ *
5
+ * Branching utility which will proxy _any_ type through except
6
+ * for those set with `Unset<[T]>`.
7
+ *
8
+ * When `Unset` is found then it will be replaced with `TElse`.
9
+ */
10
+ export type IfUnset<TTest, TElse, TIf = TTest> = TTest extends Unset ? TElse : Exclude<TIf, Unset>;
11
+ export type IfUnsetOrUndefined<TTest, TElse, TIf = TTest> = TTest extends Unset ? TElse : IsUndefined<TTest> extends true ? TElse : Exclude<TIf, Unset | undefined>;
12
+ //# sourceMappingURL=IfUnset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IfUnset.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/branching/IfUnset.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,EACN,oBAAwB;AAGzB;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,CACjB,KAAK,EACL,KAAK,EACL,GAAG,GAAG,KAAK,IACT,KAAK,SAAS,KAAK,GACrB,KAAK,GACL,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAGtB,MAAM,MAAM,kBAAkB,CAC9B,KAAK,EACL,KAAK,EACL,GAAG,GAAG,KAAK,IACP,KAAK,SAAS,KAAK,GACrB,KAAK,GACL,WAAW,CAAC,KAAK,CAAC,SAAS,IAAI,GAC/B,KAAK,GACL,OAAO,CAAC,GAAG,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC"}
@@ -5,12 +5,13 @@ export type OnPassRemap<TNever = unknown, TFalse = unknown, TError = unknown> =
5
5
  false: TFalse;
6
6
  error: TError;
7
7
  };
8
- type Merge<A extends Partial<OnPassRemap>, TKeys extends readonly (ObjectKey & keyof A)[], TConfig extends OnPassRemap = {
8
+ type Merge<TUser extends Partial<OnPassRemap>, TKeys extends readonly (ObjectKey & keyof TUser)[], TConfig extends OnPassRemap = {
9
9
  never: never;
10
10
  false: false;
11
11
  error: Constant<"not-set">;
12
- }> = [] extends TKeys ? TConfig : Merge<A, AfterFirst<TKeys>, As<ExpandDictionary<Record<First<TKeys>, A[First<TKeys>]> & Omit<TConfig, First<TKeys>>>, OnPassRemap>>;
12
+ }> = [] extends TKeys ? TConfig : Merge<TUser, AfterFirst<TKeys>, As<ExpandDictionary<Record<First<TKeys>, TUser[First<TKeys>]> & Omit<TConfig, First<TKeys>>>, OnPassRemap>>;
13
13
  type Process<TTest, TPass, TRemap extends OnPassRemap<unknown, unknown, unknown>> = [IsNever<TTest>] extends [true] ? TRemap["never"] : [IsErrorCondition<TTest>] extends [true] ? TRemap["error"] extends Constant<"not-set"> ? TTest : TRemap["error"] : [IsFalse<TTest>] extends [true] ? TRemap["false"] : TPass;
14
+ type Iterate<TTest extends readonly unknown[], TPass, TRemap extends OnPassRemap<unknown, unknown, unknown>> = [] extends TTest ? TPass : Process<First<TTest>, TPass, TRemap> extends TPass ? Iterate<AfterFirst<TTest>, TPass, TRemap> : Process<First<TTest>, TPass, TRemap>;
14
15
  /**
15
16
  * **OnPass**`<TTest, TPass,[TRemap],[TFalse]>`
16
17
  *
@@ -24,6 +25,6 @@ type Process<TTest, TPass, TRemap extends OnPassRemap<unknown, unknown, unknown>
24
25
  * - the `TRemap` allows you to remap error conditions
25
26
  * as well if needed
26
27
  */
27
- export type OnPass<TTest, TPass, TRemap extends Partial<OnPassRemap<unknown, unknown, unknown>> = OnPassRemap<never, false, Constant<"not-set">>> = Process<TTest, TPass, TRemap extends OnPassRemap<never, false, Constant<"not-set">> ? TRemap : Merge<TRemap, Keys<TRemap>>>;
28
+ export type OnPass<TTest, TPass, TRemap extends Partial<OnPassRemap<unknown, unknown, unknown>> = OnPassRemap<never, false, Constant<"not-set">>> = TTest extends readonly unknown[] ? Iterate<TTest, TPass, TRemap extends OnPassRemap<never, false, Constant<"not-set">> ? TRemap : Merge<TRemap, Keys<TRemap>>> : Process<TTest, TPass, TRemap extends OnPassRemap<never, false, Constant<"not-set">> ? TRemap : Merge<TRemap, Keys<TRemap>>>;
28
29
  export {};
29
30
  //# sourceMappingURL=OnPass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OnPass.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/branching/OnPass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,EAAE,EACF,gBAAgB,EAChB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,OAAO,EACR,oBAAwB;AACzB,OAAO,EAAE,QAAQ,EAAE,iCAA4B;AAE/C,MAAM,MAAM,WAAW,CACrB,MAAM,GAAG,OAAO,EAChB,MAAM,GAAG,OAAO,EAChB,MAAM,GAAG,OAAO,IACd;IACF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,KAAK,KAAK,CACR,CAAC,SAAS,OAAO,CAAC,WAAW,CAAC,EAC9B,KAAK,SAAS,SAAS,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC,EAAE,EAC9C,OAAO,SAAS,WAAW,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAA;CAAE,IACtF,EAAE,SAAS,KAAK,GAChB,OAAO,GACP,KAAK,CACL,CAAC,EACD,UAAU,CAAC,KAAK,CAAC,EACjB,EAAE,CAAC,gBAAgB,CACjB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GACnC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAC9B,EAAE,WAAW,CAAC,CAChB,CAAC;AAGJ,KAAK,OAAO,CACV,KAAK,EACL,KAAK,EACL,MAAM,SAAS,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,IACnD,CAAC,OAAO,CAAC,KAAK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K,GAClB,KAAK,GACL,OAAO,CACL,KAAK,CAAC,KAAK,CAAC,EACZ,KAAK,EACL,MAAM,CACP,SAAS,KAAK,GAGb,OAAO,CACL,UAAU,CAAC,KAAK,CAAC,EACjB,KAAK,EACL,MAAM,CACP,GACD,OAAO,CACP,KAAK,CAAC,KAAK,CAAC,EACZ,KAAK,EACL,MAAM,CACP,CAEF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,MAAM,CAChB,KAAK,EACL,KAAK,EACL,MAAM,SAAS,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,IAC7G,KAAK,SAAS,SAAS,OAAO,EAAE,GAClC,OAAO,CAAC,KAAK,EAAC,KAAK,EAAC,MAAM,SAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,GAC7E,MAAM,GACN,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAC9B,GAED,OAAO,CACL,KAAK,EACL,KAAK,EACL,MAAM,SAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,GAC3D,MAAM,GACN,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAC9B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { IsNever } from "../operators";
2
+ /**
3
+ * **WhenNever**`<T, [TMapTo]>`
4
+ *
5
+ * When `T` is _never_ this utility will map it to `TMapTo`; in all
6
+ * other cases it just proxies `T` through.
7
+ *
8
+ * **Note:** if not specified, `TMapTo` will be set to **false**.
9
+ */
10
+ export type WhenNever<T, TMapTo = false> = IsNever<T> extends true ? TMapTo : T;
11
+ //# sourceMappingURL=WhenNever.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WhenNever.d.ts","sourceRoot":"","sources":["../../../../src/types/boolean-logic/branching/WhenNever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CACnB,CAAC,EACD,MAAM,GAAG,KAAK,IACZ,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,GACzB,MAAM,GACN,CAAC,CAAC"}
@@ -11,4 +11,6 @@ export * from "./Default";
11
11
  export * from "./Iff";
12
12
  export * from "./Fail";
13
13
  export * from "./OnPass";
14
+ export * from "./IfUnset";
15
+ export * from "./WhenNever";
14
16
  //# sourceMappingURL=index.d.ts.map