@quadnix/octo 0.0.30 → 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 +61 -0
- package/dist/errors/transaction.error.js +61 -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 -25
- package/dist/modules/test-module.container.js +410 -178
- 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
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { DependencyError } from '../../errors/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
2
5
|
class DependencyBehavior {
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
3
9
|
constructor(onField, onAction, toField, forAction) {
|
|
4
10
|
this.onField = onField;
|
|
5
11
|
this.onAction = onAction;
|
|
@@ -8,6 +14,8 @@ class DependencyBehavior {
|
|
|
8
14
|
}
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
17
|
+
* How two nodes are related. A parent exists before its child, and outlives it.
|
|
18
|
+
*
|
|
11
19
|
* @group Functions/Dependency
|
|
12
20
|
*/
|
|
13
21
|
export var DependencyRelationship;
|
|
@@ -16,34 +24,82 @@ export var DependencyRelationship;
|
|
|
16
24
|
DependencyRelationship["PARENT"] = "parent";
|
|
17
25
|
})(DependencyRelationship || (DependencyRelationship = {}));
|
|
18
26
|
/**
|
|
27
|
+
* The edge between two nodes in Octo's graph.
|
|
28
|
+
*
|
|
29
|
+
* A dependency is directed, and carries two things: an optional parent/child relationship, and a set
|
|
30
|
+
* of *behaviors*. A behavior states an ordering rule - "when this field of `from` is added, the
|
|
31
|
+
* matching action on `to` must have run first" - and it is those rules that let Octo order a
|
|
32
|
+
* transaction correctly instead of guessing.
|
|
33
|
+
*
|
|
34
|
+
* Models create dependencies through `addChild()` and `addRelationship()`; you rarely construct one.
|
|
35
|
+
*
|
|
19
36
|
* @group Functions/Dependency
|
|
37
|
+
*
|
|
38
|
+
* @see Definition of [Dependencies](/docs/fundamentals/dependencies).
|
|
20
39
|
*/
|
|
21
40
|
export class Dependency {
|
|
41
|
+
/**
|
|
42
|
+
* @param from The node this dependency points from.
|
|
43
|
+
* @param to The node this dependency points to.
|
|
44
|
+
*/
|
|
22
45
|
constructor(from, to) {
|
|
23
46
|
this.behaviors = [];
|
|
24
47
|
this.from = from;
|
|
25
48
|
this.to = to;
|
|
26
49
|
}
|
|
27
|
-
|
|
28
|
-
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
static unSynth(from, to, dependency) {
|
|
54
|
+
const newDependency = new Dependency(from, to);
|
|
55
|
+
dependency.behaviors.forEach((b) => {
|
|
56
|
+
newDependency.addBehavior(b.onField, b.onAction, b.toField, b.forAction);
|
|
57
|
+
});
|
|
58
|
+
if (dependency.relationship) {
|
|
59
|
+
newDependency.relationship = { ...dependency.relationship };
|
|
60
|
+
}
|
|
61
|
+
return newDependency;
|
|
29
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* To declare an ordering rule: when `onAction` happens to `onField` of `from`, then `forAction`
|
|
65
|
+
* on `toField` of `to` must have been applied first. Adding the same behavior twice is a no-op.
|
|
66
|
+
*/
|
|
30
67
|
addBehavior(onField, onAction, toField, forAction) {
|
|
31
68
|
if (this.getBehaviorIndex(onField, onAction, toField, forAction) === -1) {
|
|
32
69
|
this.behaviors.push(new DependencyBehavior(onField, onAction, toField, forAction));
|
|
33
70
|
}
|
|
34
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* To mark `to` as the child of `from`.
|
|
74
|
+
*
|
|
75
|
+
* @throws {@link DependencyError} If this dependency already has a relationship.
|
|
76
|
+
*/
|
|
35
77
|
addChildRelationship(onField, toField) {
|
|
36
78
|
if (this.relationship) {
|
|
37
79
|
throw new DependencyError('Dependency relationship already exists!', this);
|
|
38
80
|
}
|
|
39
81
|
this.relationship = { onField, toField, type: DependencyRelationship.CHILD };
|
|
40
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* To mark `to` as the parent of `from`.
|
|
85
|
+
*
|
|
86
|
+
* @throws {@link DependencyError} If this dependency already has a relationship.
|
|
87
|
+
*/
|
|
41
88
|
addParentRelationship(onField, toField) {
|
|
42
89
|
if (this.relationship) {
|
|
43
90
|
throw new DependencyError('Dependency relationship already exists!', this);
|
|
44
91
|
}
|
|
45
92
|
this.relationship = { onField, toField, type: DependencyRelationship.PARENT };
|
|
46
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The relationship between the two nodes, if one was declared.
|
|
96
|
+
*/
|
|
97
|
+
getRelationship() {
|
|
98
|
+
return this.relationship;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Whether any behavior matches every argument given. Arguments left out match anything.
|
|
102
|
+
*/
|
|
47
103
|
hasMatchingBehavior(onField, onAction, toField, forAction) {
|
|
48
104
|
return this.behaviors.some((b) => {
|
|
49
105
|
const onFieldCondition = onField ? b.onField === onField : true;
|
|
@@ -53,18 +109,29 @@ export class Dependency {
|
|
|
53
109
|
return onFieldCondition && onActionCondition && toFieldCondition && forActionCondition;
|
|
54
110
|
});
|
|
55
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Whether `to` is a child of `from`.
|
|
114
|
+
*/
|
|
56
115
|
isChildRelationship() {
|
|
57
116
|
return this.relationship && this.relationship.type === DependencyRelationship.CHILD;
|
|
58
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether both dependencies connect the same two nodes, in the same direction.
|
|
120
|
+
*/
|
|
59
121
|
isEqual(dependency) {
|
|
60
122
|
return (this.from.getContext() === dependency.from.getContext() && this.to.getContext() === dependency.to.getContext());
|
|
61
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Whether `to` is a parent of `from`.
|
|
126
|
+
*/
|
|
62
127
|
isParentRelationship() {
|
|
63
128
|
return this.relationship && this.relationship.type === DependencyRelationship.PARENT;
|
|
64
129
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
130
|
+
/**
|
|
131
|
+
* To drop an ordering rule.
|
|
132
|
+
*
|
|
133
|
+
* @throws {@link DependencyError} If no such behavior exists.
|
|
134
|
+
*/
|
|
68
135
|
removeBehavior(onField, onAction, toField, forAction) {
|
|
69
136
|
const index = this.getBehaviorIndex(onField, onAction, toField, forAction);
|
|
70
137
|
if (index === -1) {
|
|
@@ -72,6 +139,9 @@ export class Dependency {
|
|
|
72
139
|
}
|
|
73
140
|
this.behaviors.splice(index, 1);
|
|
74
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
75
145
|
synth() {
|
|
76
146
|
const behaviors = [];
|
|
77
147
|
this.behaviors.forEach((b) => {
|
|
@@ -95,15 +165,11 @@ export class Dependency {
|
|
|
95
165
|
to: this.to.getContext(),
|
|
96
166
|
};
|
|
97
167
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (dependency.relationship) {
|
|
104
|
-
newDependency.relationship = { ...dependency.relationship };
|
|
105
|
-
}
|
|
106
|
-
return newDependency;
|
|
168
|
+
/**
|
|
169
|
+
* The position of a matching behavior, or `-1`.
|
|
170
|
+
*/
|
|
171
|
+
getBehaviorIndex(onField, onAction, toField, forAction) {
|
|
172
|
+
return this.behaviors.findIndex((b) => b.onField === onField && b.onAction === onAction && b.toField === toField && b.forAction === forAction);
|
|
107
173
|
}
|
|
108
174
|
}
|
|
109
175
|
//# sourceMappingURL=dependency.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../../src/functions/dependency/dependency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,MAAM,kBAAkB;IAStB,YAAY,OAAe,EAAE,QAAoB,EAAE,OAAe,EAAE,SAAqB;QACvF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED
|
|
1
|
+
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../../src/functions/dependency/dependency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA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adata } from './diff-metadata.js';
|
|
2
|
+
import { DiffAction } from './diff.js';
|
|
3
|
+
/**
|
|
4
|
+
* One octo resource's diffs, collapsed to a single action.
|
|
5
|
+
*/
|
|
6
|
+
export interface AggregatedResourceAction {
|
|
7
|
+
action: DiffAction.ADD | DiffAction.DELETE | DiffAction.REPLACE | DiffAction.UPDATE;
|
|
8
|
+
reason?: string;
|
|
9
|
+
resourceId: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Collapses a resource's field-level diffs into one action per resource, keyed by resource context.
|
|
13
|
+
*
|
|
14
|
+
* Precedence: an add/delete of `resourceId` wins; a REPLACE beats an UPDATE; otherwise UPDATE.
|
|
15
|
+
* `reason` is taken from the winning diff.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function aggregateResourceActions(diffs: DiffMetadata[]): Map<string, AggregatedResourceAction>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DiffAction } from './diff.js';
|
|
2
|
+
/**
|
|
3
|
+
* Collapses a resource's field-level diffs into one action per resource, keyed by resource context.
|
|
4
|
+
*
|
|
5
|
+
* Precedence: an add/delete of `resourceId` wins; a REPLACE beats an UPDATE; otherwise UPDATE.
|
|
6
|
+
* `reason` is taken from the winning diff.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export function aggregateResourceActions(diffs) {
|
|
11
|
+
const aggregated = new Map();
|
|
12
|
+
for (const diff of diffs) {
|
|
13
|
+
const node = diff.node;
|
|
14
|
+
const context = node.getContext();
|
|
15
|
+
const reason = diff.diff.reason;
|
|
16
|
+
if (diff.action === DiffAction.DELETE && diff.field === 'resourceId') {
|
|
17
|
+
aggregated.set(context, { action: DiffAction.DELETE, reason, resourceId: node.resourceId });
|
|
18
|
+
}
|
|
19
|
+
else if (diff.action === DiffAction.ADD && diff.field === 'resourceId') {
|
|
20
|
+
aggregated.set(context, { action: DiffAction.ADD, reason, resourceId: node.resourceId });
|
|
21
|
+
}
|
|
22
|
+
else if (diff.action === DiffAction.REPLACE) {
|
|
23
|
+
const existing = aggregated.get(context);
|
|
24
|
+
if (!existing || existing.action === DiffAction.UPDATE) {
|
|
25
|
+
aggregated.set(context, { action: DiffAction.REPLACE, reason, resourceId: node.resourceId });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (!aggregated.has(context)) {
|
|
29
|
+
aggregated.set(context, { action: DiffAction.UPDATE, reason, resourceId: node.resourceId });
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// A later update may be the only one carrying a reason.
|
|
33
|
+
const existing = aggregated.get(context);
|
|
34
|
+
if (existing.action === DiffAction.UPDATE && existing.reason === undefined && reason !== undefined) {
|
|
35
|
+
existing.reason = reason;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return aggregated;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=aggregate-resource-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-resource-actions.js","sourceRoot":"","sources":["../../../src/functions/diff/aggregate-resource-actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAWvC;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAqB;IAC5D,MAAM,UAAU,GAAG,IAAI,GAAG,EAAoC,CAAC;IAE/D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAuB,CAAC;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAEhC,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,KAAK,YAAY,EAAE,CAAC;YACrE,UAAU,CAAC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CAAC;gBACnG,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
import type { ActionInputs, ActionOutputs, IUnknownModelAction, IUnknownResourceAction, UnknownNode } from '../../app.type.js';
|
|
2
2
|
import type { Diff, DiffAction } from './diff.js';
|
|
3
3
|
/**
|
|
4
|
+
* A {@link Diff} paired with the actions that will apply it, and the order they run in.
|
|
5
|
+
*
|
|
6
|
+
* A transaction is a list of these, so this is the shape you read when inspecting what a run did -
|
|
7
|
+
* in an event payload, or in a test.
|
|
8
|
+
*
|
|
4
9
|
* @group Functions/Diff
|
|
5
10
|
*/
|
|
6
11
|
export declare class DiffMetadata {
|
|
12
|
+
readonly action: DiffAction;
|
|
7
13
|
readonly actions: IUnknownModelAction[] | IUnknownResourceAction[];
|
|
8
14
|
applied: boolean;
|
|
9
15
|
applyOrder: number;
|
|
10
16
|
readonly diff: Diff;
|
|
11
|
-
readonly action: DiffAction;
|
|
12
17
|
readonly field: string;
|
|
13
|
-
readonly node: UnknownNode;
|
|
14
|
-
readonly value: unknown;
|
|
15
18
|
readonly inputs: ActionInputs;
|
|
19
|
+
readonly node: UnknownNode;
|
|
16
20
|
readonly outputs: ActionOutputs;
|
|
21
|
+
readonly value: unknown;
|
|
22
|
+
/**
|
|
23
|
+
* @param diff The change this metadata is about.
|
|
24
|
+
* @param actions The actions that will apply it.
|
|
25
|
+
* @throws {@link NoMatchingActionFoundTransactionError} If no action was given.
|
|
26
|
+
*/
|
|
17
27
|
constructor(diff: Diff, actions: IUnknownModelAction[] | IUnknownResourceAction[]);
|
|
18
28
|
/**
|
|
19
29
|
* Overrides JSON.serialize() to output a more succinct model of diff-metadata.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
20
32
|
*/
|
|
21
33
|
toJSON(): ReturnType<Diff['toJSON']>;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
22
37
|
updateInputs(inputs: ActionInputs): void;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
23
41
|
updateOutputs(outputs: ActionOutputs): void;
|
|
24
42
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { NoMatchingActionFoundTransactionError } from '../../errors/index.js';
|
|
2
2
|
/**
|
|
3
|
+
* A {@link Diff} paired with the actions that will apply it, and the order they run in.
|
|
4
|
+
*
|
|
5
|
+
* A transaction is a list of these, so this is the shape you read when inspecting what a run did -
|
|
6
|
+
* in an event payload, or in a test.
|
|
7
|
+
*
|
|
3
8
|
* @group Functions/Diff
|
|
4
9
|
*/
|
|
5
10
|
export class DiffMetadata {
|
|
11
|
+
/**
|
|
12
|
+
* @param diff The change this metadata is about.
|
|
13
|
+
* @param actions The actions that will apply it.
|
|
14
|
+
* @throws {@link NoMatchingActionFoundTransactionError} If no action was given.
|
|
15
|
+
*/
|
|
6
16
|
constructor(diff, actions) {
|
|
7
17
|
this.inputs = { inputs: {}, metadata: {}, models: {}, overlays: {}, resources: {} };
|
|
8
18
|
this.outputs = {};
|
|
@@ -20,13 +30,21 @@ export class DiffMetadata {
|
|
|
20
30
|
}
|
|
21
31
|
/**
|
|
22
32
|
* Overrides JSON.serialize() to output a more succinct model of diff-metadata.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
23
35
|
*/
|
|
24
36
|
toJSON() {
|
|
25
37
|
return this.diff.toJSON();
|
|
26
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
27
42
|
updateInputs(inputs) {
|
|
28
43
|
Object.assign(this.inputs, inputs);
|
|
29
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
30
48
|
updateOutputs(outputs) {
|
|
31
49
|
Object.assign(this.outputs, outputs);
|
|
32
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-metadata.js","sourceRoot":"","sources":["../../../src/functions/diff/diff-metadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAG9E
|
|
1
|
+
{"version":3,"file":"diff-metadata.js","sourceRoot":"","sources":["../../../src/functions/diff/diff-metadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAG9E;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;IAcvB;;;;OAIG;IACH,YAAY,IAAU,EAAE,OAAyD;QAXxE,WAAM,GAAiB,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QAG7F,YAAO,GAAkB,EAAE,CAAC;QASnC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YACrB,MAAM,IAAI,qCAAqC,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;QAC9F,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAErB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,MAAoB;QAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAAsB;QAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -1,30 +1,84 @@
|
|
|
1
1
|
import type { UnknownNode } from '../../app.type.js';
|
|
2
2
|
/**
|
|
3
|
+
* What a {@link Diff} says happened to a node.
|
|
4
|
+
*
|
|
5
|
+
* `REPLACE` is distinct from `UPDATE`: it means the change cannot be applied in place, and the
|
|
6
|
+
* infrastructure must be destroyed and re-created.
|
|
7
|
+
*
|
|
3
8
|
* @group Functions/Diff
|
|
4
9
|
*/
|
|
5
10
|
export declare enum DiffAction {
|
|
11
|
+
/**
|
|
12
|
+
* The node is in the new graph and not in the last committed one, so it has to be created.
|
|
13
|
+
*/
|
|
6
14
|
ADD = "add",
|
|
15
|
+
/**
|
|
16
|
+
* The node is in the last committed graph and not in the new one, so it has to be destroyed.
|
|
17
|
+
*/
|
|
7
18
|
DELETE = "delete",
|
|
19
|
+
/**
|
|
20
|
+
* A field changed that cannot be changed in place, so the infrastructure is destroyed and created
|
|
21
|
+
* again. A resource declares this itself, with a reason, which is what a report shows a reviewer
|
|
22
|
+
* in place of leaving them to work a recreate out of a terraform plan.
|
|
23
|
+
*/
|
|
8
24
|
REPLACE = "replace",
|
|
25
|
+
/**
|
|
26
|
+
* A field changed and can be changed in place.
|
|
27
|
+
*/
|
|
9
28
|
UPDATE = "update",
|
|
29
|
+
/**
|
|
30
|
+
* Nothing changed, and the node still wants an action to run over it.
|
|
31
|
+
*/
|
|
10
32
|
VALIDATE = "validate"
|
|
11
33
|
}
|
|
12
34
|
/**
|
|
35
|
+
* One change to one field of one node.
|
|
36
|
+
*
|
|
37
|
+
* Diffs are the currency of Octo: comparing the graph you just described against the last committed
|
|
38
|
+
* one produces a list of them, and every action is selected and driven by the diffs it accepts.
|
|
39
|
+
*
|
|
13
40
|
* @group Functions/Diff
|
|
14
41
|
*/
|
|
15
42
|
export declare class Diff<N extends UnknownNode = UnknownNode, V = unknown> {
|
|
43
|
+
/**
|
|
44
|
+
* What happened.
|
|
45
|
+
*/
|
|
16
46
|
readonly action: DiffAction;
|
|
47
|
+
/**
|
|
48
|
+
* The field of the node that changed, e.g. `resourceId`, `properties`, or `parent`.
|
|
49
|
+
*/
|
|
17
50
|
readonly field: string;
|
|
51
|
+
/**
|
|
52
|
+
* The node that changed.
|
|
53
|
+
*/
|
|
18
54
|
readonly node: N;
|
|
55
|
+
/**
|
|
56
|
+
* Why the change is being made, when the field alone does not explain it.
|
|
57
|
+
* It is carried into reports, so write it for whoever reads the plan.
|
|
58
|
+
*/
|
|
59
|
+
readonly reason?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The new value of the field. Its shape depends on the field.
|
|
62
|
+
*/
|
|
19
63
|
readonly value: V;
|
|
20
|
-
|
|
64
|
+
/**
|
|
65
|
+
* @param node The node that changed.
|
|
66
|
+
* @param action What happened to it.
|
|
67
|
+
* @param field The field of the node that changed.
|
|
68
|
+
* @param value The new value of the field.
|
|
69
|
+
* @param reason Why the change is being made, carried into reports.
|
|
70
|
+
*/
|
|
71
|
+
constructor(node: Diff<N, V>['node'], action: Diff['action'], field: Diff['field'], value: Diff<N, V>['value'], reason?: Diff['reason']);
|
|
21
72
|
/**
|
|
22
73
|
* Overrides JSON.serialize() to output a more succinct representation of diff.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
23
76
|
*/
|
|
24
77
|
toJSON(): {
|
|
25
78
|
action: string;
|
|
26
79
|
field: string;
|
|
27
80
|
node: string;
|
|
81
|
+
reason?: string;
|
|
28
82
|
value: V | string;
|
|
29
83
|
};
|
|
30
84
|
}
|
|
@@ -1,26 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* What a {@link Diff} says happened to a node.
|
|
3
|
+
*
|
|
4
|
+
* `REPLACE` is distinct from `UPDATE`: it means the change cannot be applied in place, and the
|
|
5
|
+
* infrastructure must be destroyed and re-created.
|
|
6
|
+
*
|
|
2
7
|
* @group Functions/Diff
|
|
3
8
|
*/
|
|
4
9
|
export var DiffAction;
|
|
5
10
|
(function (DiffAction) {
|
|
11
|
+
/**
|
|
12
|
+
* The node is in the new graph and not in the last committed one, so it has to be created.
|
|
13
|
+
*/
|
|
6
14
|
DiffAction["ADD"] = "add";
|
|
15
|
+
/**
|
|
16
|
+
* The node is in the last committed graph and not in the new one, so it has to be destroyed.
|
|
17
|
+
*/
|
|
7
18
|
DiffAction["DELETE"] = "delete";
|
|
19
|
+
/**
|
|
20
|
+
* A field changed that cannot be changed in place, so the infrastructure is destroyed and created
|
|
21
|
+
* again. A resource declares this itself, with a reason, which is what a report shows a reviewer
|
|
22
|
+
* in place of leaving them to work a recreate out of a terraform plan.
|
|
23
|
+
*/
|
|
8
24
|
DiffAction["REPLACE"] = "replace";
|
|
25
|
+
/**
|
|
26
|
+
* A field changed and can be changed in place.
|
|
27
|
+
*/
|
|
9
28
|
DiffAction["UPDATE"] = "update";
|
|
29
|
+
/**
|
|
30
|
+
* Nothing changed, and the node still wants an action to run over it.
|
|
31
|
+
*/
|
|
10
32
|
DiffAction["VALIDATE"] = "validate";
|
|
11
33
|
})(DiffAction || (DiffAction = {}));
|
|
12
34
|
/**
|
|
35
|
+
* One change to one field of one node.
|
|
36
|
+
*
|
|
37
|
+
* Diffs are the currency of Octo: comparing the graph you just described against the last committed
|
|
38
|
+
* one produces a list of them, and every action is selected and driven by the diffs it accepts.
|
|
39
|
+
*
|
|
13
40
|
* @group Functions/Diff
|
|
14
41
|
*/
|
|
15
42
|
export class Diff {
|
|
16
|
-
|
|
43
|
+
/**
|
|
44
|
+
* @param node The node that changed.
|
|
45
|
+
* @param action What happened to it.
|
|
46
|
+
* @param field The field of the node that changed.
|
|
47
|
+
* @param value The new value of the field.
|
|
48
|
+
* @param reason Why the change is being made, carried into reports.
|
|
49
|
+
*/
|
|
50
|
+
constructor(node, action, field, value, reason) {
|
|
17
51
|
this.node = node;
|
|
18
52
|
this.action = action;
|
|
19
53
|
this.field = field;
|
|
20
54
|
this.value = value;
|
|
55
|
+
this.reason = reason;
|
|
21
56
|
}
|
|
22
57
|
/**
|
|
23
58
|
* Overrides JSON.serialize() to output a more succinct representation of diff.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
24
61
|
*/
|
|
25
62
|
toJSON() {
|
|
26
63
|
let value = this.value;
|
|
@@ -31,14 +68,18 @@ export class Diff {
|
|
|
31
68
|
value = `anchorId=${value.anchorId}`;
|
|
32
69
|
}
|
|
33
70
|
else {
|
|
34
|
-
value = JSON.parse(JSON.stringify(value));
|
|
71
|
+
value = value === undefined ? undefined : JSON.parse(JSON.stringify(value));
|
|
35
72
|
}
|
|
36
|
-
|
|
73
|
+
const json = {
|
|
37
74
|
action: this.action,
|
|
38
75
|
field: this.field,
|
|
39
76
|
node: this.node.getContext(),
|
|
40
77
|
value,
|
|
41
78
|
};
|
|
79
|
+
if (this.reason !== undefined) {
|
|
80
|
+
json.reason = this.reason;
|
|
81
|
+
}
|
|
82
|
+
return json;
|
|
42
83
|
}
|
|
43
84
|
}
|
|
44
85
|
//# sourceMappingURL=diff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/functions/diff/diff.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/functions/diff/diff.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,UA2BX;AA3BD,WAAY,UAAU;IACpB;;OAEG;IACH,yBAAW,CAAA;IAEX;;OAEG;IACH,+BAAiB,CAAA;IAEjB;;;;OAIG;IACH,iCAAmB,CAAA;IAEnB;;OAEG;IACH,+BAAiB,CAAA;IAEjB;;OAEG;IACH,mCAAqB,CAAA;AACvB,CAAC,EA3BW,UAAU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Node } from '../../app.type.js';
|
|
2
2
|
import { Diff } from './diff.js';
|
|
3
3
|
/**
|
|
4
|
+
* Helpers for producing {@link Diff}s between two versions of a node.
|
|
5
|
+
*
|
|
6
|
+
* Use them when overriding `diffProperties()` on a model or resource - each one compares a single
|
|
7
|
+
* field of the previous node against the latest, and returns the diffs that field's change implies.
|
|
8
|
+
*
|
|
4
9
|
* @group Functions/Diff
|
|
5
10
|
*/
|
|
6
11
|
export declare class DiffUtility {
|
|
7
|
-
private static generateDeleteDiff;
|
|
8
|
-
static isObjectDeepEquals(x: unknown, y: unknown, excludePaths?: string[], currentPath?: string[]): boolean;
|
|
9
12
|
/**
|
|
10
13
|
* Generate a deep diff of an array of basic types from the previous node vs the latest node.
|
|
11
14
|
* @param a previous node.
|
|
@@ -43,4 +46,16 @@ export declare class DiffUtility {
|
|
|
43
46
|
* @param field string representing the field parent uses to reference the object.
|
|
44
47
|
*/
|
|
45
48
|
static diffObject(a: UnknownNode, b: UnknownNode, field: string): Diff[];
|
|
49
|
+
/**
|
|
50
|
+
* Whether two values are deeply equal.
|
|
51
|
+
*
|
|
52
|
+
* @param x The first value.
|
|
53
|
+
* @param y The second value.
|
|
54
|
+
* @param excludePaths Dot-separated paths to ignore, e.g. `tags`.
|
|
55
|
+
*/
|
|
56
|
+
static isObjectDeepEquals(x: unknown, y: unknown, excludePaths?: string[], currentPath?: string[]): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The diffs that deleting a node implies - the node itself, and every child below it.
|
|
59
|
+
*/
|
|
60
|
+
private static generateDeleteDiff;
|
|
46
61
|
}
|