@start9labs/start-sdk 0.4.0-beta.4 → 0.4.0-beta.41

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 (324) hide show
  1. package/base/lib/Effects.d.ts +6 -34
  2. package/base/lib/actions/index.d.ts +13 -14
  3. package/base/lib/actions/index.js +4 -4
  4. package/base/lib/actions/index.js.map +1 -1
  5. package/base/lib/actions/input/builder/inputSpec.d.ts +16 -26
  6. package/base/lib/actions/input/builder/inputSpec.js +9 -24
  7. package/base/lib/actions/input/builder/inputSpec.js.map +1 -1
  8. package/base/lib/actions/input/builder/list.d.ts +13 -24
  9. package/base/lib/actions/input/builder/list.js +19 -30
  10. package/base/lib/actions/input/builder/list.js.map +1 -1
  11. package/base/lib/actions/input/builder/value.d.ts +394 -64
  12. package/base/lib/actions/input/builder/value.js +542 -213
  13. package/base/lib/actions/input/builder/value.js.map +1 -1
  14. package/base/lib/actions/input/builder/variants.d.ts +27 -24
  15. package/base/lib/actions/input/builder/variants.js +25 -24
  16. package/base/lib/actions/input/builder/variants.js.map +1 -1
  17. package/base/lib/actions/input/inputSpecConstants.d.ts +25 -17
  18. package/base/lib/actions/input/inputSpecConstants.js +16 -12
  19. package/base/lib/actions/input/inputSpecConstants.js.map +1 -1
  20. package/base/lib/actions/input/inputSpecTypes.d.ts +0 -3
  21. package/base/lib/actions/input/inputSpecTypes.js.map +1 -1
  22. package/base/lib/actions/setupActions.d.ts +21 -15
  23. package/base/lib/actions/setupActions.js +42 -7
  24. package/base/lib/actions/setupActions.js.map +1 -1
  25. package/base/lib/dependencies/dependencies.d.ts +7 -3
  26. package/base/lib/dependencies/dependencies.js +34 -25
  27. package/base/lib/dependencies/dependencies.js.map +1 -1
  28. package/base/lib/dependencies/setupDependencies.d.ts +2 -4
  29. package/base/lib/dependencies/setupDependencies.js +3 -10
  30. package/base/lib/dependencies/setupDependencies.js.map +1 -1
  31. package/base/lib/exver/index.js +1 -1
  32. package/base/lib/exver/index.js.map +1 -1
  33. package/base/lib/index.d.ts +1 -0
  34. package/base/lib/index.js +2 -1
  35. package/base/lib/index.js.map +1 -1
  36. package/base/lib/inits/index.d.ts +2 -0
  37. package/base/lib/inits/index.js +19 -0
  38. package/base/lib/inits/index.js.map +1 -0
  39. package/base/lib/inits/setupInit.d.ts +9 -0
  40. package/base/lib/inits/setupInit.js +40 -0
  41. package/base/lib/inits/setupInit.js.map +1 -0
  42. package/base/lib/inits/setupUninit.d.ts +25 -0
  43. package/base/lib/inits/setupUninit.js +24 -0
  44. package/base/lib/inits/setupUninit.js.map +1 -0
  45. package/base/lib/interfaces/Host.js +18 -6
  46. package/base/lib/interfaces/Host.js.map +1 -1
  47. package/base/lib/interfaces/Origin.d.ts +2 -2
  48. package/base/lib/interfaces/Origin.js +3 -3
  49. package/base/lib/interfaces/Origin.js.map +1 -1
  50. package/base/lib/interfaces/ServiceInterfaceBuilder.d.ts +2 -2
  51. package/base/lib/interfaces/setupInterfaces.d.ts +2 -4
  52. package/base/lib/interfaces/setupInterfaces.js +8 -17
  53. package/base/lib/interfaces/setupInterfaces.js.map +1 -1
  54. package/base/lib/osBindings/ActionInput.d.ts +2 -0
  55. package/base/lib/osBindings/ActionInput.js +0 -1
  56. package/base/lib/osBindings/ActionInput.js.map +1 -1
  57. package/base/lib/osBindings/AddCategoryParams.d.ts +0 -2
  58. package/base/lib/osBindings/AddPackageToCategoryParams.d.ts +5 -0
  59. package/base/lib/osBindings/AddPackageToCategoryParams.js +3 -0
  60. package/base/lib/osBindings/AddPackageToCategoryParams.js.map +1 -0
  61. package/base/lib/osBindings/AddProxyParams.d.ts +5 -0
  62. package/base/lib/osBindings/AddProxyParams.js +4 -0
  63. package/base/lib/osBindings/AddProxyParams.js.map +1 -0
  64. package/base/lib/osBindings/AddTunnelParams.d.ts +5 -0
  65. package/base/lib/osBindings/AddTunnelParams.js +4 -0
  66. package/base/lib/osBindings/AddTunnelParams.js.map +1 -0
  67. package/base/lib/osBindings/AttachParams.d.ts +1 -0
  68. package/base/lib/osBindings/BindingGatewaySetEnabledParams.d.ts +6 -0
  69. package/base/lib/osBindings/BindingGatewaySetEnabledParams.js +3 -0
  70. package/base/lib/osBindings/BindingGatewaySetEnabledParams.js.map +1 -0
  71. package/base/lib/osBindings/Category.d.ts +0 -2
  72. package/base/lib/osBindings/Category.js +1 -0
  73. package/base/lib/osBindings/Category.js.map +1 -1
  74. package/base/lib/osBindings/CheckDependenciesResult.d.ts +3 -3
  75. package/base/lib/osBindings/ClearTasksParams.d.ts +5 -0
  76. package/base/lib/osBindings/ClearTasksParams.js +4 -0
  77. package/base/lib/osBindings/ClearTasksParams.js.map +1 -0
  78. package/base/lib/osBindings/CreateTaskParams.d.ts +15 -0
  79. package/base/lib/osBindings/CreateTaskParams.js +3 -0
  80. package/base/lib/osBindings/CreateTaskParams.js.map +1 -0
  81. package/base/lib/osBindings/DepInfo.d.ts +2 -3
  82. package/base/lib/osBindings/DnsSettings.d.ts +4 -0
  83. package/base/lib/osBindings/DnsSettings.js +4 -0
  84. package/base/lib/osBindings/DnsSettings.js.map +1 -0
  85. package/base/lib/osBindings/DomainConfig.d.ts +1 -0
  86. package/base/lib/osBindings/DomainSettings.d.ts +4 -0
  87. package/base/lib/osBindings/DomainSettings.js +3 -0
  88. package/base/lib/osBindings/DomainSettings.js.map +1 -0
  89. package/base/lib/osBindings/Domains.d.ts +7 -0
  90. package/base/lib/osBindings/Domains.js +3 -0
  91. package/base/lib/osBindings/Domains.js.map +1 -0
  92. package/base/lib/osBindings/EventId.d.ts +4 -0
  93. package/base/lib/osBindings/EventId.js +3 -0
  94. package/base/lib/osBindings/EventId.js.map +1 -0
  95. package/base/lib/osBindings/FileType.d.ts +1 -0
  96. package/base/lib/osBindings/FileType.js +4 -0
  97. package/base/lib/osBindings/FileType.js.map +1 -0
  98. package/base/lib/osBindings/ForgetGatewayParams.d.ts +4 -0
  99. package/base/lib/osBindings/ForgetGatewayParams.js +3 -0
  100. package/base/lib/osBindings/ForgetGatewayParams.js.map +1 -0
  101. package/base/lib/osBindings/ForgetInterfaceParams.d.ts +2 -1
  102. package/base/lib/osBindings/ForgetInterfaceParams.js +0 -1
  103. package/base/lib/osBindings/ForgetInterfaceParams.js.map +1 -1
  104. package/base/lib/osBindings/GatewayId.d.ts +1 -0
  105. package/base/lib/osBindings/GatewayId.js +4 -0
  106. package/base/lib/osBindings/GatewayId.js.map +1 -0
  107. package/base/lib/osBindings/GatewayInfo.d.ts +6 -0
  108. package/base/lib/osBindings/GatewayInfo.js +3 -0
  109. package/base/lib/osBindings/GatewayInfo.js.map +1 -0
  110. package/base/lib/osBindings/GetOsVersionParams.d.ts +3 -3
  111. package/base/lib/osBindings/GetPackageParams.d.ts +1 -1
  112. package/base/lib/osBindings/Host.d.ts +4 -3
  113. package/base/lib/osBindings/HostnameInfo.d.ts +2 -1
  114. package/base/lib/osBindings/IpHostname.d.ts +1 -2
  115. package/base/lib/osBindings/IpInfo.d.ts +2 -0
  116. package/base/lib/osBindings/LoginParams.d.ts +1 -2
  117. package/base/lib/osBindings/LoginParams.js +1 -0
  118. package/base/lib/osBindings/LoginParams.js.map +1 -1
  119. package/base/lib/osBindings/MainStatus.d.ts +0 -2
  120. package/base/lib/osBindings/Manifest.d.ts +3 -1
  121. package/base/lib/osBindings/Metadata.d.ts +5 -0
  122. package/base/lib/osBindings/Metadata.js +3 -0
  123. package/base/lib/osBindings/Metadata.js.map +1 -0
  124. package/base/lib/osBindings/MetadataSrc.d.ts +7 -0
  125. package/base/lib/osBindings/MetadataSrc.js +3 -0
  126. package/base/lib/osBindings/MetadataSrc.js.map +1 -0
  127. package/base/lib/osBindings/MountTarget.d.ts +2 -0
  128. package/base/lib/osBindings/NetInfo.d.ts +3 -1
  129. package/base/lib/osBindings/NetInfo.js +0 -1
  130. package/base/lib/osBindings/NetInfo.js.map +1 -1
  131. package/base/lib/osBindings/NetworkInfo.d.ts +5 -2
  132. package/base/lib/osBindings/NetworkInterfaceInfo.d.ts +3 -2
  133. package/base/lib/osBindings/NetworkInterfaceSetPublicParams.d.ts +2 -1
  134. package/base/lib/osBindings/NetworkInterfaceSetPublicParams.js +0 -1
  135. package/base/lib/osBindings/NetworkInterfaceSetPublicParams.js.map +1 -1
  136. package/base/lib/osBindings/PackageDataEntry.d.ts +5 -5
  137. package/base/lib/osBindings/PackageVersionInfo.d.ts +2 -0
  138. package/base/lib/osBindings/Progress.d.ts +2 -0
  139. package/base/lib/osBindings/Progress.js +0 -1
  140. package/base/lib/osBindings/Progress.js.map +1 -1
  141. package/base/lib/osBindings/ProgressUnits.d.ts +1 -0
  142. package/base/lib/osBindings/ProgressUnits.js +4 -0
  143. package/base/lib/osBindings/ProgressUnits.js.map +1 -0
  144. package/base/lib/osBindings/Proxies.d.ts +4 -0
  145. package/base/lib/osBindings/Proxies.js +3 -0
  146. package/base/lib/osBindings/Proxies.js.map +1 -0
  147. package/base/lib/osBindings/ProxyInfo.d.ts +4 -0
  148. package/base/lib/osBindings/ProxyInfo.js +4 -0
  149. package/base/lib/osBindings/ProxyInfo.js.map +1 -0
  150. package/base/lib/osBindings/PublicDomainConfig.d.ts +6 -0
  151. package/base/lib/osBindings/PublicDomainConfig.js +3 -0
  152. package/base/lib/osBindings/PublicDomainConfig.js.map +1 -0
  153. package/base/lib/osBindings/RemoveAdminParams.d.ts +4 -0
  154. package/base/lib/osBindings/RemoveAdminParams.js +3 -0
  155. package/base/lib/osBindings/RemoveAdminParams.js.map +1 -0
  156. package/base/lib/osBindings/RemoveAssetParams.d.ts +4 -0
  157. package/base/lib/osBindings/RemoveAssetParams.js +4 -0
  158. package/base/lib/osBindings/RemoveAssetParams.js.map +1 -0
  159. package/base/lib/osBindings/RemovePackageFromCategoryParams.d.ts +5 -0
  160. package/base/lib/osBindings/RemovePackageFromCategoryParams.js +3 -0
  161. package/base/lib/osBindings/RemovePackageFromCategoryParams.js.map +1 -0
  162. package/base/lib/osBindings/RemovePackageParams.d.ts +6 -0
  163. package/base/lib/osBindings/RemovePackageParams.js +3 -0
  164. package/base/lib/osBindings/RemovePackageParams.js.map +1 -0
  165. package/base/lib/osBindings/RemoveProxyParams.d.ts +3 -0
  166. package/base/lib/osBindings/RemoveProxyParams.js +4 -0
  167. package/base/lib/osBindings/RemoveProxyParams.js.map +1 -0
  168. package/base/lib/osBindings/RemoveTunnelParams.d.ts +4 -0
  169. package/base/lib/osBindings/RemoveTunnelParams.js +3 -0
  170. package/base/lib/osBindings/RemoveTunnelParams.js.map +1 -0
  171. package/base/lib/osBindings/RenameGatewayParams.d.ts +5 -0
  172. package/base/lib/osBindings/RenameGatewayParams.js +3 -0
  173. package/base/lib/osBindings/RenameGatewayParams.js.map +1 -0
  174. package/base/lib/osBindings/RenameInterfaceParams.d.ts +5 -0
  175. package/base/lib/osBindings/RenameInterfaceParams.js +3 -0
  176. package/base/lib/osBindings/RenameInterfaceParams.js.map +1 -0
  177. package/base/lib/osBindings/ServerInfo.d.ts +2 -1
  178. package/base/lib/osBindings/Sessions.d.ts +2 -5
  179. package/base/lib/osBindings/Sessions.js +0 -1
  180. package/base/lib/osBindings/Sessions.js.map +1 -1
  181. package/base/lib/osBindings/SetupExecuteParams.d.ts +1 -0
  182. package/base/lib/osBindings/Task.d.ts +13 -0
  183. package/base/lib/osBindings/Task.js +3 -0
  184. package/base/lib/osBindings/Task.js.map +1 -0
  185. package/base/lib/osBindings/TaskCondition.d.ts +1 -0
  186. package/base/lib/osBindings/TaskCondition.js +4 -0
  187. package/base/lib/osBindings/TaskCondition.js.map +1 -0
  188. package/base/lib/osBindings/TaskEntry.d.ts +5 -0
  189. package/base/lib/osBindings/TaskEntry.js +3 -0
  190. package/base/lib/osBindings/TaskEntry.js.map +1 -0
  191. package/base/lib/osBindings/TaskInput.d.ts +4 -0
  192. package/base/lib/osBindings/TaskInput.js +4 -0
  193. package/base/lib/osBindings/TaskInput.js.map +1 -0
  194. package/base/lib/osBindings/TaskSeverity.d.ts +1 -0
  195. package/base/lib/osBindings/TaskSeverity.js +4 -0
  196. package/base/lib/osBindings/TaskSeverity.js.map +1 -0
  197. package/base/lib/osBindings/TaskTrigger.d.ts +5 -0
  198. package/base/lib/osBindings/TaskTrigger.js +3 -0
  199. package/base/lib/osBindings/TaskTrigger.js.map +1 -0
  200. package/base/lib/osBindings/UnsetInboundParams.d.ts +2 -1
  201. package/base/lib/osBindings/UnsetInboundParams.js +0 -1
  202. package/base/lib/osBindings/UnsetInboundParams.js.map +1 -1
  203. package/base/lib/osBindings/UnsetPublicParams.d.ts +2 -1
  204. package/base/lib/osBindings/UnsetPublicParams.js +0 -1
  205. package/base/lib/osBindings/UnsetPublicParams.js.map +1 -1
  206. package/base/lib/osBindings/UpdatingState.d.ts +1 -0
  207. package/base/lib/osBindings/index.d.ts +30 -18
  208. package/base/lib/s9pk/index.d.ts +2 -3
  209. package/base/lib/s9pk/index.js +9 -15
  210. package/base/lib/s9pk/index.js.map +1 -1
  211. package/base/lib/types/ManifestTypes.d.ts +4 -0
  212. package/base/lib/types.d.ts +23 -34
  213. package/base/lib/types.js +13 -0
  214. package/base/lib/types.js.map +1 -1
  215. package/base/lib/util/Drop.d.ts +47 -0
  216. package/base/lib/util/Drop.js +130 -0
  217. package/base/lib/util/Drop.js.map +1 -0
  218. package/base/lib/util/GetSystemSmtp.d.ts +11 -2
  219. package/base/lib/util/GetSystemSmtp.js +33 -7
  220. package/base/lib/util/GetSystemSmtp.js.map +1 -1
  221. package/base/lib/util/deepMerge.js +6 -1
  222. package/base/lib/util/deepMerge.js.map +1 -1
  223. package/base/lib/util/getServiceInterface.d.ts +53 -5
  224. package/base/lib/util/getServiceInterface.js +54 -19
  225. package/base/lib/util/getServiceInterface.js.map +1 -1
  226. package/base/lib/util/getServiceInterfaces.d.ts +11 -2
  227. package/base/lib/util/getServiceInterfaces.js +33 -7
  228. package/base/lib/util/getServiceInterfaces.js.map +1 -1
  229. package/base/lib/util/graph.d.ts +1 -0
  230. package/base/lib/util/graph.js +12 -0
  231. package/base/lib/util/graph.js.map +1 -1
  232. package/base/lib/util/index.d.ts +1 -2
  233. package/base/lib/util/index.js +5 -8
  234. package/base/lib/util/index.js.map +1 -1
  235. package/base/lib/util/ip.d.ts +19 -0
  236. package/base/lib/util/ip.js +92 -0
  237. package/base/lib/util/ip.js.map +1 -0
  238. package/package/lib/StartSdk.d.ts +116 -572
  239. package/package/lib/StartSdk.js +111 -435
  240. package/package/lib/StartSdk.js.map +1 -1
  241. package/package/lib/backup/Backups.d.ts +9 -3
  242. package/package/lib/backup/Backups.js +38 -28
  243. package/package/lib/backup/Backups.js.map +1 -1
  244. package/package/lib/backup/setupBackups.d.ts +5 -2
  245. package/package/lib/backup/setupBackups.js +7 -5
  246. package/package/lib/backup/setupBackups.js.map +1 -1
  247. package/package/lib/health/HealthCheck.d.ts +0 -1
  248. package/package/lib/health/HealthCheck.js +1 -7
  249. package/package/lib/health/HealthCheck.js.map +1 -1
  250. package/package/lib/health/checkFns/runHealthScript.js +1 -1
  251. package/package/lib/health/checkFns/runHealthScript.js.map +1 -1
  252. package/package/lib/index.d.ts +0 -3
  253. package/package/lib/index.js +1 -8
  254. package/package/lib/index.js.map +1 -1
  255. package/package/lib/inits/index.d.ts +2 -3
  256. package/package/lib/inits/index.js +16 -3
  257. package/package/lib/inits/index.js.map +1 -1
  258. package/package/lib/inits/setupInit.d.ts +7 -13
  259. package/package/lib/inits/setupInit.js +22 -48
  260. package/package/lib/inits/setupInit.js.map +1 -1
  261. package/package/lib/inits/setupInstall.d.ts +10 -10
  262. package/package/lib/inits/setupInstall.js.map +1 -1
  263. package/package/lib/inits/setupUninit.d.ts +7 -0
  264. package/package/lib/inits/setupUninit.js +14 -0
  265. package/package/lib/inits/setupUninit.js.map +1 -0
  266. package/package/lib/inits/setupUninstall.d.ts +5 -5
  267. package/package/lib/inits/setupUninstall.js.map +1 -1
  268. package/package/lib/mainFn/CommandController.d.ts +6 -22
  269. package/package/lib/mainFn/CommandController.js +68 -41
  270. package/package/lib/mainFn/CommandController.js.map +1 -1
  271. package/package/lib/mainFn/Daemon.d.ts +15 -20
  272. package/package/lib/mainFn/Daemon.js +71 -17
  273. package/package/lib/mainFn/Daemon.js.map +1 -1
  274. package/package/lib/mainFn/Daemons.d.ts +76 -45
  275. package/package/lib/mainFn/Daemons.js +104 -30
  276. package/package/lib/mainFn/Daemons.js.map +1 -1
  277. package/package/lib/mainFn/HealthDaemon.d.ts +6 -5
  278. package/package/lib/mainFn/HealthDaemon.js +79 -38
  279. package/package/lib/mainFn/HealthDaemon.js.map +1 -1
  280. package/package/lib/mainFn/Mounts.d.ts +32 -45
  281. package/package/lib/mainFn/Mounts.js +13 -55
  282. package/package/lib/mainFn/Mounts.js.map +1 -1
  283. package/package/lib/mainFn/Oneshot.d.ts +12 -0
  284. package/package/lib/mainFn/Oneshot.js +23 -0
  285. package/package/lib/mainFn/Oneshot.js.map +1 -0
  286. package/package/lib/mainFn/index.d.ts +1 -1
  287. package/package/lib/manifest/setupManifest.js +3 -0
  288. package/package/lib/manifest/setupManifest.js.map +1 -1
  289. package/package/lib/test/host.test.js +1 -1
  290. package/package/lib/test/host.test.js.map +1 -1
  291. package/package/lib/test/inputSpecBuilder.test.js +153 -158
  292. package/package/lib/test/inputSpecBuilder.test.js.map +1 -1
  293. package/package/lib/test/output.d.ts +8 -37
  294. package/package/lib/test/output.js +41 -40
  295. package/package/lib/test/output.js.map +1 -1
  296. package/package/lib/test/output.sdk.d.ts +154 -949
  297. package/package/lib/test/output.sdk.js +1 -4
  298. package/package/lib/test/output.sdk.js.map +1 -1
  299. package/package/lib/test/output.test.js +12 -8
  300. package/package/lib/test/output.test.js.map +1 -1
  301. package/package/lib/util/Drop.d.ts +4 -2
  302. package/package/lib/util/Drop.js +29 -7
  303. package/package/lib/util/Drop.js.map +1 -1
  304. package/package/lib/util/GetSslCertificate.d.ts +11 -2
  305. package/package/lib/util/GetSslCertificate.js +33 -7
  306. package/package/lib/util/GetSslCertificate.js.map +1 -1
  307. package/package/lib/util/SubContainer.d.ts +131 -37
  308. package/package/lib/util/SubContainer.js +155 -42
  309. package/package/lib/util/SubContainer.js.map +1 -1
  310. package/package/lib/util/fileHelper.d.ts +50 -17
  311. package/package/lib/util/fileHelper.js +166 -52
  312. package/package/lib/util/fileHelper.js.map +1 -1
  313. package/package/lib/util/index.d.ts +1 -2
  314. package/package/lib/util/index.js +2 -4
  315. package/package/lib/util/index.js.map +1 -1
  316. package/package/lib/version/VersionGraph.d.ts +27 -5
  317. package/package/lib/version/VersionGraph.js +110 -24
  318. package/package/lib/version/VersionGraph.js.map +1 -1
  319. package/package/lib/version/VersionInfo.d.ts +8 -3
  320. package/package/lib/version/VersionInfo.js.map +1 -1
  321. package/package/package.json +63 -0
  322. package/package/scripts/oldSpecToBuilder.js +5 -4
  323. package/package/scripts/oldSpecToBuilder.js.map +1 -1
  324. package/package.json +7 -8
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Value = void 0;
3
+ exports.Value = exports.fileInfoParser = void 0;
4
4
  const util_1 = require("../../../util");
