@quadnix/octo 0.0.30 → 0.2.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 (383) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +117 -8
  3. package/dist/app.type.d.ts +277 -19
  4. package/dist/app.type.js +80 -9
  5. package/dist/app.type.js.map +1 -1
  6. package/dist/decorators/action.decorator.d.ts +10 -6
  7. package/dist/decorators/action.decorator.js +19 -6
  8. package/dist/decorators/action.decorator.js.map +1 -1
  9. package/dist/decorators/anchor.decorator.d.ts +12 -5
  10. package/dist/decorators/anchor.decorator.js +12 -5
  11. package/dist/decorators/anchor.decorator.js.map +1 -1
  12. package/dist/decorators/enable-hook.decorator.d.ts +1 -1
  13. package/dist/decorators/enable-hook.decorator.js +1 -1
  14. package/dist/decorators/factory.decorator.d.ts +18 -34
  15. package/dist/decorators/factory.decorator.js +18 -34
  16. package/dist/decorators/factory.decorator.js.map +1 -1
  17. package/dist/decorators/model.decorator.d.ts +4 -6
  18. package/dist/decorators/model.decorator.js +2 -7
  19. package/dist/decorators/model.decorator.js.map +1 -1
  20. package/dist/decorators/module.decorator.d.ts +16 -10
  21. package/dist/decorators/module.decorator.js +16 -10
  22. package/dist/decorators/module.decorator.js.map +1 -1
  23. package/dist/decorators/on-event.decorator.d.ts +7 -2
  24. package/dist/decorators/on-event.decorator.js +5 -0
  25. package/dist/decorators/on-event.decorator.js.map +1 -1
  26. package/dist/decorators/resource.decorator.d.ts +50 -1
  27. package/dist/decorators/resource.decorator.js +38 -1
  28. package/dist/decorators/resource.decorator.js.map +1 -1
  29. package/dist/decorators/validate.decorator.d.ts +15 -1
  30. package/dist/decorators/validate.decorator.js +15 -1
  31. package/dist/decorators/validate.decorator.js.map +1 -1
  32. package/dist/errors/container.error.d.ts +18 -0
  33. package/dist/errors/container.error.js +18 -0
  34. package/dist/errors/container.error.js.map +1 -1
  35. package/dist/errors/index.d.ts +1 -0
  36. package/dist/errors/index.js +1 -0
  37. package/dist/errors/index.js.map +1 -1
  38. package/dist/errors/module.error.d.ts +6 -0
  39. package/dist/errors/module.error.js +6 -0
  40. package/dist/errors/module.error.js.map +1 -1
  41. package/dist/errors/node.error.d.ts +56 -0
  42. package/dist/errors/node.error.js +56 -0
  43. package/dist/errors/node.error.js.map +1 -1
  44. package/dist/errors/schema.error.d.ts +14 -1
  45. package/dist/errors/schema.error.js +11 -1
  46. package/dist/errors/schema.error.js.map +1 -1
  47. package/dist/errors/terraform.error.d.ts +20 -0
  48. package/dist/errors/terraform.error.js +24 -0
  49. package/dist/errors/terraform.error.js.map +1 -0
  50. package/dist/errors/transaction.error.d.ts +93 -2
  51. package/dist/errors/transaction.error.js +83 -0
  52. package/dist/errors/transaction.error.js.map +1 -1
  53. package/dist/events/action.event.d.ts +8 -4
  54. package/dist/events/action.event.js +2 -4
  55. package/dist/events/action.event.js.map +1 -1
  56. package/dist/events/command.event.d.ts +43 -0
  57. package/dist/events/command.event.js +33 -0
  58. package/dist/events/command.event.js.map +1 -0
  59. package/dist/events/event.model.d.ts +26 -8
  60. package/dist/events/event.model.js +15 -7
  61. package/dist/events/event.model.js.map +1 -1
  62. package/dist/events/hook/commit.hook.event.d.ts +1 -7
  63. package/dist/events/hook/commit.hook.event.js +0 -6
  64. package/dist/events/hook/commit.hook.event.js.map +1 -1
  65. package/dist/events/hook/hook.event.d.ts +1 -3
  66. package/dist/events/hook/hook.event.js +0 -2
  67. package/dist/events/hook/hook.event.js.map +1 -1
  68. package/dist/events/hook/model.hook.event.d.ts +1 -7
  69. package/dist/events/hook/model.hook.event.js +0 -6
  70. package/dist/events/hook/model.hook.event.js.map +1 -1
  71. package/dist/events/hook/resource.hook.event.d.ts +1 -7
  72. package/dist/events/hook/resource.hook.event.js +0 -6
  73. package/dist/events/hook/resource.hook.event.js.map +1 -1
  74. package/dist/events/index.d.ts +5 -0
  75. package/dist/events/index.js +5 -0
  76. package/dist/events/index.js.map +1 -1
  77. package/dist/events/mode-result.event.d.ts +57 -0
  78. package/dist/events/mode-result.event.js +24 -0
  79. package/dist/events/mode-result.event.js.map +1 -0
  80. package/dist/events/mode.event.d.ts +61 -0
  81. package/dist/events/mode.event.js +32 -0
  82. package/dist/events/mode.event.js.map +1 -0
  83. package/dist/events/module.event.d.ts +7 -5
  84. package/dist/events/module.event.js +3 -4
  85. package/dist/events/module.event.js.map +1 -1
  86. package/dist/events/registration.event.d.ts +19 -15
  87. package/dist/events/registration.event.js +18 -14
  88. package/dist/events/registration.event.js.map +1 -1
  89. package/dist/events/serialization.event.d.ts +16 -13
  90. package/dist/events/serialization.event.js +15 -12
  91. package/dist/events/serialization.event.js.map +1 -1
  92. package/dist/events/state.event.d.ts +102 -0
  93. package/dist/events/state.event.js +69 -0
  94. package/dist/events/state.event.js.map +1 -0
  95. package/dist/events/terraform.event.d.ts +78 -0
  96. package/dist/events/terraform.event.js +55 -0
  97. package/dist/events/terraform.event.js.map +1 -0
  98. package/dist/events/transaction.event.d.ts +3 -40
  99. package/dist/events/transaction.event.js +1 -29
  100. package/dist/events/transaction.event.js.map +1 -1
  101. package/dist/functions/container/container.d.ts +54 -13
  102. package/dist/functions/container/container.js +64 -19
  103. package/dist/functions/container/container.js.map +1 -1
  104. package/dist/functions/container/test-container.d.ts +43 -29
  105. package/dist/functions/container/test-container.js +71 -43
  106. package/dist/functions/container/test-container.js.map +1 -1
  107. package/dist/functions/dependency/dependency.d.ts +84 -23
  108. package/dist/functions/dependency/dependency.js +84 -14
  109. package/dist/functions/dependency/dependency.js.map +1 -1
  110. package/dist/functions/diff/aggregate-resource-actions.d.ts +19 -0
  111. package/dist/functions/diff/aggregate-resource-actions.js +41 -0
  112. package/dist/functions/diff/aggregate-resource-actions.js.map +1 -0
  113. package/dist/functions/diff/diff-metadata.d.ts +21 -3
  114. package/dist/functions/diff/diff-metadata.js +18 -0
  115. package/dist/functions/diff/diff-metadata.js.map +1 -1
  116. package/dist/functions/diff/diff.d.ts +68 -7
  117. package/dist/functions/diff/diff.js +44 -3
  118. package/dist/functions/diff/diff.js.map +1 -1
  119. package/dist/functions/hook/commit.hook.d.ts +16 -1
  120. package/dist/functions/hook/commit.hook.js +21 -6
  121. package/dist/functions/hook/commit.hook.js.map +1 -1
  122. package/dist/functions/hook/model-action.hook.d.ts +16 -1
  123. package/dist/functions/hook/model-action.hook.js +21 -6
  124. package/dist/functions/hook/model-action.hook.js.map +1 -1
  125. package/dist/functions/hook/resource-action.hook.d.ts +16 -1
  126. package/dist/functions/hook/resource-action.hook.js +21 -6
  127. package/dist/functions/hook/resource-action.hook.js.map +1 -1
  128. package/dist/functions/node/node-action.abstract.d.ts +23 -2
  129. package/dist/functions/node/node-action.abstract.js +22 -8
  130. package/dist/functions/node/node-action.abstract.js.map +1 -1
  131. package/dist/functions/node/node.abstract.d.ts +56 -5
  132. package/dist/functions/node/node.abstract.js +106 -22
  133. package/dist/functions/node/node.abstract.js.map +1 -1
  134. package/dist/functions/node/node.interface.d.ts +3 -1
  135. package/dist/functions/schema/schema.d.ts +7 -0
  136. package/dist/functions/schema/schema.js +10 -1
  137. package/dist/functions/schema/schema.js.map +1 -1
  138. package/dist/index.d.ts +12 -6
  139. package/dist/index.js +9 -4
  140. package/dist/index.js.map +1 -1
  141. package/dist/index.type.d.ts +5 -0
  142. package/dist/index.type.js +2 -0
  143. package/dist/index.type.js.map +1 -0
  144. package/dist/main.d.ts +245 -14
  145. package/dist/main.js +377 -72
  146. package/dist/main.js.map +1 -1
  147. package/dist/models/account/account.model.d.ts +43 -7
  148. package/dist/models/account/account.model.js +56 -8
  149. package/dist/models/account/account.model.js.map +1 -1
  150. package/dist/models/account/account.schema.d.ts +13 -1
  151. package/dist/models/account/account.schema.js +12 -0
  152. package/dist/models/account/account.schema.js.map +1 -1
  153. package/dist/models/app/app.model.d.ts +13 -8
  154. package/dist/models/app/app.model.js +17 -32
  155. package/dist/models/app/app.model.js.map +1 -1
  156. package/dist/models/app/app.schema.d.ts +6 -0
  157. package/dist/models/app/app.schema.js +6 -0
  158. package/dist/models/app/app.schema.js.map +1 -1
  159. package/dist/models/deployment/deployment.model.d.ts +13 -1
  160. package/dist/models/deployment/deployment.model.js +16 -4
  161. package/dist/models/deployment/deployment.model.js.map +1 -1
  162. package/dist/models/deployment/deployment.schema.d.ts +6 -0
  163. package/dist/models/deployment/deployment.schema.js +6 -0
  164. package/dist/models/deployment/deployment.schema.js.map +1 -1
  165. package/dist/models/environment/environment.model.d.ts +15 -3
  166. package/dist/models/environment/environment.model.js +22 -10
  167. package/dist/models/environment/environment.model.js.map +1 -1
  168. package/dist/models/environment/environment.schema.d.ts +2 -0
  169. package/dist/models/environment/environment.schema.js +2 -0
  170. package/dist/models/environment/environment.schema.js.map +1 -1
  171. package/dist/models/execution/execution.model.d.ts +21 -3
  172. package/dist/models/execution/execution.model.js +47 -29
  173. package/dist/models/execution/execution.model.js.map +1 -1
  174. package/dist/models/execution/execution.schema.d.ts +11 -0
  175. package/dist/models/execution/execution.schema.js +11 -0
  176. package/dist/models/execution/execution.schema.js.map +1 -1
  177. package/dist/models/filesystem/filesystem.model.d.ts +27 -1
  178. package/dist/models/filesystem/filesystem.model.js +30 -4
  179. package/dist/models/filesystem/filesystem.model.js.map +1 -1
  180. package/dist/models/filesystem/filesystem.schema.d.ts +5 -0
  181. package/dist/models/filesystem/filesystem.schema.js +5 -0
  182. package/dist/models/filesystem/filesystem.schema.js.map +1 -1
  183. package/dist/models/image/image.model.d.ts +19 -5
  184. package/dist/models/image/image.model.js +25 -11
  185. package/dist/models/image/image.model.js.map +1 -1
  186. package/dist/models/image/image.schema.d.ts +8 -0
  187. package/dist/models/image/image.schema.js +8 -0
  188. package/dist/models/image/image.schema.js.map +1 -1
  189. package/dist/models/model-action.interface.d.ts +17 -4
  190. package/dist/models/model.abstract.d.ts +96 -1
  191. package/dist/models/model.abstract.js +107 -8
  192. package/dist/models/model.abstract.js.map +1 -1
  193. package/dist/models/model.interface.d.ts +3 -0
  194. package/dist/models/pipeline/pipeline.model.d.ts +14 -2
  195. package/dist/models/pipeline/pipeline.model.js +19 -7
  196. package/dist/models/pipeline/pipeline.model.js.map +1 -1
  197. package/dist/models/pipeline/pipeline.schema.d.ts +8 -0
  198. package/dist/models/pipeline/pipeline.schema.js +8 -0
  199. package/dist/models/pipeline/pipeline.schema.js.map +1 -1
  200. package/dist/models/region/region.model.d.ts +16 -1
  201. package/dist/models/region/region.model.js +19 -4
  202. package/dist/models/region/region.model.js.map +1 -1
  203. package/dist/models/region/region.schema.d.ts +6 -0
  204. package/dist/models/region/region.schema.js +6 -0
  205. package/dist/models/region/region.schema.js.map +1 -1
  206. package/dist/models/server/server.model.d.ts +15 -3
  207. package/dist/models/server/server.model.js +18 -6
  208. package/dist/models/server/server.model.js.map +1 -1
  209. package/dist/models/server/server.schema.d.ts +3 -1
  210. package/dist/models/server/server.schema.js +3 -1
  211. package/dist/models/server/server.schema.js.map +1 -1
  212. package/dist/models/service/service.model.d.ts +37 -6
  213. package/dist/models/service/service.model.js +65 -11
  214. package/dist/models/service/service.model.js.map +1 -1
  215. package/dist/models/service/service.schema.d.ts +48 -1
  216. package/dist/models/service/service.schema.js +56 -1
  217. package/dist/models/service/service.schema.js.map +1 -1
  218. package/dist/models/subnet/subnet.model.d.ts +27 -3
  219. package/dist/models/subnet/subnet.model.js +40 -16
  220. package/dist/models/subnet/subnet.model.js.map +1 -1
  221. package/dist/models/subnet/subnet.schema.d.ts +9 -0
  222. package/dist/models/subnet/subnet.schema.js +9 -0
  223. package/dist/models/subnet/subnet.schema.js.map +1 -1
  224. package/dist/modes/apply-transaction.d.ts +23 -0
  225. package/dist/modes/apply-transaction.js +25 -0
  226. package/dist/modes/apply-transaction.js.map +1 -0
  227. package/dist/modes/commit.mode.d.ts +54 -0
  228. package/dist/modes/commit.mode.js +235 -0
  229. package/dist/modes/commit.mode.js.map +1 -0
  230. package/dist/modes/generate.mode.d.ts +30 -0
  231. package/dist/modes/generate.mode.js +50 -0
  232. package/dist/modes/generate.mode.js.map +1 -0
  233. package/dist/modes/run-action.mode.d.ts +30 -0
  234. package/dist/modes/run-action.mode.js +140 -0
  235. package/dist/modes/run-action.mode.js.map +1 -0
  236. package/dist/modes/validate.mode.d.ts +186 -0
  237. package/dist/modes/validate.mode.js +558 -0
  238. package/dist/modes/validate.mode.js.map +1 -0
  239. package/dist/modules/module.abstract.d.ts +51 -0
  240. package/dist/modules/module.abstract.js +36 -0
  241. package/dist/modules/module.abstract.js.map +1 -1
  242. package/dist/modules/module.container.d.ts +43 -1
  243. package/dist/modules/module.container.js +77 -5
  244. package/dist/modules/module.container.js.map +1 -1
  245. package/dist/modules/test-module.container.d.ts +139 -25
  246. package/dist/modules/test-module.container.js +383 -199
  247. package/dist/modules/test-module.container.js.map +1 -1
  248. package/dist/overlays/anchor.abstract.d.ts +32 -1
  249. package/dist/overlays/anchor.abstract.js +42 -11
  250. package/dist/overlays/anchor.abstract.js.map +1 -1
  251. package/dist/overlays/anchor.schema.d.ts +21 -0
  252. package/dist/overlays/anchor.schema.js +21 -0
  253. package/dist/overlays/anchor.schema.js.map +1 -1
  254. package/dist/overlays/overlay-data.repository.d.ts +18 -0
  255. package/dist/overlays/overlay-data.repository.js +18 -0
  256. package/dist/overlays/overlay-data.repository.js.map +1 -1
  257. package/dist/overlays/overlay.abstract.d.ts +56 -1
  258. package/dist/overlays/overlay.abstract.js +79 -20
  259. package/dist/overlays/overlay.abstract.js.map +1 -1
  260. package/dist/overlays/overlay.schema.d.ts +20 -0
  261. package/dist/overlays/overlay.schema.js +20 -0
  262. package/dist/overlays/overlay.schema.js.map +1 -1
  263. package/dist/resources/resource-action.interface.d.ts +29 -3
  264. package/dist/resources/resource-data.repository.d.ts +63 -1
  265. package/dist/resources/resource-data.repository.js +94 -4
  266. package/dist/resources/resource-data.repository.js.map +1 -1
  267. package/dist/resources/resource.abstract.d.ts +163 -6
  268. package/dist/resources/resource.abstract.js +223 -59
  269. package/dist/resources/resource.abstract.js.map +1 -1
  270. package/dist/resources/resource.interface.d.ts +0 -2
  271. package/dist/resources/resource.schema.d.ts +39 -1
  272. package/dist/resources/resource.schema.js +38 -0
  273. package/dist/resources/resource.schema.js.map +1 -1
  274. package/dist/resources/terraform-resource.abstract.d.ts +44 -0
  275. package/dist/resources/terraform-resource.abstract.js +45 -0
  276. package/dist/resources/terraform-resource.abstract.js.map +1 -0
  277. package/dist/services/event/event.service.d.ts +32 -5
  278. package/dist/services/event/event.service.js +58 -16
  279. package/dist/services/event/event.service.js.map +1 -1
  280. package/dist/services/input/input.service.d.ts +82 -5
  281. package/dist/services/input/input.service.js +143 -12
  282. package/dist/services/input/input.service.js.map +1 -1
  283. package/dist/services/schema-translation/schema-translation.service.d.ts +9 -0
  284. package/dist/services/schema-translation/schema-translation.service.js +9 -0
  285. package/dist/services/schema-translation/schema-translation.service.js.map +1 -1
  286. package/dist/services/serialization/model/model-serialization.service.d.ts +25 -3
  287. package/dist/services/serialization/model/model-serialization.service.js +113 -62
  288. package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
  289. package/dist/services/serialization/resource/resource-serialization.service.d.ts +36 -6
  290. package/dist/services/serialization/resource/resource-serialization.service.js +77 -28
  291. package/dist/services/serialization/resource/resource-serialization.service.js.map +1 -1
  292. package/dist/services/state-management/local.state-provider.d.ts +67 -4
  293. package/dist/services/state-management/local.state-provider.js +168 -41
  294. package/dist/services/state-management/local.state-provider.js.map +1 -1
  295. package/dist/services/state-management/remote.state-provider.d.ts +216 -0
  296. package/dist/services/state-management/remote.state-provider.js +645 -0
  297. package/dist/services/state-management/remote.state-provider.js.map +1 -0
  298. package/dist/services/state-management/state-management.service.d.ts +195 -17
  299. package/dist/services/state-management/state-management.service.js +259 -10
  300. package/dist/services/state-management/state-management.service.js.map +1 -1
  301. package/dist/services/state-management/state-provider.interface.d.ts +98 -3
  302. package/dist/services/state-management/state-provider.interface.js +14 -1
  303. package/dist/services/state-management/state-provider.interface.js.map +1 -1
  304. package/dist/services/state-management/terraform-state.service.d.ts +99 -0
  305. package/dist/services/state-management/terraform-state.service.js +197 -0
  306. package/dist/services/state-management/terraform-state.service.js.map +1 -0
  307. package/dist/services/state-management/test.state-provider.d.ts +42 -4
  308. package/dist/services/state-management/test.state-provider.js +77 -25
  309. package/dist/services/state-management/test.state-provider.js.map +1 -1
  310. package/dist/services/terraform/terraform.service.d.ts +480 -0
  311. package/dist/services/terraform/terraform.service.js +1082 -0
  312. package/dist/services/terraform/terraform.service.js.map +1 -0
  313. package/dist/services/terraform/terraform.type.d.ts +387 -0
  314. package/dist/services/terraform/terraform.type.js +579 -0
  315. package/dist/services/terraform/terraform.type.js.map +1 -0
  316. package/dist/services/transaction/transaction.service.d.ts +110 -10
  317. package/dist/services/transaction/transaction.service.js +570 -251
  318. package/dist/services/transaction/transaction.service.js.map +1 -1
  319. package/dist/services/validation/validation.service.d.ts +15 -3
  320. package/dist/services/validation/validation.service.js +12 -0
  321. package/dist/services/validation/validation.service.js.map +1 -1
  322. package/dist/utilities/array/array.utility.d.ts +3 -0
  323. package/dist/utilities/array/array.utility.js +3 -0
  324. package/dist/utilities/array/array.utility.js.map +1 -1
  325. package/dist/{functions → utilities}/diff/diff.utility.d.ts +19 -3
  326. package/dist/{functions → utilities}/diff/diff.utility.js +57 -41
  327. package/dist/utilities/diff/diff.utility.js.map +1 -0
  328. package/dist/utilities/file/file.utility.d.ts +16 -2
  329. package/dist/utilities/file/file.utility.js +23 -61
  330. package/dist/utilities/file/file.utility.js.map +1 -1
  331. package/dist/utilities/hcl/hcl.utility.d.ts +128 -0
  332. package/dist/utilities/hcl/hcl.utility.js +402 -0
  333. package/dist/utilities/hcl/hcl.utility.js.map +1 -0
  334. package/dist/utilities/http/http.utility.d.ts +57 -0
  335. package/dist/utilities/http/http.utility.js +98 -0
  336. package/dist/utilities/http/http.utility.js.map +1 -0
  337. package/dist/utilities/node/node.utility.d.ts +3 -0
  338. package/dist/utilities/node/node.utility.js +3 -0
  339. package/dist/utilities/node/node.utility.js.map +1 -1
  340. package/dist/utilities/object/object.utility.d.ts +12 -0
  341. package/dist/utilities/object/object.utility.js +12 -0
  342. package/dist/utilities/object/object.utility.js.map +1 -1
  343. package/dist/utilities/project/project.utility.d.ts +28 -0
  344. package/dist/utilities/project/project.utility.js +35 -0
  345. package/dist/utilities/project/project.utility.js.map +1 -0
  346. package/dist/utilities/string/string.utility.d.ts +41 -0
  347. package/dist/utilities/string/string.utility.js +65 -0
  348. package/dist/utilities/string/string.utility.js.map +1 -0
  349. package/dist/utilities/terraform/terraform.utility.d.ts +276 -0
  350. package/dist/utilities/terraform/terraform.utility.js +623 -0
  351. package/dist/utilities/terraform/terraform.utility.js.map +1 -0
  352. package/dist/utilities/test-helpers/test-classes.d.ts +36 -30
  353. package/dist/utilities/test-helpers/test-classes.js +38 -39
  354. package/dist/utilities/test-helpers/test-classes.js.map +1 -1
  355. package/dist/utilities/test-helpers/test-models.d.ts +8 -1
  356. package/dist/utilities/test-helpers/test-models.js +37 -12
  357. package/dist/utilities/test-helpers/test-models.js.map +1 -1
  358. package/dist/utilities/test-helpers/test-modes.d.ts +315 -0
  359. package/dist/utilities/test-helpers/test-modes.js +486 -0
  360. package/dist/utilities/test-helpers/test-modes.js.map +1 -0
  361. package/dist/utilities/test-helpers/test-modules.d.ts +47 -0
  362. package/dist/utilities/test-helpers/test-modules.js +85 -0
  363. package/dist/utilities/test-helpers/test-modules.js.map +1 -0
  364. package/dist/utilities/test-helpers/test-overlays.d.ts +20 -2
  365. package/dist/utilities/test-helpers/test-overlays.js +56 -6
  366. package/dist/utilities/test-helpers/test-overlays.js.map +1 -1
  367. package/dist/utilities/test-helpers/test-resources.d.ts +23 -3
  368. package/dist/utilities/test-helpers/test-resources.js +83 -23
  369. package/dist/utilities/test-helpers/test-resources.js.map +1 -1
  370. package/dist/utilities/validation/validation.utility.d.ts +24 -0
  371. package/dist/utilities/validation/validation.utility.js +24 -0
  372. package/dist/utilities/validation/validation.utility.js.map +1 -1
  373. package/package.json +12 -6
  374. package/dist/functions/diff/diff.utility.js.map +0 -1
  375. package/dist/services/capture/capture.service.d.ts +0 -19
  376. package/dist/services/capture/capture.service.js +0 -43
  377. package/dist/services/capture/capture.service.js.map +0 -1
  378. package/dist/services/state-management/local-encryption.state-provider.d.ts +0 -20
  379. package/dist/services/state-management/local-encryption.state-provider.js +0 -90
  380. package/dist/services/state-management/local-encryption.state-provider.js.map +0 -1
  381. package/dist/utilities/cidr/cidr.utility.d.ts +0 -10
  382. package/dist/utilities/cidr/cidr.utility.js +0 -51
  383. package/dist/utilities/cidr/cidr.utility.js.map +0 -1
