@monolayer/sdk 1.2.0-canary.4

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 (320) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/dist/bin/cli.js +21609 -0
  4. package/dist/cjs/configuration.d.ts +65 -0
  5. package/dist/cjs/configuration.js +45 -0
  6. package/dist/cjs/index.d.ts +4 -0
  7. package/dist/cjs/index.js +20 -0
  8. package/dist/cjs/introspection.d.ts +2 -0
  9. package/dist/cjs/introspection.js +11 -0
  10. package/dist/cjs/make/broadcast.d.ts +10 -0
  11. package/dist/cjs/make/broadcast.js +37 -0
  12. package/dist/cjs/make/config.d.ts +2 -0
  13. package/dist/cjs/make/config.js +44 -0
  14. package/dist/cjs/make/cron.d.ts +9 -0
  15. package/dist/cjs/make/cron.js +30 -0
  16. package/dist/cjs/make/make.d.ts +6 -0
  17. package/dist/cjs/make/make.js +134 -0
  18. package/dist/cjs/make/manifest.d.ts +202 -0
  19. package/dist/cjs/make/manifest.js +165 -0
  20. package/dist/cjs/make/required-filtes.d.ts +1 -0
  21. package/dist/cjs/make/required-filtes.js +17 -0
  22. package/dist/cjs/make/task.d.ts +9 -0
  23. package/dist/cjs/make/task.js +30 -0
  24. package/dist/cjs/package.json +3 -0
  25. package/dist/cjs/packages/docker/df.d.ts +543 -0
  26. package/dist/cjs/packages/docker/df.js +395 -0
  27. package/dist/cjs/packages/docker/validator.d.ts +7 -0
  28. package/dist/cjs/packages/docker/validator.js +18 -0
  29. package/dist/cjs/packages/utils/create-file.d.ts +1 -0
  30. package/dist/cjs/packages/utils/create-file.js +18 -0
  31. package/dist/cjs/packages/utils/date-string.d.ts +1 -0
  32. package/dist/cjs/packages/utils/date-string.js +12 -0
  33. package/dist/cjs/packages/utils/exception.d.ts +1 -0
  34. package/dist/cjs/packages/utils/exception.js +8 -0
  35. package/dist/cjs/packages/utils/hash-value.d.ts +16 -0
  36. package/dist/cjs/packages/utils/hash-value.js +25 -0
  37. package/dist/cjs/packages/utils/import-default.d.ts +1 -0
  38. package/dist/cjs/packages/utils/import-default.js +14 -0
  39. package/dist/cjs/packages/utils/import-file.d.ts +8 -0
  40. package/dist/cjs/packages/utils/import-file.js +41 -0
  41. package/dist/cjs/packages/utils/log-with-spinner.d.ts +1 -0
  42. package/dist/cjs/packages/utils/log-with-spinner.js +24 -0
  43. package/dist/cjs/packages/utils/path.d.ts +2 -0
  44. package/dist/cjs/packages/utils/path.js +21 -0
  45. package/dist/cjs/packages/utils/playground.d.ts +1 -0
  46. package/dist/cjs/packages/utils/playground.js +35 -0
  47. package/dist/cjs/scaffolding/add-env-var.d.ts +6 -0
  48. package/dist/cjs/scaffolding/add-env-var.js +65 -0
  49. package/dist/cjs/scaffolding/add-import.d.ts +16 -0
  50. package/dist/cjs/scaffolding/add-import.js +43 -0
  51. package/dist/cjs/scaffolding/add-script.d.ts +1 -0
  52. package/dist/cjs/scaffolding/add-script.js +35 -0
  53. package/dist/cjs/scaffolding/broadcast-workload.d.ts +1 -0
  54. package/dist/cjs/scaffolding/broadcast-workload.js +36 -0
  55. package/dist/cjs/scaffolding/bucket-workload.d.ts +6 -0
  56. package/dist/cjs/scaffolding/bucket-workload.js +23 -0
  57. package/dist/cjs/scaffolding/cron-workload.d.ts +6 -0
  58. package/dist/cjs/scaffolding/cron-workload.js +28 -0
  59. package/dist/cjs/scaffolding/drizzle.d.ts +4 -0
  60. package/dist/cjs/scaffolding/drizzle.js +22 -0
  61. package/dist/cjs/scaffolding/lifecycle.d.ts +9 -0
  62. package/dist/cjs/scaffolding/lifecycle.js +61 -0
  63. package/dist/cjs/scaffolding/postgres-database-workload.d.ts +15 -0
  64. package/dist/cjs/scaffolding/postgres-database-workload.js +39 -0
  65. package/dist/cjs/scaffolding/prisma.d.ts +4 -0
  66. package/dist/cjs/scaffolding/prisma.js +40 -0
  67. package/dist/cjs/scaffolding/replace-string.d.ts +10 -0
  68. package/dist/cjs/scaffolding/replace-string.js +37 -0
  69. package/dist/cjs/scaffolding/task-workload.d.ts +6 -0
  70. package/dist/cjs/scaffolding/task-workload.js +30 -0
  71. package/dist/cjs/scaffolding/workload.d.ts +1 -0
  72. package/dist/cjs/scaffolding/workload.js +18 -0
  73. package/dist/cjs/scan/project.d.ts +23 -0
  74. package/dist/cjs/scan/project.js +79 -0
  75. package/dist/cjs/scan/workload-imports.d.ts +21 -0
  76. package/dist/cjs/scan/workload-imports.js +188 -0
  77. package/dist/cjs/test-helpers/postgres.d.ts +13 -0
  78. package/dist/cjs/test-helpers/postgres.js +52 -0
  79. package/dist/cjs/test-helpers/redis.d.ts +13 -0
  80. package/dist/cjs/test-helpers/redis.js +46 -0
  81. package/dist/cjs/test-helpers/task.d.ts +14 -0
  82. package/dist/cjs/test-helpers/task.js +18 -0
  83. package/dist/cjs/test-helpers.d.ts +3 -0
  84. package/dist/cjs/test-helpers.js +10 -0
  85. package/dist/cjs/workloads/app-lifecycle/after-rollout.d.ts +22 -0
  86. package/dist/cjs/workloads/app-lifecycle/after-rollout.js +28 -0
  87. package/dist/cjs/workloads/app-lifecycle/before-rollout.d.ts +22 -0
  88. package/dist/cjs/workloads/app-lifecycle/before-rollout.js +28 -0
  89. package/dist/cjs/workloads/app-lifecycle/bootstrap.d.ts +22 -0
  90. package/dist/cjs/workloads/app-lifecycle/bootstrap.js +28 -0
  91. package/dist/cjs/workloads/app-lifecycle/lifecycle-workload.d.ts +11 -0
  92. package/dist/cjs/workloads/app-lifecycle/lifecycle-workload.js +11 -0
  93. package/dist/cjs/workloads/assertions.d.ts +13 -0
  94. package/dist/cjs/workloads/assertions.js +14 -0
  95. package/dist/cjs/workloads/stateful/bucket.d.ts +82 -0
  96. package/dist/cjs/workloads/stateful/bucket.js +95 -0
  97. package/dist/cjs/workloads/stateful/database.d.ts +25 -0
  98. package/dist/cjs/workloads/stateful/database.js +42 -0
  99. package/dist/cjs/workloads/stateful/postgres-database.d.ts +29 -0
  100. package/dist/cjs/workloads/stateful/postgres-database.js +39 -0
  101. package/dist/cjs/workloads/stateful/redis.d.ts +30 -0
  102. package/dist/cjs/workloads/stateful/redis.js +40 -0
  103. package/dist/cjs/workloads/stateful/stateful-workload.d.ts +25 -0
  104. package/dist/cjs/workloads/stateful/stateful-workload.js +41 -0
  105. package/dist/cjs/workloads/stateless/broadcast/channel-data.d.ts +3 -0
  106. package/dist/cjs/workloads/stateless/broadcast/channel-data.js +6 -0
  107. package/dist/cjs/workloads/stateless/broadcast/client/app-sync-client.d.ts +78 -0
  108. package/dist/cjs/workloads/stateless/broadcast/client/app-sync-client.js +128 -0
  109. package/dist/cjs/workloads/stateless/broadcast/client/app-sync-publisher.d.ts +34 -0
  110. package/dist/cjs/workloads/stateless/broadcast/client/app-sync-publisher.js +78 -0
  111. package/dist/cjs/workloads/stateless/broadcast/client/authenticator.d.ts +28 -0
  112. package/dist/cjs/workloads/stateless/broadcast/client/authenticator.js +43 -0
  113. package/dist/cjs/workloads/stateless/broadcast/client/broadcast-provider.d.ts +17 -0
  114. package/dist/cjs/workloads/stateless/broadcast/client/broadcast-provider.js +34 -0
  115. package/dist/cjs/workloads/stateless/broadcast/client/client.d.ts +8 -0
  116. package/dist/cjs/workloads/stateless/broadcast/client/client.js +28 -0
  117. package/dist/cjs/workloads/stateless/broadcast/client/connectionManager.d.ts +62 -0
  118. package/dist/cjs/workloads/stateless/broadcast/client/connectionManager.js +166 -0
  119. package/dist/cjs/workloads/stateless/broadcast/client/eventEmitter.d.ts +32 -0
  120. package/dist/cjs/workloads/stateless/broadcast/client/eventEmitter.js +53 -0
  121. package/dist/cjs/workloads/stateless/broadcast/client/messageBuilder.d.ts +24 -0
  122. package/dist/cjs/workloads/stateless/broadcast/client/messageBuilder.js +43 -0
  123. package/dist/cjs/workloads/stateless/broadcast/client/parser.d.ts +12 -0
  124. package/dist/cjs/workloads/stateless/broadcast/client/parser.js +22 -0
  125. package/dist/cjs/workloads/stateless/broadcast/client/provider.d.ts +4 -0
  126. package/dist/cjs/workloads/stateless/broadcast/client/provider.js +11 -0
  127. package/dist/cjs/workloads/stateless/broadcast/client/subscriptionManager.d.ts +34 -0
  128. package/dist/cjs/workloads/stateless/broadcast/client/subscriptionManager.js +91 -0
  129. package/dist/cjs/workloads/stateless/broadcast/client/types.d.ts +72 -0
  130. package/dist/cjs/workloads/stateless/broadcast/client/types.js +6 -0
  131. package/dist/cjs/workloads/stateless/broadcast/matcher.d.ts +13 -0
  132. package/dist/cjs/workloads/stateless/broadcast/matcher.js +46 -0
  133. package/dist/cjs/workloads/stateless/broadcast/router.d.ts +103 -0
  134. package/dist/cjs/workloads/stateless/broadcast/router.js +98 -0
  135. package/dist/cjs/workloads/stateless/broadcast/types.d.ts +17 -0
  136. package/dist/cjs/workloads/stateless/broadcast/types.js +2 -0
  137. package/dist/cjs/workloads/stateless/cron.d.ts +49 -0
  138. package/dist/cjs/workloads/stateless/cron.js +55 -0
  139. package/dist/cjs/workloads/stateless/stateless-workload.d.ts +3 -0
  140. package/dist/cjs/workloads/stateless/stateless-workload.js +7 -0
  141. package/dist/cjs/workloads/stateless/task/backoffs.d.ts +9 -0
  142. package/dist/cjs/workloads/stateless/task/backoffs.js +17 -0
  143. package/dist/cjs/workloads/stateless/task/dispatcher.d.ts +3 -0
  144. package/dist/cjs/workloads/stateless/task/dispatcher.js +22 -0
  145. package/dist/cjs/workloads/stateless/task/local.d.ts +14 -0
  146. package/dist/cjs/workloads/stateless/task/local.js +54 -0
  147. package/dist/cjs/workloads/stateless/task/perform-later.d.ts +2 -0
  148. package/dist/cjs/workloads/stateless/task/perform-later.js +7 -0
  149. package/dist/cjs/workloads/stateless/task/perform-now.d.ts +5 -0
  150. package/dist/cjs/workloads/stateless/task/perform-now.js +24 -0
  151. package/dist/cjs/workloads/stateless/task/perform.d.ts +7 -0
  152. package/dist/cjs/workloads/stateless/task/perform.js +10 -0
  153. package/dist/cjs/workloads/stateless/task/task.d.ts +88 -0
  154. package/dist/cjs/workloads/stateless/task/task.js +61 -0
  155. package/dist/cjs/workloads/stateless/task/validate-data-size.d.ts +1 -0
  156. package/dist/cjs/workloads/stateless/task/validate-data-size.js +10 -0
  157. package/dist/cjs/workloads/workload.d.ts +14 -0
  158. package/dist/cjs/workloads/workload.js +16 -0
  159. package/dist/cjs/workloads.d.ts +22 -0
  160. package/dist/cjs/workloads.js +30 -0
  161. package/dist/esm/configuration.d.ts +65 -0
  162. package/dist/esm/configuration.js +15 -0
  163. package/dist/esm/index.d.ts +4 -0
  164. package/dist/esm/index.js +4 -0
  165. package/dist/esm/introspection.d.ts +2 -0
  166. package/dist/esm/introspection.js +2 -0
  167. package/dist/esm/make/broadcast.d.ts +10 -0
  168. package/dist/esm/make/broadcast.js +30 -0
  169. package/dist/esm/make/config.d.ts +2 -0
  170. package/dist/esm/make/config.js +41 -0
  171. package/dist/esm/make/cron.d.ts +9 -0
  172. package/dist/esm/make/cron.js +23 -0
  173. package/dist/esm/make/make.d.ts +6 -0
  174. package/dist/esm/make/make.js +120 -0
  175. package/dist/esm/make/manifest.d.ts +202 -0
  176. package/dist/esm/make/manifest.js +162 -0
  177. package/dist/esm/make/required-filtes.d.ts +1 -0
  178. package/dist/esm/make/required-filtes.js +11 -0
  179. package/dist/esm/make/task.d.ts +9 -0
  180. package/dist/esm/make/task.js +23 -0
  181. package/dist/esm/package.json +3 -0
  182. package/dist/esm/packages/docker/df.d.ts +543 -0
  183. package/dist/esm/packages/docker/df.js +381 -0
  184. package/dist/esm/packages/docker/validator.d.ts +7 -0
  185. package/dist/esm/packages/docker/validator.js +14 -0
  186. package/dist/esm/packages/utils/create-file.d.ts +1 -0
  187. package/dist/esm/packages/utils/create-file.js +11 -0
  188. package/dist/esm/packages/utils/date-string.d.ts +1 -0
  189. package/dist/esm/packages/utils/date-string.js +8 -0
  190. package/dist/esm/packages/utils/exception.d.ts +1 -0
  191. package/dist/esm/packages/utils/exception.js +4 -0
  192. package/dist/esm/packages/utils/hash-value.d.ts +16 -0
  193. package/dist/esm/packages/utils/hash-value.js +20 -0
  194. package/dist/esm/packages/utils/import-default.d.ts +1 -0
  195. package/dist/esm/packages/utils/import-default.js +10 -0
  196. package/dist/esm/packages/utils/import-file.d.ts +8 -0
  197. package/dist/esm/packages/utils/import-file.js +13 -0
  198. package/dist/esm/packages/utils/log-with-spinner.d.ts +1 -0
  199. package/dist/esm/packages/utils/log-with-spinner.js +17 -0
  200. package/dist/esm/packages/utils/path.d.ts +2 -0
  201. package/dist/esm/packages/utils/path.js +17 -0
  202. package/dist/esm/packages/utils/playground.d.ts +1 -0
  203. package/dist/esm/packages/utils/playground.js +11 -0
  204. package/dist/esm/scaffolding/add-env-var.d.ts +6 -0
  205. package/dist/esm/scaffolding/add-env-var.js +57 -0
  206. package/dist/esm/scaffolding/add-import.d.ts +16 -0
  207. package/dist/esm/scaffolding/add-import.js +39 -0
  208. package/dist/esm/scaffolding/add-script.d.ts +1 -0
  209. package/dist/esm/scaffolding/add-script.js +29 -0
  210. package/dist/esm/scaffolding/broadcast-workload.d.ts +1 -0
  211. package/dist/esm/scaffolding/broadcast-workload.js +30 -0
  212. package/dist/esm/scaffolding/bucket-workload.d.ts +6 -0
  213. package/dist/esm/scaffolding/bucket-workload.js +17 -0
  214. package/dist/esm/scaffolding/cron-workload.d.ts +6 -0
  215. package/dist/esm/scaffolding/cron-workload.js +22 -0
  216. package/dist/esm/scaffolding/drizzle.d.ts +4 -0
  217. package/dist/esm/scaffolding/drizzle.js +19 -0
  218. package/dist/esm/scaffolding/lifecycle.d.ts +9 -0
  219. package/dist/esm/scaffolding/lifecycle.js +53 -0
  220. package/dist/esm/scaffolding/postgres-database-workload.d.ts +15 -0
  221. package/dist/esm/scaffolding/postgres-database-workload.js +31 -0
  222. package/dist/esm/scaffolding/prisma.d.ts +4 -0
  223. package/dist/esm/scaffolding/prisma.js +34 -0
  224. package/dist/esm/scaffolding/replace-string.d.ts +10 -0
  225. package/dist/esm/scaffolding/replace-string.js +30 -0
  226. package/dist/esm/scaffolding/task-workload.d.ts +6 -0
  227. package/dist/esm/scaffolding/task-workload.js +24 -0
  228. package/dist/esm/scaffolding/workload.d.ts +1 -0
  229. package/dist/esm/scaffolding/workload.js +12 -0
  230. package/dist/esm/scan/project.d.ts +23 -0
  231. package/dist/esm/scan/project.js +69 -0
  232. package/dist/esm/scan/workload-imports.d.ts +21 -0
  233. package/dist/esm/scan/workload-imports.js +144 -0
  234. package/dist/esm/test-helpers/postgres.d.ts +13 -0
  235. package/dist/esm/test-helpers/postgres.js +26 -0
  236. package/dist/esm/test-helpers/redis.d.ts +13 -0
  237. package/dist/esm/test-helpers/redis.js +20 -0
  238. package/dist/esm/test-helpers/task.d.ts +14 -0
  239. package/dist/esm/test-helpers/task.js +14 -0
  240. package/dist/esm/test-helpers.d.ts +3 -0
  241. package/dist/esm/test-helpers.js +3 -0
  242. package/dist/esm/workloads/app-lifecycle/after-rollout.d.ts +22 -0
  243. package/dist/esm/workloads/app-lifecycle/after-rollout.js +24 -0
  244. package/dist/esm/workloads/app-lifecycle/before-rollout.d.ts +22 -0
  245. package/dist/esm/workloads/app-lifecycle/before-rollout.js +24 -0
  246. package/dist/esm/workloads/app-lifecycle/bootstrap.d.ts +22 -0
  247. package/dist/esm/workloads/app-lifecycle/bootstrap.js +24 -0
  248. package/dist/esm/workloads/app-lifecycle/lifecycle-workload.d.ts +11 -0
  249. package/dist/esm/workloads/app-lifecycle/lifecycle-workload.js +7 -0
  250. package/dist/esm/workloads/assertions.d.ts +13 -0
  251. package/dist/esm/workloads/assertions.js +6 -0
  252. package/dist/esm/workloads/stateful/bucket.d.ts +82 -0
  253. package/dist/esm/workloads/stateful/bucket.js +95 -0
  254. package/dist/esm/workloads/stateful/database.d.ts +25 -0
  255. package/dist/esm/workloads/stateful/database.js +42 -0
  256. package/dist/esm/workloads/stateful/postgres-database.d.ts +29 -0
  257. package/dist/esm/workloads/stateful/postgres-database.js +35 -0
  258. package/dist/esm/workloads/stateful/redis.d.ts +30 -0
  259. package/dist/esm/workloads/stateful/redis.js +36 -0
  260. package/dist/esm/workloads/stateful/stateful-workload.d.ts +25 -0
  261. package/dist/esm/workloads/stateful/stateful-workload.js +41 -0
  262. package/dist/esm/workloads/stateless/broadcast/channel-data.d.ts +3 -0
  263. package/dist/esm/workloads/stateless/broadcast/channel-data.js +2 -0
  264. package/dist/esm/workloads/stateless/broadcast/client/app-sync-client.d.ts +78 -0
  265. package/dist/esm/workloads/stateless/broadcast/client/app-sync-client.js +130 -0
  266. package/dist/esm/workloads/stateless/broadcast/client/app-sync-publisher.d.ts +34 -0
  267. package/dist/esm/workloads/stateless/broadcast/client/app-sync-publisher.js +76 -0
  268. package/dist/esm/workloads/stateless/broadcast/client/authenticator.d.ts +28 -0
  269. package/dist/esm/workloads/stateless/broadcast/client/authenticator.js +39 -0
  270. package/dist/esm/workloads/stateless/broadcast/client/broadcast-provider.d.ts +17 -0
  271. package/dist/esm/workloads/stateless/broadcast/client/broadcast-provider.js +29 -0
  272. package/dist/esm/workloads/stateless/broadcast/client/client.d.ts +8 -0
  273. package/dist/esm/workloads/stateless/broadcast/client/client.js +25 -0
  274. package/dist/esm/workloads/stateless/broadcast/client/connectionManager.d.ts +62 -0
  275. package/dist/esm/workloads/stateless/broadcast/client/connectionManager.js +164 -0
  276. package/dist/esm/workloads/stateless/broadcast/client/eventEmitter.d.ts +32 -0
  277. package/dist/esm/workloads/stateless/broadcast/client/eventEmitter.js +50 -0
  278. package/dist/esm/workloads/stateless/broadcast/client/messageBuilder.d.ts +24 -0
  279. package/dist/esm/workloads/stateless/broadcast/client/messageBuilder.js +39 -0
  280. package/dist/esm/workloads/stateless/broadcast/client/parser.d.ts +12 -0
  281. package/dist/esm/workloads/stateless/broadcast/client/parser.js +19 -0
  282. package/dist/esm/workloads/stateless/broadcast/client/provider.d.ts +4 -0
  283. package/dist/esm/workloads/stateless/broadcast/client/provider.js +8 -0
  284. package/dist/esm/workloads/stateless/broadcast/client/subscriptionManager.d.ts +34 -0
  285. package/dist/esm/workloads/stateless/broadcast/client/subscriptionManager.js +91 -0
  286. package/dist/esm/workloads/stateless/broadcast/client/types.d.ts +72 -0
  287. package/dist/esm/workloads/stateless/broadcast/client/types.js +5 -0
  288. package/dist/esm/workloads/stateless/broadcast/matcher.d.ts +13 -0
  289. package/dist/esm/workloads/stateless/broadcast/matcher.js +43 -0
  290. package/dist/esm/workloads/stateless/broadcast/router.d.ts +103 -0
  291. package/dist/esm/workloads/stateless/broadcast/router.js +93 -0
  292. package/dist/esm/workloads/stateless/broadcast/server/broadcast-server.d.ts +2 -0
  293. package/dist/esm/workloads/stateless/broadcast/server/broadcast-server.js +316 -0
  294. package/dist/esm/workloads/stateless/broadcast/types.d.ts +17 -0
  295. package/dist/esm/workloads/stateless/broadcast/types.js +1 -0
  296. package/dist/esm/workloads/stateless/cron.d.ts +49 -0
  297. package/dist/esm/workloads/stateless/cron.js +52 -0
  298. package/dist/esm/workloads/stateless/stateless-workload.d.ts +3 -0
  299. package/dist/esm/workloads/stateless/stateless-workload.js +8 -0
  300. package/dist/esm/workloads/stateless/task/backoffs.d.ts +9 -0
  301. package/dist/esm/workloads/stateless/task/backoffs.js +14 -0
  302. package/dist/esm/workloads/stateless/task/dispatcher.d.ts +3 -0
  303. package/dist/esm/workloads/stateless/task/dispatcher.js +18 -0
  304. package/dist/esm/workloads/stateless/task/local.d.ts +14 -0
  305. package/dist/esm/workloads/stateless/task/local.js +48 -0
  306. package/dist/esm/workloads/stateless/task/perform-later.d.ts +2 -0
  307. package/dist/esm/workloads/stateless/task/perform-later.js +4 -0
  308. package/dist/esm/workloads/stateless/task/perform-now.d.ts +5 -0
  309. package/dist/esm/workloads/stateless/task/perform-now.js +18 -0
  310. package/dist/esm/workloads/stateless/task/perform.d.ts +7 -0
  311. package/dist/esm/workloads/stateless/task/perform.js +8 -0
  312. package/dist/esm/workloads/stateless/task/task.d.ts +88 -0
  313. package/dist/esm/workloads/stateless/task/task.js +59 -0
  314. package/dist/esm/workloads/stateless/task/validate-data-size.d.ts +1 -0
  315. package/dist/esm/workloads/stateless/task/validate-data-size.js +7 -0
  316. package/dist/esm/workloads/workload.d.ts +14 -0
  317. package/dist/esm/workloads/workload.js +16 -0
  318. package/dist/esm/workloads.d.ts +22 -0
  319. package/dist/esm/workloads.js +13 -0
  320. package/package.json +155 -0