5
5
  const ts_matches_1 = require("ts-matches");
6
+ exports.fileInfoParser = (0, ts_matches_1.object)({
7
+ path: ts_matches_1.string,
8
+ commitment: (0, ts_matches_1.object)({ hash: ts_matches_1.string, size: ts_matches_1.number }),
9
+ });
6
10
  const testForAsRequiredParser = (0, util_1.once)(() => (0, ts_matches_1.object)({ required: (0, ts_matches_1.literal)(true) }).test);
7
11
  function asRequiredParser(parser, input) {
8
12
  if (testForAsRequiredParser()(input))
@@ -16,47 +20,78 @@ class Value {
16
20
  this._TYPE = null;
17
21
  this._PARTIAL = null;
18
22
  }
23
+ /**
24
+ * @description Displays a boolean toggle to enable/disable
25
+ * @example
26
+ * ```
27
+ toggleExample: Value.toggle({
28
+ // required
29
+ name: 'Toggle Example',
30
+ default: true,
31
+
32
+ // optional
33
+ description: null,
34
+ warning: null,
35
+ immutable: false,
36
+ }),
37
+ * ```
38
+ */
19
39
  static toggle(a) {
40
+ const validator = ts_matches_1.boolean;
20
41
  return new Value(async () => ({
21
- description: null,
22
- warning: null,
23
- type: "toggle",
24
- disabled: false,
25
- immutable: a.immutable ?? false,
26
- ...a,
27
- }), ts_matches_1.boolean);
42
+ spec: {
43
+ description: null,
44
+ warning: null,
45
+ type: "toggle",
46
+ disabled: false,
47
+ immutable: a.immutable ?? false,
48
+ ...a,
49
+ },
50
+ validator,
51
+ }), validator);
28
52
  }