@@ -12,40 +12,46 @@ type TestContainerSubjects = {
12
12
  };
13
13
  type TestContainerOptions = {
14
14
  factoryTimeoutInMs?: number;
15
+ force?: boolean;
15
16
  };
16
17
  /**
17
- * The TestContainer class is an isolated {@link Container} for tests.
18
+ * An isolated {@link Container} for tests.
19
+ *
20
+ * The Container is a process-wide singleton, which makes it awkward to mock. TestContainer solves
21
+ * that: create one in `beforeEach()` and it takes over the Container for that test, letting you
22
+ * replace any factory with a stub. `reset()` in `afterEach()` puts it back.
18
23
  *
19
24
  * :::info Info
20
- * A test framework like Jest, supports parallel test executions in different cores of the machine.
21
- * Each test is a single test file, whose `it()` blocks are executed serially.
25
+ * A test framework like Jest runs test *files* in parallel across cores, and the `it()` blocks
26
+ * within a file serially. So a TestContainer never leaks into a test running in parallel.
22
27
  * :::
23
28
  *
24
- * TestContainer is created with testing framework's parallel execution in mind.
25
- * A TestContainer should be created in the `beforeAll()` block of your test,
26
- * which modifies the Container for the duration of the test.
27
- * This TestContainer does not affect other tests in parallel since they are on a separate machine core.
28
- * Once tests are done executing, the `afterAll()` block cleans up the Container.
29
+ * @example
30
+ * ```ts
31
+ * beforeEach(async () => {
32
+ * container = await TestContainer.create({ mocks: [] }, { factoryTimeoutInMs: 500 });
33
+ * });
34
+ *
35
+ * afterEach(async () => {
36
+ * await TestContainer.reset();
37
+ * });
38
+ * ```
29
39
  *
30
40
  * @group Functions/Container
31
41
  */
