@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.
- package/LICENSE +661 -0
- package/README.md +117 -8
- package/dist/app.type.d.ts +277 -19
- package/dist/app.type.js +80 -9
- package/dist/app.type.js.map +1 -1
- package/dist/decorators/action.decorator.d.ts +10 -6
- package/dist/decorators/action.decorator.js +19 -6
- package/dist/decorators/action.decorator.js.map +1 -1
- package/dist/decorators/anchor.decorator.d.ts +12 -5
- package/dist/decorators/anchor.decorator.js +12 -5
- package/dist/decorators/anchor.decorator.js.map +1 -1
- package/dist/decorators/enable-hook.decorator.d.ts +1 -1
- package/dist/decorators/enable-hook.decorator.js +1 -1
- package/dist/decorators/factory.decorator.d.ts +18 -34
- package/dist/decorators/factory.decorator.js +18 -34
- package/dist/decorators/factory.decorator.js.map +1 -1
- package/dist/decorators/model.decorator.d.ts +4 -6
- package/dist/decorators/model.decorator.js +2 -7
- package/dist/decorators/model.decorator.js.map +1 -1
- package/dist/decorators/module.decorator.d.ts +16 -10
- package/dist/decorators/module.decorator.js +16 -10
- package/dist/decorators/module.decorator.js.map +1 -1
- package/dist/decorators/on-event.decorator.d.ts +7 -2
- package/dist/decorators/on-event.decorator.js +5 -0
- package/dist/decorators/on-event.decorator.js.map +1 -1
- package/dist/decorators/resource.decorator.d.ts +50 -1
- package/dist/decorators/resource.decorator.js +38 -1
- package/dist/decorators/resource.decorator.js.map +1 -1
- package/dist/decorators/validate.decorator.d.ts +15 -1
- package/dist/decorators/validate.decorator.js +15 -1
- package/dist/decorators/validate.decorator.js.map +1 -1
- package/dist/errors/container.error.d.ts +18 -0
- package/dist/errors/container.error.js +18 -0
- package/dist/errors/container.error.js.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/module.error.d.ts +6 -0
- package/dist/errors/module.error.js +6 -0
- package/dist/errors/module.error.js.map +1 -1
- package/dist/errors/node.error.d.ts +56 -0
- package/dist/errors/node.error.js +56 -0
- package/dist/errors/node.error.js.map +1 -1
- package/dist/errors/schema.error.d.ts +14 -1
- package/dist/errors/schema.error.js +11 -1
- package/dist/errors/schema.error.js.map +1 -1
- package/dist/errors/terraform.error.d.ts +20 -0
- package/dist/errors/terraform.error.js +24 -0
- package/dist/errors/terraform.error.js.map +1 -0
- package/dist/errors/transaction.error.d.ts +93 -2
- package/dist/errors/transaction.error.js +83 -0
- package/dist/errors/transaction.error.js.map +1 -1
- package/dist/events/action.event.d.ts +8 -4
- package/dist/events/action.event.js +2 -4
- package/dist/events/action.event.js.map +1 -1
- package/dist/events/command.event.d.ts +43 -0
- package/dist/events/command.event.js +33 -0
- package/dist/events/command.event.js.map +1 -0
- package/dist/events/event.model.d.ts +26 -8
- package/dist/events/event.model.js +15 -7
- package/dist/events/event.model.js.map +1 -1
- package/dist/events/hook/commit.hook.event.d.ts +1 -7
- package/dist/events/hook/commit.hook.event.js +0 -6
- package/dist/events/hook/commit.hook.event.js.map +1 -1
- package/dist/events/hook/hook.event.d.ts +1 -3
- package/dist/events/hook/hook.event.js +0 -2
- package/dist/events/hook/hook.event.js.map +1 -1
- package/dist/events/hook/model.hook.event.d.ts +1 -7
- package/dist/events/hook/model.hook.event.js +0 -6
- package/dist/events/hook/model.hook.event.js.map +1 -1
- package/dist/events/hook/resource.hook.event.d.ts +1 -7
- package/dist/events/hook/resource.hook.event.js +0 -6
- package/dist/events/hook/resource.hook.event.js.map +1 -1
- package/dist/events/index.d.ts +5 -0
- package/dist/events/index.js +5 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/mode-result.event.d.ts +57 -0
- package/dist/events/mode-result.event.js +24 -0
- package/dist/events/mode-result.event.js.map +1 -0
- package/dist/events/mode.event.d.ts +61 -0
- package/dist/events/mode.event.js +32 -0
- package/dist/events/mode.event.js.map +1 -0
- package/dist/events/module.event.d.ts +7 -5
- package/dist/events/module.event.js +3 -4
- package/dist/events/module.event.js.map +1 -1
- package/dist/events/registration.event.d.ts +19 -15
- package/dist/events/registration.event.js +18 -14
- package/dist/events/registration.event.js.map +1 -1
- package/dist/events/serialization.event.d.ts +16 -13
- package/dist/events/serialization.event.js +15 -12
- package/dist/events/serialization.event.js.map +1 -1
- package/dist/events/state.event.d.ts +102 -0
- package/dist/events/state.event.js +69 -0
- package/dist/events/state.event.js.map +1 -0
- package/dist/events/terraform.event.d.ts +78 -0
- package/dist/events/terraform.event.js +55 -0
- package/dist/events/terraform.event.js.map +1 -0
- package/dist/events/transaction.event.d.ts +3 -40
- package/dist/events/transaction.event.js +1 -29
- package/dist/events/transaction.event.js.map +1 -1
- package/dist/functions/container/container.d.ts +54 -13
- package/dist/functions/container/container.js +64 -19
- package/dist/functions/container/container.js.map +1 -1
- package/dist/functions/container/test-container.d.ts +43 -29
- package/dist/functions/container/test-container.js +71 -43
- package/dist/functions/container/test-container.js.map +1 -1
- package/dist/functions/dependency/dependency.d.ts +84 -23
- package/dist/functions/dependency/dependency.js +84 -14
- package/dist/functions/dependency/dependency.js.map +1 -1
- package/dist/functions/diff/aggregate-resource-actions.d.ts +19 -0
- package/dist/functions/diff/aggregate-resource-actions.js +41 -0
- package/dist/functions/diff/aggregate-resource-actions.js.map +1 -0
- package/dist/functions/diff/diff-metadata.d.ts +21 -3
- package/dist/functions/diff/diff-metadata.js +18 -0
- package/dist/functions/diff/diff-metadata.js.map +1 -1
- package/dist/functions/diff/diff.d.ts +68 -7
- package/dist/functions/diff/diff.js +44 -3
- package/dist/functions/diff/diff.js.map +1 -1
- package/dist/functions/hook/commit.hook.d.ts +16 -1
- package/dist/functions/hook/commit.hook.js +21 -6
- package/dist/functions/hook/commit.hook.js.map +1 -1
- package/dist/functions/hook/model-action.hook.d.ts +16 -1
- package/dist/functions/hook/model-action.hook.js +21 -6
- package/dist/functions/hook/model-action.hook.js.map +1 -1
- package/dist/functions/hook/resource-action.hook.d.ts +16 -1
- package/dist/functions/hook/resource-action.hook.js +21 -6
- package/dist/functions/hook/resource-action.hook.js.map +1 -1
- package/dist/functions/node/node-action.abstract.d.ts +23 -2
- package/dist/functions/node/node-action.abstract.js +22 -8
- package/dist/functions/node/node-action.abstract.js.map +1 -1
- package/dist/functions/node/node.abstract.d.ts +56 -5
- package/dist/functions/node/node.abstract.js +106 -22
- package/dist/functions/node/node.abstract.js.map +1 -1
- package/dist/functions/node/node.interface.d.ts +3 -1
- package/dist/functions/schema/schema.d.ts +7 -0
- package/dist/functions/schema/schema.js +10 -1
- package/dist/functions/schema/schema.js.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.type.d.ts +5 -0
- package/dist/index.type.js +2 -0
- package/dist/index.type.js.map +1 -0
- package/dist/main.d.ts +245 -14
- package/dist/main.js +377 -72
- package/dist/main.js.map +1 -1
- package/dist/models/account/account.model.d.ts +43 -7
- package/dist/models/account/account.model.js +56 -8
- package/dist/models/account/account.model.js.map +1 -1
- package/dist/models/account/account.schema.d.ts +13 -1
- package/dist/models/account/account.schema.js +12 -0
- package/dist/models/account/account.schema.js.map +1 -1
- package/dist/models/app/app.model.d.ts +13 -8
- package/dist/models/app/app.model.js +17 -32
- package/dist/models/app/app.model.js.map +1 -1
- package/dist/models/app/app.schema.d.ts +6 -0
- package/dist/models/app/app.schema.js +6 -0
- package/dist/models/app/app.schema.js.map +1 -1
- package/dist/models/deployment/deployment.model.d.ts +13 -1
- package/dist/models/deployment/deployment.model.js +16 -4
- package/dist/models/deployment/deployment.model.js.map +1 -1
- package/dist/models/deployment/deployment.schema.d.ts +6 -0
- package/dist/models/deployment/deployment.schema.js +6 -0
- package/dist/models/deployment/deployment.schema.js.map +1 -1
- package/dist/models/environment/environment.model.d.ts +15 -3
- package/dist/models/environment/environment.model.js +22 -10
- package/dist/models/environment/environment.model.js.map +1 -1
- package/dist/models/environment/environment.schema.d.ts +2 -0
- package/dist/models/environment/environment.schema.js +2 -0
- package/dist/models/environment/environment.schema.js.map +1 -1
- package/dist/models/execution/execution.model.d.ts +21 -3
- package/dist/models/execution/execution.model.js +47 -29
- package/dist/models/execution/execution.model.js.map +1 -1
- package/dist/models/execution/execution.schema.d.ts +11 -0
- package/dist/models/execution/execution.schema.js +11 -0
- package/dist/models/execution/execution.schema.js.map +1 -1
- package/dist/models/filesystem/filesystem.model.d.ts +27 -1
- package/dist/models/filesystem/filesystem.model.js +30 -4
- package/dist/models/filesystem/filesystem.model.js.map +1 -1
- package/dist/models/filesystem/filesystem.schema.d.ts +5 -0
- package/dist/models/filesystem/filesystem.schema.js +5 -0
- package/dist/models/filesystem/filesystem.schema.js.map +1 -1
- package/dist/models/image/image.model.d.ts +19 -5
- package/dist/models/image/image.model.js +25 -11
- package/dist/models/image/image.model.js.map +1 -1
- package/dist/models/image/image.schema.d.ts +8 -0
- package/dist/models/image/image.schema.js +8 -0
- package/dist/models/image/image.schema.js.map +1 -1
- package/dist/models/model-action.interface.d.ts +17 -4
- package/dist/models/model.abstract.d.ts +96 -1
- package/dist/models/model.abstract.js +107 -8
- package/dist/models/model.abstract.js.map +1 -1
- package/dist/models/model.interface.d.ts +3 -0
- package/dist/models/pipeline/pipeline.model.d.ts +14 -2
- package/dist/models/pipeline/pipeline.model.js +19 -7
- package/dist/models/pipeline/pipeline.model.js.map +1 -1
- package/dist/models/pipeline/pipeline.schema.d.ts +8 -0
- package/dist/models/pipeline/pipeline.schema.js +8 -0
- package/dist/models/pipeline/pipeline.schema.js.map +1 -1
- package/dist/models/region/region.model.d.ts +16 -1
- package/dist/models/region/region.model.js +19 -4
- package/dist/models/region/region.model.js.map +1 -1
- package/dist/models/region/region.schema.d.ts +6 -0
- package/dist/models/region/region.schema.js +6 -0
- package/dist/models/region/region.schema.js.map +1 -1
- package/dist/models/server/server.model.d.ts +15 -3
- package/dist/models/server/server.model.js +18 -6
- package/dist/models/server/server.model.js.map +1 -1
- package/dist/models/server/server.schema.d.ts +3 -1
- package/dist/models/server/server.schema.js +3 -1
- package/dist/models/server/server.schema.js.map +1 -1
- package/dist/models/service/service.model.d.ts +37 -6
- package/dist/models/service/service.model.js +65 -11
- package/dist/models/service/service.model.js.map +1 -1
- package/dist/models/service/service.schema.d.ts +48 -1
- package/dist/models/service/service.schema.js +56 -1
- package/dist/models/service/service.schema.js.map +1 -1
- package/dist/models/subnet/subnet.model.d.ts +27 -3
- package/dist/models/subnet/subnet.model.js +40 -16
- package/dist/models/subnet/subnet.model.js.map +1 -1
- package/dist/models/subnet/subnet.schema.d.ts +9 -0
- package/dist/models/subnet/subnet.schema.js +9 -0
- package/dist/models/subnet/subnet.schema.js.map +1 -1
- package/dist/modes/apply-transaction.d.ts +23 -0
- package/dist/modes/apply-transaction.js +25 -0
- package/dist/modes/apply-transaction.js.map +1 -0
- package/dist/modes/commit.mode.d.ts +54 -0
- package/dist/modes/commit.mode.js +235 -0
- package/dist/modes/commit.mode.js.map +1 -0
- package/dist/modes/generate.mode.d.ts +30 -0
- package/dist/modes/generate.mode.js +50 -0
- package/dist/modes/generate.mode.js.map +1 -0
- package/dist/modes/run-action.mode.d.ts +30 -0
- package/dist/modes/run-action.mode.js +140 -0
- package/dist/modes/run-action.mode.js.map +1 -0
- package/dist/modes/validate.mode.d.ts +186 -0
- package/dist/modes/validate.mode.js +558 -0
- package/dist/modes/validate.mode.js.map +1 -0
- package/dist/modules/module.abstract.d.ts +51 -0
- package/dist/modules/module.abstract.js +36 -0
- package/dist/modules/module.abstract.js.map +1 -1
- package/dist/modules/module.container.d.ts +43 -1
- package/dist/modules/module.container.js +77 -5
- package/dist/modules/module.container.js.map +1 -1
- package/dist/modules/test-module.container.d.ts +139 -25
- package/dist/modules/test-module.container.js +383 -199
- package/dist/modules/test-module.container.js.map +1 -1
- package/dist/overlays/anchor.abstract.d.ts +32 -1
- package/dist/overlays/anchor.abstract.js +42 -11
- package/dist/overlays/anchor.abstract.js.map +1 -1
- package/dist/overlays/anchor.schema.d.ts +21 -0
- package/dist/overlays/anchor.schema.js +21 -0
- package/dist/overlays/anchor.schema.js.map +1 -1
- package/dist/overlays/overlay-data.repository.d.ts +18 -0
- package/dist/overlays/overlay-data.repository.js +18 -0
- package/dist/overlays/overlay-data.repository.js.map +1 -1
- package/dist/overlays/overlay.abstract.d.ts +56 -1
- package/dist/overlays/overlay.abstract.js +79 -20
- package/dist/overlays/overlay.abstract.js.map +1 -1
- package/dist/overlays/overlay.schema.d.ts +20 -0
- package/dist/overlays/overlay.schema.js +20 -0
- package/dist/overlays/overlay.schema.js.map +1 -1
- package/dist/resources/resource-action.interface.d.ts +29 -3
- package/dist/resources/resource-data.repository.d.ts +63 -1
- package/dist/resources/resource-data.repository.js +94 -4
- package/dist/resources/resource-data.repository.js.map +1 -1
- package/dist/resources/resource.abstract.d.ts +163 -6
- package/dist/resources/resource.abstract.js +223 -59
- package/dist/resources/resource.abstract.js.map +1 -1
- package/dist/resources/resource.interface.d.ts +0 -2
- package/dist/resources/resource.schema.d.ts +39 -1
- package/dist/resources/resource.schema.js +38 -0
- package/dist/resources/resource.schema.js.map +1 -1
- package/dist/resources/terraform-resource.abstract.d.ts +44 -0
- package/dist/resources/terraform-resource.abstract.js +45 -0
- package/dist/resources/terraform-resource.abstract.js.map +1 -0
- package/dist/services/event/event.service.d.ts +32 -5
- package/dist/services/event/event.service.js +58 -16
- package/dist/services/event/event.service.js.map +1 -1
- package/dist/services/input/input.service.d.ts +82 -5
- package/dist/services/input/input.service.js +143 -12
- package/dist/services/input/input.service.js.map +1 -1
- package/dist/services/schema-translation/schema-translation.service.d.ts +9 -0
- package/dist/services/schema-translation/schema-translation.service.js +9 -0
- package/dist/services/schema-translation/schema-translation.service.js.map +1 -1
- package/dist/services/serialization/model/model-serialization.service.d.ts +25 -3
- package/dist/services/serialization/model/model-serialization.service.js +113 -62
- package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
- package/dist/services/serialization/resource/resource-serialization.service.d.ts +36 -6
- package/dist/services/serialization/resource/resource-serialization.service.js +77 -28
- package/dist/services/serialization/resource/resource-serialization.service.js.map +1 -1
- package/dist/services/state-management/local.state-provider.d.ts +67 -4
- package/dist/services/state-management/local.state-provider.js +168 -41
- package/dist/services/state-management/local.state-provider.js.map +1 -1
- package/dist/services/state-management/remote.state-provider.d.ts +216 -0
- package/dist/services/state-management/remote.state-provider.js +645 -0
- package/dist/services/state-management/remote.state-provider.js.map +1 -0
- package/dist/services/state-management/state-management.service.d.ts +195 -17
- package/dist/services/state-management/state-management.service.js +259 -10
- package/dist/services/state-management/state-management.service.js.map +1 -1
- package/dist/services/state-management/state-provider.interface.d.ts +98 -3
- package/dist/services/state-management/state-provider.interface.js +14 -1
- package/dist/services/state-management/state-provider.interface.js.map +1 -1
- package/dist/services/state-management/terraform-state.service.d.ts +99 -0
- package/dist/services/state-management/terraform-state.service.js +197 -0
- package/dist/services/state-management/terraform-state.service.js.map +1 -0
- package/dist/services/state-management/test.state-provider.d.ts +42 -4
- package/dist/services/state-management/test.state-provider.js +77 -25
- package/dist/services/state-management/test.state-provider.js.map +1 -1
- package/dist/services/terraform/terraform.service.d.ts +480 -0
- package/dist/services/terraform/terraform.service.js +1082 -0
- package/dist/services/terraform/terraform.service.js.map +1 -0
- package/dist/services/terraform/terraform.type.d.ts +387 -0
- package/dist/services/terraform/terraform.type.js +579 -0
- package/dist/services/terraform/terraform.type.js.map +1 -0
- package/dist/services/transaction/transaction.service.d.ts +110 -10
- package/dist/services/transaction/transaction.service.js +570 -251
- package/dist/services/transaction/transaction.service.js.map +1 -1
- package/dist/services/validation/validation.service.d.ts +15 -3
- package/dist/services/validation/validation.service.js +12 -0
- package/dist/services/validation/validation.service.js.map +1 -1
- package/dist/utilities/array/array.utility.d.ts +3 -0
- package/dist/utilities/array/array.utility.js +3 -0
- package/dist/utilities/array/array.utility.js.map +1 -1
- package/dist/{functions → utilities}/diff/diff.utility.d.ts +19 -3
- package/dist/{functions → utilities}/diff/diff.utility.js +57 -41
- package/dist/utilities/diff/diff.utility.js.map +1 -0
- package/dist/utilities/file/file.utility.d.ts +16 -2
- package/dist/utilities/file/file.utility.js +23 -61
- package/dist/utilities/file/file.utility.js.map +1 -1
- package/dist/utilities/hcl/hcl.utility.d.ts +128 -0
- package/dist/utilities/hcl/hcl.utility.js +402 -0
- package/dist/utilities/hcl/hcl.utility.js.map +1 -0
- package/dist/utilities/http/http.utility.d.ts +57 -0
- package/dist/utilities/http/http.utility.js +98 -0
- package/dist/utilities/http/http.utility.js.map +1 -0
- package/dist/utilities/node/node.utility.d.ts +3 -0
- package/dist/utilities/node/node.utility.js +3 -0
- package/dist/utilities/node/node.utility.js.map +1 -1
- package/dist/utilities/object/object.utility.d.ts +12 -0
- package/dist/utilities/object/object.utility.js +12 -0
- package/dist/utilities/object/object.utility.js.map +1 -1
- package/dist/utilities/project/project.utility.d.ts +28 -0
- package/dist/utilities/project/project.utility.js +35 -0
- package/dist/utilities/project/project.utility.js.map +1 -0
- package/dist/utilities/string/string.utility.d.ts +41 -0
- package/dist/utilities/string/string.utility.js +65 -0
- package/dist/utilities/string/string.utility.js.map +1 -0
- package/dist/utilities/terraform/terraform.utility.d.ts +276 -0
- package/dist/utilities/terraform/terraform.utility.js +623 -0
- package/dist/utilities/terraform/terraform.utility.js.map +1 -0
- package/dist/utilities/test-helpers/test-classes.d.ts +36 -30
- package/dist/utilities/test-helpers/test-classes.js +38 -39
- package/dist/utilities/test-helpers/test-classes.js.map +1 -1
- package/dist/utilities/test-helpers/test-models.d.ts +8 -1
- package/dist/utilities/test-helpers/test-models.js +37 -12
- package/dist/utilities/test-helpers/test-models.js.map +1 -1
- package/dist/utilities/test-helpers/test-modes.d.ts +315 -0
- package/dist/utilities/test-helpers/test-modes.js +486 -0
- package/dist/utilities/test-helpers/test-modes.js.map +1 -0
- package/dist/utilities/test-helpers/test-modules.d.ts +47 -0
- package/dist/utilities/test-helpers/test-modules.js +85 -0
- package/dist/utilities/test-helpers/test-modules.js.map +1 -0
- package/dist/utilities/test-helpers/test-overlays.d.ts +20 -2
- package/dist/utilities/test-helpers/test-overlays.js +56 -6
- package/dist/utilities/test-helpers/test-overlays.js.map +1 -1
- package/dist/utilities/test-helpers/test-resources.d.ts +23 -3
- package/dist/utilities/test-helpers/test-resources.js +83 -23
- package/dist/utilities/test-helpers/test-resources.js.map +1 -1
- package/dist/utilities/validation/validation.utility.d.ts +24 -0
- package/dist/utilities/validation/validation.utility.js +24 -0
- package/dist/utilities/validation/validation.utility.js.map +1 -1
- package/package.json +12 -6
- package/dist/functions/diff/diff.utility.js.map +0 -1
- package/dist/services/capture/capture.service.d.ts +0 -19
- package/dist/services/capture/capture.service.js +0 -43
- package/dist/services/capture/capture.service.js.map +0 -1
- package/dist/services/state-management/local-encryption.state-provider.d.ts +0 -20
- package/dist/services/state-management/local-encryption.state-provider.js +0 -90
- package/dist/services/state-management/local-encryption.state-provider.js.map +0 -1
- package/dist/utilities/cidr/cidr.utility.d.ts +0 -10
- package/dist/utilities/cidr/cidr.utility.js +0 -51
- package/dist/utilities/cidr/cidr.utility.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subnet.model.js","sourceRoot":"","sources":["../../../src/models/subnet/subnet.model.ts"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AAEI,IAAM,MAAM,cAAZ,MAAM,MAAO,SAAQ,MAA4B;
|
|
1
|
+
{"version":3,"file":"subnet.model.js","sourceRoot":"","sources":["../../../src/models/subnet/subnet.model.ts"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,8BA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CAAC;QACvE,MAAM,OAAO,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAE/D,IAAI,gBAAgB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrF,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9D,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;YACxF,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC7F,CAAC;aAAM,IAAI,CAAC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5F,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF,CAAA;AAxHY,MAAM;IADlB,KAAK,CAAS,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC;;GAClC,MAAM,CAwHlB"}
|
|
@@ -18,13 +18,22 @@ export declare enum SubnetType {
|
|
|
18
18
|
PRIVATE = "private"
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
+
* Schema of the {@link Subnet} model.
|
|
22
|
+
*
|
|
21
23
|
* @group Models/Subnet
|
|
22
24
|
*/
|
|
23
25
|
export declare class SubnetSchema {
|
|
26
|
+
/**
|
|
27
|
+
* The behavior options of the subnet.
|
|
28
|
+
* - See {@link Subnet.disableSubnetIntraNetwork} and {@link SubnetType}.
|
|
29
|
+
*/
|
|
24
30
|
options: {
|
|
25
31
|
disableSubnetIntraNetwork: boolean;
|
|
26
32
|
subnetType: SubnetType;
|
|
27
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* The region this subnet belongs to.
|
|
36
|
+
*/
|
|
28
37
|
region: IModelReference;
|
|
29
38
|
/**
|
|
30
39
|
* The ID of the subnet.
|
|
@@ -29,11 +29,20 @@ export var SubnetType;
|
|
|
29
29
|
SubnetType["PRIVATE"] = "private";
|
|
30
30
|
})(SubnetType || (SubnetType = {}));
|
|
31
31
|
/**
|
|
32
|
+
* Schema of the {@link Subnet} model.
|
|
33
|
+
*
|
|
32
34
|
* @group Models/Subnet
|
|
33
35
|
*/
|
|
34
36
|
export class SubnetSchema {
|
|
35
37
|
constructor() {
|
|
38
|
+
/**
|
|
39
|
+
* The behavior options of the subnet.
|
|
40
|
+
* - See {@link Subnet.disableSubnetIntraNetwork} and {@link SubnetType}.
|
|
41
|
+
*/
|
|
36
42
|
this.options = Schema();
|
|
43
|
+
/**
|
|
44
|
+
* The region this subnet belongs to.
|
|
45
|
+
*/
|
|
37
46
|
this.region = Schema();
|
|
38
47
|
/**
|
|
39
48
|
* The ID of the subnet.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subnet.schema.js","sourceRoot":"","sources":["../../../src/models/subnet/subnet.schema.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D;;;;GAIG;AACH,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB;;;;OAIG;IACH,+BAAiB,CAAA;IAEjB;;;OAGG;IACH,iCAAmB,CAAA;AACrB,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AAED
|
|
1
|
+
{"version":3,"file":"subnet.schema.js","sourceRoot":"","sources":["../../../src/models/subnet/subnet.schema.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D;;;;GAIG;AACH,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB;;;;OAIG;IACH,+BAAiB,CAAA;IAEjB;;;OAGG;IACH,iCAAmB,CAAA;AACrB,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AAED;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAAzB;QACE;;;WAGG;QACH,YAAO,GAAG,MAAM,EAAkE,CAAC;QAEnF;;WAEG;QACH,WAAM,GAAG,MAAM,EAAmB,CAAC;QAEnC;;;WAGG;QACH,aAAQ,GAAG,MAAM,EAAU,CAAC;QAE5B;;WAEG;QAEH,eAAU,GAAG,MAAM,EAAU,CAAC;IAChC,CAAC;CAAA;AADC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,6BAA6B,EAAE,EAAE,CAAC;;gDAC/D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DiffMetadata } from '../functions/diff/diff-metadata.js';
|
|
2
|
+
import type { App } from '../models/app/app.model.js';
|
|
3
|
+
/**
|
|
4
|
+
* The result of applying the model transaction once: the model transaction and the resource diffs,
|
|
5
|
+
* with the resource graph built and swept into terraform as a side effect. `commit` consumes the
|
|
6
|
+
* model transaction; `generate` and `validate` consume the resource diffs.
|
|
7
|
+
*/
|
|
8
|
+
export interface ModelTransactionResult {
|
|
9
|
+
modelTransaction: DiffMetadata[][];
|
|
10
|
+
resourceDiffs: DiffMetadata[][];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Applies the model transaction: derives the full resource graph from intent (running every model
|
|
14
|
+
* action once) and sweeps it into terraform, returning the model transaction and resource diffs.
|
|
15
|
+
*
|
|
16
|
+
* This is the single "build" step of a lifecycle. In production each of generate/validate/commit is
|
|
17
|
+
* a separate process and builds its own; a single-process driver (e.g. the test harness) can build
|
|
18
|
+
* once and hand the same {@link ModelTransactionResult} to all three modes, so the graph is derived
|
|
19
|
+
* once rather than three times. No resource actions run here — that is `generateTerraform`'s path.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function applyModelTransaction(app: App): Promise<ModelTransactionResult>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Container } from '../functions/container/container.js';
|
|
2
|
+
import { TransactionService } from '../services/transaction/transaction.service.js';
|
|
3
|
+
/**
|
|
4
|
+
* Applies the model transaction: derives the full resource graph from intent (running every model
|
|
5
|
+
* action once) and sweeps it into terraform, returning the model transaction and resource diffs.
|
|
6
|
+
*
|
|
7
|
+
* This is the single "build" step of a lifecycle. In production each of generate/validate/commit is
|
|
8
|
+
* a separate process and builds its own; a single-process driver (e.g. the test harness) can build
|
|
9
|
+
* once and hand the same {@link ModelTransactionResult} to all three modes, so the graph is derived
|
|
10
|
+
* once rather than three times. No resource actions run here — that is `generateTerraform`'s path.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export async function applyModelTransaction(app) {
|
|
15
|
+
const transactionService = await Container.getInstance().get(TransactionService);
|
|
16
|
+
const transaction = transactionService.beginTransaction(await app.diff(), {
|
|
17
|
+
generateTerraform: true,
|
|
18
|
+
yieldModelTransaction: true,
|
|
19
|
+
yieldResourceDiffs: true,
|
|
20
|
+
});
|
|
21
|
+
const modelTransaction = (await transaction.next()).value;
|
|
22
|
+
const resourceDiffs = (await transaction.next()).value;
|
|
23
|
+
return { modelTransaction, resourceDiffs };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=apply-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-transaction.js","sourceRoot":"","sources":["../../src/modes/apply-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAGhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAYpF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAAQ;IAClD,MAAM,kBAAkB,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAEjF,MAAM,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE;QACxE,iBAAiB,EAAE,IAAI;QACvB,qBAAqB,EAAE,IAAI;QAC3B,kBAAkB,EAAE,IAAI;KACzB,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,CAAC,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,KAAyB,CAAC;IAC9E,MAAM,aAAa,GAAG,CAAC,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,KAAyB,CAAC;IAE3E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TerraformFolderOutput, TerraformResourceOutput } from '../app.type.js';
|
|
2
|
+
import type { CommitModeCompletedEvent } from '../events/index.js';
|
|
3
|
+
import type { DiffMetadata } from '../functions/diff/diff-metadata.js';
|
|
4
|
+
import type { ModelTransactionResult } from './apply-transaction.js';
|
|
5
|
+
export type TerraformOutputs = Record<string, {
|
|
6
|
+
value: unknown;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Records a terraform apply back into octo's state: Committed ← Cloud. The catch-up step of a
|
|
10
|
+
* run, not a drift resolver.
|
|
11
|
+
*
|
|
12
|
+
* Operates on the resource graph the `transaction` already built: reads every module folder's outputs
|
|
13
|
+
* from the caller-supplied `outputs` map (keyed by module id), populates resource responses by the
|
|
14
|
+
* `${resourceId}-${key}` convention, and syncs the actual graph to the new graph.
|
|
15
|
+
*
|
|
16
|
+
* Rejects — all-or-nothing, throwing before any mutation: a declared output that is missing
|
|
17
|
+
* (partial apply) or carries a null value (broken apply). `partial` turns those rejections into
|
|
18
|
+
* warnings and keeps every resource whose outputs did not all resolve out of the committed graph,
|
|
19
|
+
* which is what lets a failed apply still record the half that worked. Outputs are demanded only for the
|
|
20
|
+
* modules the sweep filled — never for an emptied (deleted) folder, whose destroy simply drops its
|
|
21
|
+
* resources from the committed state. Warns: outputs supplied for a folder that is neither in
|
|
22
|
+
* intent nor in the committed folder record (`previousFolders`) are ignored — octo never fails on,
|
|
23
|
+
* or touches, a folder it does not recognize; re-declaring the module in intent re-adopts it.
|
|
24
|
+
*
|
|
25
|
+
* Returns the model transaction so {@link Octo} can run the persistence + commit hooks it owns,
|
|
26
|
+
* plus a description of what was committed for the caller to emit and surface.
|
|
27
|
+
*
|
|
28
|
+
* `previousMappings` is the octo→terraform mapping persisted by the last commit. It supplies the
|
|
29
|
+
* module and addresses of resources being deleted, which this run's sweep no longer renders.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare function commit({ outputs, partial, previousFolders, previousMappings, transaction, }: {
|
|
34
|
+
outputs: Map<string, TerraformOutputs>;
|
|
35
|
+
partial?: boolean;
|
|
36
|
+
previousFolders?: TerraformFolderOutput[];
|
|
37
|
+
previousMappings?: TerraformResourceOutput[];
|
|
38
|
+
transaction: ModelTransactionResult;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
emptiedModuleIds: string[];
|
|
41
|
+
externalResourceIds: string[];
|
|
42
|
+
modelTransaction: DiffMetadata[][];
|
|
43
|
+
resources: CommitModeCompletedEvent['payload']['resources'];
|
|
44
|
+
responses: {
|
|
45
|
+
key: string;
|
|
46
|
+
previousValue?: string;
|
|
47
|
+
resourceContext: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}[];
|
|
50
|
+
warnings: {
|
|
51
|
+
message: string;
|
|
52
|
+
moduleId?: string;
|
|
53
|
+
}[];
|
|
54
|
+
}>;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { TransactionError } from '../errors/index.js';
|
|
2
|
+
import { Container } from '../functions/container/container.js';
|
|
3
|
+
import { aggregateResourceActions } from '../functions/diff/aggregate-resource-actions.js';
|
|
4
|
+
import { ResourceDataRepository } from '../resources/resource-data.repository.js';
|
|
5
|
+
import { ATerraformResource } from '../resources/terraform-resource.abstract.js';
|
|
6
|
+
import { TerraformService } from '../services/terraform/terraform.service.js';
|
|
7
|
+
import { TransactionService } from '../services/transaction/transaction.service.js';
|
|
8
|
+
/**
|
|
9
|
+
* Records a terraform apply back into octo's state: Committed ← Cloud. The catch-up step of a
|
|
10
|
+
* run, not a drift resolver.
|
|
11
|
+
*
|
|
12
|
+
* Operates on the resource graph the `transaction` already built: reads every module folder's outputs
|
|
13
|
+
* from the caller-supplied `outputs` map (keyed by module id), populates resource responses by the
|
|
14
|
+
* `${resourceId}-${key}` convention, and syncs the actual graph to the new graph.
|
|
15
|
+
*
|
|
16
|
+
* Rejects — all-or-nothing, throwing before any mutation: a declared output that is missing
|
|
17
|
+
* (partial apply) or carries a null value (broken apply). `partial` turns those rejections into
|
|
18
|
+
* warnings and keeps every resource whose outputs did not all resolve out of the committed graph,
|
|
19
|
+
* which is what lets a failed apply still record the half that worked. Outputs are demanded only for the
|
|
20
|
+
* modules the sweep filled — never for an emptied (deleted) folder, whose destroy simply drops its
|
|
21
|
+
* resources from the committed state. Warns: outputs supplied for a folder that is neither in
|
|
22
|
+
* intent nor in the committed folder record (`previousFolders`) are ignored — octo never fails on,
|
|
23
|
+
* or touches, a folder it does not recognize; re-declaring the module in intent re-adopts it.
|
|
24
|
+
*
|
|
25
|
+
* Returns the model transaction so {@link Octo} can run the persistence + commit hooks it owns,
|
|
26
|
+
* plus a description of what was committed for the caller to emit and surface.
|
|
27
|
+
*
|
|
28
|
+
* `previousMappings` is the octo→terraform mapping persisted by the last commit. It supplies the
|
|
29
|
+
* module and addresses of resources being deleted, which this run's sweep no longer renders.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export async function commit({ outputs, partial = false, previousFolders = [], previousMappings = [], transaction, }) {
|
|
34
|
+
const container = Container.getInstance();
|
|
35
|
+
const [resourceDataRepository, terraformService, transactionService] = await Promise.all([
|
|
36
|
+
container.get(ResourceDataRepository),
|
|
37
|
+
container.get(TerraformService),
|
|
38
|
+
container.get(TransactionService),
|
|
39
|
+
]);
|
|
40
|
+
const { modelTransaction } = transaction;
|
|
41
|
+
const mappings = terraformService.getOctoTerraformResourceMappings();
|
|
42
|
+
const warnings = [];
|
|
43
|
+
// Read every filled module folder's outputs from the caller-supplied map. A folder with no
|
|
44
|
+
// outputs at all never applied, which a partial commit records as a warning and skips.
|
|
45
|
+
const outputsByModule = new Map();
|
|
46
|
+
const moduleIdsWithoutOutputs = [];
|
|
47
|
+
for (const moduleId of terraformService.getModuleIds()) {
|
|
48
|
+
const moduleOutputs = outputs.get(moduleId);
|
|
49
|
+
if (moduleOutputs === undefined) {
|
|
50
|
+
if (!partial) {
|
|
51
|
+
throw new TransactionError(`No terraform outputs provided for module "${moduleId}"!`);
|
|
52
|
+
}
|
|
53
|
+
warnings.push({
|
|
54
|
+
message: `No terraform outputs for module "${moduleId}"; its resources are left uncommitted.`,
|
|
55
|
+
moduleId,
|
|
56
|
+
});
|
|
57
|
+
moduleIdsWithoutOutputs.push(moduleId);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
outputsByModule.set(moduleId, moduleOutputs);
|
|
61
|
+
}
|
|
62
|
+
// Outputs for a folder octo does not track (not in intent, not in the committed folder record)
|
|
63
|
+
// are ignored: warn, never reject. Tracked-but-emptied folders pass silently — their outputs
|
|
64
|
+
// (if any) are simply not demanded or read.
|
|
65
|
+
const trackedModuleIds = new Set([
|
|
66
|
+
...terraformService.getModuleIds(),
|
|
67
|
+
...previousFolders.map((folder) => folder.moduleId),
|
|
68
|
+
]);
|
|
69
|
+
for (const moduleId of outputs.keys()) {
|
|
70
|
+
if (!trackedModuleIds.has(moduleId)) {
|
|
71
|
+
warnings.push({
|
|
72
|
+
message: `Terraform outputs supplied for folder "${moduleId}", which octo does not track (not in intent or committed ` +
|
|
73
|
+
'state); ignoring it. Re-declare its module in intent to re-adopt it.',
|
|
74
|
+
moduleId,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Populate responses; collect all missing and null outputs before failing. Non-null values are
|
|
79
|
+
// coerced to string to honor the flat-string response contract; a null value is rejected — no
|
|
80
|
+
// resource legitimately emits one, so it signals a broken apply and must not corrupt octo state.
|
|
81
|
+
const missingOutputs = [];
|
|
82
|
+
const nullOutputs = [];
|
|
83
|
+
const responseUpdates = [];
|
|
84
|
+
const unresolvedResourceContexts = new Set();
|
|
85
|
+
for (const mapping of mappings) {
|
|
86
|
+
const resource = resourceDataRepository.getNewResourceByContext(mapping.resourceContext);
|
|
87
|
+
if (!resource) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const outputs = outputsByModule.get(mapping.moduleId) ?? {};
|
|
91
|
+
// A resource is recorded only when every one of its outputs resolved, so a partial commit never
|
|
92
|
+
// half-records one.
|
|
93
|
+
const resourceUpdates = [];
|
|
94
|
+
let isResolved = true;
|
|
95
|
+
if (mapping.entireResponseOutput !== undefined) {
|
|
96
|
+
const outputName = mapping.entireResponseOutput;
|
|
97
|
+
if (!(outputName in outputs)) {
|
|
98
|
+
missingOutputs.push(`${mapping.moduleId}/${outputName}`);
|
|
99
|
+
isResolved = false;
|
|
100
|
+
}
|
|
101
|
+
else if (outputs[outputName].value === null || outputs[outputName].value === undefined) {
|
|
102
|
+
nullOutputs.push(`${mapping.moduleId}/${outputName}`);
|
|
103
|
+
isResolved = false;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const wholeResponse = outputs[outputName].value;
|
|
107
|
+
for (const [key, value] of Object.entries(wholeResponse)) {
|
|
108
|
+
if (value === null || value === undefined) {
|
|
109
|
+
nullOutputs.push(`${mapping.moduleId}/${outputName}.${key}`);
|
|
110
|
+
isResolved = false;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
resourceUpdates.push({ key, resource, value: String(value) });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
for (const { key, outputName } of mapping.outputMappings) {
|
|
120
|
+
if (!(outputName in outputs)) {
|
|
121
|
+
missingOutputs.push(`${mapping.moduleId}/${outputName}`);
|
|
122
|
+
isResolved = false;
|
|
123
|
+
}
|
|
124
|
+
else if (outputs[outputName].value === null || outputs[outputName].value === undefined) {
|
|
125
|
+
nullOutputs.push(`${mapping.moduleId}/${outputName}`);
|
|
126
|
+
isResolved = false;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
resourceUpdates.push({ key, resource, value: String(outputs[outputName].value) });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (isResolved) {
|
|
134
|
+
responseUpdates.push(...resourceUpdates);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
unresolvedResourceContexts.add(mapping.resourceContext);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (!partial && missingOutputs.length > 0) {
|
|
141
|
+
throw new TransactionError(`Cannot commit: missing terraform outputs (partial apply?): ${missingOutputs.join(', ')}! ` +
|
|
142
|
+
'Octo state is unchanged. Re-run with a partial commit to record what did apply.');
|
|
143
|
+
}
|
|
144
|
+
if (!partial && nullOutputs.length > 0) {
|
|
145
|
+
throw new TransactionError(`Cannot commit: null terraform outputs (broken apply?): ${nullOutputs.join(', ')}! ` +
|
|
146
|
+
'A declared output must carry a value. Octo state is unchanged.');
|
|
147
|
+
}
|
|
148
|
+
if (unresolvedResourceContexts.size > 0) {
|
|
149
|
+
warnings.push({
|
|
150
|
+
message: `Partial commit: ${unresolvedResourceContexts.size} resource(s) left uncommitted because their terraform ` +
|
|
151
|
+
`outputs are missing or null: ${[...unresolvedResourceContexts].sort().join(', ')}. The next run plans to ` +
|
|
152
|
+
'create them again, which terraform reconciles against its own state.',
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// Capture the previous value before overwriting.
|
|
156
|
+
const responses = [];
|
|
157
|
+
for (const { key, resource, value } of responseUpdates) {
|
|
158
|
+
const previousValue = resource.response[key];
|
|
159
|
+
responses.push({
|
|
160
|
+
key,
|
|
161
|
+
previousValue: previousValue === undefined ? undefined : String(previousValue),
|
|
162
|
+
resourceContext: resource.getContext(),
|
|
163
|
+
value,
|
|
164
|
+
});
|
|
165
|
+
resource.response[key] = value;
|
|
166
|
+
}
|
|
167
|
+
// Tell every deleted external resource to delete itself, before anything is recorded.
|
|
168
|
+
//
|
|
169
|
+
// Terraform cannot: octo deletes a resource by removing its block from the configuration, and
|
|
170
|
+
// terraform will not run a `when = destroy` provisioner for a resource that is no longer in the
|
|
171
|
+
// configuration - it drops the `null_resource` from state and moves on, so the callback never
|
|
172
|
+
// fires. Without this the real thing outlives both state files with nothing tracking it.
|
|
173
|
+
//
|
|
174
|
+
// These deletes sit outside terraform's graph, so they run over the whole diff set with no regard
|
|
175
|
+
// for the order terraform destroyed anything in. That is only safe once terraform reached the
|
|
176
|
+
// desired state everywhere: an apply that stopped short leaves live infrastructure still pointing
|
|
177
|
+
// at what is about to be deleted, and octo cannot tell which. So an unconfirmed apply defers every
|
|
178
|
+
// one of them instead, keeping the resources recorded as present for the next run to delete.
|
|
179
|
+
//
|
|
180
|
+
// Placed before the sync deliberately. A delete that throws aborts the commit with octo state
|
|
181
|
+
// untouched, so the resource is still recorded as present and the deletion is retried next run.
|
|
182
|
+
const deferredResourceContexts = new Set();
|
|
183
|
+
if (moduleIdsWithoutOutputs.length > 0 || unresolvedResourceContexts.size > 0) {
|
|
184
|
+
for (const diff of transactionService.getExternalResourceDeletes(transaction.resourceDiffs)) {
|
|
185
|
+
deferredResourceContexts.add(diff.node.getContext());
|
|
186
|
+
}
|
|
187
|
+
if (deferredResourceContexts.size > 0) {
|
|
188
|
+
warnings.push({
|
|
189
|
+
message: `Partial commit: ${deferredResourceContexts.size} external resource(s) were not deleted because this ` +
|
|
190
|
+
`apply was not confirmed everywhere: ${[...deferredResourceContexts].sort().join(', ')}. They stay ` +
|
|
191
|
+
'recorded as present, and the next successful run deletes them.',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
await transactionService.applyExternalResourceDeletes(transaction.resourceDiffs);
|
|
197
|
+
}
|
|
198
|
+
// Terraform has applied the desired state: actual ← new, less anything a partial commit could not
|
|
199
|
+
// confirm, plus anything whose deletion was deferred.
|
|
200
|
+
resourceDataRepository.syncActualToNew(unresolvedResourceContexts, deferredResourceContexts);
|
|
201
|
+
// Describe what was committed. Addresses come from this run's sweep, falling back to the last
|
|
202
|
+
// commit's mapping for deleted resources, which the sweep no longer renders.
|
|
203
|
+
const mappingByContext = new Map(mappings.map((mapping) => [mapping.resourceContext, mapping]));
|
|
204
|
+
const previousByContext = new Map(previousMappings.map((mapping) => [mapping.resourceContext, mapping]));
|
|
205
|
+
const resources = [...aggregateResourceActions(transaction.resourceDiffs.flat()).entries()]
|
|
206
|
+
.filter(([resourceContext]) => !unresolvedResourceContexts.has(resourceContext) && !deferredResourceContexts.has(resourceContext))
|
|
207
|
+
.map(([resourceContext, action]) => {
|
|
208
|
+
const mapping = mappingByContext.get(resourceContext) ?? previousByContext.get(resourceContext);
|
|
209
|
+
return {
|
|
210
|
+
action: action.action,
|
|
211
|
+
moduleId: mapping?.moduleId,
|
|
212
|
+
reason: action.reason,
|
|
213
|
+
resourceContext,
|
|
214
|
+
resourceId: action.resourceId,
|
|
215
|
+
terraformAddresses: mapping?.terraformAddresses ?? [],
|
|
216
|
+
};
|
|
217
|
+
});
|
|
218
|
+
const writtenModuleIds = terraformService.getModuleIds();
|
|
219
|
+
const emptiedModuleIds = previousFolders
|
|
220
|
+
.map((folder) => folder.moduleId)
|
|
221
|
+
.filter((moduleId) => !writtenModuleIds.includes(moduleId));
|
|
222
|
+
// Every external resource whose response is now part of the committed graph. One left out of a
|
|
223
|
+
// partial commit is excluded: its published record is still the only copy of what it produced.
|
|
224
|
+
const externalResourceIds = [
|
|
225
|
+
...new Set([
|
|
226
|
+
...resourceDataRepository.getNewResourcesByProperties(),
|
|
227
|
+
...transaction.resourceDiffs.flat().map((diff) => diff.node),
|
|
228
|
+
]
|
|
229
|
+
.filter((resource) => !(resource instanceof ATerraformResource))
|
|
230
|
+
.filter((resource) => !unresolvedResourceContexts.has(resource.getContext()))
|
|
231
|
+
.map((resource) => resource.resourceId)),
|
|
232
|
+
];
|
|
233
|
+
return { emptiedModuleIds, externalResourceIds, modelTransaction, resources, responses, warnings };
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=commit.mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.mode.js","sourceRoot":"","sources":["../../src/modes/commit.mode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAE3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAKpF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,EAC3B,OAAO,EACP,OAAO,GAAG,KAAK,EACf,eAAe,GAAG,EAAE,EACpB,gBAAgB,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|
|
2
|
+
import type { DiffMetadata } from '../functions/diff/diff-metadata.js';
|
|
3
|
+
import type { ModelTransactionResult } from './apply-transaction.js';
|
|
4
|
+
/**
|
|
5
|
+
* Generates terragrunt module folders representing the full desired state: Folders ← Intent.
|
|
6
|
+
*
|
|
7
|
+
* Renders the resource graph the `transaction` already built — every resource contributed to
|
|
8
|
+
* terraform (terraform resources via `toHCL()`, external resources via the `null_resource` wrapper) — and
|
|
9
|
+
* writes one folder per octo module. Persists nothing to octo state; the returned resource
|
|
10
|
+
* diffs are a review artifact only. (An author's refusal in a `diff*` method surfaces earlier, when
|
|
11
|
+
* {@link applyModelTransaction} builds the transaction, so no folder is ever written from a bad graph.)
|
|
12
|
+
*
|
|
13
|
+
* `previousFolders` is the folder record persisted by previous runs (the caller reads it from
|
|
14
|
+
* `models.json` ∪ `resources.json`). A recorded folder the sweep does not produce was deleted from
|
|
15
|
+
* intent, and is written **emptied** — no resources, but the recorded provider blocks intact — so
|
|
16
|
+
* terragrunt still discovers it and a later apply destroys whatever its state holds (and cannot
|
|
17
|
+
* redeploy it). Folders are emptied, never removed. A folder the sweep did produce keeps the
|
|
18
|
+
* recorded provider blocks its resources no longer use, for the same reason.
|
|
19
|
+
*
|
|
20
|
+
* Writes are gentle: each folder is overwritten in place, and `outputDir` is not wiped, so
|
|
21
|
+
* `terraform.tfstate`, `.terragrunt-cache`, and any folder octo does not recognize (a user's own, or
|
|
22
|
+
* an emptied leftover) are preserved across runs.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function generate({ outputDir, previousFolders, transaction, }: {
|
|
27
|
+
outputDir: string;
|
|
28
|
+
previousFolders?: TerraformFolderOutput[];
|
|
29
|
+
transaction: ModelTransactionResult;
|
|
30
|
+
}): Promise<DiffMetadata[][]>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { Container } from '../functions/container/container.js';
|
|
4
|
+
import { TerraformService } from '../services/terraform/terraform.service.js';
|
|
5
|
+
/**
|
|
6
|
+
* Generates terragrunt module folders representing the full desired state: Folders ← Intent.
|
|
7
|
+
*
|
|
8
|
+
* Renders the resource graph the `transaction` already built — every resource contributed to
|
|
9
|
+
* terraform (terraform resources via `toHCL()`, external resources via the `null_resource` wrapper) — and
|
|
10
|
+
* writes one folder per octo module. Persists nothing to octo state; the returned resource
|
|
11
|
+
* diffs are a review artifact only. (An author's refusal in a `diff*` method surfaces earlier, when
|
|
12
|
+
* {@link applyModelTransaction} builds the transaction, so no folder is ever written from a bad graph.)
|
|
13
|
+
*
|
|
14
|
+
* `previousFolders` is the folder record persisted by previous runs (the caller reads it from
|
|
15
|
+
* `models.json` ∪ `resources.json`). A recorded folder the sweep does not produce was deleted from
|
|
16
|
+
* intent, and is written **emptied** — no resources, but the recorded provider blocks intact — so
|
|
17
|
+
* terragrunt still discovers it and a later apply destroys whatever its state holds (and cannot
|
|
18
|
+
* redeploy it). Folders are emptied, never removed. A folder the sweep did produce keeps the
|
|
19
|
+
* recorded provider blocks its resources no longer use, for the same reason.
|
|
20
|
+
*
|
|
21
|
+
* Writes are gentle: each folder is overwritten in place, and `outputDir` is not wiped, so
|
|
22
|
+
* `terraform.tfstate`, `.terragrunt-cache`, and any folder octo does not recognize (a user's own, or
|
|
23
|
+
* an emptied leftover) are preserved across runs.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export async function generate({ outputDir, previousFolders = [], transaction, }) {
|
|
28
|
+
const terraformService = await Container.getInstance().get(TerraformService);
|
|
29
|
+
const { resourceDiffs } = transaction;
|
|
30
|
+
const moduleFiles = terraformService.renderAllModules(previousFolders);
|
|
31
|
+
// Write rule: a recorded folder the sweep did not produce was deleted from intent — add it to
|
|
32
|
+
// the write set emptied, with the providers recorded by the last run.
|
|
33
|
+
for (const folder of previousFolders) {
|
|
34
|
+
if (!moduleFiles.has(folder.moduleId)) {
|
|
35
|
+
moduleFiles.set(folder.moduleId, terraformService.renderEmptyModule(folder));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Overwrite each module folder in place. The output directory is not wiped, so terraform state,
|
|
39
|
+
// caches, and unrelated folders survive a regenerate.
|
|
40
|
+
for (const [moduleId, files] of moduleFiles.entries()) {
|
|
41
|
+
const moduleDir = join(outputDir, moduleId);
|
|
42
|
+
await mkdir(moduleDir, { recursive: true });
|
|
43
|
+
await writeFile(join(moduleDir, 'main.tf'), files.mainTf, 'utf-8');
|
|
44
|
+
await writeFile(join(moduleDir, 'variables.tf'), files.variablesTf, 'utf-8');
|
|
45
|
+
await writeFile(join(moduleDir, 'outputs.tf'), files.outputsTf, 'utf-8');
|
|
46
|
+
await writeFile(join(moduleDir, 'terragrunt.hcl'), files.terragruntHcl, 'utf-8');
|
|
47
|
+
}
|
|
48
|
+
return resourceDiffs;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=generate.mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.mode.js","sourceRoot":"","sources":["../../src/modes/generate.mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,EAC7B,SAAS,EACT,eAAe,GAAG,EAAE,EACpB,WAAW,GAKZ;IACC,MAAM,gBAAgB,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAE7E,MAAM,EAAE,aAAa,EAAE,GAAG,WAAW,CAAC;IA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' | 'update';
|
|
4
|
+
resourceId: string;
|
|
5
|
+
response: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Runs a single resource action, invoked by terraform mid-apply for an external resource.
|
|
9
|
+
*
|
|
10
|
+
* Octo-internal: not a step of the user's generate → validate → apply → commit run — terraform
|
|
11
|
+
* shells back into it from a generated `local-exec` provisioner; users never run it by hand.
|
|
12
|
+
*
|
|
13
|
+
* Boots normally, computes the full resource diff, filters to `resourceId` — the diff decides
|
|
14
|
+
* whether this is an add, update, delete, or noop. Explicit `inputs`
|
|
15
|
+
* (`<parentResourceId>.<responseKey>` keys) are injected into the parent resources' responses in
|
|
16
|
+
* memory before the action runs. Rejects a `resourceId` that is not an external resource.
|
|
17
|
+
*
|
|
18
|
+
* What the action made of the resource is recorded against it, and a delete clears that record.
|
|
19
|
+
* Repeating a call for the same inputs and the same desired properties does nothing, because that
|
|
20
|
+
* record says the work is already done - terraform replaces a `null_resource` by destroying and
|
|
21
|
+
* recreating it, so it calls back twice for one change, and octo state learns nothing of the first
|
|
22
|
+
* call until `commit`. Nothing else in octo state is touched.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function runAction(app: App, { inputs, resourceId }: {
|
|
27
|
+
inputs?: Record<string, unknown>;
|
|
28
|
+
resourceId: string;
|
|
29
|
+
}): Promise<RunActionResult>;
|
|
30
|
+
export {};
|