@@ -0,0 +1,381 @@
1
+ /* eslint-disable max-lines */
2
+ import { kebabCase } from "case-anything";
3
+ import { writeFileSync } from "fs";
4
+ export class Dockerfile {
5
+ #lines = [];
6
+ /**
7
+ * Merge multiple Dockerfile instances into one.
8
+ *
9
+ * Returns a new Dockerfile instance.
10
+ */
11
+ static merge(dockerfiles) {
12
+ const allLines = dockerfiles.flatMap((df) => df.#lines);
13
+ const dockerfile = new Dockerfile();
14
+ dockerfile.#lines.push(...allLines);
15
+ return dockerfile;
16
+ }
17
+ constructor(df) {
18
+ if (df) {
19
+ this.#lines = df.#lines;
20
+ }
21
+ }
22
+ /**
23
+ * Instruction that initializes a new build stage and sets the base image for
24
+ * subsequent instructions.
25
+ *
26
+ * @see
27
+ *
28
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#from)
29
+ */
30
+ FROM(
31
+ /**
32
+ * Image name.
33
+ *
34
+ * Formats: `<image>`, `<image>[:<tag>]`, `<image>[@<digest>]`
35
+ */
36
+ image, options) {
37
+ const platform = options?.platform
38
+ ? `--platform=${options?.platform}`
39
+ : undefined;
40
+ const as = options?.as ? `AS ${options.as}` : undefined;
41
+ this.#pushInstruction(["FROM", platform, image, as].filter(filterUndefined).join(" "));
42
+ return this;
43
+ }
44
+ /**
45
+ * Sets the environment variable `<key>` to the value `<value>`.
46
+ * This value will be in the environment for all subsequent instructions
47
+ * in the build stage.
48
+ *
49
+ * @see
50
+ *
51
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#env)
52
+ */
53
+ ENV(key, value, options) {
54
+ const keyVal = value.match(/^\${.+}$/)
55
+ ? `${key}=${value}`
56
+ : `${key}="${value}"`;
57
+ this.#pushInstruction([buildOption(options), "ENV", keyVal].filter(filterUndefined).join(" "));
58
+ return this;
59
+ }
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ LABEL(...args) {
62
+ const pairs = [args[0]]
63
+ .flatMap((p) => p)
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
+ .map((p) => `"${p.key}"="${p.value}"`)
66
+ .join(" \\\n ");
67
+ this.#pushInstruction([buildOption(args[1]), "LABEL", pairs].filter(filterUndefined).join(" "));
68
+ return this;
69
+ }
70
+ /**
71
+ * Sets the working directory for any `RUN`, `CMD`, `ENTRYPOINT`, `COPY` and `ADD` instructions
72
+ * that follow it in the Dockerfile.
73
+ *
74
+ * @see
75
+ *
76
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#workdir)
77
+ */
78
+ WORKDIR(dir, options) {
79
+ this.#pushInstruction([buildOption(options), "WORKDIR", `${dir}`]
80
+ .filter(filterUndefined)
81
+ .join(" "));
82
+ return this;
83
+ }
84
+ /**
85
+ * Execute any commands to create a new layer on top of the current image.
86
+ *
87
+ * @see
88
+ *
89
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#run)
90
+ */
91
+ RUN(command, options) {
92
+ let base = [buildOption(options), "RUN"].filter(filterUndefined).join(" ");
93
+ if (options?.mount) {
94
+ base += ` ${mountOpts(options?.mount)}${Array.isArray(command) ? "" : " \\\n "}`;
95
+ }
96
+ const instruction = `${base} ${Array.isArray(command)
97
+ ? ["", ...command].join(" \\\n ").trimStart()
98
+ : command}`;
99
+ this.#pushInstruction(instruction);
100
+ return this;
101
+ }
102
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
+ COPY(...args) {
104
+ this.#fileInstruction(args, [buildOption(args[2]), "COPY"].filter(filterUndefined).join(" "));
105
+ return this;
106
+ }
107
+ CMD(...args) {
108
+ this.#pushInstruction(`CMD [${args
109
+ .flatMap((e) => e)
110
+ .map((e) => `"${e}"`)
111
+ .join(", ")}]`);
112
+ return this;
113
+ }
114
+ /**
115
+ * Configures a container that will run as an executable.
116
+ *
117
+ * @see
118
+ *
119
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#entrypoint)
120
+ */
121
+ ENTRYPOINT(executable, parameters) {
122
+ this.#pushInstruction(`ENTRYPOINT [${[executable, ...(parameters ?? [])].map((e) => `"${e}"`).join(", ")}]`);
123
+ return this;
124
+ }
125
+ /**
126
+ * Overrides the default shell used for the shell form of commands.
127
+ *
128
+ * The default shell on Linux is `["/bin/sh", "-c"]`,
129
+ * and on Windows is `["cmd", "/S", "/C"]`.
130
+ *
131
+ * @see
132
+ *
133
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#shell)
134
+ */
135
+ SHELL(executable, parameters, options) {
136
+ this.#pushInstruction([
137
+ buildOption(options),
138
+ `SHELL [${[executable, ...(parameters ?? [])].map((e) => `"${e}"`).join(", ")}]`,
139
+ ]
140
+ .filter(filterUndefined)
141
+ .join(" "));
142
+ return this;
143
+ }
144
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
145
+ EXPOSE(...args) {
146
+ const portAndProtocol = [args[0]]
147
+ .flatMap((p) => p)
148
+ .map((port) => {
149
+ switch (typeof port) {
150
+ case "number":
151
+ case "string":
152
+ return String(port);
153
+ default:
154
+ return `${port.port}/${port.protocol}`;
155
+ }
156
+ })
157
+ .join(" ");
158
+ this.#pushInstruction([buildOption(args[1]), `EXPOSE ${portAndProtocol}`]
159
+ .filter(filterUndefined)
160
+ .join(" "));
161
+ return this;
162
+ }
163
+ /**
164
+ * Sets the user name (or UID) and optionally the user group (or GID) to use
165
+ * as the default user and group for the remainder of the current stage.
166
+ *
167
+ * The specified user is used for RUN instructions and at runtime,
168
+ * runs the relevant `ENTRYPOINT` and `CMD` commands.
169
+ *
170
+ * @see
171
+ *
172
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#user)
173
+ */
174
+ USER(user, options) {
175
+ this.#pushInstruction([
176
+ buildOption(options),
177
+ "USER",
178
+ `${Object.values(user).filter(filterUndefined).join(":")}`,
179
+ ]
180
+ .filter(filterUndefined)
181
+ .join(" "));
182
+ return this;
183
+ }
184
+ /**
185
+ * Creates a mount point with the specified name and
186
+ * marks it as holding externally mounted volumes from native host or other containers.
187
+ *
188
+ * @see
189
+ *
190
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#volume)
191
+ */
192
+ VOLUME(names, options) {
193
+ const volumes = [names]
194
+ .flatMap((v) => v)
195
+ .map((v) => `"${v}"`)
196
+ .join(", ");
197
+ this.#pushInstruction([buildOption(options), "VOLUME", `[${volumes}]`]
198
+ .filter(filterUndefined)
199
+ .join(" "));
200
+ return this;
201
+ }
202
+ /**
203
+ * Sets the system call signal that will be sent to the container to exit.
204
+ *
205
+ * @see
206
+ *
207
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#stopsignal)
208
+ */
209
+ STOPSIGNAL(signal, options) {
210
+ this.#pushInstruction([buildOption(options), `STOPSIGNAL ${signal}`]
211
+ .filter(filterUndefined)
212
+ .join(" "));
213
+ return this;
214
+ }
215
+ /**
216
+ * Defines a variable that users can pass at build-time to the builder
217
+ * with the docker build command using the `--build-arg <varname>=<value>` flag.
218
+ *
219
+ * @see
220
+ *
221
+ * [Docker Docs](https://docs.docker.com/engine/reference/builder/#arg)
222
+ */
223
+ ARG(name, options) {
224
+ this.#pushInstruction([
225
+ buildOption(options),
226
+ `ARG ${[name, options?.default ? `"${options.default}"` : undefined].filter((c) => c !== undefined).join("=")}`,
227
+ ]
228
+ .filter(filterUndefined)
229
+ .join(" "));
230
+ return this;
231
+ }
232
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
+ ADD(...args) {
234
+ this.#fileInstruction(args, [buildOption(args[2]), "ADD"].filter(filterUndefined).join(" "));
235
+ return this;
236
+ }
237
+ HEALTHCHECK(command, options) {
238
+ switch (command) {
239
+ case "NONE":
240
+ this.#pushInstruction(`HEALTHCHECK NONE`);
241
+ break;
242
+ default:
243
+ this.#pushInstruction([
244
+ buildOption(options),
245
+ `HEALTHCHECK ${optionsToString(options)}`.trim(),
246
+ `CMD ${command}`,
247
+ ]
248
+ .filter(filterUndefined)
249
+ .join(" "));
250
+ }
251
+ return this;
252
+ }
253
+ #fileInstruction(
254
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
255
+ args, kind) {
256
+ const source = args[0];
257
+ const destination = args[1];
258
+ const options = args[2];
259
+ const base = `${kind} ${optionsToString(options)}`.trim();
260
+ const files = [source, destination].flatMap((s) => s);
261
+ const withSpaces = files.some((s) => s.includes(" "));
262
+ if (withSpaces) {
263
+ this.#pushInstruction(`${base} [ ${files.map((s) => `"${s}"`).join(", ")} ]`);
264
+ }
265
+ else {
266
+ this.#pushInstruction(`${base} ${files.join(" ")}`);
267
+ }
268
+ }
269
+ /**
270
+ * Adds a comment.
271
+ */
272
+ comment(content) {
273
+ this.#lines.push(`# ${content}`);
274
+ return this;
275
+ }
276
+ /**
277
+ * Adds a banner comment
278
+ */
279
+ banner(content) {
280
+ this.#lines.push(`# ---------`);
281
+ this.#lines.push(`# ${content}`);
282
+ this.#lines.push(`# ---------`);
283
+ this.blank();
284
+ return this;
285
+ }
286
+ /**
287
+ * Adds an empty line.
288
+ */
289
+ blank() {
290
+ this.#lines.push("");
291
+ return this;
292
+ }
293
+ /**
294
+ * Groups instructions by omitting blank lines between them.
295
+ */
296
+ group(callback) {
297
+ this.#blankAfterInstruction = false;
298
+ callback();
299
+ this.blank();
300
+ this.#blankAfterInstruction = true;
301
+ return this;
302
+ }
303
+ /**
304
+ * Returns the Dockerfile string.
305
+ */
306
+ toString() {
307
+ return this.#lines.join("\n");
308
+ }
309
+ /**
310
+ * Saves the Dockerfile.
311
+ */
312
+ save(filePath) {
313
+ writeFileSync(filePath, this.toString());
314
+ }
315
+ /**
316
+ * Appends the contents of a Dockerfile instance.
317
+ */
318
+ append(dockerfile) {
319
+ this.#lines.push(...dockerfile.#lines);
320
+ return this;
321
+ }
322
+ #blankAfterInstruction = true;
323
+ /**
324
+ * Adds an instruction
325
+ */
326
+ #pushInstruction(instruction) {
327
+ this.#lines.push(`${instruction}`);
328
+ if (this.#blankAfterInstruction) {
329
+ this.blank();
330
+ }
331
+ }
332
+ }
333
+ function mountOpts(mount) {
334
+ if (mount === undefined) {
335
+ return "";
336
+ }
337
+ return [mount]
338
+ .flatMap((m) => m)
339
+ .map((m) => Object.entries(m)
340
+ .reduce((acc, val) => {
341
+ if (val[0] === "type") {
342
+ return acc;
343
+ }
344
+ if (typeof val[1] === "string") {
345
+ acc.push(`${val[0]}=${val[1]}`);
346
+ }
347
+ else {
348
+ acc.push(val[0]);
349
+ }
350
+ return acc;
351
+ }, [`--mount=type=${m.type}`])
352
+ .join(","))
353
+ .join(" \\\n ");
354
+ }
355
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
356
+ function optionsToString(opts) {
357
+ if (opts === undefined) {
358
+ return "";
359
+ }
360
+ return Object.entries(opts)
361
+ .reduce((acc, val) => {
362
+ const optionName = kebabCase(val[0]);
363
+ if (optionName === "on-build") {
364
+ return acc;
365
+ }
366
+ if (typeof val[1] === "boolean") {
367
+ acc += `--${optionName} `;
368
+ }
369
+ else {
370
+ acc += `--${optionName}=${val[1]} `;
371
+ }
372
+ return acc;
373
+ }, "")
374
+ .trimEnd();
375
+ }
376
+ function filterUndefined(value) {
377
+ return value !== undefined;
378
+ }
379
+ function buildOption(options) {
380
+ return options?.onBuild ? "ONBUILD" : undefined;
381
+ }
@@ -0,0 +1,7 @@
1
+ import { Dockerfile } from "~docker/df.js";
2
+ /**
3
+ * Validates a {@link Dockerfile }.
4
+ *
5
+ * @throws `Error` if the Dockerfile is not valid.
6
+ */
7
+ export declare function validate(dw: Dockerfile): boolean;
@@ -0,0 +1,14 @@
1
+ import { validate as dockerfileValidate } from "dockerfile-utils";
2
+ /**
3
+ * Validates a {@link Dockerfile }.
4
+ *
5
+ * @throws `Error` if the Dockerfile is not valid.
6
+ */
7
+ export function validate(dw) {
8
+ const diagnostic = dockerfileValidate(dw.toString());
9
+ if (diagnostic.length !== 0) {
10
+ console.dir(diagnostic);
11
+ throw new Error("Invalid Dockerfile", { cause: diagnostic });
12
+ }
13
+ return true;
14
+ }
@@ -0,0 +1 @@
1
+ export declare function createFile(filePath: string, content: string, log?: boolean): void;
@@ -0,0 +1,11 @@
1
+ import { existsSync, writeFileSync } from "fs";
2
+ import path from "path";
3
+ import color from "picocolors";
4
+ export function createFile(filePath, content, log = true) {
5
+ const overwritten = existsSync(filePath);
6
+ writeFileSync(filePath, content);
7
+ if (log) {
8
+ const relativePath = path.relative(process.cwd(), filePath);
9
+ console.log(`${color.green(overwritten ? "overwritten" : "created")} ${relativePath}`);
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ export declare function dateStringWithMilliseconds(): string;
@@ -0,0 +1,8 @@
1
+ export function dateStringWithMilliseconds() {
2
+ return new Date()
3
+ .toISOString()
4
+ .replace(/[-:]/g, "")
5
+ .replace(".", "")
6
+ .replace("T", "")
7
+ .replace("Z", "");
8
+ }
@@ -0,0 +1 @@
1
+ export declare function isErrnoException(error: unknown): error is NodeJS.ErrnoException;
@@ -0,0 +1,4 @@
1
+ export function isErrnoException(error) {
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
+ return error instanceof Error && typeof error.code === "string";
4
+ }
@@ -0,0 +1,16 @@
1
+ export declare function hashValue(value: string): string;
2
+ interface HashDigestOptions {
3
+ /**
4
+ * Length of the digest to generate.
5
+ *
6
+ * @default 8
7
+ */
8
+ length: number;
9
+ }
10
+ /**
11
+ * Returns a hex digest of a string.
12
+ * @param value String to generate a digest.
13
+ * @param options {@link HashDigestOptions}
14
+ */
15
+ export declare function hashDigest(value: string, options?: HashDigestOptions): import("effect/Effect").Effect<string, never, never>;
16
+ export {};
@@ -0,0 +1,20 @@
1
+ import { gen, succeed } from "effect/Effect";
2
+ import { createHash } from "node:crypto";
3
+ export function hashValue(value) {
4
+ const hash = createHash("sha256");
5
+ hash.update(value);
6
+ return hash.digest("hex").substring(0, 8);
7
+ }
8
+ /**
9
+ * Returns a hex digest of a string.
10
+ * @param value String to generate a digest.
11
+ * @param options {@link HashDigestOptions}
12
+ */
13
+ export function hashDigest(value, options) {
14
+ return gen(function* () {
15
+ const hash = createHash("sha256");
16
+ hash.update(value);
17
+ const digest = hash.digest("hex").substring(0, options?.length ?? 8);
18
+ return yield* succeed(digest);
19
+ });
20
+ }
@@ -0,0 +1 @@
1
+ export declare function importDefault(path: string): import("effect/Effect").Effect<any, NodeJS.ErrnoException | import("effect/Cause").UnknownException, never>;
@@ -0,0 +1,10 @@
1
+ import { gen } from "effect/Effect";
2
+ import { importFile } from "./import-file.js";
3
+ export function importDefault(path) {
4
+ return gen(function* () {
5
+ const imported = yield* importFile(path);
6
+ return imported.default && imported.default.default
7
+ ? imported.default.default
8
+ : imported.default;
9
+ });
10
+ }
@@ -0,0 +1,8 @@
1
+ import type { UnknownException } from "effect/Cause";
2
+ /**
3
+ * Dynamically imports a module from the specified path.
4
+ *
5
+ * @param path path to file to import.
6
+ * @typeParam T The expected type of the imported module. Default: `any`
7
+ */
8
+ export declare const importFile: <T = any>(path: string) => import("effect/Effect").Effect<T, NodeJS.ErrnoException | UnknownException, never>;
@@ -0,0 +1,13 @@
1
+ import { tryPromise } from "effect/Effect";
2
+ import { isErrnoException } from "./exception.js";
3
+ /**
4
+ * Dynamically imports a module from the specified path.
5
+ *
6
+ * @param path path to file to import.
7
+ * @typeParam T The expected type of the imported module. Default: `any`
8
+ */
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ export const importFile = (path) => tryPromise({
11
+ try: () => import(path),
12
+ catch: (e) => (isErrnoException(e) ? e : e),
13
+ });
@@ -0,0 +1 @@
1
+ export declare function logWithSpinner(msg: string, fn: () => Promise<void>): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import ora from "ora";
2
+ import color from "picocolors";
3
+ export async function logWithSpinner(msg, fn) {
4
+ const spinner = ora();
5
+ spinner.start(msg);
6
+ const start = performance.now();
7
+ try {
8
+ await fn();
9
+ const end = performance.now();
10
+ const milliseconds = Number(end - start).toFixed(3);
11
+ spinner.succeed(`${msg} ${color.gray(`(${milliseconds}ms)`)}`);
12
+ }
13
+ catch (e) {
14
+ spinner.fail();
15
+ throw e;
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ import { Effect } from "effect";
2
+ export declare function pathExists(filePath: string): Effect.Effect<boolean, import("effect/Cause").UnknownException, never>;
@@ -0,0 +1,17 @@
1
+ import { Effect } from "effect";
2
+ import { stat } from "fs/promises";
3
+ export function pathExists(filePath) {
4
+ return Effect.tryPromise(async () => {
5
+ try {
6
+ await stat(filePath);
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ }
9
+ catch (error) {
10
+ if (error.code === "ENOENT") {
11
+ return false;
12
+ }
13
+ throw error;
14
+ }
15
+ return true;
16
+ });
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ async function main() {
2
+ const filePath = "./2323.js";
3
+ return await import(filePath);
4
+ }
5
+ main()
6
+ .then((r) => console.dir(r, { depth: null }))
7
+ .catch((e) => {
8
+ console.log("ERROR", e instanceof Error);
9
+ console.dir(e, { depth: null });
10
+ });
11
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare function addEnvVar(name: string, value: string): Promise<void>;
2
+ export declare function updateDotenvFile(vars?: {
3
+ name: string;
4
+ value: string;
5
+ }[]): Promise<void>;
6
+ export declare function dotenvFile(): Promise<string>;
@@ -0,0 +1,57 @@
1
+ // ML_PG_KLAMP_DB_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/klamp-db"
2
+ import { createReadStream, existsSync, writeFileSync } from "fs";
3
+ import ora from "ora";
4
+ import path from "path";
5
+ import { cwd } from "process";
6
+ import readline from "readline";
7
+ export async function addEnvVar(name, value) {
8
+ const spinner = ora();
9
+ spinner.start("Adding environment variable to .env.local");
10
+ await updateDotenvFile([
11
+ {
12
+ name,
13
+ value,
14
+ },
15
+ ]);
16
+ spinner.succeed();
17
+ }
18
+ export async function updateDotenvFile(vars = []) {
19
+ const envFilePath = path.join(cwd(), ".env.local");
20
+ if (!existsSync(envFilePath)) {
21
+ writeFileSync(envFilePath, vars
22
+ .map((v) => {
23
+ return `${v.name}="${v.value}"`;
24
+ })
25
+ .join("\n"));
26
+ return;
27
+ }
28
+ const newContent = [];
29
+ const file = readline.createInterface({
30
+ input: createReadStream(".env.local"),
31
+ output: process.stdout,
32
+ terminal: false,
33
+ });
34
+ const keys = vars.reduce((acc, val) => {
35
+ acc.push([val.name, new RegExp(`^${val.name}`), val.value]);
36
+ return acc;
37
+ }, []);
38
+ file.on("line", (line) => {
39
+ const idx = keys.findIndex((key) => line.trim().match(key[1]));
40
+ if (idx !== -1) {
41
+ const match = keys.splice(idx, 1)[0];
42
+ newContent.push(`${match[0]}="${match[2]}"`);
43
+ }
44
+ else {
45
+ newContent.push(line);
46
+ }
47
+ });
48
+ file.on("close", () => {
49
+ for (const key of keys) {
50
+ newContent.push(`${key[0]}="${key[2]}"`);
51
+ }
52
+ writeFileSync(envFilePath, newContent.join("\n"));
53
+ });
54
+ }
55
+ export async function dotenvFile() {
56
+ return ".env.local";
57
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Adds a named import to a TypeScript file.
3
+ *
4
+ * @param filePath The path to the file to modify.
5
+ * @param moduleSpecifier The module to import from (e.g., "react").
6
+ * @param namedImport The named import to add (e.g., "useState").
7
+ */
8
+ export declare function addImport(filePath: string, moduleSpecifier: string, namedImport: string): Promise<void>;
9
+ /**
10
+ * Adds a named import to a TypeScript file.
11
+ *
12
+ * @param filePath The path to the file to modify.
13
+ * @param moduleSpecifier The module to import from (e.g., "react").
14
+ * @param defaultImport The default import to add.
15
+ */
16
+ export declare function addDefaultImport(filePath: string, moduleSpecifier: string, defaultImport: string): Promise<void>;