29
53
  static dynamicToggle(a) {
54
+ const validator = ts_matches_1.boolean;
30
55
  return new Value(async (options) => ({
31
- description: null,
32
- warning: null,
33
- type: "toggle",
34
- disabled: false,
35
- immutable: false,
36
- ...(await a(options)),
37
- }), ts_matches_1.boolean);
56
+ spec: {
57
+ description: null,
58
+ warning: null,
59
+ type: "toggle",
60
+ disabled: false,
61
+ immutable: false,
62
+ ...(await a(options)),
63
+ },
64
+ validator,
65
+ }), validator);
38
66
  }
67
+ /**
68
+ * @description Displays a text input field
69
+ * @example
70
+ * ```
71
+ textExample: Value.text({
72
+ // required
73
+ name: 'Text Example',
74
+ required: false,
75
+ default: null,
76
+
77
+ // optional
78
+ description: null,
79
+ placeholder: null,
80
+ warning: null,
81
+ generate: null,
82
+ inputmode: 'text',
83
+ masked: false,
84
+ minLength: null,
85
+ maxLength: null,
86
+ patterns: [],
87
+ immutable: false,
88
+ }),
89
+ * ```
90
+ */
39
91
  static text(a) {
92
+ const validator = asRequiredParser(ts_matches_1.string, a);
40
93
  return new Value(async () => ({
41
- type: "text",
42
- description: null,
43
- warning: null,
44
- masked: false,
45
- placeholder: null,
46
- minLength: null,
47
- maxLength: null,
48
- patterns: [],
49
- inputmode: "text",
50
- disabled: false,
51
- immutable: a.immutable ?? false,
52
- generate: a.generate ?? null,
53
- ...a,
54
- }), asRequiredParser(ts_matches_1.string, a));
55
- }
56
- static dynamicText(getA) {
57
- return new Value(async (options) => {
58
- const a = await getA(options);
59
- return {
94
+ spec: {
60
95
  type: "text",
61
96
  description: null,
62
97
  warning: null,
@@ -67,13 +102,58 @@ class Value {
67
102
  patterns: [],
68
103
  inputmode: "text",
69
104
  disabled: false,
70
- immutable: false,
105
+ immutable: a.immutable ?? false,
71
106
  generate: a.generate ?? null,
72
107
  ...a,
108
+ },
109
+ validator,
110
+ }), validator);
111
+ }
112
+ static dynamicText(getA) {
113
+ return new Value(async (options) => {
114
+ const a = await getA(options);
115
+ return {
116
+ spec: {
117
+ type: "text",
118
+ description: null,
119
+ warning: null,
120
+ masked: false,
121
+ placeholder: null,
122
+ minLength: null,
123
+ maxLength: null,
124
+ patterns: [],
125
+ inputmode: "text",
126
+ disabled: false,
127
+ immutable: false,
128
+ generate: a.generate ?? null,
129
+ ...a,
130
+ },
131
+ validator: asRequiredParser(ts_matches_1.string, a),
73
132
  };
74
133
  }, ts_matches_1.string.nullable());
75
134
  }
135
+ /**
136
+ * @description Displays a large textarea field for long form entry.
137
+ * @example
138
+ * ```
139
+ textareaExample: Value.textarea({
140
+ // required
141
+ name: 'Textarea Example',
142
+ required: false,
143
+ default: null,
144
+
145
+ // optional
146
+ description: null,
147
+ placeholder: null,
148
+ warning: null,
149
+ minLength: null,
150
+ maxLength: null,
151
+ immutable: false,
152
+ }),
153
+ * ```
154
+ */
76
155
  static textarea(a) {
156
+ const validator = asRequiredParser(ts_matches_1.string, a);
77
157
  return new Value(async () => {
78
158
  const built = {
79
159
  description: null,
@@ -86,44 +166,55 @@ class Value {
86
166
  immutable: a.immutable ?? false,
87
167
  ...a,
88
168
  };
89
- return built;
90
- }, asRequiredParser(ts_matches_1.string, a));
169
+ return { spec: built, validator };
170
+ }, validator);
91
171
  }
