@astrale-os/sdk 0.6.0-beta.4 → 0.6.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 (516) hide show
  1. package/README.md +191 -58
  2. package/dist/application/action/action.d.ts +6 -0
  3. package/dist/application/action/authoring.d.ts +1 -1
  4. package/dist/application/action/context.d.ts +47 -31
  5. package/dist/application/action/define.d.ts +3 -3
  6. package/dist/application/action/index.d.ts +1 -1
  7. package/dist/application/define.d.ts +8 -6
  8. package/dist/application/define.js +28 -14
  9. package/dist/application/dependency/index.d.ts +1 -1
  10. package/dist/application/dependency/invoker.d.ts +21 -10
  11. package/dist/application/domain.d.ts +30 -0
  12. package/dist/application/index.d.ts +4 -4
  13. package/dist/application/index.js +1 -1
  14. package/dist/application/integration/define.d.ts +8 -1
  15. package/dist/application/integration/index.d.ts +2 -2
  16. package/dist/application/integration/integration.d.ts +13 -1
  17. package/dist/application/integration/operation.d.ts +16 -3
  18. package/dist/application/mutation/authoring/properties.d.ts +5 -3
  19. package/dist/application/mutation/authoring/properties.js +35 -2
  20. package/dist/application/mutation/authoring/transition.js +4 -1
  21. package/dist/application/mutation/execution/execute.js +1 -1
  22. package/dist/application/mutation/failure.d.ts +6 -0
  23. package/dist/application/mutation/failure.js +24 -18
  24. package/dist/application/mutation/index.d.ts +1 -1
  25. package/dist/application/query/collection/union.js +11 -4
  26. package/dist/application/query/composite/plan.d.ts +0 -4
  27. package/dist/application/query/composite/plan.js +0 -2
  28. package/dist/application/query/conformance.d.ts +15 -0
  29. package/dist/application/query/conformance.js +46 -0
  30. package/dist/application/query/define.js +4 -3
  31. package/dist/application/query/execution/execute.d.ts +0 -1
  32. package/dist/application/query/execution/execute.js +7 -1
  33. package/dist/application/query/failure.d.ts +8 -0
  34. package/dist/application/query/failure.js +8 -0
  35. package/dist/application/query/index.d.ts +1 -1
  36. package/dist/application/query/index.js +1 -1
  37. package/dist/application/routes/admission.d.ts +2 -2
  38. package/dist/application/routes/admission.js +1 -1
  39. package/dist/application/routes/route.d.ts +2 -2
  40. package/dist/application/runtime/actions.js +3 -0
  41. package/dist/application/runtime/workflows.d.ts +3 -1
  42. package/dist/application/runtime/workflows.js +3 -4
  43. package/dist/application/view/define.js +4 -6
  44. package/dist/application/view/frontend.d.ts +2 -2
  45. package/dist/application/view/index.d.ts +1 -1
  46. package/dist/application/view/route.d.ts +0 -14
  47. package/dist/application/view/route.js +1 -64
  48. package/dist/application/workflow/authoring.d.ts +3 -2
  49. package/dist/application/workflow/context.d.ts +8 -2
  50. package/dist/application/workflow/define.d.ts +4 -4
  51. package/dist/application/workflow/define.js +14 -9
  52. package/dist/application/workflow/durable.d.ts +197 -0
  53. package/dist/application/workflow/index.d.ts +3 -2
  54. package/dist/application/workflow/runner/inline.js +3 -4
  55. package/dist/application/workflow/runner/runner.d.ts +2 -2
  56. package/dist/application/workflow/step/output.d.ts +2 -0
  57. package/dist/application/workflow/step/output.js +73 -0
  58. package/dist/application/workflow/workflow.d.ts +5 -3
  59. package/dist/deployment/adapter/adapter.d.ts +55 -13
  60. package/dist/deployment/adapter/bundle/bundle.d.ts +36 -0
  61. package/dist/deployment/adapter/bundle/file.d.ts +10 -0
  62. package/dist/deployment/adapter/bundle/index.d.ts +2 -0
  63. package/dist/deployment/adapter/define.d.ts +4 -3
  64. package/dist/deployment/adapter/define.js +107 -23
  65. package/dist/deployment/adapter/index.d.ts +4 -3
  66. package/dist/deployment/adapter/index.js +1 -0
  67. package/dist/deployment/adapter/release/command.d.ts +33 -0
  68. package/dist/deployment/adapter/release/context.d.ts +94 -0
  69. package/dist/deployment/adapter/release/index.d.ts +4 -0
  70. package/dist/deployment/adapter/release/index.js +1 -0
  71. package/dist/deployment/adapter/release/list.d.ts +53 -0
  72. package/dist/deployment/adapter/release/list.js +1 -0
  73. package/dist/deployment/adapter/release/refusal.d.ts +10 -0
  74. package/dist/deployment/adapter/release/refusal.js +14 -0
  75. package/dist/deployment/adapter/release/result.d.ts +56 -0
  76. package/dist/deployment/adapter/release/result.js +1 -0
  77. package/dist/deployment/address/configuration.d.ts +96 -0
  78. package/dist/deployment/address/configuration.js +274 -0
  79. package/dist/deployment/address/fingerprint.d.ts +5 -0
  80. package/dist/deployment/address/fingerprint.js +27 -0
  81. package/dist/deployment/address/index.d.ts +5 -0
  82. package/dist/deployment/address/index.js +4 -0
  83. package/dist/deployment/address/label.d.ts +42 -0
  84. package/dist/deployment/address/label.js +80 -0
  85. package/dist/deployment/address/line.d.ts +29 -0
  86. package/dist/deployment/address/line.js +53 -0
  87. package/dist/deployment/address/record.d.ts +73 -0
  88. package/dist/deployment/address/record.js +138 -0
  89. package/dist/deployment/address/summary.d.ts +30 -0
  90. package/dist/deployment/address/summary.js +1 -0
  91. package/dist/deployment/address/vectors.d.ts +60 -0
  92. package/dist/deployment/address/vectors.js +517 -0
  93. package/dist/deployment/authoring.d.ts +0 -2
  94. package/dist/deployment/authoring.js +0 -1
  95. package/dist/deployment/build/build.d.ts +8 -2
  96. package/dist/deployment/build/compile.d.ts +4 -4
  97. package/dist/deployment/build/compile.js +19 -17
  98. package/dist/deployment/build/frontend/compilation.d.ts +2 -4
  99. package/dist/deployment/build/frontend/compilation.js +0 -5
  100. package/dist/deployment/build/frontend/digest.js +1 -5
  101. package/dist/deployment/build/index.d.ts +1 -0
  102. package/dist/deployment/build/index.js +1 -0
  103. package/dist/deployment/build/manifest.d.ts +59 -0
  104. package/dist/deployment/build/manifest.js +118 -0
  105. package/dist/deployment/build/material.d.ts +2 -2
  106. package/dist/deployment/build/material.js +28 -13
  107. package/dist/deployment/build/schema.d.ts +2 -2
  108. package/dist/deployment/deployment.d.ts +3 -2
  109. package/dist/deployment/environment.d.ts +6 -0
  110. package/dist/deployment/environment.js +6 -0
  111. package/dist/deployment/index.d.ts +4 -6
  112. package/dist/deployment/index.js +1 -2
  113. package/dist/deployment/release/addressing.d.ts +6 -5
  114. package/dist/deployment/release/addressing.js +2 -3
  115. package/dist/deployment/release/assemble.d.ts +6 -3
  116. package/dist/deployment/release/assemble.js +12 -10
  117. package/dist/deployment/release/release.d.ts +16 -5
  118. package/dist/deployment/release/seal.d.ts +14 -0
  119. package/dist/deployment/release/seal.js +22 -0
  120. package/dist/deployment/release/{publication → served}/callables.d.ts +2 -2
  121. package/dist/deployment/release/{publication → served}/callables.js +2 -2
  122. package/dist/deployment/release/served/index.d.ts +11 -0
  123. package/dist/deployment/release/served/index.js +26 -0
  124. package/dist/deployment/release/{publication → served}/views.d.ts +2 -2
  125. package/dist/deployment/release/{publication → served}/views.js +0 -1
  126. package/dist/deployment/runtime/admission.d.ts +2 -2
  127. package/dist/deployment/runtime/admission.js +5 -5
  128. package/dist/deployment/verify/index.d.ts +3 -4
  129. package/dist/deployment/verify/index.js +2 -3
  130. package/dist/deployment/verify/preflight/bundle.d.ts +18 -0
  131. package/dist/deployment/verify/preflight/bundle.js +71 -0
  132. package/dist/deployment/verify/preflight/index.d.ts +1 -12
  133. package/dist/deployment/verify/preflight/index.js +1 -12
  134. package/dist/deployment/verify/readiness/fetch.d.ts +13 -0
  135. package/dist/deployment/verify/readiness/fetch.js +26 -0
  136. package/dist/deployment/verify/readiness/identity.d.ts +3 -6
  137. package/dist/deployment/verify/readiness/identity.js +3 -3
  138. package/dist/deployment/verify/readiness/index.d.ts +15 -8
  139. package/dist/deployment/verify/readiness/index.js +25 -6
  140. package/dist/deployment/verify/readiness/release.d.ts +8 -0
  141. package/dist/deployment/verify/readiness/release.js +22 -0
  142. package/dist/deployment/worker/address.d.ts +26 -0
  143. package/dist/deployment/worker/address.js +43 -0
  144. package/dist/deployment/worker/build.d.ts +60 -0
  145. package/dist/deployment/worker/build.js +172 -0
  146. package/dist/deployment/worker/configuration.d.ts +73 -0
  147. package/dist/deployment/worker/configuration.js +165 -0
  148. package/dist/deployment/worker/content.d.ts +38 -0
  149. package/dist/deployment/worker/content.js +169 -0
  150. package/dist/deployment/worker/index.d.ts +29 -0
  151. package/dist/deployment/worker/index.js +29 -0
  152. package/dist/deployment/worker/limits.d.ts +30 -0
  153. package/dist/deployment/worker/limits.js +30 -0
  154. package/dist/deployment/worker/record.d.ts +29 -0
  155. package/dist/deployment/worker/record.js +69 -0
  156. package/dist/deployment/worker/request.d.ts +118 -0
  157. package/dist/deployment/worker/request.js +280 -0
  158. package/dist/deployment/worker/response.d.ts +101 -0
  159. package/dist/deployment/worker/response.js +207 -0
  160. package/dist/execution/cache/cache.d.ts +17 -0
  161. package/dist/execution/cache/cache.js +11 -0
  162. package/dist/execution/cache/index.d.ts +2 -0
  163. package/dist/execution/cache/index.js +2 -0
  164. package/dist/execution/cache/memory.d.ts +13 -0
  165. package/dist/execution/cache/memory.js +48 -0
  166. package/dist/execution/identity/authentication.d.ts +33 -3
  167. package/dist/execution/identity/authentication.js +90 -36
  168. package/dist/execution/identity/callback.d.ts +20 -20
  169. package/dist/execution/identity/callback.js +34 -26
  170. package/dist/execution/identity/delivery.d.ts +6 -4
  171. package/dist/execution/identity/delivery.js +25 -20
  172. package/dist/execution/identity/identity.d.ts +17 -3
  173. package/dist/execution/identity/identity.js +12 -4
  174. package/dist/execution/identity/jwks.d.ts +5 -0
  175. package/dist/execution/identity/jwks.js +92 -102
  176. package/dist/execution/index.d.ts +6 -4
  177. package/dist/execution/index.js +4 -2
  178. package/dist/execution/invocation/admission/age.d.ts +57 -0
  179. package/dist/execution/invocation/admission/age.js +208 -0
  180. package/dist/execution/invocation/admission/authentication.d.ts +13 -13
  181. package/dist/execution/invocation/admission/authentication.js +52 -44
  182. package/dist/execution/invocation/admission/authority.d.ts +28 -6
  183. package/dist/execution/invocation/admission/authority.js +9 -2
  184. package/dist/execution/invocation/admission/index.d.ts +4 -3
  185. package/dist/execution/invocation/admission/index.js +3 -2
  186. package/dist/execution/invocation/admission/input.d.ts +2 -2
  187. package/dist/execution/invocation/admission/input.js +16 -2
  188. package/dist/execution/invocation/admission/target.d.ts +11 -0
  189. package/dist/execution/invocation/admission/target.js +22 -3
  190. package/dist/execution/invocation/capabilities/bind.d.ts +11 -0
  191. package/dist/execution/invocation/capabilities/bind.js +25 -0
  192. package/dist/execution/invocation/capabilities/index.d.ts +1 -0
  193. package/dist/execution/invocation/capabilities/index.js +1 -0
  194. package/dist/execution/invocation/dependency/bind.d.ts +3 -1
  195. package/dist/execution/invocation/dependency/bind.js +36 -16
  196. package/dist/execution/invocation/dispatch/context.d.ts +7 -6
  197. package/dist/execution/invocation/dispatch/context.js +11 -44
  198. package/dist/execution/invocation/dispatch/workflow.js +0 -4
  199. package/dist/execution/invocation/handler.js +8 -2
  200. package/dist/execution/invocation/index.d.ts +2 -2
  201. package/dist/execution/invocation/index.js +1 -1
  202. package/dist/execution/invocation/integration/authentication.d.ts +3 -3
  203. package/dist/execution/invocation/integration/authentication.js +7 -7
  204. package/dist/execution/invocation/integration/call.d.ts +2 -1
  205. package/dist/execution/invocation/integration/call.js +3 -3
  206. package/dist/execution/invocation/integration/clients.d.ts +1 -1
  207. package/dist/execution/invocation/integration/index.d.ts +1 -0
  208. package/dist/execution/invocation/integration/index.js +1 -0
  209. package/dist/execution/invocation/invocation.d.ts +6 -0
  210. package/dist/execution/invocation/invocation.js +129 -21
  211. package/dist/execution/invocation/lifecycle/active.d.ts +8 -2
  212. package/dist/execution/invocation/lifecycle/active.js +3 -3
  213. package/dist/execution/invocation/lifecycle/index.d.ts +1 -1
  214. package/dist/execution/invocation/result/errors.d.ts +0 -10
  215. package/dist/execution/invocation/result/errors.js +0 -17
  216. package/dist/execution/invocation/result/index.d.ts +2 -2
  217. package/dist/execution/invocation/result/index.js +1 -1
  218. package/dist/execution/invocation/result/project.js +41 -1
  219. package/dist/execution/node/serve.d.ts +2 -2
  220. package/dist/execution/node/serve.js +1 -1
  221. package/dist/execution/runtime/index.d.ts +1 -0
  222. package/dist/execution/runtime/index.js +1 -0
  223. package/dist/execution/runtime/load.d.ts +3 -3
  224. package/dist/execution/runtime/load.js +3 -2
  225. package/dist/execution/runtime/release.d.ts +17 -0
  226. package/dist/execution/runtime/release.js +7 -0
  227. package/dist/execution/serve.d.ts +18 -4
  228. package/dist/execution/serve.js +10 -0
  229. package/dist/execution/service/create.js +43 -7
  230. package/dist/execution/service/initialization.d.ts +4 -4
  231. package/dist/execution/service/initialization.js +23 -14
  232. package/dist/execution/service/release.d.ts +2 -2
  233. package/dist/execution/service/release.js +3 -2
  234. package/dist/execution/service/service.d.ts +20 -5
  235. package/dist/execution/service/serving/delivery.d.ts +5 -0
  236. package/dist/execution/service/{publication → serving}/delivery.js +4 -1
  237. package/dist/execution/service/{publication → serving}/index.d.ts +1 -1
  238. package/dist/execution/service/serving/installation.d.ts +4 -0
  239. package/dist/execution/service/serving/installation.js +9 -0
  240. package/dist/execution/service/serving/source.d.ts +11 -0
  241. package/dist/execution/service/serving/source.js +15 -0
  242. package/dist/execution/workflows/attempts.d.ts +87 -0
  243. package/dist/execution/workflows/attempts.js +205 -0
  244. package/dist/execution/workflows/discovery.d.ts +14 -0
  245. package/dist/execution/workflows/discovery.js +151 -0
  246. package/dist/execution/workflows/engine.d.ts +83 -0
  247. package/dist/execution/workflows/engine.js +1 -0
  248. package/dist/execution/workflows/envelope.d.ts +12 -0
  249. package/dist/execution/workflows/envelope.js +46 -0
  250. package/dist/execution/workflows/failure.d.ts +39 -0
  251. package/dist/execution/workflows/failure.js +143 -0
  252. package/dist/execution/workflows/index.d.ts +4 -0
  253. package/dist/execution/workflows/index.js +3 -0
  254. package/dist/execution/workflows/integrations.d.ts +13 -0
  255. package/dist/execution/workflows/integrations.js +25 -0
  256. package/dist/execution/workflows/options.d.ts +81 -0
  257. package/dist/execution/workflows/options.js +158 -0
  258. package/dist/execution/workflows/receiver.d.ts +24 -0
  259. package/dist/execution/workflows/receiver.js +99 -0
  260. package/dist/execution/workflows/route.d.ts +12 -0
  261. package/dist/execution/workflows/route.js +35 -0
  262. package/dist/execution/workflows/run.d.ts +23 -0
  263. package/dist/execution/workflows/run.js +365 -0
  264. package/dist/execution/workflows/steps.d.ts +48 -0
  265. package/dist/execution/workflows/steps.js +93 -0
  266. package/dist/index.d.ts +4 -4
  267. package/dist/index.js +2 -2
  268. package/dist/platform/graph/alias.d.ts +1 -5
  269. package/dist/platform/graph/alias.js +1 -5
  270. package/dist/platform/graph/document/index.d.ts +1 -1
  271. package/dist/platform/graph/document/index.js +1 -1
  272. package/dist/platform/graph/index.d.ts +1 -1
  273. package/dist/platform/graph/index.js +1 -1
  274. package/dist/platform/release/index.d.ts +2 -0
  275. package/dist/platform/release/index.js +2 -0
  276. package/dist/platform/schema/callable-authoring.d.ts +21 -0
  277. package/dist/platform/schema/callable-authoring.js +27 -0
  278. package/dist/platform/schema/class-authoring.d.ts +61 -11
  279. package/dist/platform/schema/class-authoring.js +37 -4
  280. package/dist/platform/schema/class-icon-svg.d.ts +9 -0
  281. package/dist/platform/schema/class-icon-svg.js +29 -0
  282. package/dist/platform/schema/class-icon.d.ts +3 -8
  283. package/dist/platform/schema/class-icon.js +2 -29
  284. package/dist/platform/schema/index.d.ts +6 -4
  285. package/dist/platform/schema/index.js +2 -1
  286. package/dist/platform/schema/property.d.ts +5 -0
  287. package/dist/platform/schema/schema-authoring.d.ts +14 -7
  288. package/dist/platform/schema/schema-authoring.js +5 -1
  289. package/dist/platform/versioning/dependents.d.ts +18 -0
  290. package/dist/platform/versioning/dependents.js +15 -0
  291. package/dist/platform/versioning/index.d.ts +5 -0
  292. package/dist/platform/versioning/index.js +5 -0
  293. package/dist/platform/versioning/name.d.ts +38 -0
  294. package/dist/platform/versioning/name.js +58 -0
  295. package/dist/platform/versioning/reference.d.ts +48 -0
  296. package/dist/platform/versioning/reference.js +95 -0
  297. package/dist/platform/versioning/version.d.ts +72 -0
  298. package/dist/platform/versioning/version.js +98 -0
  299. package/dist/project/admit.js +1 -5
  300. package/dist/project/define.d.ts +4 -4
  301. package/dist/project/define.js +55 -35
  302. package/dist/project/index.d.ts +1 -1
  303. package/dist/project/install-command.d.ts +6 -0
  304. package/dist/project/install-command.js +9 -0
  305. package/dist/project/project.d.ts +10 -8
  306. package/dist/testing/dataset/define.d.ts +1 -1
  307. package/dist/testing/durable/engine.d.ts +128 -0
  308. package/dist/testing/durable/engine.js +619 -0
  309. package/dist/testing/durable/index.d.ts +3 -0
  310. package/dist/testing/durable/index.js +1 -0
  311. package/dist/testing/durable/steps.d.ts +30 -0
  312. package/dist/testing/durable/steps.js +45 -0
  313. package/dist/testing/index.d.ts +6 -1
  314. package/dist/testing/index.js +5 -1
  315. package/dist/testing/load.js +1 -1
  316. package/dist/tooling/cli/adapter-command.d.ts +35 -0
  317. package/dist/tooling/cli/adapter-command.js +66 -0
  318. package/dist/tooling/cli/arguments.d.ts +17 -6
  319. package/dist/tooling/cli/arguments.js +175 -52
  320. package/dist/tooling/cli/build.d.ts +55 -0
  321. package/dist/tooling/cli/build.js +77 -0
  322. package/dist/tooling/cli/bun.d.ts +0 -1
  323. package/dist/tooling/cli/bun.js +0 -7
  324. package/dist/tooling/cli/commit.d.ts +35 -0
  325. package/dist/tooling/cli/commit.js +235 -0
  326. package/dist/tooling/cli/deploy-mode.d.ts +26 -0
  327. package/dist/tooling/cli/deploy-mode.js +59 -0
  328. package/dist/tooling/cli/deploy-result.d.ts +80 -0
  329. package/dist/tooling/cli/deploy-result.js +64 -0
  330. package/dist/tooling/cli/diff/declared.d.ts +7 -0
  331. package/dist/tooling/cli/diff/declared.js +27 -0
  332. package/dist/tooling/cli/diff/index.d.ts +30 -0
  333. package/dist/tooling/cli/diff/index.js +58 -0
  334. package/dist/tooling/cli/diff/render.d.ts +15 -0
  335. package/dist/tooling/cli/diff/render.js +131 -0
  336. package/dist/tooling/cli/diff/report.d.ts +88 -0
  337. package/dist/tooling/cli/diff/report.js +154 -0
  338. package/dist/tooling/cli/dotenv.d.ts +5 -5
  339. package/dist/tooling/cli/dotenv.js +6 -36
  340. package/dist/tooling/cli/help.js +173 -60
  341. package/dist/tooling/cli/immutable-deployment.d.ts +83 -0
  342. package/dist/tooling/cli/immutable-deployment.js +135 -0
  343. package/dist/tooling/cli/index.d.ts +12 -4
  344. package/dist/tooling/cli/index.js +6 -3
  345. package/dist/tooling/cli/installed-on.d.ts +83 -0
  346. package/dist/tooling/cli/installed-on.js +156 -0
  347. package/dist/tooling/cli/list.d.ts +152 -0
  348. package/dist/tooling/cli/list.js +331 -0
  349. package/dist/tooling/cli/log.d.ts +5 -2
  350. package/dist/tooling/cli/log.js +9 -2
  351. package/dist/tooling/cli/orchestrate.d.ts +0 -6
  352. package/dist/tooling/cli/orchestrate.js +246 -90
  353. package/dist/tooling/cli/project.d.ts +3 -3
  354. package/dist/tooling/cli/publish/index.d.ts +81 -0
  355. package/dist/tooling/cli/publish/index.js +383 -0
  356. package/dist/tooling/cli/publish/report.d.ts +49 -0
  357. package/dist/tooling/cli/publish/report.js +15 -0
  358. package/dist/tooling/cli/registry/client.d.ts +121 -0
  359. package/dist/tooling/cli/registry/client.js +354 -0
  360. package/dist/tooling/cli/registry/error.d.ts +11 -0
  361. package/dist/tooling/cli/registry/error.js +17 -0
  362. package/dist/tooling/cli/registry/executable.d.ts +35 -0
  363. package/dist/tooling/cli/registry/executable.js +96 -0
  364. package/dist/tooling/cli/registry/index.d.ts +9 -0
  365. package/dist/tooling/cli/registry/index.js +8 -0
  366. package/dist/tooling/cli/registry/installations.d.ts +67 -0
  367. package/dist/tooling/cli/registry/installations.js +108 -0
  368. package/dist/tooling/cli/registry/process.d.ts +36 -0
  369. package/dist/tooling/cli/registry/process.js +119 -0
  370. package/dist/tooling/cli/secrets.d.ts +9 -0
  371. package/dist/tooling/cli/secrets.js +19 -0
  372. package/dist/tooling/cli/yank.d.ts +34 -0
  373. package/dist/tooling/cli/yank.js +32 -0
  374. package/dist/tooling/linter/adapters/typescript/imports.d.ts +0 -1
  375. package/dist/tooling/linter/adapters/typescript/imports.js +1 -5
  376. package/dist/tooling/linter/adapters/typescript/index.d.ts +1 -1
  377. package/dist/tooling/linter/adapters/typescript/index.js +1 -1
  378. package/dist/tooling/linter/adapters/typescript/syntax.d.ts +3 -3
  379. package/dist/tooling/linter/adapters/typescript/syntax.js +13 -25
  380. package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +1 -2
  381. package/dist/tooling/linter/implementations/source/callable-requirements.js +11 -16
  382. package/dist/tooling/linter/implementations/source/dependencies.js +13 -72
  383. package/dist/tooling/linter/implementations/source/global.js +1 -2
  384. package/dist/tooling/linter/implementations/source/mutations.js +18 -29
  385. package/dist/tooling/linter/implementations/source/providers.js +5 -5
  386. package/dist/tooling/linter/implementations/source/queries.js +1 -17
  387. package/dist/tooling/linter/implementations/source/shared.d.ts +12 -4
  388. package/dist/tooling/linter/implementations/source/shared.js +101 -46
  389. package/dist/tooling/linter/implementations/source/verifiers.js +0 -2
  390. package/dist/tooling/linter/implementations/source/views.js +2 -2
  391. package/dist/tooling/linter/implementations/source/workflows.js +499 -17
  392. package/dist/tooling/linter/policy/generated.js +14 -63
  393. package/dist/tooling/linter/requirements/registry.js +6 -8
  394. package/dist/tooling/packaging/declarations/ownership.js +1 -1
  395. package/dist/tooling/packaging/finalize.d.ts +1 -1
  396. package/dist/tooling/packaging/finalize.js +1 -1
  397. package/docs/admission-age.md +88 -0
  398. package/docs/auth-api-migration.md +55 -0
  399. package/docs/business-errors.md +42 -0
  400. package/docs/domain-definition-migration.md +44 -0
  401. package/docs/domain-schema-migration.md +36 -0
  402. package/docs/durable-workflows.md +445 -0
  403. package/docs/handler-dependencies.md +213 -0
  404. package/docs/release.md +155 -0
  405. package/docs/schema-cost.md +124 -0
  406. package/package.json +45 -16
  407. package/dist/application/application.d.ts +0 -28
  408. package/dist/application/query/execution/projection.d.ts +0 -3
  409. package/dist/application/query/execution/projection.js +0 -3
  410. package/dist/deployment/adapter/deploy/context.d.ts +0 -15
  411. package/dist/deployment/adapter/deploy/index.d.ts +0 -2
  412. package/dist/deployment/adapter/deploy/result.d.ts +0 -50
  413. package/dist/deployment/adapter/prepare/artifact.d.ts +0 -33
  414. package/dist/deployment/adapter/prepare/context.d.ts +0 -23
  415. package/dist/deployment/adapter/prepare/index.d.ts +0 -2
  416. package/dist/deployment/deploy.d.ts +0 -20
  417. package/dist/deployment/deploy.js +0 -31
  418. package/dist/deployment/release/publication/index.d.ts +0 -6
  419. package/dist/deployment/release/publication/index.js +0 -6
  420. package/dist/deployment/release/publication/manifest.d.ts +0 -3
  421. package/dist/deployment/release/publication/manifest.js +0 -5
  422. package/dist/deployment/release/publication/requirements.d.ts +0 -3
  423. package/dist/deployment/release/publication/requirements.js +0 -3
  424. package/dist/deployment/release/publication/seal.d.ts +0 -10
  425. package/dist/deployment/release/publication/seal.js +0 -39
  426. package/dist/deployment/verify/preflight/artifact.d.ts +0 -6
  427. package/dist/deployment/verify/preflight/artifact.js +0 -122
  428. package/dist/deployment/verify/preflight/publication.d.ts +0 -4
  429. package/dist/deployment/verify/preflight/publication.js +0 -14
  430. package/dist/deployment/verify/readiness/deployment.d.ts +0 -3
  431. package/dist/deployment/verify/readiness/deployment.js +0 -151
  432. package/dist/deployment/verify/readiness/publication.d.ts +0 -11
  433. package/dist/deployment/verify/readiness/publication.js +0 -41
  434. package/dist/execution/service/errors.d.ts +0 -3
  435. package/dist/execution/service/errors.js +0 -3
  436. package/dist/execution/service/publication/delivery.d.ts +0 -2
  437. package/dist/execution/service/publication/installation.d.ts +0 -3
  438. package/dist/execution/service/publication/installation.js +0 -8
  439. package/dist/execution/service/publication/source.d.ts +0 -3
  440. package/dist/execution/service/publication/source.js +0 -11
  441. package/dist/platform/publication/index.d.ts +0 -2
  442. package/dist/platform/publication/index.js +0 -2
  443. package/dist/tooling/cli/astrale/authority.d.ts +0 -5
  444. package/dist/tooling/cli/astrale/authority.js +0 -11
  445. package/dist/tooling/cli/astrale/executable.d.ts +0 -2
  446. package/dist/tooling/cli/astrale/executable.js +0 -47
  447. package/dist/tooling/cli/astrale/failure.d.ts +0 -6
  448. package/dist/tooling/cli/astrale/failure.js +0 -48
  449. package/dist/tooling/cli/astrale/instance.d.ts +0 -11
  450. package/dist/tooling/cli/astrale/instance.js +0 -52
  451. package/dist/tooling/cli/astrale/process.d.ts +0 -13
  452. package/dist/tooling/cli/astrale/process.js +0 -94
  453. package/dist/tooling/cli/astrale/version.d.ts +0 -18
  454. package/dist/tooling/cli/astrale/version.js +0 -55
  455. package/dist/tooling/cli/credential.d.ts +0 -2
  456. package/dist/tooling/cli/credential.js +0 -57
  457. package/dist/tooling/cli/deprecations.d.ts +0 -9
  458. package/dist/tooling/cli/deprecations.js +0 -15
  459. package/dist/tooling/cli/development/candidate.d.ts +0 -25
  460. package/dist/tooling/cli/development/candidate.js +0 -176
  461. package/dist/tooling/cli/development/deployment.d.ts +0 -16
  462. package/dist/tooling/cli/development/deployment.js +0 -39
  463. package/dist/tooling/cli/development/develop.d.ts +0 -11
  464. package/dist/tooling/cli/development/develop.js +0 -243
  465. package/dist/tooling/cli/development/lease.d.ts +0 -18
  466. package/dist/tooling/cli/development/lease.js +0 -163
  467. package/dist/tooling/cli/development/lifecycle.d.ts +0 -9
  468. package/dist/tooling/cli/development/lifecycle.js +0 -43
  469. package/dist/tooling/cli/development/project-imports.d.ts +0 -22
  470. package/dist/tooling/cli/development/project-imports.js +0 -39
  471. package/dist/tooling/cli/development/project-lock.d.ts +0 -16
  472. package/dist/tooling/cli/development/project-lock.js +0 -41
  473. package/dist/tooling/cli/development/rebuild.d.ts +0 -13
  474. package/dist/tooling/cli/development/rebuild.js +0 -58
  475. package/dist/tooling/cli/development/release-evidence.d.ts +0 -4
  476. package/dist/tooling/cli/development/release-evidence.js +0 -10
  477. package/dist/tooling/cli/development/report.d.ts +0 -6
  478. package/dist/tooling/cli/development/report.js +0 -14
  479. package/dist/tooling/cli/development/session-file.d.ts +0 -53
  480. package/dist/tooling/cli/development/session-file.js +0 -337
  481. package/dist/tooling/cli/development/source-watch.d.ts +0 -14
  482. package/dist/tooling/cli/development/source-watch.js +0 -140
  483. package/dist/tooling/cli/development/sources.d.ts +0 -7
  484. package/dist/tooling/cli/development/sources.js +0 -48
  485. package/dist/tooling/cli/development/target-lock.d.ts +0 -16
  486. package/dist/tooling/cli/development/target-lock.js +0 -68
  487. package/dist/tooling/cli/development/view.d.ts +0 -28
  488. package/dist/tooling/cli/development/view.js +0 -151
  489. package/dist/tooling/cli/environment-release.d.ts +0 -21
  490. package/dist/tooling/cli/environment-release.js +0 -46
  491. package/dist/tooling/cli/evidence.d.ts +0 -11
  492. package/dist/tooling/cli/evidence.js +0 -53
  493. package/dist/tooling/cli/installation/index.d.ts +0 -2
  494. package/dist/tooling/cli/installation/index.js +0 -1
  495. package/dist/tooling/cli/installation/observation.d.ts +0 -10
  496. package/dist/tooling/cli/installation/observation.js +0 -44
  497. package/dist/tooling/cli/installation/reconcile.d.ts +0 -32
  498. package/dist/tooling/cli/installation/reconcile.js +0 -122
  499. package/dist/tooling/linter/implementations/source/migrations.d.ts +0 -2
  500. package/dist/tooling/linter/implementations/source/migrations.js +0 -113
  501. package/dist/tooling/linter/qualification/index.d.ts +0 -10
  502. package/dist/tooling/linter/qualification/index.js +0 -2
  503. package/dist/tooling/linter/qualification/query-fixtures.d.ts +0 -2
  504. package/dist/tooling/linter/qualification/query-fixtures.js +0 -68
  505. package/dist/tooling/linter/qualification/runner.d.ts +0 -3
  506. package/dist/tooling/linter/qualification/runner.js +0 -6
  507. /package/dist/application/{application.js → domain.js} +0 -0
  508. /package/dist/{deployment/adapter/deploy/context.js → application/workflow/durable.js} +0 -0
  509. /package/dist/deployment/adapter/{deploy/index.js → bundle/bundle.js} +0 -0
  510. /package/dist/deployment/adapter/{deploy/result.js → bundle/file.js} +0 -0
  511. /package/dist/deployment/adapter/{prepare → bundle}/index.js +0 -0
  512. /package/dist/deployment/adapter/{prepare/artifact.js → release/command.js} +0 -0
  513. /package/dist/deployment/adapter/{prepare → release}/context.js +0 -0
  514. /package/dist/deployment/release/{publication → served}/routes.d.ts +0 -0
  515. /package/dist/deployment/release/{publication → served}/routes.js +0 -0
  516. /package/dist/execution/service/{publication → serving}/index.js +0 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `@astrale-os/sdk/deployment/worker` — the contract of a Worker host (Admin's Services), agnostic
3
+ * of what the Worker serves: an Astrale Domain release, or any Cloudflare Worker (a cron job, an
4
+ * API). A deployment is one Worker release in the Service of a project and an environment:
5
+ *
6
+ * - its code (`WorkerCode`): modules, a main module, static assets, and the build manifest members
7
+ * its deployer declares; `workerBuildDigest` identifies it, and its host binds that digest as
8
+ * `ASTRALE_BUILD_DIGEST`;
9
+ * - its configuration (`WorkerConfigurationV1`): the Workers runtime, plain variables, the names of
10
+ * its secrets, and what it asks of its host (`record`, `signingIdentity`, `router`);
11
+ * - its label, `<service>-<content>` (`workerDeploymentAddress`): the Service name derives from the
12
+ * project and environment, the content from the two digests, so the same release reuses its
13
+ * deployment;
14
+ * - its record (`WorkerRecord`): opaque bytes and a media type its host serves verbatim at
15
+ * `/.well-known/astrale/deployment.json`;
16
+ * - readiness paths its host probes before activation, and secret values it never stores.
17
+ *
18
+ * `encodeWorkerDeploymentRequest` builds the request a deployer sends, and
19
+ * `decodeWorkerDeploymentRequest` admits it as a host does; the response decoders admit what a
20
+ * host answers.
21
+ */
22
+ export { PROJECT_NAME, serviceName, workerDeploymentLabel } from './address.js';
23
+ export { acceptWorkerCode, WORKER_BUILD_MANIFEST, workerBuildDigest, workerBuildManifest, } from './build.js';
24
+ export { acceptWorkerConfiguration, isWorkerConfiguration, WORKER_BINDING_NAME, WORKER_CONFIGURATION_FORMAT, WORKER_CONFIGURATION_VERSION, WORKER_HOST_BINDINGS, workerConfiguration, workerConfigurationDigest, } from './configuration.js';
25
+ export { decodeWorkerContent, encodeWorkerContent } from './content.js';
26
+ export { WORKER_DEPLOYMENT_LIMITS } from './limits.js';
27
+ export { acceptWorkerRecord, decodeWorkerRecord, encodeWorkerRecord, sameWorkerRecord, WORKER_RECORD_PATH, } from './record.js';
28
+ export { decodeWorkerDeploymentRequest, encodeWorkerDeploymentRequest, WORKER_DEPLOYMENT_REQUEST_FORMAT, WORKER_DEPLOYMENT_REQUEST_VERSION, workerDeploymentAddress, WorkerDeploymentRefusal, } from './request.js';
29
+ export { decodeWorkerDeploymentList, decodeWorkerDeploymentResponse, decodeWorkerDeploymentSummary, decodeWorkerHosting, WORKER_DEPLOYMENT_REJECTIONS, } from './response.js';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The bounds of one Worker deployment on the wire and once decoded. A host refuses a request past
3
+ * any of them before it reads or writes anything; a deployer refuses one before it sends it.
4
+ */
5
+ export declare const WORKER_DEPLOYMENT_LIMITS: Readonly<{
6
+ /** Every wire string stays below Core's portable Value string limit. */
7
+ base64ChunkSize: number;
8
+ /** The Base64 of one module, chunks joined. */
9
+ moduleBase64Size: number;
10
+ /** The Base64 of one asset, chunks joined. */
11
+ assetBase64Size: number;
12
+ /** The decoded bytes of one module. */
13
+ moduleSize: number;
14
+ /** The decoded bytes of one asset. */
15
+ assetSize: number;
16
+ /** The decoded bytes of every module and asset of one Worker together. */
17
+ workerSize: number;
18
+ modules: 40;
19
+ assets: 2000;
20
+ /** The bytes of one deployment record. */
21
+ recordSize: number;
22
+ /** The canonical JSON bytes of the build manifest members a deployer declares. */
23
+ manifestSize: number;
24
+ vars: 128;
25
+ /** The UTF-16 length of one variable or secret value. */
26
+ valueLength: number;
27
+ secrets: 64;
28
+ compatibilityFlags: 64;
29
+ readinessPaths: 8;
30
+ }>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The bounds of one Worker deployment on the wire and once decoded. A host refuses a request past
3
+ * any of them before it reads or writes anything; a deployer refuses one before it sends it.
4
+ */
5
+ export const WORKER_DEPLOYMENT_LIMITS = Object.freeze({
6
+ /** Every wire string stays below Core's portable Value string limit. */
7
+ base64ChunkSize: 512 * 1024,
8
+ /** The Base64 of one module, chunks joined. */
9
+ moduleBase64Size: 10 * 1024 * 1024,
10
+ /** The Base64 of one asset, chunks joined. */
11
+ assetBase64Size: 16 * 1024 * 1024,
12
+ /** The decoded bytes of one module. */
13
+ moduleSize: ((10 * 1024 * 1024) / 4) * 3,
14
+ /** The decoded bytes of one asset. */
15
+ assetSize: ((16 * 1024 * 1024) / 4) * 3,
16
+ /** The decoded bytes of every module and asset of one Worker together. */
17
+ workerSize: 32 * 1024 * 1024,
18
+ modules: 40,
19
+ assets: 2_000,
20
+ /** The bytes of one deployment record. */
21
+ recordSize: 64 * 1024,
22
+ /** The canonical JSON bytes of the build manifest members a deployer declares. */
23
+ manifestSize: 4 * 1024,
24
+ vars: 128,
25
+ /** The UTF-16 length of one variable or secret value. */
26
+ valueLength: 64 * 1024,
27
+ secrets: 64,
28
+ compatibilityFlags: 64,
29
+ readinessPaths: 8,
30
+ });
@@ -0,0 +1,29 @@
1
+ /** Where a Worker host serves a deployment's record, which the deployment itself never answers. */
2
+ export declare const WORKER_RECORD_PATH = "/.well-known/astrale/deployment.json";
3
+ /**
4
+ * The record a deployer publishes for one deployment: opaque bytes and their media type. Its host
5
+ * serves it verbatim at `WORKER_RECORD_PATH`, immutable, and never reads it: what it says is the
6
+ * deployer's (a Domain deployer publishes its `DeploymentRecordV1`). A deployment keeps the record
7
+ * it was created with.
8
+ */
9
+ export interface WorkerRecord {
10
+ /** A media type, served verbatim as the record's `content-type`. */
11
+ readonly contentType: string;
12
+ /** One to `WORKER_DEPLOYMENT_LIMITS.recordSize` bytes. */
13
+ readonly bytes: Uint8Array;
14
+ }
15
+ /** One record on the wire: its media type and its bytes as canonical Base64. */
16
+ export interface WorkerRecordWireV1 {
17
+ readonly contentType: string;
18
+ readonly contentBase64: string;
19
+ }
20
+ /** Admit one record: a media type a response can carry as written, and bounded bytes. */
21
+ export declare function acceptWorkerRecord(input: WorkerRecord): WorkerRecord;
22
+ /** Whether two records are the same publication: the same media type and the same bytes. */
23
+ export declare function sameWorkerRecord(left: WorkerRecord, right: WorkerRecord): boolean;
24
+ /** Whether `input` is a media type a record may carry, exactly as it will be served. */
25
+ export declare function isMediaType(input: unknown): input is string;
26
+ /** One record on the wire. */
27
+ export declare function encodeWorkerRecord(record: WorkerRecord): WorkerRecordWireV1;
28
+ /** Decode one record from the wire: exactly a media type and canonical Base64 of bounded bytes. */
29
+ export declare function decodeWorkerRecord(input: unknown): WorkerRecord;
@@ -0,0 +1,69 @@
1
+ import { fromBase64, toBase64 } from './content.js';
2
+ import { WORKER_DEPLOYMENT_LIMITS } from './limits.js';
3
+ /** Where a Worker host serves a deployment's record, which the deployment itself never answers. */
4
+ export const WORKER_RECORD_PATH = '/.well-known/astrale/deployment.json';
5
+ const TOKEN = "[A-Za-z0-9!#$%&'*+.^_`|~-]+";
6
+ /** `type/subtype` and `;name=value` parameters (token or quoted value), at most 256 characters. */
7
+ const MEDIA_TYPE = new RegExp(`^${TOKEN}/${TOKEN}(?:[ \\t]*;[ \\t]*${TOKEN}=(?:${TOKEN}|"[\\x20\\x21\\x23-\\x5b\\x5d-\\x7e]*"))*$`, 'u');
8
+ const MAXIMUM_MEDIA_TYPE_LENGTH = 256;
9
+ /** Admit one record: a media type a response can carry as written, and bounded bytes. */
10
+ export function acceptWorkerRecord(input) {
11
+ if (input === null || typeof input !== 'object')
12
+ invalid('it is not an object');
13
+ if (!isMediaType(input.contentType))
14
+ invalid('its content type is not a media type');
15
+ if (!(input.bytes instanceof Uint8Array))
16
+ invalid('its bytes are not bytes');
17
+ if (input.bytes.byteLength === 0 ||
18
+ input.bytes.byteLength > WORKER_DEPLOYMENT_LIMITS.recordSize) {
19
+ invalid('its size is outside its limit');
20
+ }
21
+ return Object.freeze({ contentType: input.contentType, bytes: input.bytes });
22
+ }
23
+ /** Whether two records are the same publication: the same media type and the same bytes. */
24
+ export function sameWorkerRecord(left, right) {
25
+ if (left.contentType !== right.contentType)
26
+ return false;
27
+ if (left.bytes.byteLength !== right.bytes.byteLength)
28
+ return false;
29
+ return left.bytes.every((byte, index) => byte === right.bytes[index]);
30
+ }
31
+ /** Whether `input` is a media type a record may carry, exactly as it will be served. */
32
+ export function isMediaType(input) {
33
+ return (typeof input === 'string' && input.length <= MAXIMUM_MEDIA_TYPE_LENGTH && MEDIA_TYPE.test(input));
34
+ }
35
+ /** One record on the wire. */
36
+ export function encodeWorkerRecord(record) {
37
+ const admitted = acceptWorkerRecord(record);
38
+ return Object.freeze({
39
+ contentType: admitted.contentType,
40
+ contentBase64: toBase64(admitted.bytes),
41
+ });
42
+ }
43
+ /** Decode one record from the wire: exactly a media type and canonical Base64 of bounded bytes. */
44
+ export function decodeWorkerRecord(input) {
45
+ if (input === null ||
46
+ typeof input !== 'object' ||
47
+ Array.isArray(input) ||
48
+ Reflect.ownKeys(input).length !== 2 ||
49
+ !Object.hasOwn(input, 'contentType') ||
50
+ !Object.hasOwn(input, 'contentBase64')) {
51
+ invalid('its members are not exactly contentType and contentBase64');
52
+ }
53
+ const { contentType, contentBase64 } = input;
54
+ if (typeof contentBase64 !== 'string' ||
55
+ contentBase64.length > Math.ceil(WORKER_DEPLOYMENT_LIMITS.recordSize / 3) * 4) {
56
+ invalid('its Base64 is invalid');
57
+ }
58
+ let bytes;
59
+ try {
60
+ bytes = fromBase64(contentBase64);
61
+ }
62
+ catch (cause) {
63
+ throw new TypeError('Worker record is invalid: its Base64 is invalid.', { cause });
64
+ }
65
+ return acceptWorkerRecord({ contentType: contentType, bytes });
66
+ }
67
+ function invalid(reason) {
68
+ throw new TypeError(`Worker record is invalid: ${reason}.`);
69
+ }
@@ -0,0 +1,118 @@
1
+ import type { Digest } from '@astrale-os/kernel-protocol/artifact';
2
+ import type { WorkerBuildManifest, WorkerCode, WorkerModule } from './build.js';
3
+ import type { WorkerConfigurationV1 } from './configuration.js';
4
+ import type { WorkerContentV1 } from './content.js';
5
+ import type { WorkerRecord, WorkerRecordWireV1 } from './record.js';
6
+ export declare const WORKER_DEPLOYMENT_REQUEST_FORMAT = "astrale.worker.deployment-request";
7
+ export declare const WORKER_DEPLOYMENT_REQUEST_VERSION = 1;
8
+ /**
9
+ * `WorkerDeploymentRequestV1`: one Worker release to host as a deployment of the Service of its
10
+ * project and environment. Its host knows nothing of what the Worker serves: it recomputes the
11
+ * build digest from the uploaded bytes and the label from the Service name, the build and the
12
+ * configuration, and refuses a request that states another (`build-mismatch`,
13
+ * `address-mismatch`), so a deployer that predicted an address is never served elsewhere. Its
14
+ * `secrets` are bound to a new deployment, or rewritten in place on the reused one, and never
15
+ * stored; a host never journals the request.
16
+ */
17
+ export interface WorkerDeploymentRequestV1 {
18
+ readonly format: typeof WORKER_DEPLOYMENT_REQUEST_FORMAT;
19
+ readonly version: typeof WORKER_DEPLOYMENT_REQUEST_VERSION;
20
+ /**
21
+ * The Identity that owns the Service when this deploy creates it: the caller, or one it acts as.
22
+ * The caller when absent; an existing Service keeps its owner.
23
+ */
24
+ readonly owner?: string;
25
+ /** Any project name (`PROJECT_NAME`); a Domain deployer names its Domain's origin. */
26
+ readonly project: string;
27
+ readonly environment: string;
28
+ /** `<service>-<content>`, as `workerDeploymentAddress` derives it. */
29
+ readonly label: string;
30
+ /** The build digest of `worker`, as `workerBuildDigest` derives it. */
31
+ readonly buildDigest: string;
32
+ readonly configuration: WorkerConfigurationV1;
33
+ readonly worker: WorkerCodeWireV1;
34
+ /** Exactly when `configuration.record`: the record the deployment serves. */
35
+ readonly record?: WorkerRecordWireV1;
36
+ /**
37
+ * Local paths that must answer 200 with the deployment's `x-astrale-worker-version` before the
38
+ * deployment is activated; none when absent. A probe is not part of the configuration.
39
+ */
40
+ readonly readiness?: readonly string[];
41
+ /** The secret values, exactly the names `configuration.secrets` declares. */
42
+ readonly secrets: Readonly<Record<string, string>>;
43
+ /** Whether the Service serves the deployment once it is active; `true` when absent. */
44
+ readonly promote?: boolean;
45
+ }
46
+ /** The code of one Worker on the wire, each file in its content envelope. */
47
+ export interface WorkerCodeWireV1 {
48
+ readonly manifest: WorkerBuildManifest;
49
+ readonly mainModule: string;
50
+ readonly modules: readonly {
51
+ readonly name: string;
52
+ readonly kind: WorkerModule['kind'];
53
+ readonly content: WorkerContentV1;
54
+ }[];
55
+ readonly assets?: readonly {
56
+ readonly path: string;
57
+ readonly contentType?: string;
58
+ readonly content: WorkerContentV1;
59
+ }[];
60
+ }
61
+ /** One Worker deployment as its deployer describes it, before its address is derived. */
62
+ export interface WorkerDeploymentInput {
63
+ readonly owner?: string;
64
+ readonly project: string;
65
+ readonly environment: string;
66
+ readonly worker: WorkerCode;
67
+ readonly configuration: WorkerConfigurationV1;
68
+ readonly record?: WorkerRecord;
69
+ readonly readiness?: readonly string[];
70
+ readonly secrets?: Readonly<Record<string, string>>;
71
+ readonly promote?: boolean;
72
+ }
73
+ /** Where one Worker deployment is addressed: its Service, its digests and its label. */
74
+ export interface WorkerDeploymentAddress {
75
+ readonly service: string;
76
+ readonly buildDigest: Digest;
77
+ readonly configurationDigest: Digest;
78
+ readonly label: string;
79
+ }
80
+ /** One Worker deployment as a host admitted it: decoded, digested and addressed. */
81
+ export interface WorkerDeployment extends WorkerDeploymentAddress {
82
+ readonly owner?: string;
83
+ readonly project: string;
84
+ readonly environment: string;
85
+ readonly worker: WorkerCode;
86
+ readonly configuration: WorkerConfigurationV1;
87
+ readonly record?: WorkerRecord;
88
+ readonly readiness: readonly string[];
89
+ readonly secrets: Readonly<Record<string, string>>;
90
+ readonly promote: boolean;
91
+ }
92
+ /** Why a host refuses a Worker deployment request before reading or writing anything. */
93
+ export declare class WorkerDeploymentRefusal extends Error {
94
+ readonly reason: 'invalid-deployment' | 'build-mismatch' | 'address-mismatch';
95
+ readonly name = "WorkerDeploymentRefusal";
96
+ constructor(reason: 'invalid-deployment' | 'build-mismatch' | 'address-mismatch', message: string, options?: ErrorOptions);
97
+ }
98
+ /** The address one Worker deployment gets: its Service's name, its two digests and its label. */
99
+ export declare function workerDeploymentAddress(input: {
100
+ readonly project: string;
101
+ readonly environment: string;
102
+ readonly worker: WorkerCode;
103
+ readonly configuration: WorkerConfigurationV1;
104
+ }): WorkerDeploymentAddress;
105
+ /**
106
+ * Encode one Worker deployment as its request: its address derived, every file in its content
107
+ * envelope. A deployment its host would refuse as invalid is refused here, before any call.
108
+ */
109
+ export declare function encodeWorkerDeploymentRequest(input: WorkerDeploymentInput): Promise<WorkerDeploymentRequestV1>;
110
+ /**
111
+ * Decode and admit one Worker deployment request, as a host does before any graph or provider
112
+ * effect: exactly this request shape, every file decoded within its bounds and the Worker's, the
113
+ * configuration canonical, the record exactly when the configuration asks for one, the secrets
114
+ * exactly the names it declares. Then the build digest is recomputed from the decoded bytes
115
+ * (`build-mismatch` when the request states another) and the label from the Service name, that
116
+ * digest and the configuration (`address-mismatch`). Every refusal is a `WorkerDeploymentRefusal`.
117
+ */
118
+ export declare function decodeWorkerDeploymentRequest(input: unknown): Promise<WorkerDeployment>;
@@ -0,0 +1,280 @@
1
+ import { serviceName, workerDeploymentLabel } from './address.js';
2
+ import { acceptWorkerCode, workerBuildDigest } from './build.js';
3
+ import { acceptWorkerConfiguration, workerConfigurationDigest } from './configuration.js';
4
+ import { decodeWorkerContent, encodeWorkerContent } from './content.js';
5
+ import { WORKER_DEPLOYMENT_LIMITS } from './limits.js';
6
+ import { acceptWorkerRecord, decodeWorkerRecord, encodeWorkerRecord } from './record.js';
7
+ export const WORKER_DEPLOYMENT_REQUEST_FORMAT = 'astrale.worker.deployment-request';
8
+ export const WORKER_DEPLOYMENT_REQUEST_VERSION = 1;
9
+ /** Why a host refuses a Worker deployment request before reading or writing anything. */
10
+ export class WorkerDeploymentRefusal extends Error {
11
+ reason;
12
+ name = 'WorkerDeploymentRefusal';
13
+ constructor(reason, message, options) {
14
+ super(message, options);
15
+ this.reason = reason;
16
+ }
17
+ }
18
+ /** The address one Worker deployment gets: its Service's name, its two digests and its label. */
19
+ export function workerDeploymentAddress(input) {
20
+ const service = serviceName(input.project, input.environment);
21
+ const buildDigest = workerBuildDigest(input.worker);
22
+ const configurationDigest = workerConfigurationDigest(input.configuration);
23
+ return Object.freeze({
24
+ service,
25
+ buildDigest,
26
+ configurationDigest,
27
+ label: workerDeploymentLabel({ service, buildDigest, configurationDigest }),
28
+ });
29
+ }
30
+ /**
31
+ * Encode one Worker deployment as its request: its address derived, every file in its content
32
+ * envelope. A deployment its host would refuse as invalid is refused here, before any call.
33
+ */
34
+ export async function encodeWorkerDeploymentRequest(input) {
35
+ const deployment = admitDeployment(input);
36
+ const { worker } = deployment;
37
+ const modules = await Promise.all(worker.modules.map(async (module) => Object.freeze({
38
+ name: module.name,
39
+ kind: module.kind,
40
+ content: await encodeWorkerContent(module.bytes),
41
+ })));
42
+ const assets = await Promise.all((worker.assets ?? []).map(async (asset) => Object.freeze({
43
+ path: asset.path,
44
+ ...(asset.contentType === undefined ? {} : { contentType: asset.contentType }),
45
+ content: await encodeWorkerContent(asset.bytes),
46
+ })));
47
+ return Object.freeze({
48
+ format: WORKER_DEPLOYMENT_REQUEST_FORMAT,
49
+ version: WORKER_DEPLOYMENT_REQUEST_VERSION,
50
+ ...(deployment.owner === undefined ? {} : { owner: deployment.owner }),
51
+ project: deployment.project,
52
+ environment: deployment.environment,
53
+ label: deployment.label,
54
+ buildDigest: deployment.buildDigest,
55
+ configuration: deployment.configuration,
56
+ worker: Object.freeze({
57
+ manifest: worker.manifest,
58
+ mainModule: worker.mainModule,
59
+ modules: Object.freeze(modules),
60
+ ...(assets.length === 0 ? {} : { assets: Object.freeze(assets) }),
61
+ }),
62
+ ...(deployment.record === undefined ? {} : { record: encodeWorkerRecord(deployment.record) }),
63
+ ...(deployment.readiness.length === 0 ? {} : { readiness: deployment.readiness }),
64
+ secrets: deployment.secrets,
65
+ ...(input.promote === undefined ? {} : { promote: input.promote }),
66
+ });
67
+ }
68
+ /**
69
+ * Decode and admit one Worker deployment request, as a host does before any graph or provider
70
+ * effect: exactly this request shape, every file decoded within its bounds and the Worker's, the
71
+ * configuration canonical, the record exactly when the configuration asks for one, the secrets
72
+ * exactly the names it declares. Then the build digest is recomputed from the decoded bytes
73
+ * (`build-mismatch` when the request states another) and the label from the Service name, that
74
+ * digest and the configuration (`address-mismatch`). Every refusal is a `WorkerDeploymentRefusal`.
75
+ */
76
+ export async function decodeWorkerDeploymentRequest(input) {
77
+ let deployment;
78
+ let stated;
79
+ try {
80
+ const value = exact(input, [
81
+ 'format',
82
+ 'version',
83
+ 'project',
84
+ 'environment',
85
+ 'label',
86
+ 'buildDigest',
87
+ 'configuration',
88
+ 'worker',
89
+ 'secrets',
90
+ ], ['owner', 'record', 'readiness', 'promote'], 'request');
91
+ if (value.format !== WORKER_DEPLOYMENT_REQUEST_FORMAT ||
92
+ value.version !== WORKER_DEPLOYMENT_REQUEST_VERSION) {
93
+ throw new TypeError('The request is not a WorkerDeploymentRequestV1.');
94
+ }
95
+ stated = { buildDigest: value.buildDigest, label: value.label };
96
+ deployment = admitDeployment({
97
+ ...(value.owner === undefined ? {} : { owner: value.owner }),
98
+ project: value.project,
99
+ environment: value.environment,
100
+ worker: await decodeCode(value.worker),
101
+ configuration: value.configuration,
102
+ ...(value.record === undefined ? {} : { record: decodeWorkerRecord(value.record) }),
103
+ ...(value.readiness === undefined ? {} : { readiness: value.readiness }),
104
+ secrets: value.secrets,
105
+ ...(value.promote === undefined ? {} : { promote: value.promote }),
106
+ });
107
+ }
108
+ catch (cause) {
109
+ if (!(cause instanceof TypeError))
110
+ throw cause;
111
+ throw new WorkerDeploymentRefusal('invalid-deployment', cause.message, { cause });
112
+ }
113
+ if (stated.buildDigest !== deployment.buildDigest) {
114
+ throw new WorkerDeploymentRefusal('build-mismatch', `The uploaded Worker has build digest ${deployment.buildDigest}, not ${quoted(stated.buildDigest)}.`);
115
+ }
116
+ if (stated.label !== deployment.label) {
117
+ throw new WorkerDeploymentRefusal('address-mismatch', `This release of this Service is deployed at ${deployment.label}, not ${quoted(stated.label)}.`);
118
+ }
119
+ return deployment;
120
+ }
121
+ /** A stated value as a refusal names it: short printable text as written, anything else not. */
122
+ function quoted(value) {
123
+ return typeof value === 'string' && value.length <= 80 && !/[\p{Cc}]/u.test(value)
124
+ ? value
125
+ : 'the one stated';
126
+ }
127
+ /** Admit the decoded parts of one deployment and derive its address. */
128
+ function admitDeployment(input) {
129
+ if (input === null || typeof input !== 'object')
130
+ invalid('it is not an object');
131
+ const configuration = acceptWorkerConfiguration(input.configuration);
132
+ const worker = acceptWorkerCode(input.worker);
133
+ const secrets = acceptSecrets(input.secrets ?? {}, configuration.secrets);
134
+ if ((input.record !== undefined) !== configuration.record) {
135
+ invalid(configuration.record
136
+ ? 'its configuration serves a record it does not carry'
137
+ : 'it carries a record its configuration does not serve');
138
+ }
139
+ const record = input.record === undefined ? undefined : acceptWorkerRecord(input.record);
140
+ const readiness = acceptReadiness(input.readiness ?? []);
141
+ if (input.owner !== undefined && !isText(input.owner, 256))
142
+ invalid('its owner is invalid');
143
+ if (input.promote !== undefined && typeof input.promote !== 'boolean') {
144
+ invalid('its promote option is not a boolean');
145
+ }
146
+ const address = workerDeploymentAddress({
147
+ project: input.project,
148
+ environment: input.environment,
149
+ worker,
150
+ configuration,
151
+ });
152
+ return Object.freeze({
153
+ ...address,
154
+ ...(input.owner === undefined ? {} : { owner: input.owner }),
155
+ project: input.project,
156
+ environment: input.environment,
157
+ worker,
158
+ configuration,
159
+ ...(record === undefined ? {} : { record }),
160
+ readiness,
161
+ secrets,
162
+ promote: input.promote ?? true,
163
+ });
164
+ }
165
+ /** Exactly the declared secret names, each value bounded text. */
166
+ function acceptSecrets(input, declared) {
167
+ if (input === null || typeof input !== 'object' || Array.isArray(input)) {
168
+ invalid('its secrets are not an object');
169
+ }
170
+ const names = Reflect.ownKeys(input);
171
+ if (names.length !== declared.length ||
172
+ names.some((name) => typeof name !== 'string' || !declared.includes(name))) {
173
+ invalid('its secrets are not exactly the names its configuration declares');
174
+ }
175
+ for (const name of declared) {
176
+ if (typeof input[name] !== 'string' ||
177
+ input[name].length > WORKER_DEPLOYMENT_LIMITS.valueLength) {
178
+ invalid(`secret ${name} is not text within its size limit`);
179
+ }
180
+ }
181
+ return Object.freeze(Object.fromEntries(declared.map((name) => [name, input[name]])));
182
+ }
183
+ /**
184
+ * Readiness paths: at most `readinessPaths` distinct canonical local paths, never a host, a query,
185
+ * credentials or a redirect destination.
186
+ */
187
+ function acceptReadiness(input) {
188
+ if (!Array.isArray(input) ||
189
+ input.length > WORKER_DEPLOYMENT_LIMITS.readinessPaths ||
190
+ new Set(input).size !== input.length) {
191
+ invalid('its readiness paths are invalid');
192
+ }
193
+ for (const path of input) {
194
+ if (typeof path !== 'string' ||
195
+ path.length > 1_024 ||
196
+ !/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]*$/u.test(path) ||
197
+ path.split('/').some((part) => part === '.' || part === '..')) {
198
+ invalid('its readiness paths are not canonical local paths');
199
+ }
200
+ }
201
+ return Object.freeze([...input]);
202
+ }
203
+ /** Decode the code of one Worker, each file within its bounds and all within the Worker's. */
204
+ async function decodeCode(input) {
205
+ const value = exact(input, ['manifest', 'mainModule', 'modules'], ['assets'], 'worker');
206
+ const limits = WORKER_DEPLOYMENT_LIMITS;
207
+ if (!Array.isArray(value.modules) || value.modules.length > limits.modules) {
208
+ invalid('its modules are invalid');
209
+ }
210
+ if (value.assets !== undefined &&
211
+ (!Array.isArray(value.assets) || value.assets.length > limits.assets)) {
212
+ invalid('its assets are invalid');
213
+ }
214
+ let remaining = limits.workerSize;
215
+ const decode = async (content, size, base64Size) => {
216
+ const bytes = await decodeWorkerContent(content, {
217
+ size: Math.min(size, remaining),
218
+ base64Size,
219
+ });
220
+ remaining -= bytes.byteLength;
221
+ return bytes;
222
+ };
223
+ const modules = [];
224
+ for (const entry of value.modules) {
225
+ const module = exact(entry, ['name', 'kind', 'content'], [], 'module');
226
+ modules.push({
227
+ name: module.name,
228
+ kind: module.kind,
229
+ bytes: await decode(module.content, limits.moduleSize, limits.moduleBase64Size),
230
+ });
231
+ }
232
+ const assets = [];
233
+ for (const entry of (value.assets ?? [])) {
234
+ const asset = exact(entry, ['path', 'content'], ['contentType'], 'asset');
235
+ if (asset.contentType !== undefined && !isText(asset.contentType, 256)) {
236
+ invalid('an asset content type is invalid');
237
+ }
238
+ assets.push({
239
+ path: asset.path,
240
+ bytes: await decode(asset.content, limits.assetSize, limits.assetBase64Size),
241
+ ...(asset.contentType === undefined ? {} : { contentType: asset.contentType }),
242
+ });
243
+ }
244
+ return {
245
+ manifest: value.manifest,
246
+ mainModule: value.mainModule,
247
+ modules,
248
+ ...(assets.length === 0 ? {} : { assets }),
249
+ };
250
+ }
251
+ function isText(value, maximum) {
252
+ return (typeof value === 'string' &&
253
+ value.length > 0 &&
254
+ value.length <= maximum &&
255
+ !/[\p{Cc}]/u.test(value));
256
+ }
257
+ function exact(input, required, optional, label) {
258
+ if (input === null || typeof input !== 'object' || Array.isArray(input)) {
259
+ invalid(`its ${label} is not an object`);
260
+ }
261
+ for (const key of Reflect.ownKeys(input)) {
262
+ if (typeof key !== 'string' || (!required.includes(key) && !optional.includes(key))) {
263
+ invalid(`its ${label} has an unknown member ${String(key)}`);
264
+ }
265
+ }
266
+ const value = input;
267
+ for (const key of required) {
268
+ if (!Object.hasOwn(value, key))
269
+ invalid(`its ${label} has no ${key}`);
270
+ }
271
+ for (const key of optional) {
272
+ if (Object.hasOwn(value, key) && value[key] === undefined) {
273
+ invalid(`its ${label} has an undefined ${key}`);
274
+ }
275
+ }
276
+ return value;
277
+ }
278
+ function invalid(reason) {
279
+ throw new TypeError(`Worker deployment is invalid: ${reason}.`);
280
+ }