32
42
  export declare class TestContainer {
33
43
  private static originalFactories;
34
- private static bootstrap;
35
44
  /**
36
- * The `TestContainer.create()` method allows you to mock factories.
45
+ * To take over the Container for one test, replacing the factories you name.
37
46
  *
38
47
  * @example
39
48
  * ```ts
40
- * beforeAll(async () => {
41
- * await TestContainer.create({
42
- * mocks: [
43
- * { type: MyClass, value: jest.fn() },
44
- * { metadata: { key: 'value' }, type: AnotherClass, value: new AnotherClass() },
45
- * ],
46
- * }, { factoryTimeoutInMs: 500 });
47
- * });
48
- *
49
+ * await TestContainer.create({
50
+ * mocks: [
51
+ * { type: MyClass, value: jest.fn() },
52
+ * { metadata: { key: 'value' }, type: AnotherClass, value: new AnotherClass() },
53
+ * ],
54
+ * }, { factoryTimeoutInMs: 500 });
49
55
  * ```
50
56
  * @param subjects The subjects being mocked.
51
57
  * - `mocks` is an array of objects, to override the default factories.
@@ -54,20 +60,28 @@ export declare class TestContainer {
54
60
  * - Use `value: T` to provide the mocked value.
55
61
  * @param options Options to configure TestContainer.
56
62
  * - `factoryTimeoutInMs?: number` is to override the default container timeout.
63
+ * - `force?: boolean` performs a complete container reset.
57
64
  */
58
65
  static create(subjects: TestContainerSubjects, options?: TestContainerOptions): Promise<Container>;
59
66
  /**
60
- * The `TestContainer.reset()` method will completely destroy all factories from the Container.
61
- * Because the entire Container is destroyed, and not just the mocks,
62
- * it must always be called in your `afterAll()` block.
63
- *
64
- * @example
65
- * ```ts
66
- * afterAll(async () => {
67
- * await TestContainer.reset();
68
- * });
69
- * ```
67
+ * To destroy every factory in the Container. Because it destroys the whole Container and not only
68
+ * the mocks, it must always be called in your teardown block - otherwise the next test starts
69
+ * against a Container this test left behind.
70
70
  */
71
71
  static reset(): Promise<void>;
72
+ /**
73
+ * Bootstrap the Container with the necessary factories internal to Octo.
74
+ * Between test runs, when the container is reset, many of Octo's internal classes must be reset as well.
75
+ * Since these classes are not exposed outside of Octo, we must bootstrap them.
76
+ *
77
+ * Some factories defined in Octo using `@Factory` must be placed here,
78
+ * the exact criteria being any factory that needs to reset its state.
79
+ *
80
+ * Exceptions:
81
+ * - {@link ModelSerializationService}: We do not want to loose class mapping already instantiated via decorators.
82
+ * - {@link ResourceSerializationService}: We do not want to loose class mapping already instantiated via decorators.
83
+ * - {@link TransactionService}: We do not want to loose action mapping already instantiated via decorators.
84
+ */
85
+ private static bootstrap;
72
86
  }