92
172
  static dynamicTextarea(getA) {
93
173
  return new Value(async (options) => {
94
174
  const a = await getA(options);
95
175
  return {
96
- description: null,
97
- warning: null,
98
- minLength: null,
99
- maxLength: null,
100
- placeholder: null,
101
- type: "textarea",
102
- disabled: false,
103
- immutable: false,
104
- ...a,
176
+ spec: {
177
+ description: null,
178
+ warning: null,
179
+ minLength: null,
180
+ maxLength: null,
181
+ placeholder: null,
182
+ type: "textarea",
183
+ disabled: false,
184
+ immutable: false,
185
+ ...a,
186
+ },
187
+ validator: asRequiredParser(ts_matches_1.string, a),
105
188
  };
106
189
  }, ts_matches_1.string.nullable());
107
190
  }
191
+ /**
192
+ * @description Displays a number input field
193
+ * @example
194
+ * ```
195
+ numberExample: Value.number({
196
+ // required
197
+ name: 'Number Example',
198
+ required: false,
199
+ default: null,
200
+ integer: true,
201
+
202
+ // optional
203
+ description: null,
204
+ placeholder: null,
205
+ warning: null,
206
+ min: null,
207
+ max: null,
208
+ immutable: false,
209
+ step: null,
210
+ units: null,
211
+ }),
212
+ * ```
213
+ */
108
214
  static number(a) {
215
+ const validator = asRequiredParser(ts_matches_1.number, a);
109
216
  return new Value(() => ({
110
- type: "number",
111
- description: null,
112
- warning: null,
113
- min: null,
114
- max: null,
115
- step: null,
116
- units: null,
117
- placeholder: null,
118
- disabled: false,
119
- immutable: a.immutable ?? false,
120
- ...a,
121
- }), asRequiredParser(ts_matches_1.number, a));
122
- }
123
- static dynamicNumber(getA) {
124
- return new Value(async (options) => {
125
- const a = await getA(options);
126
- return {
217
+ spec: {
127
218
  type: "number",
128
219
  description: null,
129
220
  warning: null,
@@ -133,232 +224,470 @@ class Value {
133
224
  units: null,
134
225
  placeholder: null,
135
226
  disabled: false,
136
- immutable: false,
227
+ immutable: a.immutable ?? false,
137
228
  ...a,
229
+ },
230
+ validator,
231
+ }), validator);
232
+ }
233
+ static dynamicNumber(getA) {
234
+ return new Value(async (options) => {
235
+ const a = await getA(options);
236
+ return {
237
+ spec: {
238
+ type: "number",
239
+ description: null,
240
+ warning: null,
241
+ min: null,
242
+ max: null,
243
+ step: null,
244
+ units: null,
245
+ placeholder: null,
246
+ disabled: false,
247
+ immutable: false,
248
+ ...a,
249
+ },
250
+ validator: asRequiredParser(ts_matches_1.number, a),
138
251
  };
139
252
  }, ts_matches_1.number.nullable());
140
253
  }
254
+ /**
255
+ * @description Displays a browser-native color selector.
256
+ * @example
257
+ * ```
258
+ colorExample: Value.color({
259
+ // required
260
+ name: 'Color Example',
261
+ required: false,
262
+ default: null,
263
+
264
+ // optional
265
+ description: null,
266
+ warning: null,
267
+ immutable: false,
268
+ }),
269
+ * ```
270
+ */
141
271
  static color(a) {
272
+ const validator = asRequiredParser(ts_matches_1.string, a);
142
273
  return new Value(() => ({
143
- type: "color",
144
- description: null,
145
- warning: null,
146
- disabled: false,
147
- immutable: a.immutable ?? false,
148
- ...a,
149
- }), asRequiredParser(ts_matches_1.string, a));
150
- }
151
- static dynamicColor(getA) {
152
- return new Value(async (options) => {
153
- const a = await getA(options);
154
- return {
274
+ spec: {
155
275
  type: "color",
156
276
  description: null,
157
277
  warning: null,
158
278
  disabled: false,
159
- immutable: false,
279
+ immutable: a.immutable ?? false,
160
280
  ...a,
281
+ },
282
+ validator,
283
+ }), validator);
284
+ }
285
+ static dynamicColor(getA) {
286
+ return new Value(async (options) => {
287
+ const a = await getA(options);
288
+ return {
289
+ spec: {
290
+ type: "color",
291
+ description: null,
292
+ warning: null,
293
+ disabled: false,
294
+ immutable: false,
295
+ ...a,
296
+ },
297
+ validator: asRequiredParser(ts_matches_1.string, a),
161
298
  };
162
299
  }, ts_matches_1.string.nullable());
163
300
  }
301
+ /**
302
+ * @description Displays a browser-native date/time selector.
303
+ * @example
304
+ * ```
305
+ datetimeExample: Value.datetime({
306
+ // required
307
+ name: 'Datetime Example',
308
+ required: false,
309
+ default: null,
310
+
311
+ // optional
312
+ description: null,
313
+ warning: null,
314
+ immutable: false,
315
+ inputmode: 'datetime-local',
316
+ min: null,
317
+ max: null,
318
+ }),
319
+ * ```
320
+ */
164
321
  static datetime(a) {
322
+ const validator = asRequiredParser(ts_matches_1.string, a);
165
323
  return new Value(() => ({
166
- type: "datetime",
167
- description: null,
168
- warning: null,
169
- inputmode: "datetime-local",
170
- min: null,
171
- max: null,
172
- step: null,
173
- disabled: false,
174
- immutable: a.immutable ?? false,
175
- ...a,
176
- }), asRequiredParser(ts_matches_1.string, a));
177
- }
178
- static dynamicDatetime(getA) {
179
- return new Value(async (options) => {
180
- const a = await getA(options);
181
- return {
324
+ spec: {
182
325
  type: "datetime",
183
326
  description: null,
184
327
  warning: null,
185
328
  inputmode: "datetime-local",
186
329
  min: null,
187
330
  max: null,
331
+ step: null,
188
332
  disabled: false,
189
- immutable: false,
333
+ immutable: a.immutable ?? false,
190
334
  ...a,
335
+ },
336
+ validator,
337
+ }), validator);
338
+ }
339
+ static dynamicDatetime(getA) {
340
+ return new Value(async (options) => {
341
+ const a = await getA(options);
342
+ return {
343
+ spec: {
344
+ type: "datetime",
345
+ description: null,
346
+ warning: null,
347
+ inputmode: "datetime-local",
348
+ min: null,
349
+ max: null,
350
+ disabled: false,
351
+ immutable: false,
352
+ ...a,
353
+ },
354
+ validator: asRequiredParser(ts_matches_1.string, a),
191
355
  };
192
356
  }, ts_matches_1.string.nullable());
193
357
  }
358
+ /**
359
+ * @description Displays a select modal with radio buttons, allowing for a single selection.
360
+ * @example
361
+ * ```
362
+ selectExample: Value.select({
363
+ // required
364
+ name: 'Select Example',
365
+ default: 'radio1',
366
+ values: {
367
+ radio1: 'Radio 1',
368
+ radio2: 'Radio 2',
369
+ },
370
+
371
+ // optional
372
+ description: null,
373
+ warning: null,
374
+ immutable: false,
375
+ disabled: false,
376
+ }),
377
+ * ```
378
+ */
194
379
  static select(a) {
380
+ const validator = (0, ts_matches_1.anyOf)(...Object.keys(a.values).map((x) => (0, ts_matches_1.literal)(x)));
195
381
  return new Value(() => ({
196
- description: null,
197
- warning: null,
198
- type: "select",
199
- disabled: false,
200
- immutable: a.immutable ?? false,
201
- ...a,
202
- }), (0, ts_matches_1.anyOf)(...Object.keys(a.values).map((x) => (0, ts_matches_1.literal)(x))));
203
- }
204
- static dynamicSelect(getA) {
205
- return new Value(async (options) => {
206
- const a = await getA(options);
207
- return {
382
+ spec: {
208
383
  description: null,
209
384
  warning: null,
210
385
  type: "select",
211
386
  disabled: false,
212
- immutable: false,
387
+ immutable: a.immutable ?? false,
213
388
  ...a,
389
+ },
390
+ validator,
391
+ }), validator);
392
+ }
393
+ static dynamicSelect(getA) {
394
+ return new Value(async (options) => {
395
+ const a = await getA(options);
396
+ return {
397
+ spec: {
398
+ description: null,
399
+ warning: null,
400
+ type: "select",
401
+ disabled: false,
402
+ immutable: false,
403
+ ...a,
404
+ },
405
+ validator: (0, ts_matches_1.anyOf)(...Object.keys(a.values).map((x) => (0, ts_matches_1.literal)(x))),
214
406
  };
215
407
  }, ts_matches_1.string);
216
408
  }
409
+ /**
410
+ * @description Displays a select modal with checkboxes, allowing for multiple selections.
411
+ * @example
412
+ * ```
413
+ multiselectExample: Value.multiselect({
414
+ // required
415
+ name: 'Multiselect Example',
416
+ values: {
417
+ option1: 'Option 1',
418
+ option2: 'Option 2',
419
+ },
420
+ default: [],
421
+
422
+ // optional
423
+ description: null,
424
+ warning: null,
425
+ immutable: false,
426
+ disabled: false,
427
+ minlength: null,
428
+ maxLength: null,
429
+ }),
430
+ * ```
431
+ */
217
432
  static multiselect(a) {
433
+ const validator = (0, ts_matches_1.arrayOf)((0, ts_matches_1.literals)(...Object.keys(a.values)));
218
434
  return new Value(() => ({
219
- type: "multiselect",
220
- minLength: null,
221
- maxLength: null,
222
- warning: null,
223
- description: null,
224
- disabled: false,
225
- immutable: a.immutable ?? false,
226
- ...a,
227
- }), (0, ts_matches_1.arrayOf)((0, ts_matches_1.literals)(...Object.keys(a.values))));
228
- }
229
- static dynamicMultiselect(getA) {
230
- return new Value(async (options) => {
231
- const a = await getA(options);
232
- return {
435
+ spec: {
233
436
  type: "multiselect",
234
437
  minLength: null,
235
438
  maxLength: null,
236
439
  warning: null,
237
440
  description: null,
238
441
  disabled: false,
239
- immutable: false,
442
+ immutable: a.immutable ?? false,
240
443
  ...a,
444
+ },
445
+ validator,
446
+ }), validator);
447
+ }
448
+ static dynamicMultiselect(getA) {
449
+ return new Value(async (options) => {
450
+ const a = await getA(options);
451
+ return {
452
+ spec: {
453
+ type: "multiselect",
454
+ minLength: null,
455
+ maxLength: null,
456
+ warning: null,
457
+ description: null,
458
+ disabled: false,
459
+ immutable: false,
460
+ ...a,
461
+ },
462
+ validator: (0, ts_matches_1.arrayOf)((0, ts_matches_1.literals)(...Object.keys(a.values))),
241
463
  };
242
464
  }, (0, ts_matches_1.arrayOf)(ts_matches_1.string));
243
465
  }
466
+ /**
467
+ * @description Display a collapsable grouping of additional fields, a "sub form". The second value is the inputSpec spec for the sub form.
468
+ * @example
469
+ * ```
470
+ objectExample: Value.object(
471
+ {
472
+ // required
473
+ name: 'Object Example',
474
+
475
+ // optional
476
+ description: null,
477
+ warning: null,
478
+ },
479
+ InputSpec.of({}),
480
+ ),
481
+ * ```
482
+ */
244
483
  static object(a, spec) {
245
484
  return new Value(async (options) => {
246
485
  const built = await spec.build(options);
247
486
  return {
248
- type: "object",
249
- description: null,
250
- warning: null,
251
- ...a,
252
- spec: built,
487
+ spec: {
488
+ type: "object",
489
+ description: null,
490
+ warning: null,
491
+ ...a,
492
+ spec: built.spec,
493
+ },
494
+ validator: built.validator,
253
495
  };
254
496
  }, spec.validator);
255
497
  }
256
- // static file<Store, Required extends boolean>(a: {
257
- // name: string
258
- // description?: string | null
259
- // extensions: string[]
260
- // required: Required
261
- // }) {
262
- // const buildValue = {
263
- // type: "file" as const,
264
- // description: null,
265
- // warning: null,
266
- // ...a,
267
- // }
268
- // return new Value<AsRequired<FilePath, Required>, Store>(
269
- // () => ({
270
- // ...buildValue,
271
- // }),
272
- // asRequiredParser(object({ filePath: string }), a),
273
- // )
274
- // }
275
- // static dynamicFile<Store>(
276
- // a: LazyBuild<
277
- // Store,
278
- // {
279
- // name: string
280
- // description?: string | null
281
- // warning?: string | null
282
- // extensions: string[]
283
- // required: boolean
284
- // }
285
- // >,
286
- // ) {
287
- // return new Value<FilePath | null, Store>(
288
- // async (options) => ({
289
- // type: "file" as const,
290
- // description: null,
291
- // warning: null,
292
- // ...(await a(options)),
293
- // }),
294
- // object({ filePath: string }).nullable(),
295
- // )
296
- // }
297
- static union(a, aVariants) {
298
- return new Value(async (options) => ({
299
- type: "union",
498
+ static file(a) {
499
+ const buildValue = {
500
+ type: "file",
300
501
  description: null,
301
502
  warning: null,
302
- disabled: false,
303
503
  ...a,
304
- variants: await aVariants.build(options),
305
- immutable: a.immutable ?? false,
306
- }), aVariants.validator);
504
+ };
505
+ return new Value(() => ({
506
+ spec: {
507
+ ...buildValue,
508
+ },
509
+ validator: asRequiredParser(exports.fileInfoParser, a),
510
+ }), asRequiredParser(exports.fileInfoParser, a));
307
511
  }
308
- static filteredUnion(getDisabledFn, a, aVariants) {
309
- return new Value(async (options) => ({
310
- type: "union",
311
- description: null,
312
- warning: null,
313
- ...a,
314
- variants: await aVariants.build(options),
315
- disabled: (await getDisabledFn(options)) || false,
316
- immutable: false,
317
- }), aVariants.validator);
512
+ static dynamicFile(a) {
513
+ return new Value(async (options) => {
514
+ const spec = {
515
+ type: "file",
516
+ description: null,
517
+ warning: null,
518
+ ...(await a(options)),
519
+ };
520
+ return {
521
+ spec,
522
+ validator: asRequiredParser(exports.fileInfoParser, spec),
523
+ };
524
+ }, exports.fileInfoParser.nullable());
525
+ }
526
+ /**
527
+ * @description Displays a dropdown, allowing for a single selection. Depending on the selection, a different object ("sub form") is presented.
528
+ * @example
529
+ * ```
530
+ unionExample: Value.union(
531
+ {
532
+ // required
533
+ name: 'Union Example',
534
+ default: 'option1',
535
+
536
+ // optional
537
+ description: null,
538
+ warning: null,
539
+ disabled: false,
540
+ immutable: false,
541
+ },
542
+ Variants.of({
543
+ option1: {
544
+ name: 'Option 1',
545
+ spec: InputSpec.of({}),
546
+ },
547
+ option2: {
548
+ name: 'Option 2',
549
+ spec: InputSpec.of({}),
550
+ },
551
+ }),
552
+ ),
553
+ * ```
554
+ */
555
+ static union(a) {
556
+ return new Value(async (options) => {
557
+ const built = await a.variants.build(options);
558
+ return {
559
+ spec: {
560
+ type: "union",
561
+ description: null,
562
+ warning: null,
563
+ disabled: false,
564
+ ...a,
565
+ variants: built.spec,
566
+ immutable: a.immutable ?? false,
567
+ },
568
+ validator: built.validator,
569
+ };
570
+ }, a.variants.validator);
318
571
  }
319
- static dynamicUnion(getA, aVariants) {
572
+ static dynamicUnion(getA, validator = ts_matches_1.any) {
320
573
  return new Value(async (options) => {
321
574
  const newValues = await getA(options);
575
+ const built = await newValues.variants.build(options);
322
576
  return {
323
- type: "union",
324
- description: null,
325
- warning: null,
326
- ...newValues,
327
- variants: await aVariants.build(options),
328
- immutable: false,
577
+ spec: {
578
+ type: "union",
579
+ description: null,
580
+ warning: null,
581
+ ...newValues,
582
+ variants: built.spec,
583
+ immutable: false,
584
+ },
585
+ validator: built.validator,
329
586
  };
330
- }, aVariants.validator);
587
+ }, validator);
331
588
  }
589
+ /**
590
+ * @description Presents an interface to add/remove/edit items in a list.
591
+ * @example
592
+ * In this example, we create a list of text inputs.
593
+ *
594
+ * ```
595
+ listExampleText: Value.list(
596
+ List.text(
597
+ {
598
+ // required
599
+ name: 'Text List',
600
+
601
+ // optional
602
+ description: null,
603
+ warning: null,
604
+ default: [],
605
+ minLength: null,
606
+ maxLength: null,
607
+ },
608
+ {
609
+ // required
610
+ patterns: [],
611
+
612
+ // optional
613
+ placeholder: null,
614
+ generate: null,
615
+ inputmode: 'url',
616
+ masked: false,
617
+ minLength: null,
618
+ maxLength: null,
619
+ },
620
+ ),
621
+ ),
622
+ * ```
623
+ * @example
624
+ * In this example, we create a list of objects.
625
+ *
626
+ * ```
627
+ listExampleObject: Value.list(
628
+ List.obj(
629
+ {
630
+ // required
631
+ name: 'Object List',
632
+
633
+ // optional
634
+ description: null,
635
+ warning: null,
636
+ default: [],
637
+ minLength: null,
638
+ maxLength: null,
639
+ },
640
+ {
641
+ // required
642
+ spec: InputSpec.of({}),
643
+
644
+ // optional
645
+ displayAs: null,
646
+ uniqueBy: null,
647
+ },
648
+ ),
649
+ ),
650
+ * ```
651
+ */
332
652
  static list(a) {
333
653
  return new Value((options) => a.build(options), a.validator);
334
654
  }
335
655
  static hidden(parser = ts_matches_1.any) {
336
656
  return new Value(async () => {
337
- const built = {
338
- type: "hidden",
657
+ return {
658
+ spec: {
659
+ type: "hidden",
660
+ },
661
+ validator: parser,
339
662
  };
340
- return built;
341
663
  }, parser);
342
664
  }
343
- map(fn) {
344
- return new Value(this.build, this.validator.map(fn));
345
- }
346
665
  /**
347
- * Use this during the times that the input needs a more specific type.
348
- * Used in types that the value/ variant/ list/ inputSpec is constructed somewhere else.
349
- ```ts
350
- const a = InputSpec.text({
351
- name: "a",
352
- required: false,
353
- })
354
-
355
- return InputSpec.of<Store>()({
356
- myValue: a.withStore(),
357
- })
358
- ```
666
+ * @description Provides a way to define a hidden field with a static value. Useful for tracking
667
+ * @example
668
+ * ```
669
+ hiddenExample: Value.hidden(),
670
+ * ```
359
671
  */
360
- withStore() {
361
- return this;
672
+ static dynamicHidden(getParser) {
673
+ return new Value(async (options) => {
674
+ const validator = await getParser(options);
675
+ return {
676
+ spec: {
677
+ type: "hidden",
678
+ },
679
+ validator,
680
+ };
681
+ }, ts_matches_1.any);
682
+ }
683
+ map(fn) {
684
+ return new Value(async (effects) => {
685
+ const built = await this.build(effects);
686
+ return {
687
+ spec: built.spec,
688
+ validator: built.validator.map(fn),
689
+ };
690
+ }, this.validator.map(fn));
362
691
  }
363
692
  }
364
693
  exports.Value = Value;