@xemahq/xema 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/README.md +68 -20
  2. package/dist/assets/boot-graph.json +57 -15
  3. package/dist/assets/core/distribution.lock.json +667 -297
  4. package/dist/assets/core/images.lock.json +136 -136
  5. package/dist/assets/oss/distribution.lock.json +1497 -461
  6. package/dist/assets/oss/images.lock.json +423 -188
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +36 -1
  9. package/dist/cli.js.map +1 -1
  10. package/dist/commands/apply.d.ts.map +1 -1
  11. package/dist/commands/apply.js +1 -1
  12. package/dist/commands/apply.js.map +1 -1
  13. package/dist/commands/biome-dev.d.ts +3 -0
  14. package/dist/commands/biome-dev.d.ts.map +1 -0
  15. package/dist/commands/biome-dev.js +176 -0
  16. package/dist/commands/biome-dev.js.map +1 -0
  17. package/dist/commands/biome-validate.d.ts +10 -0
  18. package/dist/commands/biome-validate.d.ts.map +1 -0
  19. package/dist/commands/biome-validate.js +49 -0
  20. package/dist/commands/biome-validate.js.map +1 -0
  21. package/dist/commands/biome.d.ts.map +1 -1
  22. package/dist/commands/biome.js +359 -25
  23. package/dist/commands/biome.js.map +1 -1
  24. package/dist/commands/canopy.d.ts +3 -0
  25. package/dist/commands/canopy.d.ts.map +1 -0
  26. package/dist/commands/canopy.js +214 -0
  27. package/dist/commands/canopy.js.map +1 -0
  28. package/dist/commands/config.d.ts +3 -0
  29. package/dist/commands/config.d.ts.map +1 -0
  30. package/dist/commands/config.js +78 -0
  31. package/dist/commands/config.js.map +1 -0
  32. package/dist/commands/dev.d.ts.map +1 -1
  33. package/dist/commands/dev.js +71 -21
  34. package/dist/commands/dev.js.map +1 -1
  35. package/dist/commands/dist.js +1 -1
  36. package/dist/commands/dist.js.map +1 -1
  37. package/dist/commands/down.d.ts.map +1 -1
  38. package/dist/commands/down.js +40 -6
  39. package/dist/commands/down.js.map +1 -1
  40. package/dist/commands/import.d.ts.map +1 -1
  41. package/dist/commands/import.js +1 -1
  42. package/dist/commands/import.js.map +1 -1
  43. package/dist/commands/installation.d.ts +3 -0
  44. package/dist/commands/installation.d.ts.map +1 -0
  45. package/dist/commands/installation.js +101 -0
  46. package/dist/commands/installation.js.map +1 -0
  47. package/dist/commands/logs.d.ts.map +1 -1
  48. package/dist/commands/logs.js +6 -14
  49. package/dist/commands/logs.js.map +1 -1
  50. package/dist/commands/objects.d.ts.map +1 -1
  51. package/dist/commands/objects.js +85 -6
  52. package/dist/commands/objects.js.map +1 -1
  53. package/dist/commands/plan.d.ts.map +1 -1
  54. package/dist/commands/plan.js +1 -1
  55. package/dist/commands/plan.js.map +1 -1
  56. package/dist/commands/run.d.ts.map +1 -1
  57. package/dist/commands/run.js +61 -9
  58. package/dist/commands/run.js.map +1 -1
  59. package/dist/commands/serve.d.ts.map +1 -1
  60. package/dist/commands/serve.js +33 -13
  61. package/dist/commands/serve.js.map +1 -1
  62. package/dist/commands/shell.d.ts.map +1 -1
  63. package/dist/commands/shell.js +190 -6
  64. package/dist/commands/shell.js.map +1 -1
  65. package/dist/commands/source.d.ts +3 -0
  66. package/dist/commands/source.d.ts.map +1 -0
  67. package/dist/commands/source.js +120 -0
  68. package/dist/commands/source.js.map +1 -0
  69. package/dist/commands/status.d.ts.map +1 -1
  70. package/dist/commands/status.js +29 -3
  71. package/dist/commands/status.js.map +1 -1
  72. package/dist/commands/up.d.ts.map +1 -1
  73. package/dist/commands/up.js +55 -5
  74. package/dist/commands/up.js.map +1 -1
  75. package/dist/dev/env-defaults.d.ts.map +1 -1
  76. package/dist/dev/env-defaults.js +9 -6
  77. package/dist/dev/env-defaults.js.map +1 -1
  78. package/dist/dev/forked-worker.d.ts +15 -0
  79. package/dist/dev/forked-worker.d.ts.map +1 -1
  80. package/dist/dev/forked-worker.js +72 -14
  81. package/dist/dev/forked-worker.js.map +1 -1
  82. package/dist/dev/opa-policies.d.ts +3 -0
  83. package/dist/dev/opa-policies.d.ts.map +1 -0
  84. package/dist/dev/opa-policies.js +64 -0
  85. package/dist/dev/opa-policies.js.map +1 -0
  86. package/dist/lib/cli-errors.d.ts +7 -0
  87. package/dist/lib/cli-errors.d.ts.map +1 -0
  88. package/dist/lib/cli-errors.js +30 -0
  89. package/dist/lib/cli-errors.js.map +1 -0
  90. package/dist/lib/control-plane.d.ts.map +1 -1
  91. package/dist/lib/control-plane.js +5 -2
  92. package/dist/lib/control-plane.js.map +1 -1
  93. package/dist/lib/exit-codes.d.ts +3 -4
  94. package/dist/lib/exit-codes.d.ts.map +1 -1
  95. package/dist/lib/exit-codes.js +3 -4
  96. package/dist/lib/exit-codes.js.map +1 -1
  97. package/dist/lib/http-error.d.ts +2 -0
  98. package/dist/lib/http-error.d.ts.map +1 -0
  99. package/dist/lib/http-error.js +51 -0
  100. package/dist/lib/http-error.js.map +1 -0
  101. package/dist/lib/roster-profile.d.ts +10 -0
  102. package/dist/lib/roster-profile.d.ts.map +1 -0
  103. package/dist/lib/roster-profile.js +44 -0
  104. package/dist/lib/roster-profile.js.map +1 -0
  105. package/dist/runtime/biome-dev.d.ts +28 -0
  106. package/dist/runtime/biome-dev.d.ts.map +1 -0
  107. package/dist/runtime/biome-dev.js +131 -0
  108. package/dist/runtime/biome-dev.js.map +1 -0
  109. package/dist/runtime/biome-local-install.d.ts +29 -0
  110. package/dist/runtime/biome-local-install.d.ts.map +1 -0
  111. package/dist/runtime/biome-local-install.js +243 -0
  112. package/dist/runtime/biome-local-install.js.map +1 -0
  113. package/dist/runtime/biome-publish.d.ts +34 -0
  114. package/dist/runtime/biome-publish.d.ts.map +1 -0
  115. package/dist/runtime/biome-publish.js +214 -0
  116. package/dist/runtime/biome-publish.js.map +1 -0
  117. package/dist/runtime/biome-scaffold.d.ts +35 -0
  118. package/dist/runtime/biome-scaffold.d.ts.map +1 -0
  119. package/dist/runtime/biome-scaffold.js +153 -0
  120. package/dist/runtime/biome-scaffold.js.map +1 -0
  121. package/dist/runtime/biome-validate.d.ts +28 -0
  122. package/dist/runtime/biome-validate.d.ts.map +1 -0
  123. package/dist/runtime/biome-validate.js +450 -0
  124. package/dist/runtime/biome-validate.js.map +1 -0
  125. package/dist/runtime/boot-graph-loader.d.ts +1 -0
  126. package/dist/runtime/boot-graph-loader.d.ts.map +1 -1
  127. package/dist/runtime/boot-graph-loader.js +99 -7
  128. package/dist/runtime/boot-graph-loader.js.map +1 -1
  129. package/dist/runtime/canopy-refs.d.ts +8 -0
  130. package/dist/runtime/canopy-refs.d.ts.map +1 -0
  131. package/dist/runtime/canopy-refs.js +51 -0
  132. package/dist/runtime/canopy-refs.js.map +1 -0
  133. package/dist/runtime/canopy-replies.d.ts +14 -0
  134. package/dist/runtime/canopy-replies.d.ts.map +1 -0
  135. package/dist/runtime/canopy-replies.js +39 -0
  136. package/dist/runtime/canopy-replies.js.map +1 -0
  137. package/dist/runtime/capability-invoke.d.ts +35 -0
  138. package/dist/runtime/capability-invoke.d.ts.map +1 -0
  139. package/dist/runtime/capability-invoke.js +119 -0
  140. package/dist/runtime/capability-invoke.js.map +1 -0
  141. package/dist/runtime/config/dev-mode.d.ts +8 -0
  142. package/dist/runtime/config/dev-mode.d.ts.map +1 -0
  143. package/dist/runtime/config/dev-mode.js +84 -0
  144. package/dist/runtime/config/dev-mode.js.map +1 -0
  145. package/dist/runtime/config/init-presets.d.ts +1 -1
  146. package/dist/runtime/config/init-presets.d.ts.map +1 -1
  147. package/dist/runtime/config/init-presets.js +63 -11
  148. package/dist/runtime/config/init-presets.js.map +1 -1
  149. package/dist/runtime/config/loader.d.ts +1 -0
  150. package/dist/runtime/config/loader.d.ts.map +1 -1
  151. package/dist/runtime/config/loader.js +41 -5
  152. package/dist/runtime/config/loader.js.map +1 -1
  153. package/dist/runtime/config/schema.d.ts +27 -12
  154. package/dist/runtime/config/schema.d.ts.map +1 -1
  155. package/dist/runtime/config/schema.js +113 -8
  156. package/dist/runtime/config/schema.js.map +1 -1
  157. package/dist/runtime/config/sources-config.d.ts +14 -0
  158. package/dist/runtime/config/sources-config.d.ts.map +1 -0
  159. package/dist/runtime/config/sources-config.js +79 -0
  160. package/dist/runtime/config/sources-config.js.map +1 -0
  161. package/dist/runtime/distribution/compose.d.ts.map +1 -1
  162. package/dist/runtime/distribution/compose.js +3 -1
  163. package/dist/runtime/distribution/compose.js.map +1 -1
  164. package/dist/runtime/env-seeder.d.ts +5 -0
  165. package/dist/runtime/env-seeder.d.ts.map +1 -1
  166. package/dist/runtime/env-seeder.js +118 -16
  167. package/dist/runtime/env-seeder.js.map +1 -1
  168. package/dist/runtime/foreground.d.ts +4 -0
  169. package/dist/runtime/foreground.d.ts.map +1 -1
  170. package/dist/runtime/foreground.js +11 -0
  171. package/dist/runtime/foreground.js.map +1 -1
  172. package/dist/runtime/infra/infra-catalog.d.ts +1 -0
  173. package/dist/runtime/infra/infra-catalog.d.ts.map +1 -1
  174. package/dist/runtime/infra/infra-catalog.js +2 -1
  175. package/dist/runtime/infra/infra-catalog.js.map +1 -1
  176. package/dist/runtime/infra/infra-runner.d.ts +5 -0
  177. package/dist/runtime/infra/infra-runner.d.ts.map +1 -1
  178. package/dist/runtime/infra/infra-runner.js +82 -13
  179. package/dist/runtime/infra/infra-runner.js.map +1 -1
  180. package/dist/runtime/installation/compiler.d.ts +37 -0
  181. package/dist/runtime/installation/compiler.d.ts.map +1 -0
  182. package/dist/runtime/installation/compiler.js +190 -0
  183. package/dist/runtime/installation/compiler.js.map +1 -0
  184. package/dist/runtime/installation/contract.d.ts +125 -0
  185. package/dist/runtime/installation/contract.d.ts.map +1 -0
  186. package/dist/runtime/installation/contract.js +182 -0
  187. package/dist/runtime/installation/contract.js.map +1 -0
  188. package/dist/runtime/installation/diagnostics.d.ts +16 -0
  189. package/dist/runtime/installation/diagnostics.d.ts.map +1 -0
  190. package/dist/runtime/installation/diagnostics.js +21 -0
  191. package/dist/runtime/installation/diagnostics.js.map +1 -0
  192. package/dist/runtime/installation/diff.d.ts +17 -0
  193. package/dist/runtime/installation/diff.d.ts.map +1 -0
  194. package/dist/runtime/installation/diff.js +99 -0
  195. package/dist/runtime/installation/diff.js.map +1 -0
  196. package/dist/runtime/installation/format.d.ts +3 -0
  197. package/dist/runtime/installation/format.d.ts.map +1 -0
  198. package/dist/runtime/installation/format.js +22 -0
  199. package/dist/runtime/installation/format.js.map +1 -0
  200. package/dist/runtime/installation/from-current-config.d.ts +8 -0
  201. package/dist/runtime/installation/from-current-config.d.ts.map +1 -0
  202. package/dist/runtime/installation/from-current-config.js +75 -0
  203. package/dist/runtime/installation/from-current-config.js.map +1 -0
  204. package/dist/runtime/installation/index.d.ts +13 -0
  205. package/dist/runtime/installation/index.d.ts.map +1 -0
  206. package/dist/runtime/installation/index.js +29 -0
  207. package/dist/runtime/installation/index.js.map +1 -0
  208. package/dist/runtime/installation/lifecycle.d.ts +23 -0
  209. package/dist/runtime/installation/lifecycle.d.ts.map +1 -0
  210. package/dist/runtime/installation/lifecycle.js +70 -0
  211. package/dist/runtime/installation/lifecycle.js.map +1 -0
  212. package/dist/runtime/installation/serialization.d.ts +3 -0
  213. package/dist/runtime/installation/serialization.d.ts.map +1 -0
  214. package/dist/runtime/installation/serialization.js +39 -0
  215. package/dist/runtime/installation/serialization.js.map +1 -0
  216. package/dist/runtime/installation/state-store.d.ts +20 -0
  217. package/dist/runtime/installation/state-store.d.ts.map +1 -0
  218. package/dist/runtime/installation/state-store.js +257 -0
  219. package/dist/runtime/installation/state-store.js.map +1 -0
  220. package/dist/runtime/installation/status.d.ts +30 -0
  221. package/dist/runtime/installation/status.d.ts.map +1 -0
  222. package/dist/runtime/installation/status.js +138 -0
  223. package/dist/runtime/installation/status.js.map +1 -0
  224. package/dist/runtime/installation/support-bundle.d.ts +30 -0
  225. package/dist/runtime/installation/support-bundle.d.ts.map +1 -0
  226. package/dist/runtime/installation/support-bundle.js +130 -0
  227. package/dist/runtime/installation/support-bundle.js.map +1 -0
  228. package/dist/runtime/installation/validation.d.ts +8 -0
  229. package/dist/runtime/installation/validation.d.ts.map +1 -0
  230. package/dist/runtime/installation/validation.js +39 -0
  231. package/dist/runtime/installation/validation.js.map +1 -0
  232. package/dist/runtime/installation/validators/common.d.ts +4 -0
  233. package/dist/runtime/installation/validators/common.d.ts.map +1 -0
  234. package/dist/runtime/installation/validators/common.js +29 -0
  235. package/dist/runtime/installation/validators/common.js.map +1 -0
  236. package/dist/runtime/installation/validators/infrastructure.d.ts +4 -0
  237. package/dist/runtime/installation/validators/infrastructure.d.ts.map +1 -0
  238. package/dist/runtime/installation/validators/infrastructure.js +78 -0
  239. package/dist/runtime/installation/validators/infrastructure.js.map +1 -0
  240. package/dist/runtime/installation/validators/operational.d.ts +4 -0
  241. package/dist/runtime/installation/validators/operational.d.ts.map +1 -0
  242. package/dist/runtime/installation/validators/operational.js +126 -0
  243. package/dist/runtime/installation/validators/operational.js.map +1 -0
  244. package/dist/runtime/installation/validators/profile.d.ts +4 -0
  245. package/dist/runtime/installation/validators/profile.d.ts.map +1 -0
  246. package/dist/runtime/installation/validators/profile.js +78 -0
  247. package/dist/runtime/installation/validators/profile.js.map +1 -0
  248. package/dist/runtime/installation/validators/secrets.d.ts +4 -0
  249. package/dist/runtime/installation/validators/secrets.d.ts.map +1 -0
  250. package/dist/runtime/installation/validators/secrets.js +68 -0
  251. package/dist/runtime/installation/validators/secrets.js.map +1 -0
  252. package/dist/runtime/launch-plan-format.d.ts +3 -0
  253. package/dist/runtime/launch-plan-format.d.ts.map +1 -0
  254. package/dist/runtime/launch-plan-format.js +57 -0
  255. package/dist/runtime/launch-plan-format.js.map +1 -0
  256. package/dist/runtime/launch.d.ts +25 -3
  257. package/dist/runtime/launch.d.ts.map +1 -1
  258. package/dist/runtime/launch.js +264 -24
  259. package/dist/runtime/launch.js.map +1 -1
  260. package/dist/runtime/object-registry-client.d.ts +31 -0
  261. package/dist/runtime/object-registry-client.d.ts.map +1 -0
  262. package/dist/runtime/object-registry-client.js +54 -0
  263. package/dist/runtime/object-registry-client.js.map +1 -0
  264. package/dist/runtime/paths.d.ts +1 -0
  265. package/dist/runtime/paths.d.ts.map +1 -1
  266. package/dist/runtime/paths.js +2 -0
  267. package/dist/runtime/paths.js.map +1 -1
  268. package/dist/runtime/roster.d.ts +10 -4
  269. package/dist/runtime/roster.d.ts.map +1 -1
  270. package/dist/runtime/roster.js +73 -7
  271. package/dist/runtime/roster.js.map +1 -1
  272. package/dist/runtime/run-manifest.d.ts +23 -0
  273. package/dist/runtime/run-manifest.d.ts.map +1 -0
  274. package/dist/runtime/run-manifest.js +273 -0
  275. package/dist/runtime/run-manifest.js.map +1 -0
  276. package/dist/runtime/runner/container-runner.d.ts +6 -0
  277. package/dist/runtime/runner/container-runner.d.ts.map +1 -1
  278. package/dist/runtime/runner/container-runner.js +25 -6
  279. package/dist/runtime/runner/container-runner.js.map +1 -1
  280. package/dist/runtime/runner/docker-cli.d.ts +6 -1
  281. package/dist/runtime/runner/docker-cli.d.ts.map +1 -1
  282. package/dist/runtime/runner/docker-cli.js +47 -6
  283. package/dist/runtime/runner/docker-cli.js.map +1 -1
  284. package/dist/runtime/runner/native-runner.d.ts.map +1 -1
  285. package/dist/runtime/runner/native-runner.js +21 -14
  286. package/dist/runtime/runner/native-runner.js.map +1 -1
  287. package/dist/runtime/secrets/managed-local-store.d.ts +26 -0
  288. package/dist/runtime/secrets/managed-local-store.d.ts.map +1 -0
  289. package/dist/runtime/secrets/managed-local-store.js +202 -0
  290. package/dist/runtime/secrets/managed-local-store.js.map +1 -0
  291. package/dist/runtime/secrets/resolver.d.ts +23 -0
  292. package/dist/runtime/secrets/resolver.d.ts.map +1 -0
  293. package/dist/runtime/secrets/resolver.js +265 -0
  294. package/dist/runtime/secrets/resolver.js.map +1 -0
  295. package/dist/runtime/secrets/url-security.d.ts +3 -0
  296. package/dist/runtime/secrets/url-security.d.ts.map +1 -0
  297. package/dist/runtime/secrets/url-security.js +13 -0
  298. package/dist/runtime/secrets/url-security.js.map +1 -0
  299. package/dist/runtime/sources/credentials.d.ts.map +1 -1
  300. package/dist/runtime/sources/credentials.js +2 -1
  301. package/dist/runtime/sources/credentials.js.map +1 -1
  302. package/dist/runtime/sources/kinds/git.d.ts +6 -3
  303. package/dist/runtime/sources/kinds/git.d.ts.map +1 -1
  304. package/dist/runtime/sources/kinds/git.js +99 -22
  305. package/dist/runtime/sources/kinds/git.js.map +1 -1
  306. package/dist/runtime/sources/resolve-context.d.ts +7 -0
  307. package/dist/runtime/sources/resolve-context.d.ts.map +1 -0
  308. package/dist/runtime/sources/resolve-context.js +3 -0
  309. package/dist/runtime/sources/resolve-context.js.map +1 -0
  310. package/dist/runtime/sources/resolver.d.ts +2 -2
  311. package/dist/runtime/sources/resolver.d.ts.map +1 -1
  312. package/dist/runtime/sources/resolver.js +11 -5
  313. package/dist/runtime/sources/resolver.js.map +1 -1
  314. package/dist/runtime/store-client.d.ts +59 -0
  315. package/dist/runtime/store-client.d.ts.map +1 -0
  316. package/dist/runtime/store-client.js +71 -0
  317. package/dist/runtime/store-client.js.map +1 -0
  318. package/dist/runtime/supervisor.d.ts +6 -0
  319. package/dist/runtime/supervisor.d.ts.map +1 -1
  320. package/dist/runtime/supervisor.js +37 -5
  321. package/dist/runtime/supervisor.js.map +1 -1
  322. package/dist/runtime/waves.d.ts +1 -1
  323. package/dist/runtime/waves.d.ts.map +1 -1
  324. package/dist/runtime/waves.js +86 -19
  325. package/dist/runtime/waves.js.map +1 -1
  326. package/examples/01-local-native.yaml +4 -1
  327. package/examples/03-byo-infra.yaml +17 -7
  328. package/examples/05-appliance-helm.yaml +1 -1
  329. package/examples/06-biome-sources.yaml +4 -1
  330. package/package.json +6 -5
  331. package/xema.config.example.yaml +22 -18
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InstallationChangeClass = void 0;
4
+ exports.diffInstallationPlans = diffInstallationPlans;
5
+ const serialization_1 = require("./serialization");
6
+ var InstallationChangeClass;
7
+ (function (InstallationChangeClass) {
8
+ InstallationChangeClass["SafeInPlace"] = "safe-in-place";
9
+ InstallationChangeClass["RequiresRollout"] = "requires-rollout";
10
+ InstallationChangeClass["Destructive"] = "destructive";
11
+ InstallationChangeClass["Rejected"] = "rejected";
12
+ })(InstallationChangeClass || (exports.InstallationChangeClass = InstallationChangeClass = {}));
13
+ const CLASS_RANK = {
14
+ [InstallationChangeClass.SafeInPlace]: 0,
15
+ [InstallationChangeClass.RequiresRollout]: 1,
16
+ [InstallationChangeClass.Destructive]: 2,
17
+ [InstallationChangeClass.Rejected]: 3,
18
+ };
19
+ function diffInstallationPlans(current, desired) {
20
+ const paths = changedPaths(withoutHash(current), withoutHash(desired));
21
+ const changes = paths.map((path) => ({
22
+ path,
23
+ classification: classifyChange(path, valueAtPath(current, path), valueAtPath(desired, path)),
24
+ }));
25
+ const classification = changes.reduce((highest, change) => CLASS_RANK[change.classification] > CLASS_RANK[highest]
26
+ ? change.classification
27
+ : highest, InstallationChangeClass.SafeInPlace);
28
+ return { classification, changes };
29
+ }
30
+ function withoutHash(plan) {
31
+ const { planHash: _planHash, ...payload } = plan;
32
+ return payload;
33
+ }
34
+ function changedPaths(current, desired, path = '') {
35
+ if (current === undefined || desired === undefined) {
36
+ return current === desired ? [] : [path];
37
+ }
38
+ if ((0, serialization_1.serializeInstallation)(current) === (0, serialization_1.serializeInstallation)(desired)) {
39
+ return [];
40
+ }
41
+ if (current === null ||
42
+ desired === null ||
43
+ typeof current !== 'object' ||
44
+ typeof desired !== 'object' ||
45
+ Array.isArray(current) ||
46
+ Array.isArray(desired)) {
47
+ return [path];
48
+ }
49
+ const left = current;
50
+ const right = desired;
51
+ const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
52
+ return [...keys]
53
+ .sort()
54
+ .flatMap((key) => changedPaths(left[key], right[key], path.length === 0 ? key : `${path}.${key}`));
55
+ }
56
+ function classifyChange(path, current, desired) {
57
+ if (path === 'installationId' || path === 'schemaVersion') {
58
+ return InstallationChangeClass.Rejected;
59
+ }
60
+ if (path === 'infrastructure' ||
61
+ path.startsWith('tenancy.') ||
62
+ path === 'storage.class' ||
63
+ path === 'storage.externalBinding' ||
64
+ path === 'storage.workspaceDriver' ||
65
+ path.startsWith('storage.backup.') ||
66
+ path === 'deployment.profile' ||
67
+ path === 'deployment.substrate' ||
68
+ path === 'deployment.regions') {
69
+ return InstallationChangeClass.Destructive;
70
+ }
71
+ if (path === 'capacity.maxOrganizations' ||
72
+ path === 'capacity.maxConcurrentSessions') {
73
+ return numericIncrease(current, desired)
74
+ ? InstallationChangeClass.SafeInPlace
75
+ : InstallationChangeClass.Destructive;
76
+ }
77
+ if (path === 'capacity.maxReplicas') {
78
+ return numericIncrease(current, desired)
79
+ ? InstallationChangeClass.SafeInPlace
80
+ : InstallationChangeClass.RequiresRollout;
81
+ }
82
+ return InstallationChangeClass.RequiresRollout;
83
+ }
84
+ function numericIncrease(current, desired) {
85
+ return (typeof current === 'number' &&
86
+ typeof desired === 'number' &&
87
+ desired >= current);
88
+ }
89
+ function valueAtPath(value, path) {
90
+ let cursor = value;
91
+ for (const segment of path.split('.')) {
92
+ if (cursor === null || typeof cursor !== 'object') {
93
+ return undefined;
94
+ }
95
+ cursor = cursor[segment];
96
+ }
97
+ return cursor;
98
+ }
99
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/runtime/installation/diff.ts"],"names":[],"mappings":";;;AA4BA,sDAqBC;AAjDD,mDAAwD;AAIxD,IAAY,uBAKX;AALD,WAAY,uBAAuB;IACjC,wDAA6B,CAAA;IAC7B,+DAAoC,CAAA;IACpC,sDAA2B,CAAA;IAC3B,gDAAqB,CAAA;AACvB,CAAC,EALW,uBAAuB,uCAAvB,uBAAuB,QAKlC;AAYD,MAAM,UAAU,GAAsD;IACpE,CAAC,uBAAuB,CAAC,WAAW,CAAC,EAAE,CAAC;IACxC,CAAC,uBAAuB,CAAC,eAAe,CAAC,EAAE,CAAC;IAC5C,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ationPlan(plan: InstallationPlanResult): string;
3
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/runtime/installation/format.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAoB3E"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatInstallationPlan = formatInstallationPlan;
4
+ const support_bundle_1 = require("./support-bundle");
5
+ function formatInstallationPlan(plan) {
6
+ const changes = plan.diff.changes.length === 0
7
+ ? ' = no changes'
8
+ : plan.diff.changes
9
+ .map((change) => ` ${change.classification.padEnd(17, ' ')} ${change.path}`)
10
+ .join('\n');
11
+ return [
12
+ `Installation: ${plan.desired.installationId}`,
13
+ `Plan hash : ${plan.desired.planHash}`,
14
+ `Applied hash: ${plan.applied?.planHash ?? '<none>'}`,
15
+ `Change class: ${plan.diff.classification}`,
16
+ 'Changes:',
17
+ changes,
18
+ 'Desired (redacted):',
19
+ JSON.stringify((0, support_bundle_1.redactSupportValue)(plan.desired), null, 2),
20
+ ].join('\n');
21
+ }
22
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/runtime/installation/format.ts"],"names":[],"mappings":";;AAIA,wDAoBC;AAxBD,qDAAsD;AAItD,SAAgB,sBAAsB,CAAC,IAA4B;IACjE,MAAM,OAAO,GACX,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAC5B,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO;aACd,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CACT,KAAK,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAC9D;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO;QACL,iBAAiB,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;QAC9C,iBAAiB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACxC,iBAAiB,IAAI,CAAC,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE;QACrD,iBAAiB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QAC3C,UAAU;QACV,OAAO;QACP,qBAAqB;QACrB,IAAI,CAAC,SAAS,CAAC,IAAA,mCAAkB,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;KAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { InstallationDeploymentProfile, type XemaInstallation } from './contract';
2
+ import { type XemaConfig } from '../config/schema';
3
+ export interface CurrentConfigInstallationContext {
4
+ readonly installationId: string;
5
+ readonly profile?: InstallationDeploymentProfile;
6
+ }
7
+ export declare function installationFromCurrentConfig(config: XemaConfig, context: CurrentConfigInstallationContext): XemaInstallation;
8
+ //# sourceMappingURL=from-current-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from-current-config.d.ts","sourceRoot":"","sources":["../../../src/runtime/installation/from-current-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,6BAA6B,EAE7B,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,6BAA6B,CAAC;CAClD;AAOD,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,gCAAgC,GACxC,gBAAgB,CAqClB"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installationFromCurrentConfig = installationFromCurrentConfig;
4
+ const contract_1 = require("./contract");
5
+ const serialization_1 = require("./serialization");
6
+ const schema_1 = require("../config/schema");
7
+ const infra_catalog_1 = require("../infra/infra-catalog");
8
+ function installationFromCurrentConfig(config, context) {
9
+ const profile = context.profile ?? profileForSubstrate(config.app.substrate);
10
+ return {
11
+ schemaVersion: 1,
12
+ installationId: context.installationId,
13
+ sourceConfigHash: (0, serialization_1.hashInstallation)(config),
14
+ distribution: {
15
+ kind: contract_1.DistributionReferenceKind.Edition,
16
+ edition: config.edition,
17
+ },
18
+ deployment: {
19
+ profile,
20
+ substrate: installationSubstrate(config.app.substrate),
21
+ },
22
+ infrastructure: infra_catalog_1.INFRA_COMPONENTS.map((component) => {
23
+ const current = config.infra[component] ?? { mode: schema_1.InfraMode.Managed };
24
+ return {
25
+ component,
26
+ ownership: current.mode,
27
+ ...(current.url === undefined ? {} : { endpoint: current.url }),
28
+ ...(current.secretRef === undefined
29
+ ? {}
30
+ : { secretRefs: [current.secretRef] }),
31
+ };
32
+ }),
33
+ secrets: Object.entries(config.secrets).map(([name, secret]) => ({
34
+ name,
35
+ provider: contract_1.CURRENT_SECRET_SOURCE_PROVIDER[secret.from],
36
+ ...secretLocator(name, secret.from, secret.env, secret.path),
37
+ })),
38
+ storage: {
39
+ ...(config.state.workspaces.driver === undefined
40
+ ? {}
41
+ : { workspaceDriver: config.state.workspaces.driver }),
42
+ },
43
+ };
44
+ }
45
+ function profileForSubstrate(substrate) {
46
+ switch (substrate) {
47
+ case schema_1.Substrate.Native:
48
+ return contract_1.InstallationDeploymentProfile.Developer;
49
+ case schema_1.Substrate.Container:
50
+ return contract_1.InstallationDeploymentProfile.StarterPme;
51
+ case schema_1.Substrate.Helm:
52
+ return contract_1.InstallationDeploymentProfile.HighAvailability;
53
+ }
54
+ }
55
+ function installationSubstrate(substrate) {
56
+ switch (substrate) {
57
+ case schema_1.Substrate.Native:
58
+ return contract_1.InstallationSubstrate.Local;
59
+ case schema_1.Substrate.Container:
60
+ return contract_1.InstallationSubstrate.SingleNode;
61
+ case schema_1.Substrate.Helm:
62
+ return contract_1.InstallationSubstrate.Cluster;
63
+ }
64
+ }
65
+ function secretLocator(name, source, env, path) {
66
+ switch (source) {
67
+ case schema_1.SecretSource.Env:
68
+ return { locator: env ?? name };
69
+ case schema_1.SecretSource.File:
70
+ return path === undefined ? {} : { locator: path };
71
+ case schema_1.SecretSource.Prompt:
72
+ return {};
73
+ }
74
+ }
75
+ //# sourceMappingURL=from-current-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from-current-config.js","sourceRoot":"","sources":["../../../src/runtime/installation/from-current-config.ts"],"names":[],"mappings":";;AA0BA,sEAwCC;AAlED,yCAMoB;AACpB,mDAAmD;AACnD,6CAK0B;AAC1B,0DAA0D;AAY1D,SAAgB,6BAA6B,CAC3C,MAAkB,EAClB,OAAyC;IAEzC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAE7E,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,gBAAgB,EAAE,IAAA,gCAAgB,EAAC,MAAM,CAAC;QAC1C,YAAY,EAAE;YACZ,IAAI,EAAE,oCAAyB,CAAC,OAAO;YACvC,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB;QACD,UAAU,EAAE;YACV,OAAO;YACP,SAAS,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;SACvD;QACD,cAAc,EAAE,gCAAgB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACjD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,kBAAS,CAA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wCAA6B,CAAC,gBAAgB,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,SAAoB;IACjD,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,kBAAS,CAAC,MAAM;YACnB,OAAO,gCAAqB,CAAC,KAAK,CAAC;QACrC,KAAK,kBAAS,CAAC,SAAS;YACtB,OAAO,gCAAqB,CAAC,UAAU,CAAC;QAC1C,KAAK,kBAAS,CAAC,IAAI;YACjB,OAAO,gCAAqB,CAAC,OAAO,CAAC;IACzC,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CACpB,IAAY,EACZ,MAAoB,EACpB,GAAuB,EACvB,IAAwB;IAExB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,qBAAY,CAAC,GAAG;YACnB,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;QAClC,KAAK,qBAAY,CAAC,IAAI;YACpB,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrD,KAAK,qBAAY,CAAC,MAAM;YACtB,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ export * from './compiler';
2
+ export * from './contract';
3
+ export * from './diagnostics';
4
+ export * from './diff';
5
+ export * from './from-current-config';
6
+ export * from './format';
7
+ export * from './lifecycle';
8
+ export * from './serialization';
9
+ export * from './state-store';
10
+ export * from './status';
11
+ export * from './support-bundle';
12
+ export * from './validation';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/installation/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./compiler"), exports);
18
+ __exportStar(require("./contract"), exports);
19
+ __exportStar(require("./diagnostics"), exports);
20
+ __exportStar(require("./diff"), exports);
21
+ __exportStar(require("./from-current-config"), exports);
22
+ __exportStar(require("./format"), exports);
23
+ __exportStar(require("./lifecycle"), exports);
24
+ __exportStar(require("./serialization"), exports);
25
+ __exportStar(require("./state-store"), exports);
26
+ __exportStar(require("./status"), exports);
27
+ __exportStar(require("./support-bundle"), exports);
28
+ __exportStar(require("./validation"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/installation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,gDAA8B;AAC9B,yCAAuB;AACvB,wDAAsC;AACtC,2CAAyB;AACzB,8CAA4B;AAC5B,kDAAgC;AAChC,gDAA8B;AAC9B,2CAAyB;AACzB,mDAAiC;AACjC,+CAA6B"}
@@ -0,0 +1,23 @@
1
+ import { type CompiledXemaInstallation } from './compiler';
2
+ import { type InstallationPlanDiff } from './diff';
3
+ import { type CurrentConfigInstallationContext } from './from-current-config';
4
+ import type { InstallationStateStore } from './state-store';
5
+ import type { XemaConfig } from '../config/schema';
6
+ export interface InstallationPlanResult {
7
+ readonly desired: CompiledXemaInstallation;
8
+ readonly applied?: CompiledXemaInstallation;
9
+ readonly diff: InstallationPlanDiff;
10
+ }
11
+ export interface InstallationApplyOptions {
12
+ readonly allowDestructive?: boolean;
13
+ readonly forceExecution?: boolean;
14
+ }
15
+ export interface InstallationApplyResult extends InstallationPlanResult {
16
+ readonly executed: boolean;
17
+ }
18
+ export type InstallationExecutor = (onReady: () => Promise<void>) => Promise<void>;
19
+ export declare function installationContext(installationIdentity: string): CurrentConfigInstallationContext;
20
+ export declare function compileCurrentInstallation(config: XemaConfig, installationIdentity: string): CompiledXemaInstallation;
21
+ export declare function planInstallation(desired: CompiledXemaInstallation, store: InstallationStateStore): InstallationPlanResult;
22
+ export declare function applyInstallation(desired: CompiledXemaInstallation, store: InstallationStateStore, executor: InstallationExecutor, opts?: InstallationApplyOptions): Promise<InstallationApplyResult>;
23
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/runtime/installation/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,QAAQ,CAAC;AAChB,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;CACrC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACrE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,wBAAgB,mBAAmB,CACjC,oBAAoB,EAAE,MAAM,GAC3B,gCAAgC,CAIlC;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,UAAU,EAClB,oBAAoB,EAAE,MAAM,GAC3B,wBAAwB,CAO1B;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,sBAAsB,GAC5B,sBAAsB,CAmBxB;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,sBAAsB,EAC7B,QAAQ,EAAE,oBAAoB,EAC9B,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAwBlC"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installationContext = installationContext;
4
+ exports.compileCurrentInstallation = compileCurrentInstallation;
5
+ exports.planInstallation = planInstallation;
6
+ exports.applyInstallation = applyInstallation;
7
+ const compiler_1 = require("./compiler");
8
+ const diff_1 = require("./diff");
9
+ const from_current_config_1 = require("./from-current-config");
10
+ const serialization_1 = require("./serialization");
11
+ function installationContext(installationIdentity) {
12
+ return {
13
+ installationId: `local-${(0, serialization_1.hashInstallation)(installationIdentity).slice(0, 20)}`,
14
+ };
15
+ }
16
+ function compileCurrentInstallation(config, installationIdentity) {
17
+ return (0, compiler_1.compileXemaInstallation)((0, from_current_config_1.installationFromCurrentConfig)(config, installationContext(installationIdentity)));
18
+ }
19
+ function planInstallation(desired, store) {
20
+ const appliedState = store.read(desired.installationId);
21
+ const applied = appliedState?.plan;
22
+ return {
23
+ desired,
24
+ ...(applied === undefined ? {} : { applied }),
25
+ diff: applied === undefined
26
+ ? {
27
+ classification: diff_1.InstallationChangeClass.RequiresRollout,
28
+ changes: [
29
+ {
30
+ path: '<installation>',
31
+ classification: diff_1.InstallationChangeClass.RequiresRollout,
32
+ },
33
+ ],
34
+ }
35
+ : (0, diff_1.diffInstallationPlans)(applied, desired),
36
+ };
37
+ }
38
+ async function applyInstallation(desired, store, executor, opts = {}) {
39
+ const release = store.acquireApplyLock(desired.installationId);
40
+ let ready = false;
41
+ try {
42
+ const planned = planInstallation(desired, store);
43
+ assertChangeAuthorized(planned.diff, opts);
44
+ if (planned.diff.changes.length === 0 && opts.forceExecution !== true) {
45
+ return { ...planned, executed: false };
46
+ }
47
+ await executor(async () => {
48
+ store.write(desired);
49
+ ready = true;
50
+ release();
51
+ });
52
+ if (!ready) {
53
+ throw new Error('Installation executor completed without reporting a ready installation.');
54
+ }
55
+ return { ...planned, executed: true };
56
+ }
57
+ finally {
58
+ release();
59
+ }
60
+ }
61
+ function assertChangeAuthorized(diff, opts) {
62
+ if (diff.classification === diff_1.InstallationChangeClass.Rejected) {
63
+ throw new Error('Installation apply rejected this identity/schema transition. Create a distinct installation or restore the previous desired state.');
64
+ }
65
+ if (diff.classification === diff_1.InstallationChangeClass.Destructive &&
66
+ opts.allowDestructive !== true) {
67
+ throw new Error('Installation plan contains destructive changes. Re-run with --allow-destructive after reviewing the plan.');
68
+ }
69
+ }
70
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../src/runtime/installation/lifecycle.ts"],"names":[],"mappings":";;AAqCA,kDAMC;AAED,gEAUC;AAED,4CAsBC;AAED,8CA6BC;AA9GD,yCAGoB;AACpB,iCAIgB;AAChB,+DAG+B;AAC/B,mDAAmD;AAwBnD,SAAgB,mBAAmB,CACjC,oBAA4B;IAE5B,OAAO;QACL,cAAc,EAAE,SAAS,IAAA,gCAAgB,EAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;KAC/E,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CACxC,MAAkB,EAClB,oBAA4B;IAE5B,OAAO,IAAA,kCAAuB,EAC5B,IAAA,mDAA6B,EAC3B,MAAM,EACN,mBAAmB,CAAC,oBAAoB,CAAC,CAC1C,CACF,CAAC;AACJ,CAAC;AAED,SAAgB,gBAAgB,CAC9B,OAAiC,EACjC,KAA6B;IAE7B,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,YAAY,EAAE,IAAI,CAAC;IACnC,OAAO;QACL,OAAO;QACP,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC7C,IAAI,EACF,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC;gBACE,cAAc,EAAE,8BAAuB,CAAC,eAAe;gBACvD,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,gBAAgB;wBACtB,cAAc,EAAE,8BAAuB,CAAC,eAAe;qBACxD;iBACF;aACF;YACH,CAAC,CAAC,IAAA,4BAAqB,EAAC,OAAO,EAAE,OAAO,CAAC;KAC9C,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,iBAAiB,CACrC,OAAiC,EACjC,KAA6B,EAC7B,QAA8B,EAC9B,OAAiC,EAAE;I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 +1,3 @@
1
+ export declare function serializeInstallation(value: unknown): string;
2
+ export declare function hashInstallation(value: unknown): string;
3
+ //# sourceMappingURL=serialization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/runtime/installation/serialization.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE5D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIvD"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeInstallation = serializeInstallation;
4
+ exports.hashInstallation = hashInstallation;
5
+ const node_crypto_1 = require("node:crypto");
6
+ function serializeInstallation(value) {
7
+ return serializeValue(value);
8
+ }
9
+ function hashInstallation(value) {
10
+ return (0, node_crypto_1.createHash)('sha256')
11
+ .update(serializeInstallation(value))
12
+ .digest('hex');
13
+ }
14
+ function serializeValue(value) {
15
+ if (value === null ||
16
+ typeof value === 'boolean' ||
17
+ typeof value === 'string') {
18
+ return JSON.stringify(value);
19
+ }
20
+ if (typeof value === 'number') {
21
+ if (!Number.isFinite(value)) {
22
+ throw new Error('Installation plans cannot contain non-finite numbers');
23
+ }
24
+ return JSON.stringify(value);
25
+ }
26
+ if (Array.isArray(value)) {
27
+ return `[${value.map((entry) => serializeValue(entry)).join(',')}]`;
28
+ }
29
+ if (typeof value === 'object') {
30
+ const record = value;
31
+ return `{${Object.keys(record)
32
+ .filter((key) => record[key] !== undefined)
33
+ .sort()
34
+ .map((key) => `${JSON.stringify(key)}:${serializeValue(record[key])}`)
35
+ .join(',')}}`;
36
+ }
37
+ throw new Error(`Installation plans cannot contain values of type ${typeof value}`);
38
+ }
39
+ //# sourceMappingURL=serialization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../src/runtime/installation/serialization.ts"],"names":[],"mappings":";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CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;aACrE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,KAAK,CACb,oDAAoD,OAAO,KAAK,EAAE,CACnE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type CompiledXemaInstallation } from './compiler';
2
+ export interface AppliedInstallationState {
3
+ readonly schemaVersion: 1;
4
+ readonly appliedAt: string;
5
+ readonly planHash: string;
6
+ readonly plan: CompiledXemaInstallation;
7
+ }
8
+ export interface InstallationStateStoreOptions {
9
+ readonly root?: string;
10
+ }
11
+ export declare class InstallationStateStore {
12
+ private readonly root;
13
+ constructor(opts?: InstallationStateStoreOptions);
14
+ read(installationId: string): AppliedInstallationState | undefined;
15
+ write(plan: CompiledXemaInstallation, appliedAt?: string): AppliedInstallationState;
16
+ acquireApplyLock(installationId: string): () => void;
17
+ private appliedPath;
18
+ private installationDirectory;
19
+ }
20
+ //# sourceMappingURL=state-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-store.d.ts","sourceRoot":"","sources":["../../../src/runtime/installation/state-store.ts"],"names":[],"mappings":"AAkBA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;CACzC;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAWD,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAEX,IAAI,GAAE,6BAAkC;IAIpD,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAclE,KAAK,CACV,IAAI,EAAE,wBAAwB,EAC9B,SAAS,SAA2B,GACnC,wBAAwB;IAWpB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,IAAI;IA8D3D,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,qBAAqB;CAQ9B"}