73
87
  export {};
@@ -1,51 +1,50 @@
1
1
  import { ModuleContainer } from '../../modules/module.container.js';
2
2
  import { OverlayDataRepository } from '../../overlays/overlay-data.repository.js';
3
3
  import { ResourceDataRepository, } from '../../resources/resource-data.repository.js';
4
- import { CaptureService } from '../../services/capture/capture.service.js';
4
+ import { EventService } from '../../services/event/event.service.js';
5
5
  import { InputService } from '../../services/input/input.service.js';
6
+ import { ModelSerializationService } from '../../services/serialization/model/model-serialization.service.js';
7
+ import { ResourceSerializationService } from '../../services/serialization/resource/resource-serialization.service.js';
8
+ import { TerraformService } from '../../services/terraform/terraform.service.js';
9
+ import { TransactionService } from '../../services/transaction/transaction.service.js';
6
10
  import { Container } from './container.js';
7
11
  /**
8
- * The TestContainer class is an isolated {@link Container} for tests.
12
+ * An isolated {@link Container} for tests.
13
+ *
14
+ * The Container is a process-wide singleton, which makes it awkward to mock. TestContainer solves
15
+ * that: create one in `beforeEach()` and it takes over the Container for that test, letting you
16
+ * replace any factory with a stub. `reset()` in `afterEach()` puts it back.
9
17
  *
10
18
  * :::info Info
11
- * A test framework like Jest, supports parallel test executions in different cores of the machine.
12
- * Each test is a single test file, whose `it()` blocks are executed serially.
19
+ * A test framework like Jest runs test *files* in parallel across cores, and the `it()` blocks
20
+ * within a file serially. So a TestContainer never leaks into a test running in parallel.
13
21
  * :::
14
22
  *
15
- * TestContainer is created with testing framework's parallel execution in mind.
16
- * A TestContainer should be created in the `beforeAll()` block of your test,
17
- * which modifies the Container for the duration of the test.
18
- * This TestContainer does not affect other tests in parallel since they are on a separate machine core.
19
- * Once tests are done executing, the `afterAll()` block cleans up the Container.
23
+ * @example
24
+ * ```ts
25
+ * beforeEach(async () => {
26
+ * container = await TestContainer.create({ mocks: [] }, { factoryTimeoutInMs: 500 });
27
+ * });
28
+ *
29
+ * afterEach(async () => {
30
+ * await TestContainer.reset();
31
+ * });
32
+ * ```
20
33
  *
21
34
  * @group Functions/Container
22
35
  */
