@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
|
@@ -3,22 +3,28 @@ import { AModule } from '../modules/module.abstract.js';
|
|
|
3
3
|
import { ModuleContainer } from '../modules/module.container.js';
|
|
4
4
|
import { ValidationUtility } from '../utilities/validation/validation.utility.js';
|
|
5
5
|
/**
|
|
6
|
-
* A `@Module` is a class decorator
|
|
7
|
-
* - A
|
|
8
|
-
* -
|
|
9
|
-
*
|
|
6
|
+
* A `@Module` is a class decorator and must be placed on top of a class representing a module.
|
|
7
|
+
* - A module must also extend the {@link AModule} class.
|
|
8
|
+
* - For type safety, the type of module being decorated is passed to the decorator.
|
|
9
|
+
*
|
|
10
|
+
* Decorating a class registers it with Octo, which is what makes the module loadable by name
|
|
11
|
+
* with {@link Octo.loadModule}.
|
|
10
12
|
*
|
|
11
13
|
* @example
|
|
12
14
|
* ```ts
|
|
13
|
-
* @Module<
|
|
14
|
-
* export class MyModule
|
|
15
|
-
* constructor(inputs: IMyInputs) { ... }
|
|
16
|
-
*
|
|
17
|
-
* async onInit(): Promise<Region> { ... }
|
|
18
|
-
* }
|
|
15
|
+
* @Module<MyModule>('@example', MyModuleSchema)
|
|
16
|
+
* export class MyModule extends AModule<MyModuleSchema, MyRegion> { ... }
|
|
19
17
|
* ```
|
|
18
|
+
*
|
|
20
19
|
* @group Decorators
|
|
20
|
+
*
|
|
21
|
+
* @param packageName - The name of the package under which the module is registered.
|
|
22
|
+
* Selecting a unique package name helps avoid collisions between same module class names across different libraries.
|
|
23
|
+
* You will reuse the same package name throughout your library for different Octo components you create.
|
|
24
|
+
* @param schema - The schema of the module, describing the inputs it accepts.
|
|
25
|
+
*
|
|
21
26
|
* @returns The decorated class.
|
|
27
|
+
*
|
|
22
28
|
* @see Definition of [Modules](/docs/fundamentals/modules).
|
|
23
29
|
*/
|
|
24
30
|
export function Module(packageName, schema) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.decorator.js","sourceRoot":"","sources":["../../src/decorators/module.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF
|
|
1
|
+
{"version":3,"file":"module.decorator.js","sourceRoot":"","sources":["../../src/decorators/module.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,MAAM,CAAI,WAAmB,EAAE,MAAsC;IACnF,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAE1C,OAAO,UAAU,WAAgB;QAC/B,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,WAAW,EAAE,2BAA2B,CAAC,EAAE,CAAC;YAC/E,MAAM,IAAI,KAAK,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,CAAC,WAAW,CAAC,SAAS,YAAY,OAAO,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,UAAU,WAAW,CAAC,IAAI,kCAAkC,CAAC,CAAC;QAChF,CAAC;QAED,WAAW,CAAC,cAAc,GAAG,WAAW,CAAC;QACzC,WAAW,CAAC,aAAa,GAAG,MAAM,CAAC;QAEnC,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,EAAE;YACtE,eAAe,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AbstractConstructable } from '../app.type.js';
|
|
2
2
|
import type { Event } from '../events/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* An `@OnEvent` is a method decorator to listen to an event.
|
|
5
5
|
*
|
|
6
|
+
* Octo narrates everything it does as {@link Event}s. Subscribing is how you add logging, reporting,
|
|
7
|
+
* or notifications without changing the framework. A handler receives every event that is an instance
|
|
8
|
+
* of the given type, so listening to a base class such as {@link TransactionEvent} catches all of its
|
|
9
|
+
* subclasses.
|
|
10
|
+
*
|
|
6
11
|
* @example
|
|
7
12
|
* ```ts
|
|
8
13
|
* // Async handler.
|
|
@@ -17,4 +22,4 @@ import type { Event } from '../events/index.js';
|
|
|
17
22
|
* @param ofType The type of event being listened to.
|
|
18
23
|
* @returns The decorated method.
|
|
19
24
|
*/
|
|
20
|
-
export declare function OnEvent(ofType:
|
|
25
|
+
export declare function OnEvent(ofType: AbstractConstructable<Event<unknown>>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -2,6 +2,11 @@ import { EventService } from '../services/event/event.service.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* An `@OnEvent` is a method decorator to listen to an event.
|
|
4
4
|
*
|
|
5
|
+
* Octo narrates everything it does as {@link Event}s. Subscribing is how you add logging, reporting,
|
|
6
|
+
* or notifications without changing the framework. A handler receives every event that is an instance
|
|
7
|
+
* of the given type, so listening to a base class such as {@link TransactionEvent} catches all of its
|
|
8
|
+
* subclasses.
|
|
9
|
+
*
|
|
5
10
|
* @example
|
|
6
11
|
* ```ts
|
|
7
12
|
* // Async handler.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-event.decorator.js","sourceRoot":"","sources":["../../src/decorators/on-event.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE
|
|
1
|
+
{"version":3,"file":"on-event.decorator.js","sourceRoot":"","sources":["../../src/decorators/on-event.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,OAAO,CACrB,MAA6C;IAE7C,OAAO,UAAU,MAAW,EAAE,YAAoB,EAAE,UAA8B;QAChF,YAAY,CAAC,WAAW,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { type Constructable, type ResourceSchema, type UnknownResource } from '../app.type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every dot path through `T` that ends at a string, with `[]` after a key holding an array. Below a key
|
|
4
|
+
* typed `unknown` any path is accepted.
|
|
5
|
+
*/
|
|
6
|
+
type NamePath<T, Depth extends unknown[] = []> = Depth['length'] extends 6 ? never : {
|
|
7
|
+
[K in keyof T & string]-?: unknown extends T[K] ? K | `${K}.${string}` | `${K}[]` | `${K}[].${string}` : NonNullable<T[K]> extends readonly (infer E)[] ? (NonNullable<E> extends string ? `${K}[]` : never) | (NonNullable<E> extends object ? `${K}[].${NamePath<NonNullable<E>, [...Depth, unknown]>}` : never) : NonNullable<T[K]> extends string ? K : NonNullable<T[K]> extends object ? `${K}.${NamePath<NonNullable<T[K]>, [...Depth, unknown]>}` : never;
|
|
8
|
+
}[keyof T & string];
|
|
2
9
|
/**
|
|
3
10
|
* A `@Resource` is a class decorator and must be placed on top of a class representing a resource.
|
|
4
11
|
* - A resource must also extend the {@link AResource} class.
|
|
@@ -10,6 +17,30 @@ import { type Constructable, type ResourceSchema, type UnknownResource } from '.
|
|
|
10
17
|
* export class MyResource extends AResource<MyResourceSchema, MyResource> { ... }
|
|
11
18
|
* ```
|
|
12
19
|
*
|
|
20
|
+
* A resource whose properties hold a name the cloud requires unique declares it in `options.uniqueProperties`, and
|
|
21
|
+
* generate refuses two values of `path` that share the values of `within`, whether they come from two
|
|
22
|
+
* resources of the class or from one.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* @Resource<MyTable>('@example', 'my-table', MyTableSchema, {
|
|
27
|
+
* uniqueProperties: [
|
|
28
|
+
* { path: 'tableName', within: ['accountId', 'regionId'] },
|
|
29
|
+
* { path: 'indexes[].name', within: ['accountId', 'regionId'] },
|
|
30
|
+
* ],
|
|
31
|
+
* })
|
|
32
|
+
* export class MyTable extends AResource<MyTableSchema, MyTable> { ... }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* A resource holding data octo cannot put back from its inputs - a table's rows, a filesystem's files -
|
|
36
|
+
* sets `options.destroyLosesData`, and every destroy terraform plans of it is reported as losing data.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* @Resource<MyTable>('@example', 'my-table', MyTableSchema, { destroyLosesData: true })
|
|
41
|
+
* export class MyTable extends AResource<MyTableSchema, MyTable> { ... }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
13
44
|
* @group Decorators
|
|
14
45
|
*
|
|
15
46
|
* @param packageName - The name of the package under which the resource is registered.
|
|
@@ -17,9 +48,27 @@ import { type Constructable, type ResourceSchema, type UnknownResource } from '.
|
|
|
17
48
|
* You will reuse the same package name throughout your library for different Octo components you create.
|
|
18
49
|
* @param resourceName - a string that uniquely represents the name of the resource.
|
|
19
50
|
* @param schema - The schema of the resource.
|
|
51
|
+
* @param options - Optional settings of the resource.
|
|
52
|
+
* `destroyLosesData` marks the resource as holding data that is lost when it is destroyed. Validate,
|
|
53
|
+
* and apply's check for destroys, add a message to each destroy of it, whatever the cause.
|
|
54
|
+
*
|
|
55
|
+
* `uniqueProperties` lists the names the cloud requires unique, one entry per name.
|
|
56
|
+
* - `path` is a dot path through the resource's properties, with `[]` after a key holding an array.
|
|
57
|
+
* A resource with no value at `path` is not checked.
|
|
58
|
+
* - `within` names the properties whose values form the name's domain. A resource missing one is refused.
|
|
59
|
+
* An empty `within` makes the name unique across the app.
|
|
60
|
+
*
|
|
61
|
+
* Only resources of one class are compared with each other, and a class declaring no names is not checked.
|
|
20
62
|
*
|
|
21
63
|
* @returns The decorated class.
|
|
22
64
|
*
|
|
23
65
|
* @see Definition of [Resources](/docs/fundamentals/resources).
|
|
24
66
|
*/
|
|
25
|
-
export declare function Resource<T extends UnknownResource>(packageName: string, resourceName: string, schema: Constructable<ResourceSchema<T
|
|
67
|
+
export declare function Resource<T extends UnknownResource>(packageName: string, resourceName: string, schema: Constructable<ResourceSchema<T>>, { destroyLosesData, uniqueProperties, }?: {
|
|
68
|
+
destroyLosesData?: boolean;
|
|
69
|
+
uniqueProperties?: {
|
|
70
|
+
path: NamePath<ResourceSchema<T>['properties']>;
|
|
71
|
+
within: (keyof ResourceSchema<T>['properties'] & string)[];
|
|
72
|
+
}[];
|
|
73
|
+
}): (constructor: any) => void;
|
|
74
|
+
export {};
|
|
@@ -14,6 +14,30 @@ import { ValidationUtility } from '../utilities/validation/validation.utility.js
|
|
|
14
14
|
* export class MyResource extends AResource<MyResourceSchema, MyResource> { ... }
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
|
+
* A resource whose properties hold a name the cloud requires unique declares it in `options.uniqueProperties`, and
|
|
18
|
+
* generate refuses two values of `path` that share the values of `within`, whether they come from two
|
|
19
|
+
* resources of the class or from one.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* @Resource<MyTable>('@example', 'my-table', MyTableSchema, {
|
|
24
|
+
* uniqueProperties: [
|
|
25
|
+
* { path: 'tableName', within: ['accountId', 'regionId'] },
|
|
26
|
+
* { path: 'indexes[].name', within: ['accountId', 'regionId'] },
|
|
27
|
+
* ],
|
|
28
|
+
* })
|
|
29
|
+
* export class MyTable extends AResource<MyTableSchema, MyTable> { ... }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* A resource holding data octo cannot put back from its inputs - a table's rows, a filesystem's files -
|
|
33
|
+
* sets `options.destroyLosesData`, and every destroy terraform plans of it is reported as losing data.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* @Resource<MyTable>('@example', 'my-table', MyTableSchema, { destroyLosesData: true })
|
|
38
|
+
* export class MyTable extends AResource<MyTableSchema, MyTable> { ... }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
17
41
|
* @group Decorators
|
|
18
42
|
*
|
|
19
43
|
* @param packageName - The name of the package under which the resource is registered.
|
|
@@ -21,12 +45,23 @@ import { ValidationUtility } from '../utilities/validation/validation.utility.js
|
|
|
21
45
|
* You will reuse the same package name throughout your library for different Octo components you create.
|
|
22
46
|
* @param resourceName - a string that uniquely represents the name of the resource.
|
|
23
47
|
* @param schema - The schema of the resource.
|
|
48
|
+
* @param options - Optional settings of the resource.
|
|
49
|
+
* `destroyLosesData` marks the resource as holding data that is lost when it is destroyed. Validate,
|
|
50
|
+
* and apply's check for destroys, add a message to each destroy of it, whatever the cause.
|
|
51
|
+
*
|
|
52
|
+
* `uniqueProperties` lists the names the cloud requires unique, one entry per name.
|
|
53
|
+
* - `path` is a dot path through the resource's properties, with `[]` after a key holding an array.
|
|
54
|
+
* A resource with no value at `path` is not checked.
|
|
55
|
+
* - `within` names the properties whose values form the name's domain. A resource missing one is refused.
|
|
56
|
+
* An empty `within` makes the name unique across the app.
|
|
57
|
+
*
|
|
58
|
+
* Only resources of one class are compared with each other, and a class declaring no names is not checked.
|
|
24
59
|
*
|
|
25
60
|
* @returns The decorated class.
|
|
26
61
|
*
|
|
27
62
|
* @see Definition of [Resources](/docs/fundamentals/resources).
|
|
28
63
|
*/
|
|
29
|
-
export function Resource(packageName, resourceName, schema) {
|
|
64
|
+
export function Resource(packageName, resourceName, schema, { destroyLosesData = false, uniqueProperties = [], } = {}) {
|
|
30
65
|
const container = Container.getInstance();
|
|
31
66
|
return function (constructor) {
|
|
32
67
|
if (!ValidationUtility.validateRegex(packageName, /^[@A-Za-z][\w-]+[A-Za-z]$/)) {
|
|
@@ -38,10 +73,12 @@ export function Resource(packageName, resourceName, schema) {
|
|
|
38
73
|
if (!(constructor.prototype instanceof AResource)) {
|
|
39
74
|
throw new Error(`Class "${constructor.name}" must extend the AResource class!`);
|
|
40
75
|
}
|
|
76
|
+
constructor.DESTROY_LOSES_DATA = destroyLosesData;
|
|
41
77
|
constructor.NODE_NAME = resourceName;
|
|
42
78
|
constructor.NODE_PACKAGE = packageName;
|
|
43
79
|
constructor.NODE_SCHEMA = schema;
|
|
44
80
|
constructor.NODE_TYPE = NodeType.RESOURCE;
|
|
81
|
+
constructor.UNIQUE_PROPERTIES = uniqueProperties.map(({ path, within }) => ({ path, within: [...within] }));
|
|
45
82
|
const promise = container.get(ResourceSerializationService).then((resourceSerializationService) => {
|
|
46
83
|
resourceSerializationService.registerClass(`${packageName}/${constructor.name}`, constructor);
|
|
47
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.decorator.js","sourceRoot":"","sources":["../../src/decorators/resource.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAA6C,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sEAAsE,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"resource.decorator.js","sourceRoot":"","sources":["../../src/decorators/resource.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAA6C,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sEAAsE,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAsBlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,UAAU,QAAQ,CACtB,WAAmB,EACnB,YAAoB,EACpB,MAAwC,EACxC,EACE,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,EAAE,MAOnB,EAAE;IAEN,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAE1C,OAAO,UAAU,WAAgB;QAC/B,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,WAAW,EAAE,2BAA2B,CAAC,EAAE,CAAC;YAC/E,MAAM,IAAI,KAAK,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,YAAY,EAAE,0BAA0B,CAAC,EAAE,CAAC;YAC/E,MAAM,IAAI,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC,CAAC,WAAW,CAAC,SAAS,YAAY,SAAS,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,UAAU,WAAW,CAAC,IAAI,oCAAoC,CAAC,CAAC;QAClF,CAAC;QAED,WAAW,CAAC,kBAAkB,GAAG,gBAAgB,CAAC;QAClD,WAAW,CAAC,SAAS,GAAG,YAAY,CAAC;QACrC,WAAW,CAAC,YAAY,GAAG,WAAW,CAAC;QACvC,WAAW,CAAC,WAAW,GAAG,MAAM,CAAC;QACjC,WAAW,CAAC,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAC1C,WAAW,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAE5G,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,IAAI,CAAC,CAAC,4BAA4B,EAAE,EAAE;YAChG,4BAA4B,CAAC,aAAa,CAAC,GAAG,WAAW,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -9,9 +9,23 @@ type ValidationOptions<T> = {
|
|
|
9
9
|
* A `@Validate` is a property decorator to validate a property.
|
|
10
10
|
* It is typically used in {@link Schema} to validate schema properties.
|
|
11
11
|
*
|
|
12
|
+
* Validation runs on assignment, and a failure throws a {@link ValidationTransactionError}.
|
|
13
|
+
* Declaring constraints here is what lets a module reject bad inputs before any infrastructure is touched.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* @Validate({ options: { maxLength: 65535, minLength: 1 } })
|
|
18
|
+
* containerPort = Schema<number>();
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
12
21
|
* @group Decorators
|
|
13
22
|
*
|
|
14
|
-
* @
|
|
23
|
+
* @param validators One constraint, or an array of them. Each constraint carries the `options` to apply,
|
|
24
|
+
* and an optional `destruct` to reduce the property into the list of values the constraints run against.
|
|
25
|
+
* Without `destruct`, the property value is validated as-is.
|
|
26
|
+
* @param transform Runs before validation, and **replaces** the stored value with what it returns.
|
|
27
|
+
*
|
|
28
|
+
* @see Techniques for [Validation](/docs/techniques/validation) for the full list of constraints.
|
|
15
29
|
*/
|
|
16
30
|
export declare function Validate<T>(validators: ValidationOptions<T> | ValidationOptions<T>[], transform?: (value: any) => any): (target: any, propertyKey: string) => void;
|
|
17
31
|
export {};
|
|
@@ -4,9 +4,23 @@ import { ValidationService } from '../services/validation/validation.service.js'
|
|
|
4
4
|
* A `@Validate` is a property decorator to validate a property.
|
|
5
5
|
* It is typically used in {@link Schema} to validate schema properties.
|
|
6
6
|
*
|
|
7
|
+
* Validation runs on assignment, and a failure throws a {@link ValidationTransactionError}.
|
|
8
|
+
* Declaring constraints here is what lets a module reject bad inputs before any infrastructure is touched.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* @Validate({ options: { maxLength: 65535, minLength: 1 } })
|
|
13
|
+
* containerPort = Schema<number>();
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
7
16
|
* @group Decorators
|
|
8
17
|
*
|
|
9
|
-
* @
|
|
18
|
+
* @param validators One constraint, or an array of them. Each constraint carries the `options` to apply,
|
|
19
|
+
* and an optional `destruct` to reduce the property into the list of values the constraints run against.
|
|
20
|
+
* Without `destruct`, the property value is validated as-is.
|
|
21
|
+
* @param transform Runs before validation, and **replaces** the stored value with what it returns.
|
|
22
|
+
*
|
|
23
|
+
* @see Techniques for [Validation](/docs/techniques/validation) for the full list of constraints.
|
|
10
24
|
*/
|
|
11
25
|
export function Validate(validators, transform) {
|
|
12
26
|
return function (target, propertyKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.decorator.js","sourceRoot":"","sources":["../../src/decorators/validate.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAOjF
|
|
1
|
+
{"version":3,"file":"validate.decorator.js","sourceRoot":"","sources":["../../src/decorators/validate.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAOjF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,QAAQ,CACtB,UAAyD,EACzD,SAA+B;IAE/B,OAAO,UAAU,MAAW,EAAE,WAAmB;QAC/C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE;YACzC,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE;gBACH,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;YACtB,CAAC;YACD,GAAG,EAAE,UAAU,QAAa;gBAC1B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;oBAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;oBACzB,OAAO;gBACT,CAAC;gBAED,IAAI,SAAS,EAAE,CAAC;oBACd,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;gBACjC,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC/B,UAAU,GAAG,CAAC,UAAU,CAAC,CAAC;gBAC5B,CAAC;gBAED,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;gBAClD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;oBACnC,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;wBACnE,iBAAiB,CAAC,UAAU,CAC1B,IAAsB,EACtB,UAAU,EACV,MAAM,EACN,WAAW,EACX,QAAQ,EACR,SAAS,CAAC,QAAQ,CACnB,CAAC;oBACJ,CAAC;gBACH,CAAC;gBAED,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;gBAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;oBACjB,MAAM,IAAI,0BAA0B,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;gBACpE,CAAC;gBAED,IAAI,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;YAC1B,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
import type { Constructable } from '../app.type.js';
|
|
2
2
|
/**
|
|
3
|
+
* Parent error class for all {@link Container} errors.
|
|
4
|
+
*
|
|
3
5
|
* @group Errors/Container
|
|
4
6
|
*/
|
|
5
7
|
export declare class ContainerError extends Error {
|
|
6
8
|
readonly type: string;
|
|
9
|
+
/**
|
|
10
|
+
* @param message The error message.
|
|
11
|
+
* @param type The class the container was resolving or registering.
|
|
12
|
+
*/
|
|
7
13
|
constructor(message: string, type: Constructable<unknown> | string);
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
16
|
+
* Thrown when a factory is registered for a class that already has one with the same metadata.
|
|
17
|
+
*
|
|
10
18
|
* @group Errors/Container
|
|
11
19
|
*/
|
|
12
20
|
export declare class ContainerRegistrationError extends ContainerError {
|
|
21
|
+
/**
|
|
22
|
+
* @param message The error message.
|
|
23
|
+
* @param type The class whose factory was being registered.
|
|
24
|
+
*/
|
|
13
25
|
constructor(message: string, type: Constructable<unknown> | string);
|
|
14
26
|
}
|
|
15
27
|
/**
|
|
28
|
+
* Thrown when a class is requested and no factory registers for it before the timeout - see {@link Container.setFactoryTimeout}.
|
|
29
|
+
*
|
|
16
30
|
* @group Errors/Container
|
|
17
31
|
*/
|
|
18
32
|
export declare class ContainerResolutionError extends ContainerError {
|
|
33
|
+
/**
|
|
34
|
+
* @param message The error message.
|
|
35
|
+
* @param type The class that could not be resolved.
|
|
36
|
+
*/
|
|
19
37
|
constructor(message: string, type: Constructable<unknown> | string);
|
|
20
38
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Parent error class for all {@link Container} errors.
|
|
3
|
+
*
|
|
2
4
|
* @group Errors/Container
|
|
3
5
|
*/
|
|
4
6
|
export class ContainerError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* @param message The error message.
|
|
9
|
+
* @param type The class the container was resolving or registering.
|
|
10
|
+
*/
|
|
5
11
|
constructor(message, type) {
|
|
6
12
|
super(message);
|
|
7
13
|
this.type = typeof type === 'string' ? type : type.name;
|
|
@@ -9,18 +15,30 @@ export class ContainerError extends Error {
|
|
|
9
15
|
}
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
18
|
+
* Thrown when a factory is registered for a class that already has one with the same metadata.
|
|
19
|
+
*
|
|
12
20
|
* @group Errors/Container
|
|
13
21
|
*/
|
|
14
22
|
export class ContainerRegistrationError extends ContainerError {
|
|
23
|
+
/**
|
|
24
|
+
* @param message The error message.
|
|
25
|
+
* @param type The class whose factory was being registered.
|
|
26
|
+
*/
|
|
15
27
|
constructor(message, type) {
|
|
16
28
|
super(message, type);
|
|
17
29
|
Object.setPrototypeOf(this, ContainerRegistrationError.prototype);
|
|
18
30
|
}
|
|
19
31
|
}
|
|
20
32
|
/**
|
|
33
|
+
* Thrown when a class is requested and no factory registers for it before the timeout - see {@link Container.setFactoryTimeout}.
|
|
34
|
+
*
|
|
21
35
|
* @group Errors/Container
|
|
22
36
|
*/
|
|
23
37
|
export class ContainerResolutionError extends ContainerError {
|
|
38
|
+
/**
|
|
39
|
+
* @param message The error message.
|
|
40
|
+
* @param type The class that could not be resolved.
|
|
41
|
+
*/
|
|
24
42
|
constructor(message, type) {
|
|
25
43
|
super(message, type);
|
|
26
44
|
Object.setPrototypeOf(this, ContainerResolutionError.prototype);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.error.js","sourceRoot":"","sources":["../../src/errors/container.error.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"container.error.js","sourceRoot":"","sources":["../../src/errors/container.error.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAGvC;;;OAGG;IACH,YAAY,OAAe,EAAE,IAAqC;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAExD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IAC5D;;;OAGG;IACH,YAAY,OAAe,EAAE,IAAqC;QAChE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAErB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,0BAA0B,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAC1D;;;OAGG;IACH,YAAY,OAAe,EAAE,IAAqC;QAChE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAErB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACF"}
|
package/dist/errors/index.d.ts
CHANGED
package/dist/errors/index.js
CHANGED
package/dist/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Thrown by a module that cannot satisfy its inputs. Raise it from {@link AModule.onInit} to fail a run before anything is built.
|
|
3
|
+
*
|
|
2
4
|
* @group Errors/Module
|
|
3
5
|
*/
|
|
4
6
|
export declare class ModuleError extends Error {
|
|
5
7
|
readonly module: string;
|
|
8
|
+
/**
|
|
9
|
+
* @param message The error message.
|
|
10
|
+
* @param moduleName The module that raised it.
|
|
11
|
+
*/
|
|
6
12
|
constructor(message: string, moduleName: string);
|
|
7
13
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Thrown by a module that cannot satisfy its inputs. Raise it from {@link AModule.onInit} to fail a run before anything is built.
|
|
3
|
+
*
|
|
2
4
|
* @group Errors/Module
|
|
3
5
|
*/
|
|
4
6
|
export class ModuleError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* @param message The error message.
|
|
9
|
+
* @param moduleName The module that raised it.
|
|
10
|
+
*/
|
|
5
11
|
constructor(message, moduleName) {
|
|
6
12
|
super(message);
|
|
7
13
|
this.module = moduleName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.error.js","sourceRoot":"","sources":["../../src/errors/module.error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"module.error.js","sourceRoot":"","sources":["../../src/errors/module.error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGpC;;;OAGG;IACH,YAAY,OAAe,EAAE,UAAkB;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;QAEzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -3,61 +3,117 @@ import type { Dependency, IDependency } from '../functions/dependency/dependency
|
|
|
3
3
|
import type { Diff } from '../functions/diff/diff.js';
|
|
4
4
|
import type { AResource } from '../resources/resource.abstract.js';
|
|
5
5
|
/**
|
|
6
|
+
* Thrown when a {@link Dependency} is given a second relationship, or asked to drop a behavior it does not have.
|
|
7
|
+
*
|
|
6
8
|
* @group Errors/Node
|
|
7
9
|
*/
|
|
8
10
|
export declare class DependencyError extends Error {
|
|
9
11
|
readonly dependency: IDependency;
|
|
12
|
+
/**
|
|
13
|
+
* @param message The error message.
|
|
14
|
+
* @param dependency The dependency that was being changed.
|
|
15
|
+
*/
|
|
10
16
|
constructor(message: string, dependency: Dependency);
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
19
|
+
* Thrown when state cannot be deserialized back into a node, e.g. because it references something no longer in the graph.
|
|
20
|
+
*
|
|
13
21
|
* @group Errors/Node
|
|
14
22
|
*/
|
|
15
23
|
export declare class NodeUnsynthError extends Error {
|
|
16
24
|
readonly subject: string;
|
|
25
|
+
/**
|
|
26
|
+
* @param message The error message.
|
|
27
|
+
* @param subject The node, named by its ID, that could not be deserialized.
|
|
28
|
+
*/
|
|
17
29
|
constructor(message: string, subject: string);
|
|
18
30
|
}
|
|
19
31
|
/**
|
|
32
|
+
* Parent error class for all node errors.
|
|
33
|
+
*
|
|
20
34
|
* @group Errors/Node
|
|
21
35
|
*/
|
|
22
36
|
export declare class NodeError extends Error {
|
|
23
37
|
readonly node: string;
|
|
38
|
+
/**
|
|
39
|
+
* @param message The error message.
|
|
40
|
+
* @param node The node the error is about.
|
|
41
|
+
*/
|
|
24
42
|
constructor(message: string, node: typeof AResource | UnknownNode);
|
|
25
43
|
}
|
|
26
44
|
/**
|
|
45
|
+
* Thrown when a node's context cannot be derived, which usually means it was never attached to a parent.
|
|
46
|
+
*
|
|
27
47
|
* @group Errors/Node
|
|
28
48
|
*/
|
|
29
49
|
export declare class ContextNodeError extends NodeError {
|
|
50
|
+
/**
|
|
51
|
+
* @param message The error message.
|
|
52
|
+
* @param node The node whose context could not be derived.
|
|
53
|
+
*/
|
|
30
54
|
constructor(message: string, node: UnknownNode);
|
|
31
55
|
}
|
|
32
56
|
/**
|
|
57
|
+
* Thrown when a model is used in a way its own rules forbid, e.g. adding a child that already exists.
|
|
58
|
+
*
|
|
33
59
|
* @group Errors/Node
|
|
34
60
|
*/
|
|
35
61
|
export declare class ModelError extends NodeError {
|
|
62
|
+
/**
|
|
63
|
+
* @param message The error message.
|
|
64
|
+
* @param model The model the error is about.
|
|
65
|
+
*/
|
|
36
66
|
constructor(message: string, model: UnknownModel);
|
|
37
67
|
}
|
|
38
68
|
/**
|
|
69
|
+
* Thrown when an overlay is used in a way its own rules forbid.
|
|
70
|
+
*
|
|
39
71
|
* @group Errors/Node
|
|
40
72
|
*/
|
|
41
73
|
export declare class OverlayError extends NodeError {
|
|
74
|
+
/**
|
|
75
|
+
* @param message The error message.
|
|
76
|
+
* @param overlay The overlay the error is about.
|
|
77
|
+
*/
|
|
42
78
|
constructor(message: string, overlay: UnknownOverlay);
|
|
43
79
|
}
|
|
44
80
|
/**
|
|
81
|
+
* Thrown when a resource is used in a way its own rules forbid, e.g. an invalid resource ID.
|
|
82
|
+
*
|
|
45
83
|
* @group Errors/Node
|
|
46
84
|
*/
|
|
47
85
|
export declare class ResourceError extends NodeError {
|
|
86
|
+
/**
|
|
87
|
+
* @param message The error message.
|
|
88
|
+
* @param resource The resource the error is about.
|
|
89
|
+
*/
|
|
48
90
|
constructor(message: string, resource: typeof AResource | UnknownResource);
|
|
49
91
|
}
|
|
50
92
|
/**
|
|
93
|
+
* Thrown when a diff cannot be applied back onto a resource, because its field or action is not one the resource knows how to handle.
|
|
94
|
+
*
|
|
51
95
|
* @group Errors/Node
|
|
52
96
|
*/
|
|
53
97
|
export declare class DiffInverseResourceError extends ResourceError {
|
|
54
98
|
readonly diff: ReturnType<Diff['toJSON']>;
|
|
99
|
+
/**
|
|
100
|
+
* @param message The error message.
|
|
101
|
+
* @param resource The resource the diff was being applied to.
|
|
102
|
+
* @param diff The diff that could not be applied.
|
|
103
|
+
*/
|
|
55
104
|
constructor(message: string, resource: UnknownResource, diff: Diff);
|
|
56
105
|
}
|
|
57
106
|
/**
|
|
107
|
+
* Thrown when a resource is removed while other resources still depend on it. Carries the children that blocked it.
|
|
108
|
+
*
|
|
58
109
|
* @group Errors/Node
|
|
59
110
|
*/
|
|
60
111
|
export declare class RemoveResourceError extends ResourceError {
|
|
61
112
|
readonly childrenResources: string[];
|
|
113
|
+
/**
|
|
114
|
+
* @param message The error message.
|
|
115
|
+
* @param resource The resource that could not be removed.
|
|
116
|
+
* @param childrenResources The resources still depending on it.
|
|
117
|
+
*/
|
|
62
118
|
constructor(message: string, resource: UnknownResource, childrenResources: UnknownResource[]);
|
|
63
119
|
}
|