@api-client/core 0.13.6 → 0.14.1
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/build/src/amf/AmfTypes.d.ts +1 -1
- package/build/src/amf/AmfTypes.js +1 -1
- package/build/src/amf/AmfTypes.js.map +1 -1
- package/build/src/amf/Utils.d.ts +0 -6
- package/build/src/amf/Utils.d.ts.map +1 -1
- package/build/src/amf/Utils.js +0 -14
- package/build/src/amf/Utils.js.map +1 -1
- package/build/src/browser.d.ts +1 -0
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +1 -0
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +1 -0
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +1 -0
- package/build/src/index.js.map +1 -1
- package/build/src/legacy.d.ts +0 -8
- package/build/src/legacy.d.ts.map +1 -1
- package/build/src/legacy.js +0 -9
- package/build/src/legacy.js.map +1 -1
- package/build/src/modeling/Bindings.d.ts +1 -1
- package/build/src/modeling/Bindings.js.map +1 -1
- package/build/src/modeling/DataDomain.js +2 -2
- package/build/src/modeling/DataDomain.js.map +1 -1
- package/build/src/modeling/DataFormat.d.ts +0 -40
- package/build/src/modeling/DataFormat.d.ts.map +1 -1
- package/build/src/modeling/DataFormat.js +0 -27
- package/build/src/modeling/DataFormat.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +28 -0
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
- package/build/src/modeling/DomainAssociation.js +73 -4
- package/build/src/modeling/DomainAssociation.js.map +1 -1
- package/build/src/modeling/DomainEntity.d.ts +25 -9
- package/build/src/modeling/DomainEntity.d.ts.map +1 -1
- package/build/src/modeling/DomainEntity.js +65 -21
- package/build/src/modeling/DomainEntity.js.map +1 -1
- package/build/src/modeling/DomainFile.d.ts +3 -4
- package/build/src/modeling/DomainFile.d.ts.map +1 -1
- package/build/src/modeling/DomainFile.js +5 -9
- package/build/src/modeling/DomainFile.js.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.d.ts +1 -1
- package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.js +3 -3
- package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
- package/build/src/modeling/DomainModel.d.ts +2 -2
- package/build/src/modeling/DomainModel.js +2 -2
- package/build/src/modeling/DomainModel.js.map +1 -1
- package/build/src/modeling/DomainProperty.d.ts +28 -12
- package/build/src/modeling/DomainProperty.d.ts.map +1 -1
- package/build/src/modeling/DomainProperty.js +61 -26
- package/build/src/modeling/DomainProperty.js.map +1 -1
- package/build/src/modeling/Semantics.d.ts +109 -0
- package/build/src/modeling/Semantics.d.ts.map +1 -0
- package/build/src/modeling/Semantics.js +97 -0
- package/build/src/modeling/Semantics.js.map +1 -0
- package/build/src/models/CertificateFile.d.ts +2 -3
- package/build/src/models/CertificateFile.d.ts.map +1 -1
- package/build/src/models/CertificateFile.js +4 -8
- package/build/src/models/CertificateFile.js.map +1 -1
- package/build/src/models/Folder.d.ts +1 -2
- package/build/src/models/Folder.d.ts.map +1 -1
- package/build/src/models/Folder.js +2 -4
- package/build/src/models/Folder.js.map +1 -1
- package/build/src/models/Project.d.ts +2 -3
- package/build/src/models/Project.d.ts.map +1 -1
- package/build/src/models/Project.js +4 -8
- package/build/src/models/Project.js.map +1 -1
- package/build/src/models/kinds.d.ts +0 -24
- package/build/src/models/kinds.d.ts.map +1 -1
- package/build/src/models/kinds.js +0 -24
- package/build/src/models/kinds.js.map +1 -1
- package/build/src/models/store/File.d.ts +1 -21
- package/build/src/models/store/File.d.ts.map +1 -1
- package/build/src/models/store/File.js +3 -23
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/data_catalog.d.ts +1 -1
- package/build/src/models/store/data_catalog.js.map +1 -1
- package/build/src/sdk/FilesSdk.js +1 -1
- package/build/src/sdk/FilesSdk.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +22 -22
- package/eslint.config.js +1 -0
- package/package.json +5 -5
- package/src/amf/AmfTypes.ts +1 -1
- package/src/amf/Utils.ts +0 -15
- package/src/modeling/Bindings.ts +1 -1
- package/src/modeling/DataDomain.ts +2 -2
- package/src/modeling/DataFormat.ts +0 -48
- package/src/modeling/DomainAssociation.ts +66 -3
- package/src/modeling/DomainEntity.ts +56 -17
- package/src/modeling/DomainFile.ts +5 -9
- package/src/modeling/DomainImpactAnalysis.ts +3 -3
- package/src/modeling/DomainModel.ts +2 -2
- package/src/modeling/DomainProperty.ts +60 -21
- package/src/modeling/Semantics.ts +178 -0
- package/src/modeling/graph.md +14 -14
- package/src/modeling/readme.md +29 -29
- package/src/models/CertificateFile.ts +4 -12
- package/src/models/Folder.ts +2 -4
- package/src/models/Project.ts +4 -8
- package/src/models/kinds.ts +0 -25
- package/src/models/store/File.ts +4 -35
- package/src/models/store/data_catalog.ts +1 -1
- package/src/sdk/FilesSdk.ts +1 -1
- package/tests/unit/modeling/data_domain_change_observers.spec.ts +11 -10
- package/tests/unit/modeling/data_domain_entities.spec.ts +129 -1
- package/tests/unit/modeling/data_domain_property.spec.ts +1 -1
- package/tests/unit/modeling/domain_asociation.spec.ts +177 -0
- package/tests/unit/modeling/domain_entity.spec.ts +27 -26
- package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +11 -11
- package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +10 -10
- package/tests/unit/modeling/domain_file.spec.ts +4 -27
- package/tests/unit/modeling/{domain.property.spec.ts → domain_property.spec.ts} +139 -23
- package/tests/unit/models/Certificate/from_name.spec.ts +3 -15
- package/tests/unit/models/File/constructor.spec.ts +0 -1
- package/tests/unit/models/File/new.spec.ts +0 -13
- package/tests/unit/models/File/shortcutTo.spec.ts +1 -2
- package/tests/unit/models/File/toJSON.spec.ts +0 -13
- package/tests/unit/models/File/updateByMeMeta.spec.ts +4 -6
- package/tests/unit/models/Folder/create.spec.ts +2 -23
- package/tests/unit/models/Project/create.spec.ts +6 -32
- package/build/src/amf/AmfShapeGenerator.d.ts +0 -103
- package/build/src/amf/AmfShapeGenerator.d.ts.map +0 -1
- package/build/src/amf/AmfShapeGenerator.js +0 -416
- package/build/src/amf/AmfShapeGenerator.js.map +0 -1
- package/build/src/modeling/legacy/DataAssociation.d.ts +0 -284
- package/build/src/modeling/legacy/DataAssociation.d.ts.map +0 -1
- package/build/src/modeling/legacy/DataAssociation.js +0 -443
- package/build/src/modeling/legacy/DataAssociation.js.map +0 -1
- package/build/src/modeling/legacy/DataEntity.d.ts +0 -358
- package/build/src/modeling/legacy/DataEntity.d.ts.map +0 -1
- package/build/src/modeling/legacy/DataEntity.js +0 -855
- package/build/src/modeling/legacy/DataEntity.js.map +0 -1
- package/build/src/modeling/legacy/DataEntityBuilder.d.ts +0 -162
- package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +0 -1
- package/build/src/modeling/legacy/DataEntityBuilder.js +0 -221
- package/build/src/modeling/legacy/DataEntityBuilder.js.map +0 -1
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +0 -298
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +0 -1
- package/build/src/modeling/legacy/DataImpactAnalysis.js +0 -441
- package/build/src/modeling/legacy/DataImpactAnalysis.js.map +0 -1
- package/build/src/modeling/legacy/DataModel.d.ts +0 -99
- package/build/src/modeling/legacy/DataModel.d.ts.map +0 -1
- package/build/src/modeling/legacy/DataModel.js +0 -237
- package/build/src/modeling/legacy/DataModel.js.map +0 -1
- package/build/src/modeling/legacy/DataNamespace.d.ts +0 -340
- package/build/src/modeling/legacy/DataNamespace.d.ts.map +0 -1
- package/build/src/modeling/legacy/DataNamespace.js +0 -784
- package/build/src/modeling/legacy/DataNamespace.js.map +0 -1
- package/build/src/modeling/legacy/DataProperty.d.ts +0 -332
- package/build/src/modeling/legacy/DataProperty.d.ts.map +0 -1
- package/build/src/modeling/legacy/DataProperty.js +0 -415
- package/build/src/modeling/legacy/DataProperty.js.map +0 -1
- package/build/src/models/store/DataFile.d.ts +0 -31
- package/build/src/models/store/DataFile.d.ts.map +0 -1
- package/build/src/models/store/DataFile.js +0 -92
- package/build/src/models/store/DataFile.js.map +0 -1
- package/src/amf/AmfShapeGenerator.ts +0 -477
- package/src/modeling/legacy/DataAssociation.ts +0 -554
- package/src/modeling/legacy/DataEntity.ts +0 -1019
- package/src/modeling/legacy/DataEntityBuilder.ts +0 -236
- package/src/modeling/legacy/DataImpactAnalysis.ts +0 -530
- package/src/modeling/legacy/DataModel.ts +0 -276
- package/src/modeling/legacy/DataNamespace.ts +0 -929
- package/src/modeling/legacy/DataProperty.ts +0 -630
- package/src/models/store/DataFile.ts +0 -100
- package/tests/unit/modeling/legacy/amf_shape_generator.spec.ts +0 -1041
- package/tests/unit/modeling/legacy/data_association.spec.ts +0 -710
- package/tests/unit/modeling/legacy/data_entity.spec.ts +0 -2061
- package/tests/unit/modeling/legacy/data_entity_generator_json.spec.ts +0 -987
- package/tests/unit/modeling/legacy/data_entity_generator_xml.spec.ts +0 -1451
- package/tests/unit/modeling/legacy/data_model.spec.ts +0 -395
- package/tests/unit/modeling/legacy/data_namespace.spec.ts +0 -1312
- package/tests/unit/modeling/legacy/data_property.spec.ts +0 -887
- package/tests/unit/modeling/legacy/impact_analysis.spec.ts +0 -373
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, DataAssociationKind, } from '../../models/kinds.js';
|
|
2
|
-
/**
|
|
3
|
-
* # DomainImpactAnalysis
|
|
4
|
-
*
|
|
5
|
-
* The `DomainImpactAnalysis` class is a powerful tool for analyzing the consequences of deleting data domain objects
|
|
6
|
-
* within a `DataNamespace`.
|
|
7
|
-
* It helps developers understand the ripple effects of removing a namespace, data model, entity, property,
|
|
8
|
-
* or association, ensuring data integrity and preventing unintended side effects.
|
|
9
|
-
*
|
|
10
|
-
* ## Core Concepts
|
|
11
|
-
*
|
|
12
|
-
* - **Impact Report:** The central output of the `DomainImpactAnalysis` class is an `DataImpactReport`.
|
|
13
|
-
* This report details the potential consequences of a deletion operation, including:
|
|
14
|
-
* - The object being deleted (`key`, `kind`).
|
|
15
|
-
* - A list of `ImpactItem` objects, each describing a specific consequence.
|
|
16
|
-
* - Whether the deletion can proceed safely (`canProceed`).
|
|
17
|
-
*
|
|
18
|
-
* - **ImpactItem:** Each `ImpactItem` describes a specific consequence of the deletion. Key properties include:
|
|
19
|
-
* - `key`: The key of the impacted object.
|
|
20
|
-
* - `kind`: The kind of the impacted object.
|
|
21
|
-
* - `type`: The type of impact (currently only `delete`).
|
|
22
|
-
* - `impact`: A human-readable description of the impact.
|
|
23
|
-
* - `blocking`: Whether this impact prevents the deletion from proceeding.
|
|
24
|
-
* - `relationship`: The type of relationship between the deleted object and the impacted object (e.g., `child`).
|
|
25
|
-
* - `resolution`: A description of how the impact will be resolved if the deletion is forced.
|
|
26
|
-
*
|
|
27
|
-
* - **Blocking Impacts:** Some impacts are considered "blocking," meaning they prevent the deletion from proceeding
|
|
28
|
-
* without manual intervention. For example, deleting an entity that is a parent to other entities is
|
|
29
|
-
* a blocking impact.
|
|
30
|
-
*
|
|
31
|
-
* - **Non-Blocking Impacts:** Some impacts are informational and do not prevent the deletion. For example, deleting a
|
|
32
|
-
* property is not a blocking impact.
|
|
33
|
-
*
|
|
34
|
-
* ## Usage
|
|
35
|
-
*
|
|
36
|
-
* 1. **Instantiation:** Create an instance of `DomainImpactAnalysis`, passing the root `DataNamespace` as an argument.
|
|
37
|
-
*
|
|
38
|
-
* ```typescript
|
|
39
|
-
* import { DataNamespace } from './DataNamespace';
|
|
40
|
-
* import { DomainImpactAnalysis } from './DomainImpactAnalysis';
|
|
41
|
-
*
|
|
42
|
-
* const rootNamespace = new DataNamespace();
|
|
43
|
-
* // ... add some data to the namespace
|
|
44
|
-
* const analyzer = new DomainImpactAnalysis(rootNamespace);
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* 2. **Performing Analysis:** Use the `deleteAnalysis()` method to generate an `ImpactReport` for a specific deletion.
|
|
48
|
-
* Provide the `key` and `kind` of the object to be deleted.
|
|
49
|
-
*
|
|
50
|
-
* ```typescript
|
|
51
|
-
* import { DataEntityKind } from '../models/kinds.js';
|
|
52
|
-
* // ...
|
|
53
|
-
* const entityKey = 'some-entity-key';
|
|
54
|
-
* const report = analyzer.deleteAnalysis(entityKey, DataEntityKind);
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* 3. **Interpreting the Report:** Examine the `ImpactReport` to understand the consequences of the deletion.
|
|
58
|
-
* - Check `report.canProceed` to see if the deletion is safe.
|
|
59
|
-
* - Iterate through `report.impact` to understand each consequence.
|
|
60
|
-
* - Pay special attention to `impact.blocking` to identify impacts that require manual resolution.
|
|
61
|
-
*
|
|
62
|
-
* ```typescript
|
|
63
|
-
* if (report.canProceed) {
|
|
64
|
-
* // Proceed with deletion
|
|
65
|
-
* } else {
|
|
66
|
-
* console.warn('Deletion cannot proceed due to the following impacts:');
|
|
67
|
-
* report.impact.forEach((item) => {
|
|
68
|
-
* console.warn(`- ${item.impact}`);
|
|
69
|
-
* if (item.blocking) {
|
|
70
|
-
* console.warn(` - This impact is blocking.`);
|
|
71
|
-
* if (item.resolution) {
|
|
72
|
-
* console.warn(` - Resolution: ${item.resolution}`);
|
|
73
|
-
* }
|
|
74
|
-
* }
|
|
75
|
-
* });
|
|
76
|
-
* // Handle blocking impacts (e.g., prompt the user, modify the data, etc.)
|
|
77
|
-
* }
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* ## Supported Deletion Scenarios
|
|
81
|
-
*
|
|
82
|
-
* The `DomainImpactAnalysis` class supports analyzing the deletion of the following data domain object types:
|
|
83
|
-
*
|
|
84
|
-
* - **Namespaces (`DataNamespaceKind`):** Deleting a namespace also impacts all its child namespaces,
|
|
85
|
-
* data models, entities, properties, and associations.
|
|
86
|
-
* - **Data Models (`DataModelKind`):** Deleting a data model impacts all its entities, properties, and associations.
|
|
87
|
-
* - **Entities (`DataEntityKind`):** Deleting an entity impacts its properties, associations, and any other
|
|
88
|
-
* entities that have it as a parent or target in an association.
|
|
89
|
-
* - **Properties (`DataPropertyKind`):** Deleting a property impacts the entity it belongs to.
|
|
90
|
-
* - **Associations (`DataAssociationKind`):** Deleting an association impacts the entity it belongs to.
|
|
91
|
-
*
|
|
92
|
-
* ## Example: Deleting an Entity
|
|
93
|
-
*
|
|
94
|
-
* Consider the following scenario:
|
|
95
|
-
*
|
|
96
|
-
* - Namespace: `MyNamespace`
|
|
97
|
-
* - Data Model: `ProductModel`
|
|
98
|
-
* - Entity: `Product`
|
|
99
|
-
* - Property: `name`
|
|
100
|
-
* - Association: `category` (targets `Category` entity)
|
|
101
|
-
* - Entity: `Category`
|
|
102
|
-
* - Property: `name`
|
|
103
|
-
* - Entity: `SpecialProduct` (parent: `Product`)
|
|
104
|
-
*
|
|
105
|
-
* If you attempt to delete the `Product` entity, the `DomainImpactAnalysis` will generate a report similar to this:
|
|
106
|
-
*
|
|
107
|
-
* ```json
|
|
108
|
-
* {
|
|
109
|
-
* "key": "Product",
|
|
110
|
-
* "kind": "DataEntityKind",
|
|
111
|
-
* "impact": [
|
|
112
|
-
* {
|
|
113
|
-
* "key": "Product",
|
|
114
|
-
* "kind": "DataEntityKind",
|
|
115
|
-
* "type": "delete",
|
|
116
|
-
* "impact": "The entity with key Product will be deleted.",
|
|
117
|
-
* "blocking": false
|
|
118
|
-
* },
|
|
119
|
-
* {
|
|
120
|
-
* "key": "SpecialProduct",
|
|
121
|
-
* "kind": "DataEntityKind",
|
|
122
|
-
* "type": "delete",
|
|
123
|
-
* "impact": "The SpecialProduct entity will become an orphan because it is a child of Product.",
|
|
124
|
-
* "resolution": "The "Product" entity will be removed as the parent of the "SpecialProduct" entity.",
|
|
125
|
-
* "blocking": true,
|
|
126
|
-
* "relationship": "child"
|
|
127
|
-
* },
|
|
128
|
-
* {
|
|
129
|
-
* "key": "category",
|
|
130
|
-
* "kind": "DataAssociationKind",
|
|
131
|
-
* "type": "delete",
|
|
132
|
-
* "impact": "The association with key category will be broken because it has a target to Product.",
|
|
133
|
-
* "resolution": "The association with key category will be removed from Product.",
|
|
134
|
-
* "blocking": true
|
|
135
|
-
* },
|
|
136
|
-
* {
|
|
137
|
-
* "key": "name",
|
|
138
|
-
* "kind": "DataPropertyKind",
|
|
139
|
-
* "type": "delete",
|
|
140
|
-
* "impact": "The property with key name will be deleted.",
|
|
141
|
-
* "blocking": false
|
|
142
|
-
* }
|
|
143
|
-
* ],
|
|
144
|
-
* "canProceed": false
|
|
145
|
-
* }
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* This report indicates that:
|
|
149
|
-
*
|
|
150
|
-
* - The `Product` entity will be deleted.
|
|
151
|
-
* - The `SpecialProduct` entity will become an orphan (blocking).
|
|
152
|
-
* - The `category` association will be broken (blocking).
|
|
153
|
-
* - The `name` property will be deleted.
|
|
154
|
-
* - The deletion cannot proceed without addressing the blocking impacts.
|
|
155
|
-
*
|
|
156
|
-
* ## Types
|
|
157
|
-
*
|
|
158
|
-
* ### `ImpactKinds`
|
|
159
|
-
*
|
|
160
|
-
* - **Description:** A type alias for the kinds of data domain objects that can be analyzed.
|
|
161
|
-
* - **Values:**
|
|
162
|
-
* - `DataNamespaceKind`
|
|
163
|
-
* - `DataEntityKind`
|
|
164
|
-
* - `DataModelKind`
|
|
165
|
-
* - `DataPropertyKind`
|
|
166
|
-
* - `DataAssociationKind`
|
|
167
|
-
*
|
|
168
|
-
* ### `ImpactReport`
|
|
169
|
-
*
|
|
170
|
-
* - **Description:** The structure of the impact analysis report.
|
|
171
|
-
* - **Properties:**
|
|
172
|
-
* - `key` (`string`): The key of the object being deleted.
|
|
173
|
-
* - `kind` (`ImpactKinds`): The kind of the object being deleted.
|
|
174
|
-
* - `impact` (`ImpactItem[]`): The list of impacts.
|
|
175
|
-
* - `canProceed` (`boolean`): Whether the deletion can proceed.
|
|
176
|
-
*
|
|
177
|
-
* ### `ImpactItem`
|
|
178
|
-
*
|
|
179
|
-
* - **Description:** The structure of an individual impact item.
|
|
180
|
-
* - **Properties:**
|
|
181
|
-
* - `key` (`string`): The key of the impacted object.
|
|
182
|
-
* - `kind` (`string`): The kind of the impacted object.
|
|
183
|
-
* - `type` (`'delete'`): The type of impact.
|
|
184
|
-
* - `impact` (`string`): The impact description.
|
|
185
|
-
* - `blocking` (`boolean`): Whether the impact is blocking.
|
|
186
|
-
* - `relationship` (`'child'`, optional): The relationship type.
|
|
187
|
-
* - `resolution` (`string`, optional): The resolution description.
|
|
188
|
-
*
|
|
189
|
-
* ## Error Handling
|
|
190
|
-
*
|
|
191
|
-
* The `DomainImpactAnalysis` class does not throw errors. Instead, it uses the `ImpactReport` to communicate
|
|
192
|
-
* the results of the analysis, including any blocking impacts.
|
|
193
|
-
*
|
|
194
|
-
* ## Best Practices
|
|
195
|
-
*
|
|
196
|
-
* - **Always Analyze Before Deleting:** Before deleting any data domain object, always use `DomainImpactAnalysis`
|
|
197
|
-
* to understand the consequences.
|
|
198
|
-
* - **Handle Blocking Impacts:** Pay close attention to `blocking` impacts and implement appropriate
|
|
199
|
-
* logic to handle them.
|
|
200
|
-
* - **Inform the User:** If a deletion cannot proceed, inform the user about the blocking impacts and provide
|
|
201
|
-
* guidance on how to resolve them.
|
|
202
|
-
* - **Consider Forced Deletion:** In some cases, you may want to allow users to force a deletion even if there are
|
|
203
|
-
* blocking impacts. In such cases, you should clearly communicate the risks to the user.
|
|
204
|
-
*
|
|
205
|
-
* ## Conclusion
|
|
206
|
-
*
|
|
207
|
-
* The `DomainImpactAnalysis` class is an essential tool for maintaining data integrity when working with complex
|
|
208
|
-
* data domain models. By providing detailed impact reports, it empowers developers to make informed decisions
|
|
209
|
-
* about data deletion and prevent unintended consequences.
|
|
210
|
-
* @deprecated
|
|
211
|
-
*/
|
|
212
|
-
export class DataImpactAnalysis {
|
|
213
|
-
report;
|
|
214
|
-
root;
|
|
215
|
-
constructor(root) {
|
|
216
|
-
this.root = root;
|
|
217
|
-
this.report = {
|
|
218
|
-
key: '',
|
|
219
|
-
kind: DataNamespaceKind,
|
|
220
|
-
impact: [],
|
|
221
|
-
canProceed: false,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Generates a report of how the data domain will be impacted by the deletion of a data domain object.
|
|
226
|
-
* @param key The key of the impacted data domain object.
|
|
227
|
-
* @param kind The kind of the impacted data object.
|
|
228
|
-
* @returns The delete impact analysis report.
|
|
229
|
-
* @deprecated
|
|
230
|
-
*/
|
|
231
|
-
deleteAnalysis(key, kind) {
|
|
232
|
-
this.report = {
|
|
233
|
-
key,
|
|
234
|
-
kind,
|
|
235
|
-
impact: [],
|
|
236
|
-
canProceed: true,
|
|
237
|
-
};
|
|
238
|
-
this.report.impact = this.createDeleteImpact(key, kind, key);
|
|
239
|
-
// this.report.impact.unshift({
|
|
240
|
-
// key,
|
|
241
|
-
// kind,
|
|
242
|
-
// type: 'delete',
|
|
243
|
-
// impact: `The ${this.kindToLabel(kind)} with key ${key} will be deleted.`,
|
|
244
|
-
// blocking: false,
|
|
245
|
-
// })
|
|
246
|
-
return this.report;
|
|
247
|
-
}
|
|
248
|
-
createDeleteImpact(key, kind, rootKey) {
|
|
249
|
-
switch (kind) {
|
|
250
|
-
case DataNamespaceKind:
|
|
251
|
-
return this.deleteNamespaceAnalysis(key, rootKey);
|
|
252
|
-
case DataModelKind:
|
|
253
|
-
return this.deleteDataModelAnalysis(key, rootKey);
|
|
254
|
-
case DataEntityKind:
|
|
255
|
-
return this.deleteEntityAnalysis(key, rootKey);
|
|
256
|
-
case DataPropertyKind:
|
|
257
|
-
return this.deletePropertyAnalysis(key);
|
|
258
|
-
case DataAssociationKind:
|
|
259
|
-
return this.deleteAssociationAnalysis(key);
|
|
260
|
-
default:
|
|
261
|
-
return [];
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
deleteNamespaceAnalysis(key, rootKey) {
|
|
265
|
-
const result = [];
|
|
266
|
-
const ns = this.root.findNamespace(key);
|
|
267
|
-
if (!ns) {
|
|
268
|
-
return result;
|
|
269
|
-
}
|
|
270
|
-
result.push({
|
|
271
|
-
key: ns.key,
|
|
272
|
-
kind: ns.kind,
|
|
273
|
-
type: 'delete',
|
|
274
|
-
impact: `The ${ns.info.getLabel()} ${this.kindToLabel(DataNamespaceKind)} will be deleted.`,
|
|
275
|
-
blocking: false,
|
|
276
|
-
});
|
|
277
|
-
const namespaces = ns.listNamespaces();
|
|
278
|
-
namespaces.forEach((child) => {
|
|
279
|
-
const items = this.deleteNamespaceAnalysis(child.key, rootKey);
|
|
280
|
-
result.push(...items);
|
|
281
|
-
});
|
|
282
|
-
const models = ns.listDataModels();
|
|
283
|
-
models.forEach((child) => {
|
|
284
|
-
const items = this.deleteDataModelAnalysis(child.key, rootKey);
|
|
285
|
-
result.push(...items);
|
|
286
|
-
});
|
|
287
|
-
return result;
|
|
288
|
-
}
|
|
289
|
-
deleteDataModelAnalysis(key, rootKey) {
|
|
290
|
-
const result = [];
|
|
291
|
-
const model = this.root.findDataModel(key);
|
|
292
|
-
if (!model) {
|
|
293
|
-
return result;
|
|
294
|
-
}
|
|
295
|
-
result.push({
|
|
296
|
-
key: model.key,
|
|
297
|
-
kind: model.kind,
|
|
298
|
-
type: 'delete',
|
|
299
|
-
impact: `The ${model.info.getLabel()} ${this.kindToLabel(DataModelKind)} will be deleted.`,
|
|
300
|
-
blocking: false,
|
|
301
|
-
});
|
|
302
|
-
model.entities.forEach((child) => {
|
|
303
|
-
const items = this.deleteEntityAnalysis(child.key, rootKey);
|
|
304
|
-
result.push(...items);
|
|
305
|
-
});
|
|
306
|
-
return result;
|
|
307
|
-
}
|
|
308
|
-
deleteEntityAnalysis(key, rootKey) {
|
|
309
|
-
const result = [];
|
|
310
|
-
const entity = this.root.findEntity(key);
|
|
311
|
-
if (!entity) {
|
|
312
|
-
return result;
|
|
313
|
-
}
|
|
314
|
-
result.push({
|
|
315
|
-
key: entity.key,
|
|
316
|
-
kind: entity.kind,
|
|
317
|
-
type: 'delete',
|
|
318
|
-
impact: `The ${entity.info.getLabel()} ${this.kindToLabel(DataEntityKind)} will be deleted.`,
|
|
319
|
-
blocking: false,
|
|
320
|
-
});
|
|
321
|
-
// We need to know whether the entity is a parent of another entity
|
|
322
|
-
const children = this.root.definitions.entities.filter((domainEntity) => {
|
|
323
|
-
if (domainEntity.key === entity.key) {
|
|
324
|
-
// ignore self
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
327
|
-
if (!domainEntity.parents.includes(entity.key)) {
|
|
328
|
-
// no relationship
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
|
-
if (domainEntity.isChildOf(rootKey)) {
|
|
332
|
-
// No need to include this parent as it itself is being deleted
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
// the entity has a parent-child relationship to the deleted entity.
|
|
336
|
-
return true;
|
|
337
|
-
});
|
|
338
|
-
if (children.length) {
|
|
339
|
-
children.forEach((child) => {
|
|
340
|
-
const pLabel = entity.info.getLabel();
|
|
341
|
-
const cLabel = child.info.getLabel();
|
|
342
|
-
result.push({
|
|
343
|
-
key: child.key,
|
|
344
|
-
kind: child.kind,
|
|
345
|
-
type: 'delete',
|
|
346
|
-
impact: `The "${cLabel}" ${this.kindToLabel(DataEntityKind)} will become an orphan because it is a child of the "${pLabel}" entity.`,
|
|
347
|
-
resolution: `The "${pLabel}" entity will be removed as the parent of the "${cLabel}" entity.`,
|
|
348
|
-
blocking: true,
|
|
349
|
-
relationship: 'child',
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
this.report.canProceed = false;
|
|
353
|
-
}
|
|
354
|
-
// We need to know whether there's another entity that has an association to this entity.
|
|
355
|
-
const inAssociations = this.root.definitions.associations.filter((association) => {
|
|
356
|
-
return association.targets.some((item) => {
|
|
357
|
-
if (item.key === entity.key) {
|
|
358
|
-
const related = association.getParentInstance();
|
|
359
|
-
if (!related) {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
if (related.isChildOf(rootKey)) {
|
|
363
|
-
// No need to include this association as the related entity itself is being deleted
|
|
364
|
-
return false;
|
|
365
|
-
}
|
|
366
|
-
return true;
|
|
367
|
-
}
|
|
368
|
-
return false;
|
|
369
|
-
});
|
|
370
|
-
});
|
|
371
|
-
if (inAssociations.length) {
|
|
372
|
-
inAssociations.forEach((association) => {
|
|
373
|
-
result.push({
|
|
374
|
-
key: association.key,
|
|
375
|
-
kind: association.kind,
|
|
376
|
-
type: 'delete',
|
|
377
|
-
impact: `The ${association.info.getLabel()} ${this.kindToLabel(DataAssociationKind)} will be broken because it has a target to ${entity.info.getLabel()}.`,
|
|
378
|
-
resolution: `The ${association.info.getLabel()} ${this.kindToLabel(DataAssociationKind)} will be removed from ${entity.info.getLabel()}.`,
|
|
379
|
-
blocking: true,
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
this.report.canProceed = false;
|
|
383
|
-
}
|
|
384
|
-
entity.properties.forEach((child) => {
|
|
385
|
-
const items = this.deletePropertyAnalysis(child.key);
|
|
386
|
-
result.push(...items);
|
|
387
|
-
});
|
|
388
|
-
entity.associations.forEach((child) => {
|
|
389
|
-
const items = this.deleteAssociationAnalysis(child.key);
|
|
390
|
-
result.push(...items);
|
|
391
|
-
});
|
|
392
|
-
return result;
|
|
393
|
-
}
|
|
394
|
-
deletePropertyAnalysis(key) {
|
|
395
|
-
const result = [];
|
|
396
|
-
const property = this.root.findProperty(key);
|
|
397
|
-
if (!property) {
|
|
398
|
-
return result;
|
|
399
|
-
}
|
|
400
|
-
result.push({
|
|
401
|
-
key: property.key,
|
|
402
|
-
kind: property.kind,
|
|
403
|
-
type: 'delete',
|
|
404
|
-
impact: `The ${property.info.getLabel()} ${this.kindToLabel(DataPropertyKind)} will be deleted.`,
|
|
405
|
-
blocking: false,
|
|
406
|
-
});
|
|
407
|
-
return result;
|
|
408
|
-
}
|
|
409
|
-
deleteAssociationAnalysis(key) {
|
|
410
|
-
const result = [];
|
|
411
|
-
const association = this.root.findAssociation(key);
|
|
412
|
-
if (!association) {
|
|
413
|
-
return result;
|
|
414
|
-
}
|
|
415
|
-
result.push({
|
|
416
|
-
key: association.key,
|
|
417
|
-
kind: association.kind,
|
|
418
|
-
type: 'delete',
|
|
419
|
-
impact: `The ${association.info.getLabel()} ${this.kindToLabel(DataAssociationKind)} will be deleted.`,
|
|
420
|
-
blocking: false,
|
|
421
|
-
});
|
|
422
|
-
return result;
|
|
423
|
-
}
|
|
424
|
-
kindToLabel(kind) {
|
|
425
|
-
switch (kind) {
|
|
426
|
-
case DataNamespaceKind:
|
|
427
|
-
return 'namespace';
|
|
428
|
-
case DataEntityKind:
|
|
429
|
-
return 'entity';
|
|
430
|
-
case DataModelKind:
|
|
431
|
-
return 'data model';
|
|
432
|
-
case DataPropertyKind:
|
|
433
|
-
return 'property';
|
|
434
|
-
case DataAssociationKind:
|
|
435
|
-
return 'association';
|
|
436
|
-
default:
|
|
437
|
-
return 'unknown';
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
//# sourceMappingURL=DataImpactAnalysis.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataImpactAnalysis.js","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataImpactAnalysis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AA4E9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiNG;AACH,MAAM,OAAO,kBAAkB;I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AE,WAAW,CAAC,GAAG;YACpB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,mBAAmB;YACtG,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACf,CAAC;IAES,WAAW,CAAC,IAAqB;QACzC,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,iBAAiB;gBACpB,OAAO,WAAW,CAAA;YACpB,KAAK,cAAc;gBACjB,OAAO,QAAQ,CAAA;YACjB,KAAK,aAAa;gBAChB,OAAO,YAAY,CAAA;YACrB,KAAK,gBAAgB;gBACnB,OAAO,UAAU,CAAA;YACnB,KAAK,mBAAmB;gBACtB,OAAO,aAAa,CAAA;YACtB;gBACE,OAAO,SAAS,CAAA;QACpB,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n DataNamespaceKind,\n DataEntityKind,\n DataModelKind,\n DataPropertyKind,\n DataAssociationKind,\n} from '../../models/kinds.js'\nimport type { DataNamespace } from './DataNamespace.js'\n\n/**\n * @deprecated\n */\nexport type DataImpactKinds =\n | typeof DataNamespaceKind\n | typeof DataEntityKind\n | typeof DataModelKind\n | typeof DataPropertyKind\n | typeof DataAssociationKind\n\n/**\n * The impact analysis report\n * @deprecated\n */\nexport interface DataImpactReport {\n /**\n * The key of the impacted data object.\n * This is the key of the object that is being changed.\n */\n key: string\n /**\n * The kind of the impacted data object.\n * This is the kind of the object that is being changed.\n */\n kind: DataImpactKinds\n /**\n * The list of impacted data objects.\n */\n impact: DataImpactItem[]\n /**\n * Whether it is possible to proceed with the change.\n * If the change is not possible, the reason will be in the impact list.\n */\n canProceed: boolean\n}\n\n/**\n * @deprecated\n */\nexport interface DataImpactItem {\n /**\n * The key of the impacted data object.\n */\n key: string\n /**\n * The kind of the impacted data object.\n */\n kind: string\n /**\n * The type of the impact.\n *\n * - `delete` - The data object would be deleted.\n */\n type: 'delete'\n /**\n * The impact description.\n */\n impact: string\n /**\n * Whether the impact is blocking the operation.\n * If true, the operation cannot proceed.\n */\n blocking: boolean\n /**\n * The type of the relationship between two impacted objects.\n */\n relationship?: 'child'\n /**\n * The resolution of the conflict if the change will be forced.\n */\n resolution?: string\n}\n\n/**\n * # DomainImpactAnalysis\n *\n * The `DomainImpactAnalysis` class is a powerful tool for analyzing the consequences of deleting data domain objects\n * within a `DataNamespace`.\n * It helps developers understand the ripple effects of removing a namespace, data model, entity, property,\n * or association, ensuring data integrity and preventing unintended side effects.\n *\n * ## Core Concepts\n *\n * - **Impact Report:** The central output of the `DomainImpactAnalysis` class is an `DataImpactReport`.\n * This report details the potential consequences of a deletion operation, including:\n * - The object being deleted (`key`, `kind`).\n * - A list of `ImpactItem` objects, each describing a specific consequence.\n * - Whether the deletion can proceed safely (`canProceed`).\n *\n * - **ImpactItem:** Each `ImpactItem` describes a specific consequence of the deletion. Key properties include:\n * - `key`: The key of the impacted object.\n * - `kind`: The kind of the impacted object.\n * - `type`: The type of impact (currently only `delete`).\n * - `impact`: A human-readable description of the impact.\n * - `blocking`: Whether this impact prevents the deletion from proceeding.\n * - `relationship`: The type of relationship between the deleted object and the impacted object (e.g., `child`).\n * - `resolution`: A description of how the impact will be resolved if the deletion is forced.\n *\n * - **Blocking Impacts:** Some impacts are considered \"blocking,\" meaning they prevent the deletion from proceeding\n * without manual intervention. For example, deleting an entity that is a parent to other entities is\n * a blocking impact.\n *\n * - **Non-Blocking Impacts:** Some impacts are informational and do not prevent the deletion. For example, deleting a\n * property is not a blocking impact.\n *\n * ## Usage\n *\n * 1. **Instantiation:** Create an instance of `DomainImpactAnalysis`, passing the root `DataNamespace` as an argument.\n *\n * ```typescript\n * import { DataNamespace } from './DataNamespace';\n * import { DomainImpactAnalysis } from './DomainImpactAnalysis';\n *\n * const rootNamespace = new DataNamespace();\n * // ... add some data to the namespace\n * const analyzer = new DomainImpactAnalysis(rootNamespace);\n * ```\n *\n * 2. **Performing Analysis:** Use the `deleteAnalysis()` method to generate an `ImpactReport` for a specific deletion.\n * Provide the `key` and `kind` of the object to be deleted.\n *\n * ```typescript\n * import { DataEntityKind } from '../models/kinds.js';\n * // ...\n * const entityKey = 'some-entity-key';\n * const report = analyzer.deleteAnalysis(entityKey, DataEntityKind);\n * ```\n *\n * 3. **Interpreting the Report:** Examine the `ImpactReport` to understand the consequences of the deletion.\n * - Check `report.canProceed` to see if the deletion is safe.\n * - Iterate through `report.impact` to understand each consequence.\n * - Pay special attention to `impact.blocking` to identify impacts that require manual resolution.\n *\n * ```typescript\n * if (report.canProceed) {\n * // Proceed with deletion\n * } else {\n * console.warn('Deletion cannot proceed due to the following impacts:');\n * report.impact.forEach((item) => {\n * console.warn(`- ${item.impact}`);\n * if (item.blocking) {\n * console.warn(` - This impact is blocking.`);\n * if (item.resolution) {\n * console.warn(` - Resolution: ${item.resolution}`);\n * }\n * }\n * });\n * // Handle blocking impacts (e.g., prompt the user, modify the data, etc.)\n * }\n * ```\n *\n * ## Supported Deletion Scenarios\n *\n * The `DomainImpactAnalysis` class supports analyzing the deletion of the following data domain object types:\n *\n * - **Namespaces (`DataNamespaceKind`):** Deleting a namespace also impacts all its child namespaces,\n * data models, entities, properties, and associations.\n * - **Data Models (`DataModelKind`):** Deleting a data model impacts all its entities, properties, and associations.\n * - **Entities (`DataEntityKind`):** Deleting an entity impacts its properties, associations, and any other\n * entities that have it as a parent or target in an association.\n * - **Properties (`DataPropertyKind`):** Deleting a property impacts the entity it belongs to.\n * - **Associations (`DataAssociationKind`):** Deleting an association impacts the entity it belongs to.\n *\n * ## Example: Deleting an Entity\n *\n * Consider the following scenario:\n *\n * - Namespace: `MyNamespace`\n * - Data Model: `ProductModel`\n * - Entity: `Product`\n * - Property: `name`\n * - Association: `category` (targets `Category` entity)\n * - Entity: `Category`\n * - Property: `name`\n * - Entity: `SpecialProduct` (parent: `Product`)\n *\n * If you attempt to delete the `Product` entity, the `DomainImpactAnalysis` will generate a report similar to this:\n *\n * ```json\n * {\n * \"key\": \"Product\",\n * \"kind\": \"DataEntityKind\",\n * \"impact\": [\n * {\n * \"key\": \"Product\",\n * \"kind\": \"DataEntityKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The entity with key Product will be deleted.\",\n * \"blocking\": false\n * },\n * {\n * \"key\": \"SpecialProduct\",\n * \"kind\": \"DataEntityKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The SpecialProduct entity will become an orphan because it is a child of Product.\",\n * \"resolution\": \"The \"Product\" entity will be removed as the parent of the \"SpecialProduct\" entity.\",\n * \"blocking\": true,\n * \"relationship\": \"child\"\n * },\n * {\n * \"key\": \"category\",\n * \"kind\": \"DataAssociationKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The association with key category will be broken because it has a target to Product.\",\n * \"resolution\": \"The association with key category will be removed from Product.\",\n * \"blocking\": true\n * },\n * {\n * \"key\": \"name\",\n * \"kind\": \"DataPropertyKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The property with key name will be deleted.\",\n * \"blocking\": false\n * }\n * ],\n * \"canProceed\": false\n * }\n * ```\n *\n * This report indicates that:\n *\n * - The `Product` entity will be deleted.\n * - The `SpecialProduct` entity will become an orphan (blocking).\n * - The `category` association will be broken (blocking).\n * - The `name` property will be deleted.\n * - The deletion cannot proceed without addressing the blocking impacts.\n *\n * ## Types\n *\n * ### `ImpactKinds`\n *\n * - **Description:** A type alias for the kinds of data domain objects that can be analyzed.\n * - **Values:**\n * - `DataNamespaceKind`\n * - `DataEntityKind`\n * - `DataModelKind`\n * - `DataPropertyKind`\n * - `DataAssociationKind`\n *\n * ### `ImpactReport`\n *\n * - **Description:** The structure of the impact analysis report.\n * - **Properties:**\n * - `key` (`string`): The key of the object being deleted.\n * - `kind` (`ImpactKinds`): The kind of the object being deleted.\n * - `impact` (`ImpactItem[]`): The list of impacts.\n * - `canProceed` (`boolean`): Whether the deletion can proceed.\n *\n * ### `ImpactItem`\n *\n * - **Description:** The structure of an individual impact item.\n * - **Properties:**\n * - `key` (`string`): The key of the impacted object.\n * - `kind` (`string`): The kind of the impacted object.\n * - `type` (`'delete'`): The type of impact.\n * - `impact` (`string`): The impact description.\n * - `blocking` (`boolean`): Whether the impact is blocking.\n * - `relationship` (`'child'`, optional): The relationship type.\n * - `resolution` (`string`, optional): The resolution description.\n *\n * ## Error Handling\n *\n * The `DomainImpactAnalysis` class does not throw errors. Instead, it uses the `ImpactReport` to communicate\n * the results of the analysis, including any blocking impacts.\n *\n * ## Best Practices\n *\n * - **Always Analyze Before Deleting:** Before deleting any data domain object, always use `DomainImpactAnalysis`\n * to understand the consequences.\n * - **Handle Blocking Impacts:** Pay close attention to `blocking` impacts and implement appropriate\n * logic to handle them.\n * - **Inform the User:** If a deletion cannot proceed, inform the user about the blocking impacts and provide\n * guidance on how to resolve them.\n * - **Consider Forced Deletion:** In some cases, you may want to allow users to force a deletion even if there are\n * blocking impacts. In such cases, you should clearly communicate the risks to the user.\n *\n * ## Conclusion\n *\n * The `DomainImpactAnalysis` class is an essential tool for maintaining data integrity when working with complex\n * data domain models. By providing detailed impact reports, it empowers developers to make informed decisions\n * about data deletion and prevent unintended consequences.\n * @deprecated\n */\nexport class DataImpactAnalysis {\n private report: DataImpactReport\n private root: DataNamespace\n\n constructor(root: DataNamespace) {\n this.root = root\n this.report = {\n key: '',\n kind: DataNamespaceKind,\n impact: [],\n canProceed: false,\n }\n }\n\n /**\n * Generates a report of how the data domain will be impacted by the deletion of a data domain object.\n * @param key The key of the impacted data domain object.\n * @param kind The kind of the impacted data object.\n * @returns The delete impact analysis report.\n * @deprecated\n */\n deleteAnalysis(key: string, kind: DataImpactKinds): DataImpactReport {\n this.report = {\n key,\n kind,\n impact: [],\n canProceed: true,\n }\n this.report.impact = this.createDeleteImpact(key, kind, key)\n // this.report.impact.unshift({\n // key,\n // kind,\n // type: 'delete',\n // impact: `The ${this.kindToLabel(kind)} with key ${key} will be deleted.`,\n // blocking: false,\n // })\n return this.report\n }\n\n protected createDeleteImpact(key: string, kind: DataImpactKinds, rootKey: string): DataImpactItem[] {\n switch (kind) {\n case DataNamespaceKind:\n return this.deleteNamespaceAnalysis(key, rootKey)\n case DataModelKind:\n return this.deleteDataModelAnalysis(key, rootKey)\n case DataEntityKind:\n return this.deleteEntityAnalysis(key, rootKey)\n case DataPropertyKind:\n return this.deletePropertyAnalysis(key)\n case DataAssociationKind:\n return this.deleteAssociationAnalysis(key)\n default:\n return []\n }\n }\n\n protected deleteNamespaceAnalysis(key: string, rootKey: string): DataImpactItem[] {\n const result: DataImpactItem[] = []\n const ns = this.root.findNamespace(key)\n if (!ns) {\n return result\n }\n result.push({\n key: ns.key,\n kind: ns.kind,\n type: 'delete',\n impact: `The ${ns.info.getLabel()} ${this.kindToLabel(DataNamespaceKind)} will be deleted.`,\n blocking: false,\n })\n const namespaces = ns.listNamespaces()\n namespaces.forEach((child) => {\n const items = this.deleteNamespaceAnalysis(child.key, rootKey)\n result.push(...items)\n })\n const models = ns.listDataModels()\n models.forEach((child) => {\n const items = this.deleteDataModelAnalysis(child.key, rootKey)\n result.push(...items)\n })\n return result\n }\n\n protected deleteDataModelAnalysis(key: string, rootKey: string): DataImpactItem[] {\n const result: DataImpactItem[] = []\n const model = this.root.findDataModel(key)\n if (!model) {\n return result\n }\n result.push({\n key: model.key,\n kind: model.kind,\n type: 'delete',\n impact: `The ${model.info.getLabel()} ${this.kindToLabel(DataModelKind)} will be deleted.`,\n blocking: false,\n })\n model.entities.forEach((child) => {\n const items = this.deleteEntityAnalysis(child.key, rootKey)\n result.push(...items)\n })\n return result\n }\n\n protected deleteEntityAnalysis(key: string, rootKey: string): DataImpactItem[] {\n const result: DataImpactItem[] = []\n const entity = this.root.findEntity(key)\n if (!entity) {\n return result\n }\n result.push({\n key: entity.key,\n kind: entity.kind,\n type: 'delete',\n impact: `The ${entity.info.getLabel()} ${this.kindToLabel(DataEntityKind)} will be deleted.`,\n blocking: false,\n })\n // We need to know whether the entity is a parent of another entity\n const children = this.root.definitions.entities.filter((domainEntity) => {\n if (domainEntity.key === entity.key) {\n // ignore self\n return false\n }\n if (!domainEntity.parents.includes(entity.key)) {\n // no relationship\n return false\n }\n if (domainEntity.isChildOf(rootKey)) {\n // No need to include this parent as it itself is being deleted\n return false\n }\n // the entity has a parent-child relationship to the deleted entity.\n return true\n })\n if (children.length) {\n children.forEach((child) => {\n const pLabel = entity.info.getLabel()\n const cLabel = child.info.getLabel()\n result.push({\n key: child.key,\n kind: child.kind,\n type: 'delete',\n impact: `The \"${cLabel}\" ${this.kindToLabel(DataEntityKind)} will become an orphan because it is a child of the \"${pLabel}\" entity.`,\n resolution: `The \"${pLabel}\" entity will be removed as the parent of the \"${cLabel}\" entity.`,\n blocking: true,\n relationship: 'child',\n })\n })\n this.report.canProceed = false\n }\n // We need to know whether there's another entity that has an association to this entity.\n const inAssociations = this.root.definitions.associations.filter((association) => {\n return association.targets.some((item) => {\n if (item.key === entity.key) {\n const related = association.getParentInstance()\n if (!related) {\n return false\n }\n if (related.isChildOf(rootKey)) {\n // No need to include this association as the related entity itself is being deleted\n return false\n }\n return true\n }\n return false\n })\n })\n if (inAssociations.length) {\n inAssociations.forEach((association) => {\n result.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${association.info.getLabel()} ${this.kindToLabel(DataAssociationKind)} will be broken because it has a target to ${entity.info.getLabel()}.`,\n resolution: `The ${association.info.getLabel()} ${this.kindToLabel(DataAssociationKind)} will be removed from ${entity.info.getLabel()}.`,\n blocking: true,\n })\n })\n this.report.canProceed = false\n }\n entity.properties.forEach((child) => {\n const items = this.deletePropertyAnalysis(child.key)\n result.push(...items)\n })\n entity.associations.forEach((child) => {\n const items = this.deleteAssociationAnalysis(child.key)\n result.push(...items)\n })\n return result\n }\n\n protected deletePropertyAnalysis(key: string): DataImpactItem[] {\n const result: DataImpactItem[] = []\n const property = this.root.findProperty(key)\n if (!property) {\n return result\n }\n result.push({\n key: property.key,\n kind: property.kind,\n type: 'delete',\n impact: `The ${property.info.getLabel()} ${this.kindToLabel(DataPropertyKind)} will be deleted.`,\n blocking: false,\n })\n return result\n }\n\n protected deleteAssociationAnalysis(key: string): DataImpactItem[] {\n const result: DataImpactItem[] = []\n const association = this.root.findAssociation(key)\n if (!association) {\n return result\n }\n result.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${association.info.getLabel()} ${this.kindToLabel(DataAssociationKind)} will be deleted.`,\n blocking: false,\n })\n return result\n }\n\n protected kindToLabel(kind: DataImpactKinds): string {\n switch (kind) {\n case DataNamespaceKind:\n return 'namespace'\n case DataEntityKind:\n return 'entity'\n case DataModelKind:\n return 'data model'\n case DataPropertyKind:\n return 'property'\n case DataAssociationKind:\n return 'association'\n default:\n return 'unknown'\n }\n }\n}\n"]}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { IThing, Thing } from '../../models/Thing.js';
|
|
2
|
-
import { DataEntity, IDataEntity } from './DataEntity.js';
|
|
3
|
-
import type { DataItemAdaptingOptions, DataNamespace } from './DataNamespace.js';
|
|
4
|
-
import { FileBreadcrumb } from '../../models/store/File.js';
|
|
5
|
-
import { DataModelKind } from '../../models/kinds.js';
|
|
6
|
-
import type { DataDomainRemoveOptions } from '../types.js';
|
|
7
|
-
/**
|
|
8
|
-
* Data model creates a logical structure around data entities.
|
|
9
|
-
* It groups entities that represents a whole schema, like a Product data model
|
|
10
|
-
* can have entities that describe: the product entity, price history entity,
|
|
11
|
-
* product location, etc.
|
|
12
|
-
* @deprecated
|
|
13
|
-
*/
|
|
14
|
-
export interface IDataModel {
|
|
15
|
-
kind: typeof DataModelKind;
|
|
16
|
-
/**
|
|
17
|
-
* The key of the namespace.
|
|
18
|
-
*/
|
|
19
|
-
key: string;
|
|
20
|
-
/**
|
|
21
|
-
* The data model description.
|
|
22
|
-
*/
|
|
23
|
-
info: IThing;
|
|
24
|
-
/**
|
|
25
|
-
* The list of keys of entities that this data model contain.
|
|
26
|
-
*/
|
|
27
|
-
entities?: string[];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Data model creates a logical structure around data entities.
|
|
31
|
-
* It groups entities that represents a whole schema, like a Product data model
|
|
32
|
-
* can have entities that describe: the product entity, price history entity,
|
|
33
|
-
* product location, etc.
|
|
34
|
-
* @deprecated
|
|
35
|
-
*/
|
|
36
|
-
export declare class DataModel {
|
|
37
|
-
root: DataNamespace;
|
|
38
|
-
kind: string;
|
|
39
|
-
key: string;
|
|
40
|
-
/**
|
|
41
|
-
* The description of the data namespace.
|
|
42
|
-
*/
|
|
43
|
-
info: Thing;
|
|
44
|
-
/**
|
|
45
|
-
* The list of entities that this data model has.
|
|
46
|
-
*/
|
|
47
|
-
entities: DataEntity[];
|
|
48
|
-
static fromName(root: DataNamespace, name: string): DataModel;
|
|
49
|
-
/**
|
|
50
|
-
* @param root the root namespace.
|
|
51
|
-
* @param input The data model definition to restore.
|
|
52
|
-
*/
|
|
53
|
-
constructor(root: DataNamespace, input?: string | IDataModel);
|
|
54
|
-
new(init: IDataModel): void;
|
|
55
|
-
static isDataModel(input: unknown): boolean;
|
|
56
|
-
toJSON(): IDataModel;
|
|
57
|
-
protected _readEntity(key: string): DataEntity | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Removes self from the namespace with all entities.
|
|
60
|
-
*/
|
|
61
|
-
remove(opts?: DataDomainRemoveOptions): void;
|
|
62
|
-
/**
|
|
63
|
-
* Adapts an entity to this data model.
|
|
64
|
-
* The entity must already be added to another data model within this namespace for it to be
|
|
65
|
-
* adapted to this data model.
|
|
66
|
-
* This method is used to change the data model of an entity.
|
|
67
|
-
* It will remove the entity from the previous data model and add it to this one.
|
|
68
|
-
* @param entity The entity to adapt.
|
|
69
|
-
*/
|
|
70
|
-
adaptEntity(entity: DataEntity, opts?: DataItemAdaptingOptions): void;
|
|
71
|
-
/**
|
|
72
|
-
* Adds an entity to this data model.
|
|
73
|
-
*
|
|
74
|
-
* @param init The name of the entity to create, the instance of the entity or its schema
|
|
75
|
-
* @returns A reference to the created entity.
|
|
76
|
-
*/
|
|
77
|
-
addEntity(init: string | DataEntity | IDataEntity): DataEntity;
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Use the `getParentInstance()` method instead.
|
|
80
|
-
*/
|
|
81
|
-
getParent(): DataNamespace | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Returns the parent namespace where this data model exist.
|
|
84
|
-
*/
|
|
85
|
-
getParentInstance(): DataNamespace | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Creates breadcrumbs from this data model to the root namespace.
|
|
88
|
-
*/
|
|
89
|
-
breadcrumbs(): FileBreadcrumb[];
|
|
90
|
-
/**
|
|
91
|
-
* Checks whether the data model is a child of the given namespace.
|
|
92
|
-
* The relationship doesn't have to be direct, as long as the data model is in the hierarchy it will return true.
|
|
93
|
-
*
|
|
94
|
-
* @param key The key of the parent namespace to check.
|
|
95
|
-
* @returns True if this data model is a child of the given namespace.
|
|
96
|
-
*/
|
|
97
|
-
isChildOf(key: string): boolean;
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=DataModel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataModel.d.ts","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAE1D;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI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