@quadnix/octo 0.0.29 → 0.1.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 +25 -3
- package/dist/app.type.d.ts +143 -4
- 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 +1 -1
- package/dist/decorators/model.decorator.js +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 +5 -0
- package/dist/decorators/on-event.decorator.js +5 -0
- package/dist/decorators/on-event.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 +6 -0
- package/dist/errors/schema.error.js +6 -0
- package/dist/errors/schema.error.js.map +1 -1
- package/dist/errors/terraform.error.d.ts +19 -0
- package/dist/errors/terraform.error.js +23 -0
- package/dist/errors/terraform.error.js.map +1 -0
- package/dist/errors/transaction.error.d.ts +77 -0
- package/dist/errors/transaction.error.js +83 -0
- package/dist/errors/transaction.error.js.map +1 -1
- package/dist/events/action.event.d.ts +0 -2
- package/dist/events/action.event.js +0 -2
- package/dist/events/action.event.js.map +1 -1
- package/dist/events/event.model.d.ts +21 -5
- package/dist/events/event.model.js +11 -5
- package/dist/events/event.model.js.map +1 -1
- package/dist/events/hook/commit.hook.event.d.ts +0 -6
- 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 +0 -2
- 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 +0 -6
- 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 +0 -6
- 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 +3 -0
- package/dist/events/index.js +3 -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 +57 -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 +0 -2
- package/dist/events/module.event.js +0 -2
- package/dist/events/module.event.js.map +1 -1
- package/dist/events/registration.event.d.ts +18 -14
- package/dist/events/registration.event.js +18 -14
- package/dist/events/registration.event.js.map +1 -1
- package/dist/events/serialization.event.d.ts +15 -12
- package/dist/events/serialization.event.js +15 -12
- package/dist/events/serialization.event.js.map +1 -1
- package/dist/events/terraform.event.d.ts +42 -0
- package/dist/events/terraform.event.js +31 -0
- package/dist/events/terraform.event.js.map +1 -0
- package/dist/events/transaction.event.d.ts +0 -37
- package/dist/events/transaction.event.js +0 -28
- package/dist/events/transaction.event.js.map +1 -1
- package/dist/functions/container/container.d.ts +54 -13
- package/dist/functions/container/container.js +63 -18
- 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 +82 -8
- package/dist/functions/dependency/dependency.js +80 -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 +55 -1
- package/dist/functions/diff/diff.js +44 -3
- package/dist/functions/diff/diff.js.map +1 -1
- package/dist/functions/diff/diff.utility.d.ts +17 -2
- package/dist/functions/diff/diff.utility.js +53 -38
- package/dist/functions/diff/diff.utility.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 -0
- package/dist/functions/node/node-action.abstract.js +20 -0
- 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 +85 -12
- package/dist/functions/node/node.abstract.js.map +1 -1
- package/dist/functions/node/node.interface.d.ts +1 -0
- package/dist/functions/schema/schema.d.ts +7 -0
- package/dist/functions/schema/schema.js +9 -0
- package/dist/functions/schema/schema.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +244 -14
- package/dist/main.js +361 -72
- package/dist/main.js.map +1 -1
- package/dist/models/account/account.model.d.ts +37 -7
- package/dist/models/account/account.model.js +40 -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 +16 -1
- package/dist/models/app/app.model.js +19 -4
- 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 +2 -0
- package/dist/models/deployment/deployment.schema.js +2 -0
- package/dist/models/deployment/deployment.schema.js.map +1 -1
- package/dist/models/environment/environment.model.d.ts +13 -1
- package/dist/models/environment/environment.model.js +20 -8
- 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 +20 -2
- package/dist/models/execution/execution.model.js +46 -28
- 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 +17 -4
- package/dist/models/image/image.model.js +20 -7
- 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 +106 -7
- 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 +13 -1
- package/dist/models/pipeline/pipeline.model.js +18 -6
- 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 +13 -1
- package/dist/models/server/server.model.js +16 -4
- 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 +15 -1
- package/dist/models/service/service.model.js +15 -1
- package/dist/models/service/service.model.js.map +1 -1
- package/dist/models/service/service.schema.d.ts +4 -1
- package/dist/models/service/service.schema.js +4 -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 +29 -0
- package/dist/modes/generate.mode.js +49 -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 +162 -0
- package/dist/modes/validate.mode.js +480 -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 +36 -0
- package/dist/modules/module.container.js +36 -0
- package/dist/modules/module.container.js.map +1 -1
- package/dist/modules/test-module.container.d.ts +139 -24
- package/dist/modules/test-module.container.js +410 -163
- 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 +26 -2
- 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 +118 -3
- package/dist/resources/resource.abstract.js +166 -33
- package/dist/resources/resource.abstract.js.map +1 -1
- package/dist/resources/resource.schema.d.ts +29 -1
- package/dist/resources/resource.schema.js +28 -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 +30 -3
- 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 +52 -3
- package/dist/services/input/input.service.js +72 -8
- 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 +26 -2
- package/dist/services/serialization/model/model-serialization.service.js +110 -62
- package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
- package/dist/services/serialization/resource/resource-serialization.service.d.ts +33 -4
- package/dist/services/serialization/resource/resource-serialization.service.js +64 -28
- package/dist/services/serialization/resource/resource-serialization.service.js.map +1 -1
- package/dist/services/state-management/file-app-lock.utility.d.ts +43 -0
- package/dist/services/state-management/file-app-lock.utility.js +124 -0
- package/dist/services/state-management/file-app-lock.utility.js.map +1 -0
- package/dist/services/state-management/local-encryption.state-provider.d.ts +53 -2
- package/dist/services/state-management/local-encryption.state-provider.js +75 -49
- package/dist/services/state-management/local-encryption.state-provider.js.map +1 -1
- package/dist/services/state-management/local.state-provider.d.ts +49 -2
- package/dist/services/state-management/local.state-provider.js +70 -49
- package/dist/services/state-management/local.state-provider.js.map +1 -1
- package/dist/services/state-management/state-management.service.d.ts +141 -6
- package/dist/services/state-management/state-management.service.js +149 -4
- package/dist/services/state-management/state-management.service.js.map +1 -1
- package/dist/services/state-management/state-provider.interface.d.ts +55 -1
- package/dist/services/state-management/terraform-state.service.d.ts +76 -0
- package/dist/services/state-management/terraform-state.service.js +154 -0
- package/dist/services/state-management/terraform-state.service.js.map +1 -0
- package/dist/services/state-management/test.state-provider.d.ts +38 -1
- package/dist/services/state-management/test.state-provider.js +52 -21
- package/dist/services/state-management/test.state-provider.js.map +1 -1
- package/dist/services/terraform/terraform.service.d.ts +426 -0
- package/dist/services/terraform/terraform.service.js +995 -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 +86 -10
- package/dist/services/transaction/transaction.service.js +387 -232
- package/dist/services/transaction/transaction.service.js.map +1 -1
- package/dist/services/validation/validation.service.d.ts +13 -1
- 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/utilities/file/file.utility.d.ts +15 -0
- package/dist/utilities/file/file.utility.js +18 -1
- package/dist/utilities/file/file.utility.js.map +1 -1
- package/dist/utilities/hcl/hcl.utility.d.ts +61 -0
- package/dist/utilities/hcl/hcl.utility.js +229 -0
- package/dist/utilities/hcl/hcl.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 +21 -0
- package/dist/utilities/string/string.utility.js +39 -0
- package/dist/utilities/string/string.utility.js.map +1 -0
- package/dist/utilities/terraform/terraform.utility.d.ts +227 -0
- package/dist/utilities/terraform/terraform.utility.js +434 -0
- package/dist/utilities/terraform/terraform.utility.js.map +1 -0
- package/dist/utilities/test-helpers/test-classes.d.ts +18 -31
- package/dist/utilities/test-helpers/test-classes.js +18 -41
- package/dist/utilities/test-helpers/test-classes.js.map +1 -1
- package/dist/utilities/test-helpers/test-models.js +12 -0
- 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 +463 -0
- package/dist/utilities/test-helpers/test-modes.js.map +1 -0
- package/dist/utilities/test-helpers/test-modules.d.ts +41 -0
- package/dist/utilities/test-helpers/test-modules.js +79 -0
- package/dist/utilities/test-helpers/test-modules.js.map +1 -0
- package/dist/utilities/test-helpers/test-overlays.d.ts +17 -1
- package/dist/utilities/test-helpers/test-overlays.js +49 -5
- package/dist/utilities/test-helpers/test-overlays.js.map +1 -1
- package/dist/utilities/test-helpers/test-resources.d.ts +19 -1
- package/dist/utilities/test-helpers/test-resources.js +61 -3
- 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 +6 -5
- 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/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
|
@@ -2,8 +2,20 @@
|
|
|
2
2
|
* @internal
|
|
3
3
|
*/
|
|
4
4
|
export declare class ObjectUtility {
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
static deepFreeze<T extends object>(object: T): void;
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
6
12
|
static deepMergeInPlace(target: object, source: object): void;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
7
16
|
static isPlainObject(value: unknown): value is object;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
8
20
|
static onEveryNestedKey(object: object, callback: (parent: object, key: string, value: unknown) => void): void;
|
|
9
21
|
}
|
|
@@ -4,12 +4,18 @@ import { ANode } from '../../functions/node/node.abstract.js';
|
|
|
4
4
|
*/
|
|
5
5
|
export class ObjectUtility {
|
|
6
6
|
// Source: https://stackoverflow.com/a/58496119/1834562
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
7
10
|
static deepFreeze(object) {
|
|
8
11
|
Object.freeze(object);
|
|
9
12
|
Object.values(object)
|
|
10
13
|
.filter((x) => !Object.isFrozen(x))
|
|
11
14
|
.forEach(ObjectUtility.deepFreeze);
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
13
19
|
static deepMergeInPlace(target, source) {
|
|
14
20
|
for (const key of Object.keys(source)) {
|
|
15
21
|
const sourceValue = source[key];
|
|
@@ -25,9 +31,15 @@ export class ObjectUtility {
|
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
28
37
|
static isPlainObject(value) {
|
|
29
38
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
30
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
31
43
|
static onEveryNestedKey(object, callback) {
|
|
32
44
|
const keys = object instanceof ANode ? Object.keys(object.synth()) : Object.keys(object);
|
|
33
45
|
for (const key of keys) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.utility.js","sourceRoot":"","sources":["../../../src/utilities/object/object.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,uDAAuD;IACvD,MAAM,CAAC,UAAU,CAAmB,MAAS;QAC3C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;aAClB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aAClC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,MAAc;QACpD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAChC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAEhC,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvE,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAClD,CAAC;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACpE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CACpG,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CACzC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,KAAc;QACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,QAA+D;QACrG,MAAM,IAAI,GAAG,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;gBACtD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBAE1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBAChD,aAAa,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBAClD,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"object.utility.js","sourceRoot":"","sources":["../../../src/utilities/object/object.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,uDAAuD;IACvD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAmB,MAAS;QAC3C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;aAClB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aAClC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,MAAc;QACpD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAChC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAEhC,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvE,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAClD,CAAC;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACpE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CACpG,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CACzC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAc;QACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,QAA+D;QACrG,MAAM,IAAI,GAAG,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;gBACtD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBAE1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBAChD,aAAa,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBAClD,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The octo project root, for code that cannot rely on the current working directory being it.
|
|
3
|
+
*
|
|
4
|
+
* An external resource's action is the case this exists for. Octo runs it in two different places:
|
|
5
|
+
* `octo commit` runs the delete action from the project root, but terraform runs the add and update
|
|
6
|
+
* actions from a terragrunt cache directory, so a path a module resolved against the project root
|
|
7
|
+
* resolves against nothing by the time the action reads it. Octo already supplies the root to every
|
|
8
|
+
* terragrunt command as `TF_VAR_OCTO_PROJECT_ROOT`, which terraform passes down to `local-exec`;
|
|
9
|
+
* this reads it back, and falls back to the working directory for the run that has no terraform in
|
|
10
|
+
* the middle.
|
|
11
|
+
*
|
|
12
|
+
* Store a project-relative path in a resource's `properties` and resolve it here. An absolute one
|
|
13
|
+
* would put the developer's directory layout into octo state, and into the properties hash that
|
|
14
|
+
* generated terraform commits as an external resource's trigger.
|
|
15
|
+
*
|
|
16
|
+
* @group Utilities
|
|
17
|
+
*/
|
|
18
|
+
export declare class ProjectUtility {
|
|
19
|
+
/**
|
|
20
|
+
* The absolute path of the octo project root.
|
|
21
|
+
*/
|
|
22
|
+
static getProjectRoot(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a project-relative path against {@link ProjectUtility.getProjectRoot}. An absolute path
|
|
25
|
+
* is returned as given.
|
|
26
|
+
*/
|
|
27
|
+
static resolveFromProjectRoot(filePath: string): string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
2
|
+
import { PROJECT_ROOT_VARIABLE_NAME } from '../../services/terraform/terraform.type.js';
|
|
3
|
+
/**
|
|
4
|
+
* The octo project root, for code that cannot rely on the current working directory being it.
|
|
5
|
+
*
|
|
6
|
+
* An external resource's action is the case this exists for. Octo runs it in two different places:
|
|
7
|
+
* `octo commit` runs the delete action from the project root, but terraform runs the add and update
|
|
8
|
+
* actions from a terragrunt cache directory, so a path a module resolved against the project root
|
|
9
|
+
* resolves against nothing by the time the action reads it. Octo already supplies the root to every
|
|
10
|
+
* terragrunt command as `TF_VAR_OCTO_PROJECT_ROOT`, which terraform passes down to `local-exec`;
|
|
11
|
+
* this reads it back, and falls back to the working directory for the run that has no terraform in
|
|
12
|
+
* the middle.
|
|
13
|
+
*
|
|
14
|
+
* Store a project-relative path in a resource's `properties` and resolve it here. An absolute one
|
|
15
|
+
* would put the developer's directory layout into octo state, and into the properties hash that
|
|
16
|
+
* generated terraform commits as an external resource's trigger.
|
|
17
|
+
*
|
|
18
|
+
* @group Utilities
|
|
19
|
+
*/
|
|
20
|
+
export class ProjectUtility {
|
|
21
|
+
/**
|
|
22
|
+
* The absolute path of the octo project root.
|
|
23
|
+
*/
|
|
24
|
+
static getProjectRoot() {
|
|
25
|
+
return process.env[`TF_VAR_${PROJECT_ROOT_VARIABLE_NAME}`] || process.cwd();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolves a project-relative path against {@link ProjectUtility.getProjectRoot}. An absolute path
|
|
29
|
+
* is returned as given.
|
|
30
|
+
*/
|
|
31
|
+
static resolveFromProjectRoot(filePath) {
|
|
32
|
+
return isAbsolute(filePath) ? filePath : resolve(this.getProjectRoot(), filePath);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=project.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.utility.js","sourceRoot":"","sources":["../../../src/utilities/project/project.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAExF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,cAAc;QACnB,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,0BAA0B,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9E,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,QAAgB;QAC5C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,QAAQ,CAAC,CAAC;IACpF,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export declare class StringUtility {
|
|
5
|
+
/**
|
|
6
|
+
* Produces a short deterministic hash of a value, with object keys sorted recursively,
|
|
7
|
+
* so the hash does not change when key insertion order does.
|
|
8
|
+
*/
|
|
9
|
+
static deterministicHash(value: unknown): string;
|
|
10
|
+
/**
|
|
11
|
+
* Replaces every character that is not a letter, digit, or underscore with an underscore.
|
|
12
|
+
* Suitable for names that travel through environment variables (e.g. terraform variables,
|
|
13
|
+
* which terragrunt passes as `TF_VAR_<name>`), where dashes are not allowed.
|
|
14
|
+
*/
|
|
15
|
+
static sanitizeForEnvironmentVariable(value: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Replaces every character that is not a letter, digit, underscore, or dash with an underscore.
|
|
18
|
+
* Suitable for terraform identifiers (resource names, output names), which allow dashes.
|
|
19
|
+
*/
|
|
20
|
+
static sanitizeForIdentifier(value: string): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export class StringUtility {
|
|
6
|
+
/**
|
|
7
|
+
* Produces a short deterministic hash of a value, with object keys sorted recursively,
|
|
8
|
+
* so the hash does not change when key insertion order does.
|
|
9
|
+
*/
|
|
10
|
+
static deterministicHash(value) {
|
|
11
|
+
const stableStringify = (v) => {
|
|
12
|
+
if (v === null || typeof v !== 'object') {
|
|
13
|
+
return JSON.stringify(v);
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(v)) {
|
|
16
|
+
return `[${v.map(stableStringify).join(',')}]`;
|
|
17
|
+
}
|
|
18
|
+
const keys = Object.keys(v).sort();
|
|
19
|
+
return `{${keys.map((k) => `${JSON.stringify(k)}:${stableStringify(v[k])}`).join(',')}}`;
|
|
20
|
+
};
|
|
21
|
+
return createHash('sha256').update(stableStringify(value)).digest('hex').substring(0, 16);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Replaces every character that is not a letter, digit, or underscore with an underscore.
|
|
25
|
+
* Suitable for names that travel through environment variables (e.g. terraform variables,
|
|
26
|
+
* which terragrunt passes as `TF_VAR_<name>`), where dashes are not allowed.
|
|
27
|
+
*/
|
|
28
|
+
static sanitizeForEnvironmentVariable(value) {
|
|
29
|
+
return value.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Replaces every character that is not a letter, digit, underscore, or dash with an underscore.
|
|
33
|
+
* Suitable for terraform identifiers (resource names, output names), which allow dashes.
|
|
34
|
+
*/
|
|
35
|
+
static sanitizeForIdentifier(value) {
|
|
36
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=string.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.utility.js","sourceRoot":"","sources":["../../../src/utilities/string/string.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAc;QACrC,MAAM,eAAe,GAAG,CAAC,CAAU,EAAU,EAAE;YAC7C,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACxC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;YACD,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YACjD,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAA4B,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9D,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,eAAe,CAAE,CAA6B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QACxH,CAAC,CAAC;QACF,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,8BAA8B,CAAC,KAAa;QACjD,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAa;QACxC,OAAO,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { type ExecFileOptionsWithStringEncoding } from 'node:child_process';
|
|
2
|
+
import type { TerraformOutputs } from '../../modes/commit.mode.js';
|
|
3
|
+
import type { TerraformPlan } from '../../modes/validate.mode.js';
|
|
4
|
+
interface TerraformRawResult {
|
|
5
|
+
readonly args: string[];
|
|
6
|
+
readonly exitCode: number;
|
|
7
|
+
readonly stderr: string;
|
|
8
|
+
readonly stdout: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The result of planning every module folder under a terragrunt directory.
|
|
12
|
+
*
|
|
13
|
+
* A folder appears in exactly one of the two maps: in `plans` when terraform produced a plan, or in
|
|
14
|
+
* `errors` with the reason it could not. Both are keyed by the folder name, i.e. the octo `moduleId`.
|
|
15
|
+
* `errors` is what lets `validate` say why a folder could not be inspected.
|
|
16
|
+
*/
|
|
17
|
+
interface TerraformPlanResult {
|
|
18
|
+
errors: Map<string, string>;
|
|
19
|
+
plans: Map<string, TerraformPlan>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Octo's single interface to the terraform and terragrunt binaries.
|
|
23
|
+
*
|
|
24
|
+
* {@link Octo.generate} writes module folders; this runs them, and turns their output back into the
|
|
25
|
+
* shapes the other modes expect - `plan(dir, { json: true })` feeds {@link Octo.validate}, and
|
|
26
|
+
* `output(dir, { json: true })` feeds {@link Octo.commit}. Routing every invocation through one class
|
|
27
|
+
* is what keeps flags, timeouts, and event emission consistent.
|
|
28
|
+
*
|
|
29
|
+
* Resolve it from the {@link Container} so that a run's terraform events reach the same listeners as
|
|
30
|
+
* everything else.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const terraform = await Container.getInstance().get(TerraformUtility);
|
|
35
|
+
* const { errors, plans } = await terraform.plan('./infrastructure', { json: true });
|
|
36
|
+
* const report = await octo.validate(app, { errors, plans });
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @group Utilities/Terraform
|
|
40
|
+
*/
|
|
41
|
+
export declare class TerraformUtility {
|
|
42
|
+
private onceArgs;
|
|
43
|
+
private readonly options;
|
|
44
|
+
/**
|
|
45
|
+
* The timeout the caller asked for, or undefined when they asked for none. A command that changes
|
|
46
|
+
* infrastructure is bounded only by this, never by the default.
|
|
47
|
+
*/
|
|
48
|
+
private readonly requestedTimeoutInMs;
|
|
49
|
+
/**
|
|
50
|
+
* @param options Overrides for the binaries invoked and the per-command timeout. `terragruntBinary`
|
|
51
|
+
* defaults to `terragrunt`.
|
|
52
|
+
*
|
|
53
|
+
* `timeoutInMs` defaults to 60 minutes for the commands that only read - `plan`, `output`, `show`.
|
|
54
|
+
* `apply` and `destroy` run unbounded unless it is given: a timeout there turns a slow apply into
|
|
55
|
+
* one killed part way through a mutation, and how long a stack legitimately takes is a fact about
|
|
56
|
+
* that stack rather than something a default can know. What bounds them instead is the caller -
|
|
57
|
+
* a CI job's own timeout, or a person at a terminal.
|
|
58
|
+
*/
|
|
59
|
+
constructor(options?: {
|
|
60
|
+
terraformBinary?: string;
|
|
61
|
+
terragruntBinary?: string;
|
|
62
|
+
timeoutInMs?: number;
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Runs `terragrunt run-all apply` over every generated module folder.
|
|
66
|
+
*
|
|
67
|
+
* **This changes real infrastructure**, and runs with `-auto-approve`. Use
|
|
68
|
+
* {@link TerraformUtility.findPlannedDestroys} beforehand if a destroy needs confirming.
|
|
69
|
+
*
|
|
70
|
+
* @param onOutput Called with each chunk terragrunt writes, as it writes it. An apply can run for
|
|
71
|
+
* tens of minutes, and the buffered result only arrives at the end - without this the caller has
|
|
72
|
+
* nothing to show for the whole run. The chunks are also still accumulated into the result.
|
|
73
|
+
*/
|
|
74
|
+
apply(terragruntDir: string, { onOutput }?: {
|
|
75
|
+
onOutput?: (chunk: string, stream: 'stderr' | 'stdout') => void;
|
|
76
|
+
}): Promise<TerraformRawResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Runs `terragrunt run-all destroy` over every generated module folder.
|
|
79
|
+
*
|
|
80
|
+
* **This tears down real infrastructure**, and runs with `-auto-approve`.
|
|
81
|
+
*/
|
|
82
|
+
destroy(terragruntDir: string): Promise<TerraformRawResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Every address a set of plans will destroy, across all folders. A recreate (`create` + `delete`)
|
|
85
|
+
* counts, since the old object is still destroyed.
|
|
86
|
+
*
|
|
87
|
+
* Lets a caller refuse to apply until the destroys have been shown, which {@link apply} cannot do on
|
|
88
|
+
* its own because it runs with `-auto-approve`.
|
|
89
|
+
*/
|
|
90
|
+
findPlannedDestroys(plans: Map<string, TerraformPlan>): {
|
|
91
|
+
address: string;
|
|
92
|
+
moduleId: string;
|
|
93
|
+
tfActions: string[];
|
|
94
|
+
}[];
|
|
95
|
+
/**
|
|
96
|
+
* Returns the immediate sub-directories of `terragruntDir` that look like generated module
|
|
97
|
+
* folders (they contain a `terragrunt.hcl`). Each folder name is the octo `moduleId`.
|
|
98
|
+
*/
|
|
99
|
+
listModuleFolders(terragruntDir: string): Promise<string[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Reads the outputs of every generated module folder.
|
|
102
|
+
*
|
|
103
|
+
* @param options Pass `{ json: true }` to get the outputs parsed and keyed by `moduleId`, which is
|
|
104
|
+
* the shape {@link Octo.commit} takes. Without it, terragrunt's raw output is returned.
|
|
105
|
+
*/
|
|
106
|
+
output(terragruntDir: string, options: {
|
|
107
|
+
json: true;
|
|
108
|
+
}): Promise<Map<string, TerraformOutputs>>;
|
|
109
|
+
/**
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
output(terragruntDir: string, options?: {
|
|
113
|
+
json?: false;
|
|
114
|
+
}): Promise<TerraformRawResult>;
|
|
115
|
+
/**
|
|
116
|
+
* Plans every generated module folder.
|
|
117
|
+
*
|
|
118
|
+
* @param options Pass `{ json: true }` to get the plans parsed and keyed by `moduleId`, which is
|
|
119
|
+
* the shape {@link Octo.validate} takes - along with the `errors` of any folder that could not be
|
|
120
|
+
* planned. Without it, terragrunt's raw output is returned.
|
|
121
|
+
*/
|
|
122
|
+
plan(terragruntDir: string, options: {
|
|
123
|
+
json: true;
|
|
124
|
+
}): Promise<TerraformPlanResult>;
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
plan(terragruntDir: string, options?: {
|
|
129
|
+
json?: false;
|
|
130
|
+
}): Promise<TerraformRawResult>;
|
|
131
|
+
/**
|
|
132
|
+
* To append extra CLI arguments to the *next* command only. Returns `this`, so it chains.
|
|
133
|
+
*/
|
|
134
|
+
setArgsOnce(args: string[]): this;
|
|
135
|
+
/**
|
|
136
|
+
* Runs `terragrunt run-all validate` over every generated module folder, checking the generated
|
|
137
|
+
* HCL is well-formed. Unrelated to {@link Octo.validate}, which compares plans against intent.
|
|
138
|
+
*/
|
|
139
|
+
validate(terragruntDir: string): Promise<TerraformRawResult>;
|
|
140
|
+
/**
|
|
141
|
+
* @param onOutput Receives each chunk as the child writes it. `execFile` keeps accumulating into
|
|
142
|
+
* its own buffers regardless, so the resolved result is unchanged whether or not this is passed.
|
|
143
|
+
*/
|
|
144
|
+
protected execFileAsync(file: string, args: string[], options: ExecFileOptionsWithStringEncoding, onOutput?: (chunk: string, stream: 'stderr' | 'stdout') => void): Promise<{
|
|
145
|
+
stderr: string;
|
|
146
|
+
stdout: string;
|
|
147
|
+
}>;
|
|
148
|
+
/**
|
|
149
|
+
* The environment a terragrunt command runs with, carrying the terraform binary override.
|
|
150
|
+
*/
|
|
151
|
+
private buildEnv;
|
|
152
|
+
/**
|
|
153
|
+
* Takes the arguments set by {@link TerraformUtility.setArgsOnce}, clearing them.
|
|
154
|
+
*/
|
|
155
|
+
private consumeArgs;
|
|
156
|
+
/**
|
|
157
|
+
* Renders why one folder could not be planned.
|
|
158
|
+
*
|
|
159
|
+
* Terragrunt writes its diagnostics to stderr, which carries the `Error:` block, so that comes
|
|
160
|
+
* first. The wrapped {@link TerraformCommandError} message is the fallback for failures that
|
|
161
|
+
* produce no stderr, such as a malformed `show -json` payload failing at `JSON.parse`.
|
|
162
|
+
*/
|
|
163
|
+
private describePlanFailure;
|
|
164
|
+
/**
|
|
165
|
+
* Publishes the same started/finished pair {@link runAll} does, around a body that drives
|
|
166
|
+
* terragrunt folder by folder instead.
|
|
167
|
+
*
|
|
168
|
+
* The JSON-mode `plan` and `output` take that per-folder path, and it is the slowest step of a
|
|
169
|
+
* `validate` - a full plan runs for tens of seconds - so the log must not fall silent through it.
|
|
170
|
+
*/
|
|
171
|
+
private emitAround;
|
|
172
|
+
/**
|
|
173
|
+
* The `terragrunt run --all` invocation itself, wrapped in its started/finished pair.
|
|
174
|
+
*/
|
|
175
|
+
private invokeRunAll;
|
|
176
|
+
/**
|
|
177
|
+
* Runs `terragrunt output -json` in one module folder.
|
|
178
|
+
*
|
|
179
|
+
* A folder whose output fails is reported as `undefined`, not thrown — one bad module folder must not
|
|
180
|
+
* abort every other folder's result.
|
|
181
|
+
*/
|
|
182
|
+
private readOutputs;
|
|
183
|
+
/**
|
|
184
|
+
* Runs `terragrunt plan -out=<planFile>` followed by `terragrunt show -json <planFile>` in one module folder.
|
|
185
|
+
*
|
|
186
|
+
* The plan file is written to an absolute temp path, never inside a terragrunt
|
|
187
|
+
* cache — terragrunt picks a different cache sub-directory per invocation, so a relative plan file
|
|
188
|
+
* written by one command cannot be found by the next.
|
|
189
|
+
*
|
|
190
|
+
* A folder whose plan/show/parse fails is reported as an `error`, not thrown — one bad module folder must not
|
|
191
|
+
* abort every other folder's result. The failure is carried so `validate` can report it verbatim.
|
|
192
|
+
*/
|
|
193
|
+
private readPlan;
|
|
194
|
+
/**
|
|
195
|
+
* Runs one terragrunt command in a single module folder (`cwd` = that folder).
|
|
196
|
+
*/
|
|
197
|
+
private run;
|
|
198
|
+
/**
|
|
199
|
+
* Runs `terragrunt run --all -- <command>` across every module folder under `terragruntDir`, with
|
|
200
|
+
* the terraform state of every folder checked out around it.
|
|
201
|
+
*/
|
|
202
|
+
private runAll;
|
|
203
|
+
/**
|
|
204
|
+
* Wraps whatever a failed spawn threw into a {@link TerraformCommandError}.
|
|
205
|
+
*/
|
|
206
|
+
private toTerraformCommandError;
|
|
207
|
+
/**
|
|
208
|
+
* Checks every module folder's terraform state out of Octo's state provider, runs `body`, and
|
|
209
|
+
* checks it back in.
|
|
210
|
+
*
|
|
211
|
+
* The check-in runs on the way out of a failure as much as a success, because what terraform has
|
|
212
|
+
* already built is real whether or not the command that built it returned cleanly. A timer checks
|
|
213
|
+
* in through the command as well, bounding what a killed runner loses.
|
|
214
|
+
*/
|
|
215
|
+
private withTerraformState;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
export declare class TerraformUtilityFactory {
|
|
221
|
+
private static instance;
|
|
222
|
+
/**
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
static create(options?: ConstructorParameters<typeof TerraformUtility>[0], forceNew?: boolean): Promise<TerraformUtility>;
|
|
226
|
+
}
|
|
227
|
+
export {};
|