23
36
  export class TestContainer {
24
- static async bootstrap(container) {
25
- await container.get(OverlayDataRepository, {
26
- args: [true, []],
27
- });
28
- await container.get(ResourceDataRepository, {
29
- args: [true, [], [], []],
30
- });
31
- await container.get(CaptureService, { args: [true] });
32
- await container.get(InputService, { args: [true] });
33
- await container.get(ModuleContainer, { args: [true] });
34
- }
35
37
  /**
36
- * The `TestContainer.create()` method allows you to mock factories.
38
+ * To take over the Container for one test, replacing the factories you name.
37
39
  *
38
40
  * @example
39
41
  * ```ts
40
- * beforeAll(async () => {
41
- * await TestContainer.create({
42
- * mocks: [
43
- * { type: MyClass, value: jest.fn() },
44
- * { metadata: { key: 'value' }, type: AnotherClass, value: new AnotherClass() },
45
- * ],
46
- * }, { factoryTimeoutInMs: 500 });
47
- * });
48
- *
42
+ * await TestContainer.create({
43
+ * mocks: [
44
+ * { type: MyClass, value: jest.fn() },
45
+ * { metadata: { key: 'value' }, type: AnotherClass, value: new AnotherClass() },
46
+ * ],
47
+ * }, { factoryTimeoutInMs: 500 });
49
48
  * ```
50
49
  * @param subjects The subjects being mocked.
51
50
  * - `mocks` is an array of objects, to override the default factories.
@@ -54,6 +53,7 @@ export class TestContainer {
54
53
  * - Use `value: T` to provide the mocked value.
55
54
  * @param options Options to configure TestContainer.
56
55
  * - `factoryTimeoutInMs?: number` is to override the default container timeout.
56
+ * - `force?: boolean` performs a complete container reset.
57
57
  */
58
58
  static async create(subjects, options) {
59
59
  if (!TestContainer.originalFactories) {
@@ -64,31 +64,59 @@ export class TestContainer {
64
64
  container.setFactories(this.originalFactories);
65
65
  // Reset state of eligible factories.
66
66
  // A factory is eligible if it has an internal structure and should be reset on every test.
67
- await this.bootstrap(container);
67
+ await this.bootstrap(container, options?.force ?? false);
68
68
  if (options?.factoryTimeoutInMs) {
69
69
  container.setFactoryTimeout(options.factoryTimeoutInMs);
70
70
  }
71
71
  // Override new container with mock factories as instructed.
72
72
  for (const mock of subjects.mocks || []) {
73
- container.unRegisterFactory(mock.type, { metadata: mock.metadata });
74
- container.registerValue(mock.type, mock.value, { metadata: mock.metadata });
73
+ container.replaceValue(mock.type, mock.value, { metadata: mock.metadata });
75
74
  }
76
75
  return container;
77
76
  }
78
77
  /**
79
- * The `TestContainer.reset()` method will completely destroy all factories from the Container.
80
- * Because the entire Container is destroyed, and not just the mocks,
81
- * it must always be called in your `afterAll()` block.
82
- *
83
- * @example
84
- * ```ts
85
- * afterAll(async () => {
86
- * await TestContainer.reset();
87
- * });
88
- * ```
78
+ * To destroy every factory in the Container. Because it destroys the whole Container and not only
79
+ * the mocks, it must always be called in your teardown block - otherwise the next test starts
80
+ * against a Container this test left behind.
89
81
  */
90
82
  static async reset() {
91
83
  Container.getInstance().reset();
92
84
  }
85
+ /**
86
+ * Bootstrap the Container with the necessary factories internal to Octo.
87
+ * Between test runs, when the container is reset, many of Octo's internal classes must be reset as well.
88
+ * Since these classes are not exposed outside of Octo, we must bootstrap them.
89
+ *
90
+ * Some factories defined in Octo using `@Factory` must be placed here,
91
+ * the exact criteria being any factory that needs to reset its state.
92
+ *
93
+ * Exceptions:
94
+ * - {@link ModelSerializationService}: We do not want to loose class mapping already instantiated via decorators.
95
+ * - {@link ResourceSerializationService}: We do not want to loose class mapping already instantiated via decorators.
96
+ * - {@link TransactionService}: We do not want to loose action mapping already instantiated via decorators.
97
+ */
98
+ static async bootstrap(container, force = false) {
99
+ const overlayDataRepository = await container.get(OverlayDataRepository, { args: [true, []] });
100
+ const resourceDataRepository = await container.get(ResourceDataRepository, { args: [true, [], [], []] });
101
+ const inputService = await container.get(InputService, { args: [true] });
102
+ const moduleContainer = await container.get(ModuleContainer, {
103
+ args: [true],
104
+ });
105
+ const terraformService = await container.get(TerraformService, {
106
+ args: [{}, true],
107
+ });
108
+ if (force) {
109
+ const eventService = await container.get(EventService);
110
+ const modelSerializationService = new ModelSerializationService(inputService, moduleContainer);
111
+ container.unRegisterFactory(ModelSerializationService);
112
+ container.registerValue(ModelSerializationService, modelSerializationService);
113
+ const resourceSerializationService = new ResourceSerializationService(resourceDataRepository, inputService);
114
+ container.unRegisterFactory(ResourceSerializationService);
115
+ container.registerValue(ResourceSerializationService, resourceSerializationService);
116
+ const transactionService = new TransactionService(eventService, inputService, moduleContainer, overlayDataRepository, resourceDataRepository, resourceSerializationService, terraformService);
117
+ container.unRegisterFactory(TransactionService);
118
+ container.registerValue(TransactionService, transactionService);
119
+ }
120
+ }
93
121
  }
94
122
  //# sourceMappingURL=test-container.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-container.js","sourceRoot":"","sources":["../../../src/functions/container/test-container.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA+B,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAqC,MAAM,2CAA2C,CAAC;AACrH,OAAO,EACL,sBAAsB,GAEvB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,cAAc,EAA8B,MAAM,2CAA2C,CAAC;AACvG,OAAO,EAAE,YAAY,EAA4B,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAa3C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,aAAa;IAGhB,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,SAAoB;QACjD,MAAM,SAAS,CAAC,GAAG,CAA6D,qBAAqB,EAAE;YACrG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;SACjB,CAAC,CAAC;QAEH,MAAM,SAAS,CAAC,GAAG,CAA+D,sBAAsB,EAAE;YACxG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;SACzB,CAAC,CAAC;QAEH,MAAM,S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QAC9E,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK;QAChB,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CACF"}
1
+ {"version":3,"file":"test-container.js","sourceRoot":"","sources":["../../../src/functions/container/test-container.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA+B,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAqC,MAAM,2CAA2C,CAAC;AACrH,OAAO,EACL,sBAAsB,GAEvB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,YAAY,EAA4B,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,mEAAmE,CAAC;AAC9G,OAAO,EAAE,4BAA4B,EAAE,MAAM,yEAAyE,CAAC;AACvH,OAAO,EAAE,gBAAgB,EAAgC,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAa3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,aAAa;IAGxB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAA+B,EAAE,OAA8B;QACjF,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,CAAC;YACrC,aAAa,CAAC,iBAAiB,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,aAAa,EAAE,CAAC;QAC5E,CAAC;QACD,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QAE1C,0CAA0C;QAC1C,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC/C,qCA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I,CAAC;SACb,CAAC,CAAC;QAEH,MAAM,gBAAgB,GAAG,MAAM,SAAS,CAAC,GAAG,CAAmD,gBAAgB,EAAE;YAC/G,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;SACjB,CAAC,CAAC;QAEH,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAEvD,MAAM,yBAAyB,GAAG,IAAI,yBAAyB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;YAC/F,SAAS,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;YACvD,SAAS,CAAC,aAAa,CAAC,yBAAyB,EAAE,yBAAyB,CAAC,CAAC;YAE9E,MAAM,4BAA4B,GAAG,IAAI,4BAA4B,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;YAC5G,SAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;YAC1D,SAAS,CAAC,aAAa,CAAC,4BAA4B,EAAE,4BAA4B,CAAC,CAAC;YAEpF,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,CAC/C,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,gBAAgB,CACjB,CAAC;YACF,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;YAChD,SAAS,CAAC,aAAa,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF"}
@@ -1,13 +1,8 @@
1
1
  import type { UnknownNode } from '../../app.type.js';
2
2
  import type { DiffAction } from '../diff/diff.js';
3
- declare class DependencyBehavior {
4
- forAction: DiffAction;
5
- onAction: DiffAction;
6
- onField: string;
7
- toField: string;
8
- constructor(onField: string, onAction: DiffAction, toField: string, forAction: DiffAction);
9
- }
10
3
  /**
4
+ * How two nodes are related. A parent exists before its child, and outlives it.
5
+ *
11
6
  * @group Functions/Dependency
12
7
  */
13
8
  export declare enum DependencyRelationship {
@@ -15,47 +10,113 @@ export declare enum DependencyRelationship {
15
10
  PARENT = "parent"
16
11
  }
17
12
  /**
13
+ * The serialized form of a {@link Dependency}, as it is written to state. A behavior says that the
14
+ * `forAction` diff of `to`'s `toField` waits for the `onAction` diff of `from`'s `onField`.
15
+ *
18
16
  * @group Functions/Dependency
19
17
  */
20
18
  export interface IDependency {
21
19
  behaviors: {
22
- forAction: DependencyBehavior['forAction'];
23
- onAction: DependencyBehavior['onAction'];
24
- onField: DependencyBehavior['onField'];
25
- toField: DependencyBehavior['toField'];
20
+ forAction: `${DiffAction}`;
21
+ onAction: `${DiffAction}`;
22
+ onField: string;
23
+ toField: string;
26
24
  }[];
27
25
  from: string;
28
26
  relationship?: {
29
- onField: DependencyBehavior['onField'];
30
- toField: DependencyBehavior['toField'];
31
- type: DependencyRelationship;
27
+ onField: string;
28
+ toField: string;
29
+ type: `${DependencyRelationship}`;
32
30
  };
33
31
  to: string;
34
32
  }
35
33
  /**
34
+ * The edge between two nodes in Octo's graph.
35
+ *
36
+ * A dependency is directed, and carries two things: an optional parent/child relationship, and a set
37
+ * of *behaviors*. A behavior states an ordering rule - "when this field of `from` is added, the
38
+ * matching action on `to` must have run first" - and it is those rules that let Octo order a
39
+ * transaction correctly instead of guessing.
40
+ *
41
+ * Models create dependencies through `addChild()` and `addRelationship()`; you rarely construct one.
42
+ *
36
43
  * @group Functions/Dependency
44
+ *
45
+ * @see Definition of [Dependencies](/docs/fundamentals/dependencies).
37
46
  */
38
47
  export declare class Dependency {
39
- private readonly behaviors;
48
+ /**
49
+ * The node this dependency points from.
50
+ */
40
51
  readonly from: UnknownNode;
41
- private relationship;
52
+ /**
53
+ * The node this dependency points to.
54
+ */
42
55
  readonly to: UnknownNode;
56
+ private readonly behaviors;
57
+ private relationship;
58
+ /**
59
+ * @param from The node this dependency points from.
60
+ * @param to The node this dependency points to.
61
+ */
43
62
  constructor(from: UnknownNode, to: UnknownNode);
44
- private getBehaviorIndex;
63
+ /**
64
+ * @internal
65
+ */
66
+ static unSynth(from: UnknownNode, to: UnknownNode, dependency: IDependency): Dependency;
67
+ /**
68
+ * To declare an ordering rule: when `onAction` happens to `onField` of `from`, then `forAction`
69
+ * on `toField` of `to` must have been applied first. Adding the same behavior twice is a no-op.
70
+ */
45
71
  addBehavior(onField: string, onAction: DiffAction, toField: string, forAction: DiffAction): void;
72
+ /**
73
+ * To mark `to` as the child of `from`.
74
+ *
75
+ * @throws {@link DependencyError} If this dependency already has a relationship.
76
+ */
46
77
  addChildRelationship(onField: string, toField: string): void;
78
+ /**
79
+ * To mark `to` as the parent of `from`.
80
+ *
81
+ * @throws {@link DependencyError} If this dependency already has a relationship.
82
+ */
47
83
  addParentRelationship(onField: string, toField: string): void;
48
- hasMatchingBehavior(onField?: string, onAction?: DiffAction, toField?: string, forAction?: DiffAction): boolean;
49
- isChildRelationship(): boolean;
50
- isEqual(dependency: Dependency): boolean;
51
- isParentRelationship(): boolean;
84
+ /**
85
+ * The relationship between the two nodes, if one was declared.
86
+ */
52
87
  getRelationship(): {
53
88
  onField: string;
54
89
  toField: string;
55
90
  type: DependencyRelationship;
56
91
  } | undefined;
92
+ /**
93
+ * Whether any behavior matches every argument given. Arguments left out match anything.
94
+ */
95
+ hasMatchingBehavior(onField?: string, onAction?: DiffAction, toField?: string, forAction?: DiffAction): boolean;
96
+ /**
97
+ * Whether `to` is a child of `from`.
98
+ */
99
+ isChildRelationship(): boolean;
100
+ /**
101
+ * Whether both dependencies connect the same two nodes, in the same direction.
102
+ */
103
+ isEqual(dependency: Dependency): boolean;
104
+ /**
105
+ * Whether `to` is a parent of `from`.
106
+ */
107
+ isParentRelationship(): boolean;
108
+ /**
109
+ * To drop an ordering rule.
110
+ *
111
+ * @throws {@link DependencyError} If no such behavior exists.
112
+ */
57
113
  removeBehavior(onField: string, onAction: DiffAction, toField: string, forAction: DiffAction): void;
114
+ /**
115
+ * @internal
116
+ */
58
117
  synth(): IDependency;
59
- static unSynth(from: UnknownNode, to: UnknownNode, dependency: IDependency): Dependency;
118
+ /**
119
+ * The position of a matching behavior, or `-1`.
120
+ */
121
+ private getBehaviorIndex;
60
122
  }
61
- export {};
@@ -1,5 +1,11 @@
1
1
  import { DependencyError } from '../../errors/index.js';
2
+ /**
3
+ * @internal
4
+ */
2
5
  class DependencyBehavior {
6
+ /**
7
+ * @internal
8
+ */
3
9
  constructor(onField, onAction, toField, forAction) {
4
10
  this.onField = onField;
5
11
  this.onAction = onAction;
@@ -8,6 +14,8 @@ class DependencyBehavior {
8
14
  }
9
15
  }
10
16
  /**
17
+ * How two nodes are related. A parent exists before its child, and outlives it.
18
+ *
11
19
  * @group Functions/Dependency
12
20
  */
13
21
  export var DependencyRelationship;
@@ -16,34 +24,86 @@ export var DependencyRelationship;
16
24
  DependencyRelationship["PARENT"] = "parent";
17
25
  })(DependencyRelationship || (DependencyRelationship = {}));
18
26
  /**
27
+ * The edge between two nodes in Octo's graph.
28
+ *
29
+ * A dependency is directed, and carries two things: an optional parent/child relationship, and a set
30
+ * of *behaviors*. A behavior states an ordering rule - "when this field of `from` is added, the
31
+ * matching action on `to` must have run first" - and it is those rules that let Octo order a
32
+ * transaction correctly instead of guessing.
33
+ *
34
+ * Models create dependencies through `addChild()` and `addRelationship()`; you rarely construct one.
35
+ *
19
36
  * @group Functions/Dependency
37
+ *
38
+ * @see Definition of [Dependencies](/docs/fundamentals/dependencies).
20
39
  */
21
40
  export class Dependency {
41
+ /**
42
+ * @param from The node this dependency points from.
43
+ * @param to The node this dependency points to.
44
+ */
22
45
  constructor(from, to) {
23
46
  this.behaviors = [];
24
47
  this.from = from;
25
48
  this.to = to;
26
49
  }
27
- getBehaviorIndex(onField, onAction, toField, forAction) {
28
- return this.behaviors.findIndex((b) => b.onField === onField && b.onAction === onAction && b.toField === toField && b.forAction === forAction);
50
+ /**
51
+ * @internal
52
+ */
53
+ static unSynth(from, to, dependency) {
54
+ const newDependency = new Dependency(from, to);
55
+ // Read the actions and the relationship back as the values they were written from.
56
+ dependency.behaviors.forEach((b) => {
57
+ newDependency.addBehavior(b.onField, b.onAction, b.toField, b.forAction);
58
+ });
59
+ if (dependency.relationship) {
60
+ newDependency.relationship = {
61
+ ...dependency.relationship,
62
+ type: dependency.relationship.type,
63
+ };
64
+ }
65
+ return newDependency;
29
66
  }
67
+ /**
68
+ * To declare an ordering rule: when `onAction` happens to `onField` of `from`, then `forAction`
69
+ * on `toField` of `to` must have been applied first. Adding the same behavior twice is a no-op.
70
+ */
30
71
  addBehavior(onField, onAction, toField, forAction) {
31
72
  if (this.getBehaviorIndex(onField, onAction, toField, forAction) === -1) {
32
73
  this.behaviors.push(new DependencyBehavior(onField, onAction, toField, forAction));
33
74
  }
34
75
  }
76
+ /**
77
+ * To mark `to` as the child of `from`.
78
+ *
79
+ * @throws {@link DependencyError} If this dependency already has a relationship.
80
+ */
35
81
  addChildRelationship(onField, toField) {
36
82
  if (this.relationship) {
37
83
  throw new DependencyError('Dependency relationship already exists!', this);
38
84
  }
39
85
  this.relationship = { onField, toField, type: DependencyRelationship.CHILD };
40
86
  }
87
+ /**
88
+ * To mark `to` as the parent of `from`.
89
+ *
90
+ * @throws {@link DependencyError} If this dependency already has a relationship.
91
+ */
41
92
  addParentRelationship(onField, toField) {
42
93
  if (this.relationship) {
43
94
  throw new DependencyError('Dependency relationship already exists!', this);
44
95
  }
45
96
  this.relationship = { onField, toField, type: DependencyRelationship.PARENT };
46
97
  }
98
+ /**
99
+ * The relationship between the two nodes, if one was declared.
100
+ */
101
+ getRelationship() {
102
+ return this.relationship;
103
+ }
104
+ /**
105
+ * Whether any behavior matches every argument given. Arguments left out match anything.
106
+ */
47
107
  hasMatchingBehavior(onField, onAction, toField, forAction) {
48
108
  return this.behaviors.some((b) => {
49
109
  const onFieldCondition = onField ? b.onField === onField : true;
@@ -53,18 +113,29 @@ export class Dependency {
53
113
  return onFieldCondition && onActionCondition && toFieldCondition && forActionCondition;
54
114
  });
55
115
  }
116
+ /**
117
+ * Whether `to` is a child of `from`.
118
+ */
56
119
  isChildRelationship() {
57
120
  return this.relationship && this.relationship.type === DependencyRelationship.CHILD;
58
121
  }
122
+ /**
123
+ * Whether both dependencies connect the same two nodes, in the same direction.
124
+ */
59
125
  isEqual(dependency) {
60
126
  return (this.from.getContext() === dependency.from.getContext() && this.to.getContext() === dependency.to.getContext());
61
127
  }
128
+ /**
129
+ * Whether `to` is a parent of `from`.
130
+ */
62
131
  isParentRelationship() {
63
132
  return this.relationship && this.relationship.type === DependencyRelationship.PARENT;
64
133
  }
65
- getRelationship() {
66
- return this.relationship;
67
- }
134
+ /**
135
+ * To drop an ordering rule.
136
+ *
137
+ * @throws {@link DependencyError} If no such behavior exists.
138
+ */
68
139
  removeBehavior(onField, onAction, toField, forAction) {
69
140
  const index = this.getBehaviorIndex(onField, onAction, toField, forAction);
70
141
  if (index === -1) {
@@ -72,6 +143,9 @@ export class Dependency {
72
143
  }
73
144
  this.behaviors.splice(index, 1);
74
145
  }
146
+ /**
147
+ * @internal
148
+ */
75
149
  synth() {
76
150
  const behaviors = [];
77
151
  this.behaviors.forEach((b) => {
@@ -95,15 +169,11 @@ export class Dependency {
95
169
  to: this.to.getContext(),
96
170
  };
97
171
  }
98
- static unSynth(from, to, dependency) {
99
- const newDependency = new Dependency(from, to);
100
- dependency.behaviors.forEach((b) => {
101
- newDependency.addBehavior(b.onField, b.onAction, b.toField, b.forAction);
102
- });
103
- if (dependency.relationship) {
104
- newDependency.relationship = { ...dependency.relationship };
105
- }
106
- return newDependency;
172
+ /**
173
+ * The position of a matching behavior, or `-1`.
174
+ */
175
+ getBehaviorIndex(onField, onAction, toField, forAction) {
176
+ return this.behaviors.findIndex((b) => b.onField === onField && b.onAction === onAction && b.toField === toField && b.forAction === forAction);
107
177
  }
108
178
  }
109
179
  //# sourceMappingURL=dependency.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../../src/functions/dependency/dependency.ts"],"names":[],"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diffs, collapsed to a single action.
5
+ */
6
+ export interface AggregatedResourceAction {
7
+ action: DiffAction.ADD | DiffAction.DELETE | DiffAction.REPLACE | DiffAction.UPDATE;
8
+ reason?: string;
9
+ resourceId: string;
10
+ }
11
+ /**
12
+ * Collapses a resource's field-level diffs into one action per resource, keyed by resource context.
13
+ *
14
+ * Precedence: an add/delete of `resourceId` wins; a REPLACE beats an UPDATE; otherwise UPDATE.
15
+ * `reason` is taken from the winning diff.
16
+ *
17
+ * @internal
18
+ */
19
+ export declare function aggregateResourceActions(diffs: DiffMetadata[]): Map<string, AggregatedResourceAction>;