@quadnix/octo 0.0.22 → 0.0.24
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/dist/app.type.d.ts +236 -27
- package/dist/app.type.js +92 -1
- package/dist/app.type.js.map +1 -1
- package/dist/decorators/action.decorator.d.ts +4 -5
- package/dist/decorators/action.decorator.js +42 -41
- package/dist/decorators/action.decorator.js.map +1 -1
- package/dist/decorators/anchor.decorator.d.ts +2 -2
- package/dist/decorators/anchor.decorator.js +16 -11
- package/dist/decorators/anchor.decorator.js.map +1 -1
- package/dist/decorators/enable-hook.decorator.d.ts +5 -0
- package/dist/decorators/enable-hook.decorator.js +7 -2
- package/dist/decorators/enable-hook.decorator.js.map +1 -1
- package/dist/decorators/event-source.decorator.d.ts +5 -1
- package/dist/decorators/event-source.decorator.js +5 -1
- package/dist/decorators/event-source.decorator.js.map +1 -1
- package/dist/decorators/factory.decorator.d.ts +14 -2
- package/dist/decorators/factory.decorator.js +12 -3
- package/dist/decorators/factory.decorator.js.map +1 -1
- package/dist/decorators/model.decorator.d.ts +19 -5
- package/dist/decorators/model.decorator.js +40 -14
- package/dist/decorators/model.decorator.js.map +1 -1
- package/dist/decorators/module.decorator.d.ts +4 -75
- package/dist/decorators/module.decorator.js +18 -58
- package/dist/decorators/module.decorator.js.map +1 -1
- package/dist/decorators/on-event.decorator.d.ts +1 -1
- package/dist/decorators/on-event.decorator.js +1 -1
- package/dist/decorators/on-event.decorator.js.map +1 -1
- package/dist/decorators/overlay.decorator.d.ts +16 -6
- package/dist/decorators/overlay.decorator.js +36 -15
- package/dist/decorators/overlay.decorator.js.map +1 -1
- package/dist/decorators/resource.decorator.d.ts +17 -6
- package/dist/decorators/resource.decorator.js +37 -15
- package/dist/decorators/resource.decorator.js.map +1 -1
- package/dist/decorators/validate.decorator.d.ts +12 -4
- package/dist/decorators/validate.decorator.js +24 -2
- package/dist/decorators/validate.decorator.js.map +1 -1
- package/dist/errors/container.error.d.ts +20 -0
- package/dist/errors/container.error.js +29 -0
- package/dist/errors/container.error.js.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.js +7 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/input.error.d.ts +49 -0
- package/dist/errors/input.error.js +59 -0
- package/dist/errors/input.error.js.map +1 -0
- package/dist/errors/module.error.d.ts +7 -0
- package/dist/errors/module.error.js +11 -0
- package/dist/errors/module.error.js.map +1 -0
- package/dist/errors/node.error.d.ts +63 -0
- package/dist/errors/node.error.js +87 -0
- package/dist/errors/node.error.js.map +1 -0
- package/dist/errors/schema.error.d.ts +7 -0
- package/dist/errors/schema.error.js +11 -0
- package/dist/errors/schema.error.js.map +1 -0
- package/dist/errors/transaction.error.d.ts +56 -0
- package/dist/errors/transaction.error.js +79 -0
- package/dist/errors/transaction.error.js.map +1 -0
- package/dist/events/action.event.d.ts +14 -0
- package/dist/events/action.event.js +12 -0
- package/dist/events/action.event.js.map +1 -0
- package/dist/events/event.model.d.ts +8 -12
- package/dist/events/event.model.js +7 -11
- package/dist/events/event.model.js.map +1 -1
- package/dist/events/hook/commit.hook.event.d.ts +28 -0
- package/dist/events/hook/commit.hook.event.js +29 -0
- package/dist/events/hook/commit.hook.event.js.map +1 -0
- package/dist/events/hook/hook.event.d.ts +10 -0
- package/dist/events/hook/hook.event.js +11 -0
- package/dist/events/hook/hook.event.js.map +1 -0
- package/dist/events/hook/index.d.ts +4 -0
- package/dist/events/hook/index.js +5 -0
- package/dist/events/hook/index.js.map +1 -0
- package/dist/events/hook/model.hook.event.d.ts +28 -0
- package/dist/events/hook/model.hook.event.js +29 -0
- package/dist/events/hook/model.hook.event.js.map +1 -0
- package/dist/events/hook/resource.hook.event.d.ts +28 -0
- package/dist/events/hook/resource.hook.event.js +29 -0
- package/dist/events/hook/resource.hook.event.js.map +1 -0
- package/dist/events/index.d.ts +7 -0
- package/dist/events/index.js +8 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/module.event.d.ts +3 -7
- package/dist/events/module.event.js +2 -6
- package/dist/events/module.event.js.map +1 -1
- package/dist/events/registration.event.d.ts +22 -57
- package/dist/events/registration.event.js +29 -70
- package/dist/events/registration.event.js.map +1 -1
- package/dist/events/serialization.event.d.ts +34 -41
- package/dist/events/serialization.event.js +59 -37
- package/dist/events/serialization.event.js.map +1 -1
- package/dist/events/transaction.event.d.ts +72 -29
- package/dist/events/transaction.event.js +63 -27
- package/dist/events/transaction.event.js.map +1 -1
- package/dist/functions/container/container.d.ts +56 -9
- package/dist/functions/container/container.js +108 -19
- package/dist/functions/container/container.js.map +1 -1
- package/dist/functions/container/test-container.d.ts +11 -13
- package/dist/functions/container/test-container.js +35 -38
- package/dist/functions/container/test-container.js.map +1 -1
- package/dist/functions/dependency/dependency.d.ts +9 -0
- package/dist/functions/dependency/dependency.js +10 -3
- package/dist/functions/dependency/dependency.js.map +1 -1
- package/dist/functions/diff/diff-metadata.d.ts +6 -5
- package/dist/functions/diff/diff-metadata.js +6 -2
- package/dist/functions/diff/diff-metadata.js.map +1 -1
- package/dist/functions/diff/diff.d.ts +16 -5
- package/dist/functions/diff/diff.js +11 -4
- package/dist/functions/diff/diff.js.map +1 -1
- package/dist/functions/diff/diff.utility.d.ts +5 -2
- package/dist/functions/diff/diff.utility.js +28 -4
- package/dist/functions/diff/diff.utility.js.map +1 -1
- package/dist/functions/hook/commit.hook.d.ts +17 -3
- package/dist/functions/hook/commit.hook.js +19 -16
- package/dist/functions/hook/commit.hook.js.map +1 -1
- package/dist/functions/hook/hook.interface.d.ts +10 -6
- package/dist/functions/hook/model-action.hook.d.ts +20 -5
- package/dist/functions/hook/model-action.hook.js +23 -39
- package/dist/functions/hook/model-action.hook.js.map +1 -1
- package/dist/functions/hook/resource-action.hook.d.ts +20 -5
- package/dist/functions/hook/resource-action.hook.js +21 -18
- package/dist/functions/hook/resource-action.hook.js.map +1 -1
- package/dist/functions/node/node-action.abstract.d.ts +10 -0
- package/dist/functions/node/node-action.abstract.js +23 -0
- package/dist/functions/node/node-action.abstract.js.map +1 -0
- package/dist/functions/node/node.abstract.d.ts +20 -9
- package/dist/functions/node/node.abstract.js +101 -32
- package/dist/functions/node/node.abstract.js.map +1 -1
- package/dist/functions/node/node.interface.d.ts +22 -18
- package/dist/functions/schema/schema.d.ts +21 -0
- package/dist/functions/schema/schema.js +55 -0
- package/dist/functions/schema/schema.js.map +1 -0
- package/dist/index.d.ts +31 -32
- package/dist/index.js +29 -12
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +32 -15
- package/dist/main.js +65 -50
- package/dist/main.js.map +1 -1
- package/dist/models/account/account.model.d.ts +26 -0
- package/dist/models/account/account.model.js +71 -0
- package/dist/models/account/account.model.js.map +1 -0
- package/dist/models/account/account.schema.d.ts +13 -0
- package/dist/models/account/account.schema.js +18 -0
- package/dist/models/account/account.schema.js.map +1 -0
- package/dist/models/app/app.model.d.ts +9 -14
- package/dist/models/app/app.model.js +27 -27
- 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 +24 -0
- package/dist/models/app/app.schema.js.map +1 -0
- package/dist/models/deployment/deployment.model.d.ts +9 -12
- package/dist/models/deployment/deployment.model.js +11 -11
- package/dist/models/deployment/deployment.model.js.map +1 -1
- package/dist/models/deployment/deployment.schema.d.ts +10 -0
- package/dist/models/deployment/deployment.schema.js +28 -0
- package/dist/models/deployment/deployment.schema.js.map +1 -0
- package/dist/models/environment/environment.model.d.ts +8 -14
- package/dist/models/environment/environment.model.js +10 -22
- package/dist/models/environment/environment.model.js.map +1 -1
- package/dist/models/environment/environment.schema.d.ts +16 -0
- package/dist/models/environment/environment.schema.js +41 -0
- package/dist/models/environment/environment.schema.js.map +1 -0
- package/dist/models/execution/execution.model.d.ts +9 -13
- package/dist/models/execution/execution.model.js +18 -25
- package/dist/models/execution/execution.model.js.map +1 -1
- package/dist/models/execution/execution.schema.d.ts +17 -0
- package/dist/models/execution/execution.schema.js +37 -0
- package/dist/models/execution/execution.schema.js.map +1 -0
- package/dist/models/filesystem/filesystem.model.d.ts +13 -0
- package/dist/models/filesystem/filesystem.model.js +46 -0
- package/dist/models/filesystem/filesystem.model.js.map +1 -0
- package/dist/models/filesystem/filesystem.schema.d.ts +6 -0
- package/dist/models/filesystem/filesystem.schema.js +24 -0
- package/dist/models/filesystem/filesystem.schema.js.map +1 -0
- package/dist/models/image/image.model.d.ts +10 -40
- package/dist/models/image/image.model.js +17 -27
- package/dist/models/image/image.model.js.map +1 -1
- package/dist/models/image/image.schema.d.ts +12 -0
- package/dist/models/image/image.schema.js +34 -0
- package/dist/models/image/image.schema.js.map +1 -0
- package/dist/models/model-action.interface.d.ts +5 -13
- package/dist/models/model.abstract.d.ts +28 -13
- package/dist/models/model.abstract.js +179 -13
- package/dist/models/model.abstract.js.map +1 -1
- package/dist/models/model.interface.d.ts +17 -6
- package/dist/models/pipeline/pipeline.model.d.ts +8 -7
- package/dist/models/pipeline/pipeline.model.js +10 -10
- package/dist/models/pipeline/pipeline.model.js.map +1 -1
- package/dist/models/pipeline/pipeline.schema.d.ts +7 -0
- package/dist/models/pipeline/pipeline.schema.js +25 -0
- package/dist/models/pipeline/pipeline.schema.js.map +1 -0
- package/dist/models/region/region.model.d.ts +11 -8
- package/dist/models/region/region.model.js +25 -12
- 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 +24 -0
- package/dist/models/region/region.schema.js.map +1 -0
- package/dist/models/server/server.model.d.ts +8 -10
- package/dist/models/server/server.model.js +13 -11
- package/dist/models/server/server.model.js.map +1 -1
- package/dist/models/server/server.schema.d.ts +9 -0
- package/dist/models/server/server.schema.js +27 -0
- package/dist/models/server/server.schema.js.map +1 -0
- package/dist/models/service/service.model.d.ts +7 -9
- package/dist/models/service/service.model.js +15 -13
- package/dist/models/service/service.model.js.map +1 -1
- package/dist/models/service/service.schema.d.ts +9 -0
- package/dist/models/service/service.schema.js +27 -0
- package/dist/models/service/service.schema.js.map +1 -0
- package/dist/models/subnet/subnet.model.d.ts +11 -33
- package/dist/models/subnet/subnet.model.js +14 -34
- package/dist/models/subnet/subnet.model.js.map +1 -1
- package/dist/models/subnet/subnet.schema.d.ts +38 -0
- package/dist/models/subnet/subnet.schema.js +53 -0
- package/dist/models/subnet/subnet.schema.js.map +1 -0
- package/dist/modules/module.abstract.d.ts +24 -0
- package/dist/modules/module.abstract.js +17 -0
- package/dist/modules/module.abstract.js.map +1 -0
- package/dist/modules/module.container.d.ts +38 -18
- package/dist/modules/module.container.js +140 -81
- package/dist/modules/module.container.js.map +1 -1
- package/dist/modules/module.interface.d.ts +18 -2
- package/dist/modules/test-module.container.d.ts +39 -15
- package/dist/modules/test-module.container.js +262 -26
- package/dist/modules/test-module.container.js.map +1 -1
- package/dist/overlays/anchor.abstract.d.ts +16 -8
- package/dist/overlays/anchor.abstract.js +4 -1
- package/dist/overlays/anchor.abstract.js.map +1 -1
- package/dist/overlays/anchor.interface.d.ts +8 -8
- package/dist/overlays/anchor.schema.d.ts +14 -0
- package/dist/overlays/anchor.schema.js +12 -0
- package/dist/overlays/anchor.schema.js.map +1 -0
- package/dist/overlays/overlay-data.repository.d.ts +9 -4
- package/dist/overlays/overlay-data.repository.js +20 -10
- package/dist/overlays/overlay-data.repository.js.map +1 -1
- package/dist/overlays/overlay.abstract.d.ts +15 -13
- package/dist/overlays/overlay.abstract.js +22 -8
- package/dist/overlays/overlay.abstract.js.map +1 -1
- package/dist/overlays/overlay.interface.d.ts +6 -7
- package/dist/overlays/overlay.schema.d.ts +11 -0
- package/dist/overlays/overlay.schema.js +12 -0
- package/dist/overlays/overlay.schema.js.map +1 -0
- package/dist/resources/resource-action.interface.d.ts +7 -3
- package/dist/resources/resource-data.repository.d.ts +8 -3
- package/dist/resources/resource-data.repository.js +64 -82
- package/dist/resources/resource-data.repository.js.map +1 -1
- package/dist/resources/resource.abstract.d.ts +53 -27
- package/dist/resources/resource.abstract.js +233 -57
- package/dist/resources/resource.abstract.js.map +1 -1
- package/dist/resources/resource.interface.d.ts +45 -8
- package/dist/resources/resource.schema.d.ts +17 -0
- package/dist/resources/resource.schema.js +14 -0
- package/dist/resources/resource.schema.js.map +1 -0
- package/dist/services/capture/capture.service.d.ts +12 -6
- package/dist/services/capture/capture.service.js +14 -5
- package/dist/services/capture/capture.service.js.map +1 -1
- package/dist/services/event/event.service.d.ts +8 -2
- package/dist/services/event/event.service.js +9 -2
- package/dist/services/event/event.service.js.map +1 -1
- package/dist/services/input/input.service.d.ts +68 -6
- package/dist/services/input/input.service.js +296 -14
- package/dist/services/input/input.service.js.map +1 -1
- package/dist/services/schema-translation/schema-translation.service.d.ts +19 -0
- package/dist/services/schema-translation/schema-translation.service.js +48 -0
- package/dist/services/schema-translation/schema-translation.service.js.map +1 -0
- package/dist/services/serialization/model/model-serialization.service.d.ts +7 -4
- package/dist/services/serialization/model/model-serialization.service.js +65 -33
- package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
- package/dist/services/serialization/resource/resource-serialization.service.d.ts +7 -1
- package/dist/services/serialization/resource/resource-serialization.service.js +64 -80
- package/dist/services/serialization/resource/resource-serialization.service.js.map +1 -1
- package/dist/services/state-management/local.state-provider.d.ts +3 -1
- package/dist/services/state-management/local.state-provider.js +8 -7
- package/dist/services/state-management/local.state-provider.js.map +1 -1
- package/dist/services/state-management/state-management.service.d.ts +8 -3
- package/dist/services/state-management/state-management.service.js +25 -8
- package/dist/services/state-management/state-management.service.js.map +1 -1
- package/dist/services/state-management/state-provider.interface.d.ts +3 -1
- package/dist/services/state-management/test.state-provider.d.ts +3 -1
- package/dist/services/state-management/test.state-provider.js +5 -1
- package/dist/services/state-management/test.state-provider.js.map +1 -1
- package/dist/services/transaction/transaction.service.d.ts +22 -11
- package/dist/services/transaction/transaction.service.js +215 -66
- package/dist/services/transaction/transaction.service.js.map +1 -1
- package/dist/services/validation/validation.service.d.ts +8 -3
- package/dist/services/validation/validation.service.js +33 -12
- 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/cidr/cidr.utility.d.ts +3 -0
- package/dist/utilities/cidr/cidr.utility.js +3 -0
- package/dist/utilities/cidr/cidr.utility.js.map +1 -1
- package/dist/utilities/node/node.utility.d.ts +7 -0
- package/dist/utilities/node/node.utility.js +25 -0
- package/dist/utilities/node/node.utility.js.map +1 -0
- package/dist/utilities/object/object.utility.d.ts +6 -0
- package/dist/utilities/object/object.utility.js +36 -0
- package/dist/utilities/object/object.utility.js.map +1 -1
- package/dist/utilities/test-helpers/test-classes.d.ts +84 -0
- package/dist/utilities/test-helpers/test-classes.js +103 -0
- package/dist/utilities/test-helpers/test-classes.js.map +1 -0
- package/dist/utilities/test-helpers/test-models.d.ts +47 -0
- package/dist/utilities/test-helpers/test-models.js +230 -0
- package/dist/utilities/test-helpers/test-models.js.map +1 -0
- package/dist/utilities/test-helpers/test-overlays.d.ts +13 -0
- package/dist/utilities/test-helpers/test-overlays.js +56 -0
- package/dist/utilities/test-helpers/test-overlays.js.map +1 -0
- package/dist/utilities/test-helpers/test-resources.d.ts +31 -0
- package/dist/utilities/test-helpers/test-resources.js +171 -0
- package/dist/utilities/test-helpers/test-resources.js.map +1 -0
- package/dist/utilities/validation/validation.utility.d.ts +34 -3
- package/dist/utilities/validation/validation.utility.js +124 -2
- package/dist/utilities/validation/validation.utility.js.map +1 -1
- package/package.json +7 -7
- package/dist/events/error.event.d.ts +0 -35
- package/dist/events/error.event.js +0 -36
- package/dist/events/error.event.js.map +0 -1
- package/dist/events/hook.event.d.ts +0 -194
- package/dist/events/hook.event.js +0 -195
- package/dist/events/hook.event.js.map +0 -1
- package/dist/models/app/app.interface.d.ts +0 -9
- package/dist/models/app/app.interface.js +0 -2
- package/dist/models/app/app.interface.js.map +0 -1
- package/dist/models/deployment/deployment.interface.d.ts +0 -9
- package/dist/models/deployment/deployment.interface.js +0 -2
- package/dist/models/deployment/deployment.interface.js.map +0 -1
- package/dist/models/environment/environment.interface.d.ts +0 -12
- package/dist/models/environment/environment.interface.js +0 -2
- package/dist/models/environment/environment.interface.js.map +0 -1
- package/dist/models/execution/execution.interface.d.ts +0 -14
- package/dist/models/execution/execution.interface.js +0 -2
- package/dist/models/execution/execution.interface.js.map +0 -1
- package/dist/models/image/image.interface.d.ts +0 -12
- package/dist/models/image/image.interface.js +0 -2
- package/dist/models/image/image.interface.js.map +0 -1
- package/dist/models/pipeline/pipeline.interface.d.ts +0 -10
- package/dist/models/pipeline/pipeline.interface.js +0 -2
- package/dist/models/pipeline/pipeline.interface.js.map +0 -1
- package/dist/models/region/region.interface.d.ts +0 -9
- package/dist/models/region/region.interface.js +0 -2
- package/dist/models/region/region.interface.js.map +0 -1
- package/dist/models/server/server.interface.d.ts +0 -9
- package/dist/models/server/server.interface.js +0 -2
- package/dist/models/server/server.interface.js.map +0 -1
- package/dist/models/service/service.interface.d.ts +0 -9
- package/dist/models/service/service.interface.js +0 -2
- package/dist/models/service/service.interface.js.map +0 -1
- package/dist/models/subnet/subnet.interface.d.ts +0 -13
- package/dist/models/subnet/subnet.interface.js +0 -2
- package/dist/models/subnet/subnet.interface.js.map +0 -1
- package/dist/overlays/overlay.service.d.ts +0 -17
- package/dist/overlays/overlay.service.js +0 -41
- package/dist/overlays/overlay.service.js.map +0 -1
- package/dist/resources/shared-resource.abstract.d.ts +0 -13
- package/dist/resources/shared-resource.abstract.js +0 -47
- package/dist/resources/shared-resource.abstract.js.map +0 -1
|
@@ -1,14 +1,25 @@
|
|
|
1
|
+
import { type Constructable, type ResourceSchema, type UnknownResource } from '../app.type.js';
|
|
1
2
|
/**
|
|
2
|
-
* A `@Resource` is a class decorator
|
|
3
|
-
* - A resource must extend the {@link AResource} class.
|
|
3
|
+
* A `@Resource` is a class decorator and must be placed on top of a class representing a resource.
|
|
4
|
+
* - A resource must also extend the {@link AResource} class.
|
|
5
|
+
* - For type safety, the type of resource being decorated is passed to the decorator.
|
|
4
6
|
*
|
|
5
7
|
* @example
|
|
6
8
|
* ```ts
|
|
7
|
-
* @Resource()
|
|
8
|
-
* export class MyResource extends AResource<MyResource> { ... }
|
|
9
|
+
* @Resource<MyResource>('@example', 'my-name', MyResourceSchema)
|
|
10
|
+
* export class MyResource extends AResource<MyResourceSchema, MyResource> { ... }
|
|
9
11
|
* ```
|
|
12
|
+
*
|
|
10
13
|
* @group Decorators
|
|
14
|
+
*
|
|
15
|
+
* @param packageName - The name of the package under which the resource is registered.
|
|
16
|
+
* Selecting a unique package name helps avoid collisions between same resource class names across different libraries.
|
|
17
|
+
* You will reuse the same package name throughout your library for different Octo components you create.
|
|
18
|
+
* @param resourceName - a string that uniquely represents the name of the resource.
|
|
19
|
+
* @param schema - The schema of the resource.
|
|
20
|
+
*
|
|
11
21
|
* @returns The decorated class.
|
|
12
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* @see Definition of [Resources](/docs/fundamentals/resources).
|
|
13
24
|
*/
|
|
14
|
-
export declare function Resource(): (constructor: any) => void;
|
|
25
|
+
export declare function Resource<T extends UnknownResource>(packageName: string, resourceName: string, schema: Constructable<ResourceSchema<T>>): (constructor: any) => void;
|
|
@@ -1,29 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EventService } from '../services/event/event.service.js';
|
|
3
|
-
import { ResourceSerializationService } from '../services/serialization/resource/resource-serialization.service.js';
|
|
1
|
+
import { NodeType } from '../app.type.js';
|
|
4
2
|
import { Container } from '../functions/container/container.js';
|
|
3
|
+
import { AResource } from '../resources/resource.abstract.js';
|
|
4
|
+
import { ResourceSerializationService } from '../services/serialization/resource/resource-serialization.service.js';
|
|
5
|
+
import { ValidationUtility } from '../utilities/validation/validation.utility.js';
|
|
5
6
|
/**
|
|
6
|
-
* A `@Resource` is a class decorator
|
|
7
|
-
* - A resource must extend the {@link AResource} class.
|
|
7
|
+
* A `@Resource` is a class decorator and must be placed on top of a class representing a resource.
|
|
8
|
+
* - A resource must also extend the {@link AResource} class.
|
|
9
|
+
* - For type safety, the type of resource being decorated is passed to the decorator.
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* ```ts
|
|
11
|
-
* @Resource()
|
|
12
|
-
* export class MyResource extends AResource<MyResource> { ... }
|
|
13
|
+
* @Resource<MyResource>('@example', 'my-name', MyResourceSchema)
|
|
14
|
+
* export class MyResource extends AResource<MyResourceSchema, MyResource> { ... }
|
|
13
15
|
* ```
|
|
16
|
+
*
|
|
14
17
|
* @group Decorators
|
|
18
|
+
*
|
|
19
|
+
* @param packageName - The name of the package under which the resource is registered.
|
|
20
|
+
* Selecting a unique package name helps avoid collisions between same resource class names across different libraries.
|
|
21
|
+
* You will reuse the same package name throughout your library for different Octo components you create.
|
|
22
|
+
* @param resourceName - a string that uniquely represents the name of the resource.
|
|
23
|
+
* @param schema - The schema of the resource.
|
|
24
|
+
*
|
|
15
25
|
* @returns The decorated class.
|
|
16
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* @see Definition of [Resources](/docs/fundamentals/resources).
|
|
17
28
|
*/
|
|
18
|
-
export function Resource() {
|
|
29
|
+
export function Resource(packageName, resourceName, schema) {
|
|
30
|
+
const container = Container.getInstance();
|
|
19
31
|
return function (constructor) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
if (!ValidationUtility.validateRegex(packageName, /^[@A-Za-z][\w-]+[A-Za-z]$/)) {
|
|
33
|
+
throw new Error(`Invalid package name: ${packageName}`);
|
|
34
|
+
}
|
|
35
|
+
if (!ValidationUtility.validateRegex(resourceName, /^[A-Za-z][\w-]+[A-Za-z]$/)) {
|
|
36
|
+
throw new Error(`Invalid resource name: ${resourceName}`);
|
|
37
|
+
}
|
|
38
|
+
if (!(constructor.prototype instanceof AResource)) {
|
|
39
|
+
throw new Error(`Class "${constructor.name}" must extend the AResource class!`);
|
|
40
|
+
}
|
|
41
|
+
constructor.NODE_NAME = resourceName;
|
|
42
|
+
constructor.NODE_PACKAGE = packageName;
|
|
43
|
+
constructor.NODE_SCHEMA = schema;
|
|
44
|
+
constructor.NODE_TYPE = NodeType.RESOURCE;
|
|
45
|
+
const promise = container.get(ResourceSerializationService).then((resourceSerializationService) => {
|
|
46
|
+
resourceSerializationService.registerClass(`${packageName}/${constructor.name}`, constructor);
|
|
26
47
|
});
|
|
48
|
+
container.registerStartupUnhandledPromise(promise);
|
|
27
49
|
};
|
|
28
50
|
}
|
|
29
51
|
//# sourceMappingURL=resource.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.decorator.js","sourceRoot":"","sources":["../../src/decorators/resource.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,QAAQ,CACtB,WAAmB,EACnB,YAAoB,EACpB,MAAwC;IAExC,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,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;QAE1C,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"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type { ValidationType } from '../app.type.js';
|
|
1
|
+
import type { ValidationType, ValidationTypeOptions } from '../app.type.js';
|
|
2
2
|
type ValidationOptions<T> = {
|
|
3
|
+
destruct?: (value: any) => T[];
|
|
3
4
|
options: {
|
|
4
|
-
[key in ValidationType]?:
|
|
5
|
+
[key in ValidationType]?: ValidationTypeOptions[key];
|
|
5
6
|
};
|
|
6
|
-
destruct?: (value: any) => T[];
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A `@Validate` is a property decorator to validate a property.
|
|
10
|
+
* It is typically used in {@link Schema} to validate schema properties.
|
|
11
|
+
*
|
|
12
|
+
* @group Decorators
|
|
13
|
+
*
|
|
14
|
+
* @see Techniques for [Validation](/docs/techniques/validation).
|
|
15
|
+
*/
|
|
16
|
+
export declare function Validate<T>(validators: ValidationOptions<T> | ValidationOptions<T>[], transform?: (value: any) => any): (target: any, propertyKey: string) => void;
|
|
9
17
|
export {};
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
+
import { ValidationTransactionError } from '../errors/index.js';
|
|
1
2
|
import { ValidationService } from '../services/validation/validation.service.js';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A `@Validate` is a property decorator to validate a property.
|
|
5
|
+
* It is typically used in {@link Schema} to validate schema properties.
|
|
6
|
+
*
|
|
7
|
+
* @group Decorators
|
|
8
|
+
*
|
|
9
|
+
* @see Techniques for [Validation](/docs/techniques/validation).
|
|
10
|
+
*/
|
|
11
|
+
export function Validate(validators, transform) {
|
|
3
12
|
return function (target, propertyKey) {
|
|
4
13
|
const symbol = Symbol();
|
|
5
14
|
Object.defineProperty(target, propertyKey, {
|
|
15
|
+
enumerable: true,
|
|
6
16
|
get: function () {
|
|
7
17
|
return this[symbol];
|
|
8
18
|
},
|
|
9
19
|
set: function (newValue) {
|
|
20
|
+
if (newValue === undefined) {
|
|
21
|
+
this[symbol] = undefined;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (transform) {
|
|
25
|
+
newValue = transform(newValue);
|
|
26
|
+
}
|
|
10
27
|
if (!Array.isArray(validators)) {
|
|
11
28
|
validators = [validators];
|
|
12
29
|
}
|
|
30
|
+
const validationService = new ValidationService();
|
|
13
31
|
for (const validator of validators) {
|
|
14
32
|
for (const [type, constraint] of Object.entries(validator.options)) {
|
|
15
|
-
|
|
33
|
+
validationService.addSubject(type, constraint, target, propertyKey, newValue, validator.destruct);
|
|
16
34
|
}
|
|
17
35
|
}
|
|
36
|
+
const result = validationService.validate();
|
|
37
|
+
if (!result.pass) {
|
|
38
|
+
throw new ValidationTransactionError('Validation error!', result);
|
|
39
|
+
}
|
|
18
40
|
this[symbol] = newValue;
|
|
19
41
|
},
|
|
20
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.decorator.js","sourceRoot":"","sources":["../../src/decorators/validate.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAOjF,MAAM,UAAU,QAAQ,CACtB,UAAyD;
|
|
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;;;;;;;GAOG;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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Constructable } from '../app.type.js';
|
|
2
|
+
/**
|
|
3
|
+
* @group Errors/Container
|
|
4
|
+
*/
|
|
5
|
+
export declare class ContainerError extends Error {
|
|
6
|
+
readonly type: string;
|
|
7
|
+
constructor(message: string, type: Constructable<unknown> | string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @group Errors/Container
|
|
11
|
+
*/
|
|
12
|
+
export declare class ContainerRegistrationError extends ContainerError {
|
|
13
|
+
constructor(message: string, type: Constructable<unknown> | string);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @group Errors/Container
|
|
17
|
+
*/
|
|
18
|
+
export declare class ContainerResolutionError extends ContainerError {
|
|
19
|
+
constructor(message: string, type: Constructable<unknown> | string);
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @group Errors/Container
|
|
3
|
+
*/
|
|
4
|
+
export class ContainerError extends Error {
|
|
5
|
+
constructor(message, type) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.type = typeof type === 'string' ? type : type.name;
|
|
8
|
+
Object.setPrototypeOf(this, ContainerError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @group Errors/Container
|
|
13
|
+
*/
|
|
14
|
+
export class ContainerRegistrationError extends ContainerError {
|
|
15
|
+
constructor(message, type) {
|
|
16
|
+
super(message, type);
|
|
17
|
+
Object.setPrototypeOf(this, ContainerRegistrationError.prototype);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @group Errors/Container
|
|
22
|
+
*/
|
|
23
|
+
export class ContainerResolutionError extends ContainerError {
|
|
24
|
+
constructor(message, type) {
|
|
25
|
+
super(message, type);
|
|
26
|
+
Object.setPrototypeOf(this, ContainerResolutionError.prototype);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=container.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.error.js","sourceRoot":"","sources":["../../src/errors/container.error.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAGvC,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;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IAC5D,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;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAC1D,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"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parent error class for all input errors.
|
|
3
|
+
*
|
|
4
|
+
* @group Errors/Input
|
|
5
|
+
*/
|
|
6
|
+
export declare class InputError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new instance.
|
|
9
|
+
*
|
|
10
|
+
* @param message The error message.
|
|
11
|
+
*/
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Error class for input registration errors.
|
|
16
|
+
* This error is thrown when an input key cannot be registered,
|
|
17
|
+
* either because it has already been registered, or is not a valid input key,
|
|
18
|
+
* or is not a valid input value.
|
|
19
|
+
*
|
|
20
|
+
* @group Errors/Input
|
|
21
|
+
*/
|
|
22
|
+
export declare class InputRegistrationError extends InputError {
|
|
23
|
+
readonly inputKey: string;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new instance.
|
|
26
|
+
*
|
|
27
|
+
* @param message The error message.
|
|
28
|
+
* @param inputKey The input key for which the error occurred.
|
|
29
|
+
*/
|
|
30
|
+
constructor(message: string, inputKey: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Error class for input resolution errors.
|
|
34
|
+
* This error is thrown when an input key cannot be resolved at runtime.
|
|
35
|
+
* Some common reasons include invalid values found during resolution,
|
|
36
|
+
* or invalid references used to resolve the input key.
|
|
37
|
+
*
|
|
38
|
+
* @group Errors/Input
|
|
39
|
+
*/
|
|
40
|
+
export declare class InputResolutionError extends InputError {
|
|
41
|
+
readonly inputKey: string;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new instance.
|
|
44
|
+
*
|
|
45
|
+
* @param message The error message.
|
|
46
|
+
* @param inputKey The input key for which the error occurred.
|
|
47
|
+
*/
|
|
48
|
+
constructor(message: string, inputKey: string);
|
|
49
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parent error class for all input errors.
|
|
3
|
+
*
|
|
4
|
+
* @group Errors/Input
|
|
5
|
+
*/
|
|
6
|
+
export class InputError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new instance.
|
|
9
|
+
*
|
|
10
|
+
* @param message The error message.
|
|
11
|
+
*/
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
Object.setPrototypeOf(this, InputError.prototype);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error class for input registration errors.
|
|
19
|
+
* This error is thrown when an input key cannot be registered,
|
|
20
|
+
* either because it has already been registered, or is not a valid input key,
|
|
21
|
+
* or is not a valid input value.
|
|
22
|
+
*
|
|
23
|
+
* @group Errors/Input
|
|
24
|
+
*/
|
|
25
|
+
export class InputRegistrationError extends InputError {
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new instance.
|
|
28
|
+
*
|
|
29
|
+
* @param message The error message.
|
|
30
|
+
* @param inputKey The input key for which the error occurred.
|
|
31
|
+
*/
|
|
32
|
+
constructor(message, inputKey) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.inputKey = inputKey;
|
|
35
|
+
Object.setPrototypeOf(this, InputRegistrationError.prototype);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Error class for input resolution errors.
|
|
40
|
+
* This error is thrown when an input key cannot be resolved at runtime.
|
|
41
|
+
* Some common reasons include invalid values found during resolution,
|
|
42
|
+
* or invalid references used to resolve the input key.
|
|
43
|
+
*
|
|
44
|
+
* @group Errors/Input
|
|
45
|
+
*/
|
|
46
|
+
export class InputResolutionError extends InputError {
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new instance.
|
|
49
|
+
*
|
|
50
|
+
* @param message The error message.
|
|
51
|
+
* @param inputKey The input key for which the error occurred.
|
|
52
|
+
*/
|
|
53
|
+
constructor(message, inputKey) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.inputKey = inputKey;
|
|
56
|
+
Object.setPrototypeOf(this, InputResolutionError.prototype);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=input.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.error.js","sourceRoot":"","sources":["../../src/errors/input.error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC;;;;OAIG;IACH,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,sBAAuB,SAAQ,UAAU;IAGpD;;;;;OAKG;IACH,YAAY,OAAe,EAAE,QAAgB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAGlD;;;;;OAKG;IACH,YAAY,OAAe,EAAE,QAAgB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @group Errors/Module
|
|
3
|
+
*/
|
|
4
|
+
export class ModuleError extends Error {
|
|
5
|
+
constructor(message, moduleName) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.module = moduleName;
|
|
8
|
+
Object.setPrototypeOf(this, ModuleError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=module.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.error.js","sourceRoot":"","sources":["../../src/errors/module.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGpC,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"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { UnknownModel, UnknownNode, UnknownOverlay, UnknownResource } from '../app.type.js';
|
|
2
|
+
import type { Dependency, IDependency } from '../functions/dependency/dependency.js';
|
|
3
|
+
import type { Diff } from '../functions/diff/diff.js';
|
|
4
|
+
import type { AResource } from '../resources/resource.abstract.js';
|
|
5
|
+
/**
|
|
6
|
+
* @group Errors/Node
|
|
7
|
+
*/
|
|
8
|
+
export declare class DependencyError extends Error {
|
|
9
|
+
readonly dependency: IDependency;
|
|
10
|
+
constructor(message: string, dependency: Dependency);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @group Errors/Node
|
|
14
|
+
*/
|
|
15
|
+
export declare class NodeUnsynthError extends Error {
|
|
16
|
+
readonly subject: string;
|
|
17
|
+
constructor(message: string, subject: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @group Errors/Node
|
|
21
|
+
*/
|
|
22
|
+
export declare class NodeError extends Error {
|
|
23
|
+
readonly node: string;
|
|
24
|
+
constructor(message: string, node: typeof AResource | UnknownNode);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @group Errors/Node
|
|
28
|
+
*/
|
|
29
|
+
export declare class ContextNodeError extends NodeError {
|
|
30
|
+
constructor(message: string, node: UnknownNode);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @group Errors/Node
|
|
34
|
+
*/
|
|
35
|
+
export declare class ModelError extends NodeError {
|
|
36
|
+
constructor(message: string, model: UnknownModel);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @group Errors/Node
|
|
40
|
+
*/
|
|
41
|
+
export declare class OverlayError extends NodeError {
|
|
42
|
+
constructor(message: string, overlay: UnknownOverlay);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @group Errors/Node
|
|
46
|
+
*/
|
|
47
|
+
export declare class ResourceError extends NodeError {
|
|
48
|
+
constructor(message: string, resource: typeof AResource | UnknownResource);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @group Errors/Node
|
|
52
|
+
*/
|
|
53
|
+
export declare class DiffInverseResourceError extends ResourceError {
|
|
54
|
+
readonly diff: ReturnType<Diff['toJSON']>;
|
|
55
|
+
constructor(message: string, resource: UnknownResource, diff: Diff);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @group Errors/Node
|
|
59
|
+
*/
|
|
60
|
+
export declare class RemoveResourceError extends ResourceError {
|
|
61
|
+
readonly childrenResources: string[];
|
|
62
|
+
constructor(message: string, resource: UnknownResource, childrenResources: UnknownResource[]);
|
|
63
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @group Errors/Node
|
|
3
|
+
*/
|
|
4
|
+
export class DependencyError extends Error {
|
|
5
|
+
constructor(message, dependency) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.dependency = dependency.synth();
|
|
8
|
+
Object.setPrototypeOf(this, DependencyError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @group Errors/Node
|
|
13
|
+
*/
|
|
14
|
+
export class NodeUnsynthError extends Error {
|
|
15
|
+
constructor(message, subject) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.subject = subject;
|
|
18
|
+
Object.setPrototypeOf(this, NodeUnsynthError.prototype);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @group Errors/Node
|
|
23
|
+
*/
|
|
24
|
+
export class NodeError extends Error {
|
|
25
|
+
constructor(message, node) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.node = node.NODE_NAME || node.constructor.NODE_NAME;
|
|
28
|
+
Object.setPrototypeOf(this, NodeError.prototype);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @group Errors/Node
|
|
33
|
+
*/
|
|
34
|
+
export class ContextNodeError extends NodeError {
|
|
35
|
+
constructor(message, node) {
|
|
36
|
+
super(message, node);
|
|
37
|
+
Object.setPrototypeOf(this, ContextNodeError.prototype);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @group Errors/Node
|
|
42
|
+
*/
|
|
43
|
+
export class ModelError extends NodeError {
|
|
44
|
+
constructor(message, model) {
|
|
45
|
+
super(message, model);
|
|
46
|
+
Object.setPrototypeOf(this, ModelError.prototype);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @group Errors/Node
|
|
51
|
+
*/
|
|
52
|
+
export class OverlayError extends NodeError {
|
|
53
|
+
constructor(message, overlay) {
|
|
54
|
+
super(message, overlay);
|
|
55
|
+
Object.setPrototypeOf(this, OverlayError.prototype);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @group Errors/Node
|
|
60
|
+
*/
|
|
61
|
+
export class ResourceError extends NodeError {
|
|
62
|
+
constructor(message, resource) {
|
|
63
|
+
super(message, resource);
|
|
64
|
+
Object.setPrototypeOf(this, ResourceError.prototype);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @group Errors/Node
|
|
69
|
+
*/
|
|
70
|
+
export class DiffInverseResourceError extends ResourceError {
|
|
71
|
+
constructor(message, resource, diff) {
|
|
72
|
+
super(message, resource);
|
|
73
|
+
this.diff = diff.toJSON();
|
|
74
|
+
Object.setPrototypeOf(this, DiffInverseResourceError.prototype);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @group Errors/Node
|
|
79
|
+
*/
|
|
80
|
+
export class RemoveResourceError extends ResourceError {
|
|
81
|
+
constructor(message, resource, childrenResources) {
|
|
82
|
+
super(message, resource);
|
|
83
|
+
this.childrenResources = childrenResources.map((r) => r.constructor.NODE_NAME);
|
|
84
|
+
Object.setPrototypeOf(this, RemoveResourceError.prototype);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=node.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.error.js","sourceRoot":"","sources":["../../src/errors/node.error.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAGxC,YAAY,OAAe,EAAE,UAAsB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;QAErC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAGzC,YAAY,OAAe,EAAE,OAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAGlC,YAAY,OAAe,EAAE,IAAoC;QAC/D,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAI,IAAgC,CAAC,SAAS,IAAK,IAAI,CAAC,WAA4B,CAAC,SAAS,CAAC;QAExG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,YAAY,OAAe,EAAE,IAAiB;QAC5C,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAErB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,SAAS;IACvC,YAAY,OAAe,EAAE,KAAmB;QAC9C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEtB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,YAAY,OAAe,EAAE,OAAuB;QAClD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,YAAY,OAAe,EAAE,QAA4C;QACvE,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAGzD,YAAY,OAAe,EAAE,QAAyB,EAAE,IAAU;QAChE,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAE1B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAGpD,YAAY,OAAe,EAAE,QAAyB,EAAE,iBAAoC;QAC1F,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEzB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAAC,CAAC,WAA4B,CAAC,SAAS,CAAC,CAAC;QAEjG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @group Errors/Schema
|
|
3
|
+
*/
|
|
4
|
+
export class SchemaError extends Error {
|
|
5
|
+
constructor(message, schemaClassName) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.schemaClassName = schemaClassName;
|
|
8
|
+
Object.setPrototypeOf(this, SchemaError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=schema.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.error.js","sourceRoot":"","sources":["../../src/errors/schema.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGpC,YAAY,OAAe,EAAE,eAAuB;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QAEvC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { IUnknownModelAction, UnknownResource } from '../app.type.js';
|
|
2
|
+
import type { Diff } from '../functions/diff/diff.js';
|
|
3
|
+
import type { ValidationService } from '../services/validation/validation.service.js';
|
|
4
|
+
/**
|
|
5
|
+
* @group Errors/Transaction
|
|
6
|
+
*/
|
|
7
|
+
export declare class TransactionError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @group Errors/Transaction
|
|
12
|
+
*/
|
|
13
|
+
export declare class DiffsOnDirtyResourcesTransactionError extends TransactionError {
|
|
14
|
+
readonly diffs: ReturnType<Diff['toJSON']>[];
|
|
15
|
+
readonly dirtyResources: UnknownResource[];
|
|
16
|
+
constructor(message: string, diffs: Diff[], dirtyResources: UnknownResource[]);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @group Errors/Transaction
|
|
20
|
+
*/
|
|
21
|
+
export declare class InputNotFoundTransactionError extends TransactionError {
|
|
22
|
+
readonly action: string;
|
|
23
|
+
readonly diff: ReturnType<Diff['toJSON']>;
|
|
24
|
+
readonly key: string;
|
|
25
|
+
constructor(message: string, action: IUnknownModelAction, diff: Diff, key: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @group Errors/Transaction
|
|
29
|
+
*/
|
|
30
|
+
export declare class NoMatchingActionFoundTransactionError extends TransactionError {
|
|
31
|
+
readonly diff: ReturnType<Diff['toJSON']>;
|
|
32
|
+
constructor(message: string, diff: Diff);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @group Errors/Transaction
|
|
36
|
+
*/
|
|
37
|
+
export declare class ResourceActionExceptionTransactionError extends TransactionError {
|
|
38
|
+
readonly actionClassName: string;
|
|
39
|
+
readonly diff: ReturnType<Diff['toJSON']>;
|
|
40
|
+
constructor(message: string, originalError: Error, diff: Diff, actionClassName: string);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @group Errors/Transaction
|
|
44
|
+
*/
|
|
45
|
+
export declare class ResourceActionTimeoutTransactionError extends TransactionError {
|
|
46
|
+
readonly actionClassName: string;
|
|
47
|
+
readonly diff: ReturnType<Diff['toJSON']>;
|
|
48
|
+
constructor(message: string, diff: Diff, actionClassName: string);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @group Errors/Transaction
|
|
52
|
+
*/
|
|
53
|
+
export declare class ValidationTransactionError extends TransactionError {
|
|
54
|
+
errors: ReturnType<ValidationService['validate']>;
|
|
55
|
+
constructor(message: string, errors: ReturnType<ValidationService['validate']>);
|
|
56
|
+
}
|