@api-client/core 0.11.11 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Testing.md +1 -1
- package/bin/plugins/events/EventPlugin.ts +61 -0
- package/bin/plugins/events/assert.ts +193 -0
- package/bin/plugins/events/types.ts +6 -0
- package/bin/test.ts +8 -1
- package/build/src/amf/AmfShapeGenerator.d.ts +6 -3
- package/build/src/amf/AmfShapeGenerator.d.ts.map +1 -1
- package/build/src/amf/AmfShapeGenerator.js +4 -1
- package/build/src/amf/AmfShapeGenerator.js.map +1 -1
- package/build/src/amf/AmfTypes.d.ts +2 -2
- package/build/src/amf/AmfTypes.d.ts.map +1 -1
- package/build/src/amf/AmfTypes.js.map +1 -1
- package/build/src/amf/DataValueGenerator.d.ts +15 -15
- package/build/src/amf/DataValueGenerator.d.ts.map +1 -1
- package/build/src/amf/DataValueGenerator.js +14 -14
- package/build/src/amf/DataValueGenerator.js.map +1 -1
- package/build/src/browser.d.ts +12 -9
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +11 -8
- package/build/src/browser.js.map +1 -1
- package/build/src/exceptions/attach_exception.d.ts +11 -0
- package/build/src/exceptions/attach_exception.d.ts.map +1 -0
- package/build/src/exceptions/attach_exception.js +11 -0
- package/build/src/exceptions/attach_exception.js.map +1 -0
- package/build/src/exceptions/detach_exception.d.ts +11 -0
- package/build/src/exceptions/detach_exception.d.ts.map +1 -0
- package/build/src/exceptions/detach_exception.js +11 -0
- package/build/src/exceptions/detach_exception.js.map +1 -0
- package/build/src/exceptions/remove_model_exception.d.ts +8 -0
- package/build/src/exceptions/remove_model_exception.d.ts.map +1 -0
- package/build/src/exceptions/remove_model_exception.js +8 -0
- package/build/src/exceptions/remove_model_exception.js.map +1 -0
- package/build/src/exceptions/remove_namespace_exception.d.ts +8 -0
- package/build/src/exceptions/remove_namespace_exception.d.ts.map +1 -0
- package/build/src/exceptions/remove_namespace_exception.js +8 -0
- package/build/src/exceptions/remove_namespace_exception.js.map +1 -0
- package/build/src/index.d.ts +12 -9
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +11 -8
- package/build/src/index.js.map +1 -1
- package/build/src/legacy.d.ts +8 -0
- package/build/src/legacy.d.ts.map +1 -1
- package/build/src/legacy.js +9 -0
- package/build/src/legacy.js.map +1 -1
- package/build/src/modeling/Bindings.d.ts +2 -2
- package/build/src/modeling/Bindings.d.ts.map +1 -1
- package/build/src/modeling/Bindings.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts +601 -0
- package/build/src/modeling/DataDomain.d.ts.map +1 -0
- package/build/src/modeling/DataDomain.js +1142 -0
- package/build/src/modeling/DataDomain.js.map +1 -0
- package/build/src/modeling/DataFormat.d.ts +42 -41
- package/build/src/modeling/DataFormat.d.ts.map +1 -1
- package/build/src/modeling/DataFormat.js +30 -131
- package/build/src/modeling/DataFormat.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +281 -0
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -0
- package/build/src/modeling/DomainAssociation.js +440 -0
- package/build/src/modeling/DomainAssociation.js.map +1 -0
- package/build/src/modeling/DomainElement.d.ts +33 -0
- package/build/src/modeling/DomainElement.d.ts.map +1 -0
- package/build/src/modeling/DomainElement.js +32 -0
- package/build/src/modeling/DomainElement.js.map +1 -0
- package/build/src/modeling/DomainEntity.d.ts +383 -0
- package/build/src/modeling/DomainEntity.d.ts.map +1 -0
- package/build/src/modeling/DomainEntity.js +718 -0
- package/build/src/modeling/DomainEntity.js.map +1 -0
- package/build/src/modeling/DomainFile.d.ts +25 -0
- package/build/src/modeling/DomainFile.d.ts.map +1 -0
- package/build/src/modeling/DomainFile.js +86 -0
- package/build/src/modeling/DomainFile.js.map +1 -0
- package/build/src/modeling/DomainImpactAnalysis.d.ts +60 -47
- package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.js +201 -132
- package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
- package/build/src/modeling/DomainModel.d.ts +226 -0
- package/build/src/modeling/DomainModel.d.ts.map +1 -0
- package/build/src/modeling/DomainModel.js +401 -0
- package/build/src/modeling/DomainModel.js.map +1 -0
- package/build/src/modeling/DomainNamespace.d.ts +268 -0
- package/build/src/modeling/DomainNamespace.d.ts.map +1 -0
- package/build/src/modeling/DomainNamespace.js +512 -0
- package/build/src/modeling/DomainNamespace.js.map +1 -0
- package/build/src/modeling/DomainProperty.d.ts +281 -0
- package/build/src/modeling/DomainProperty.d.ts.map +1 -0
- package/build/src/modeling/DomainProperty.js +560 -0
- package/build/src/modeling/DomainProperty.js.map +1 -0
- package/build/src/modeling/DomainSerialization.d.ts +40 -0
- package/build/src/modeling/DomainSerialization.d.ts.map +1 -0
- package/build/src/modeling/DomainSerialization.js +288 -0
- package/build/src/modeling/DomainSerialization.js.map +1 -0
- package/build/src/modeling/DomainVersioning.d.ts +17 -0
- package/build/src/modeling/DomainVersioning.d.ts.map +1 -0
- package/build/src/modeling/DomainVersioning.js +124 -0
- package/build/src/modeling/DomainVersioning.js.map +1 -0
- package/build/src/modeling/GraphUtils.d.ts +8 -0
- package/build/src/modeling/GraphUtils.d.ts.map +1 -0
- package/build/src/modeling/GraphUtils.js +26 -0
- package/build/src/modeling/GraphUtils.js.map +1 -0
- package/build/src/modeling/amf/ShapeGenerator.d.ts +164 -0
- package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -0
- package/build/src/modeling/amf/ShapeGenerator.js +492 -0
- package/build/src/modeling/amf/ShapeGenerator.js.map +1 -0
- package/build/src/modeling/{DataAssociation.d.ts → legacy/DataAssociation.d.ts} +10 -5
- package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -0
- package/build/src/modeling/{DataAssociation.js → legacy/DataAssociation.js} +9 -6
- package/build/src/modeling/legacy/DataAssociation.js.map +1 -0
- package/build/src/modeling/{DataEntity.d.ts → legacy/DataEntity.d.ts} +12 -7
- package/build/src/modeling/legacy/DataEntity.d.ts.map +1 -0
- package/build/src/modeling/{DataEntity.js → legacy/DataEntity.js} +19 -18
- package/build/src/modeling/legacy/DataEntity.js.map +1 -0
- package/build/src/modeling/{DataEntityBuilder.d.ts → legacy/DataEntityBuilder.d.ts} +3 -2
- package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +1 -0
- package/build/src/modeling/{DataEntityBuilder.js → legacy/DataEntityBuilder.js} +3 -2
- package/build/src/modeling/legacy/DataEntityBuilder.js.map +1 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +298 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +1 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.js +441 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.js.map +1 -0
- package/build/src/modeling/{DataModel.d.ts → legacy/DataModel.d.ts} +6 -4
- package/build/src/modeling/legacy/DataModel.d.ts.map +1 -0
- package/build/src/modeling/{DataModel.js → legacy/DataModel.js} +7 -6
- package/build/src/modeling/legacy/DataModel.js.map +1 -0
- package/build/src/modeling/{DataNamespace.d.ts → legacy/DataNamespace.d.ts} +22 -3
- package/build/src/modeling/legacy/DataNamespace.d.ts.map +1 -0
- package/build/src/modeling/{DataNamespace.js → legacy/DataNamespace.js} +7 -3
- package/build/src/modeling/legacy/DataNamespace.js.map +1 -0
- package/build/src/modeling/{DataProperty.d.ts → legacy/DataProperty.d.ts} +13 -5
- package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -0
- package/build/src/modeling/{DataProperty.js → legacy/DataProperty.js} +8 -5
- package/build/src/modeling/legacy/DataProperty.js.map +1 -0
- package/build/src/modeling/observed.d.ts +67 -0
- package/build/src/modeling/observed.d.ts.map +1 -0
- package/build/src/modeling/observed.js +230 -0
- package/build/src/modeling/observed.js.map +1 -0
- package/build/src/modeling/types.d.ts +165 -1
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/models/Thing.d.ts +26 -5
- package/build/src/models/Thing.d.ts.map +1 -1
- package/build/src/models/Thing.js +193 -91
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/kinds.d.ts +31 -6
- package/build/src/models/kinds.d.ts.map +1 -1
- package/build/src/models/kinds.js +31 -6
- package/build/src/models/kinds.js.map +1 -1
- package/build/src/models/store/DataFile.d.ts +3 -1
- package/build/src/models/store/DataFile.d.ts.map +1 -1
- package/build/src/models/store/DataFile.js +2 -0
- package/build/src/models/store/DataFile.js.map +1 -1
- package/build/src/models/types.d.ts +12 -0
- package/build/src/models/types.d.ts.map +1 -0
- package/build/src/models/types.js +2 -0
- package/build/src/models/types.js.map +1 -0
- package/build/src/runtime/store/FilesSdk.d.ts +2 -2
- package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/data/models/example-generator-api.json +16 -16
- package/package.json +20 -6
- package/readme.md +1 -1
- package/src/amf/AmfShapeGenerator.ts +7 -4
- package/src/amf/AmfTypes.ts +2 -2
- package/src/amf/DataValueGenerator.ts +21 -21
- package/src/exceptions/attach_exception.ts +11 -0
- package/src/exceptions/detach_exception.ts +11 -0
- package/src/exceptions/remove_model_exception.ts +8 -0
- package/src/exceptions/remove_namespace_exception.ts +8 -0
- package/src/modeling/Bindings.ts +2 -2
- package/src/modeling/DataDomain.ts +1221 -0
- package/src/modeling/DataFormat.ts +54 -163
- package/src/modeling/DomainAssociation.ts +476 -0
- package/src/modeling/DomainElement.ts +50 -0
- package/src/modeling/DomainEntity.ts +769 -0
- package/src/modeling/DomainFile.ts +94 -0
- package/src/modeling/DomainImpactAnalysis.ts +218 -144
- package/src/modeling/DomainModel.ts +421 -0
- package/src/modeling/DomainNamespace.ts +537 -0
- package/src/modeling/DomainProperty.ts +548 -0
- package/src/modeling/DomainSerialization.ts +312 -0
- package/src/modeling/DomainVersioning.ts +144 -0
- package/src/modeling/GraphUtils.ts +28 -0
- package/src/modeling/amf/ShapeGenerator.ts +552 -0
- package/src/modeling/graph.md +115 -0
- package/src/modeling/{DataAssociation.ts → legacy/DataAssociation.ts} +13 -8
- package/src/modeling/{DataEntity.ts → legacy/DataEntity.ts} +28 -23
- package/src/modeling/{DataEntityBuilder.ts → legacy/DataEntityBuilder.ts} +4 -3
- package/src/modeling/legacy/DataImpactAnalysis.ts +530 -0
- package/src/modeling/{DataModel.ts → legacy/DataModel.ts} +10 -8
- package/src/modeling/{DataNamespace.ts → legacy/DataNamespace.ts} +23 -5
- package/src/modeling/{DataProperty.ts → legacy/DataProperty.ts} +15 -7
- package/src/modeling/observed.ts +267 -0
- package/src/modeling/types.ts +174 -1
- package/src/models/Thing.ts +70 -5
- package/src/models/kinds.ts +32 -6
- package/src/models/store/DataFile.ts +3 -1
- package/src/models/types.ts +11 -0
- package/src/runtime/store/FilesSdk.ts +2 -2
- package/tests/unit/amf/data_value_generator.spec.ts +15 -15
- package/tests/unit/legacy-transformers/ARC-legacy-import.spec.ts +1 -1
- package/tests/unit/modeling/amf/shape_generator.spec.ts +1174 -0
- package/tests/unit/modeling/data_domain.spec.ts +444 -0
- package/tests/unit/modeling/data_domain_associations.spec.ts +279 -0
- package/tests/unit/modeling/data_domain_change_observers.spec.ts +681 -0
- package/tests/unit/modeling/data_domain_entities.spec.ts +449 -0
- package/tests/unit/modeling/data_domain_foreign.spec.ts +355 -0
- package/tests/unit/modeling/data_domain_models.spec.ts +658 -0
- package/tests/unit/modeling/data_domain_namespaces.spec.ts +668 -0
- package/tests/unit/modeling/data_domain_property.spec.ts +264 -0
- package/tests/unit/modeling/data_domain_serialization.spec.ts +294 -0
- package/tests/unit/modeling/domain.property.spec.ts +822 -0
- package/tests/unit/modeling/domain_asociation.spec.ts +643 -0
- package/tests/unit/modeling/domain_asociation_targets.spec.ts +350 -0
- package/tests/unit/modeling/domain_entity.spec.ts +730 -0
- package/tests/unit/modeling/domain_entity_associations.spec.ts +330 -0
- package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +988 -0
- package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +1451 -0
- package/tests/unit/modeling/domain_entity_fields.spec.ts +113 -0
- package/tests/unit/modeling/domain_entity_generators.spec.ts +20 -0
- package/tests/unit/modeling/domain_entity_parents.spec.ts +291 -0
- package/tests/unit/modeling/domain_entity_properties.spec.ts +305 -0
- package/tests/unit/modeling/{data_file.spec.ts → domain_file.spec.ts} +29 -85
- package/tests/unit/modeling/domain_impact_analysis.spec.ts +452 -0
- package/tests/unit/modeling/domain_model.spec.ts +568 -0
- package/tests/unit/modeling/domain_model_entities.spec.ts +408 -0
- package/tests/unit/modeling/domain_namespace.spec.ts +514 -0
- package/tests/unit/modeling/domain_namespace_models.spec.ts +324 -0
- package/tests/unit/modeling/domain_namespace_namespaces.spec.ts +404 -0
- package/tests/unit/modeling/domain_versioning.spec.ts +140 -0
- package/tests/unit/{amf → modeling/legacy}/amf_shape_generator.spec.ts +11 -11
- package/tests/unit/modeling/{data_association.spec.ts → legacy/data_association.spec.ts} +3 -11
- package/tests/unit/modeling/{data_entity.spec.ts → legacy/data_entity.spec.ts} +10 -8
- package/tests/unit/modeling/{data_entity_generator_json.spec.ts → legacy/data_entity_generator_json.spec.ts} +1 -1
- package/tests/unit/modeling/{data_entity_generator_xml.spec.ts → legacy/data_entity_generator_xml.spec.ts} +1 -1
- package/tests/unit/modeling/{data_model.spec.ts → legacy/data_model.spec.ts} +3 -3
- package/tests/unit/modeling/{data_namespace.spec.ts → legacy/data_namespace.spec.ts} +3 -10
- package/tests/unit/modeling/{data_property.spec.ts → legacy/data_property.spec.ts} +3 -6
- package/tests/unit/modeling/{impact_analysis.spec.ts → legacy/impact_analysis.spec.ts} +9 -9
- package/tests/unit/models/File/new.spec.ts +1 -1
- package/tests/unit/models/HttpProject.spec.ts +3 -3
- package/tsconfig.node.json +35 -0
- package/build/src/modeling/DataAssociation.d.ts.map +0 -1
- package/build/src/modeling/DataAssociation.js.map +0 -1
- package/build/src/modeling/DataEntity.d.ts.map +0 -1
- package/build/src/modeling/DataEntity.js.map +0 -1
- package/build/src/modeling/DataEntityBuilder.d.ts.map +0 -1
- package/build/src/modeling/DataEntityBuilder.js.map +0 -1
- package/build/src/modeling/DataModel.d.ts.map +0 -1
- package/build/src/modeling/DataModel.js.map +0 -1
- package/build/src/modeling/DataNamespace.d.ts.map +0 -1
- package/build/src/modeling/DataNamespace.js.map +0 -1
- package/build/src/modeling/DataProperty.d.ts.map +0 -1
- package/build/src/modeling/DataProperty.js.map +0 -1
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import type { DataDomain } from './DataDomain.js';
|
|
2
|
+
import { DomainEntityKind } from '../models/kinds.js';
|
|
3
|
+
import { DomainElement, type DomainElementSchema } from './DomainElement.js';
|
|
4
|
+
import { type IThing, Thing } from '../models/Thing.js';
|
|
5
|
+
import type { IShapeUnion } from '../amf/definitions/Shapes.js';
|
|
6
|
+
import { DomainProperty, type DomainPropertySchema } from './DomainProperty.js';
|
|
7
|
+
import { DomainAssociation, DomainAssociationSchema } from './DomainAssociation.js';
|
|
8
|
+
import type { AssociationAddOptions } from './types.js';
|
|
9
|
+
import type { FileBreadcrumb } from '../models/store/File.js';
|
|
10
|
+
import type { DomainModel } from './DomainModel.js';
|
|
11
|
+
import type { IShapeRenderOptions } from '../amf/shape/ShapeBase.js';
|
|
12
|
+
export interface EntityOrderedItem {
|
|
13
|
+
/**
|
|
14
|
+
* The type of the ordered item.
|
|
15
|
+
*/
|
|
16
|
+
type: 'property' | 'association';
|
|
17
|
+
/**
|
|
18
|
+
* The key of the ordered item.
|
|
19
|
+
*/
|
|
20
|
+
key: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DomainEntitySchema extends DomainElementSchema {
|
|
23
|
+
kind: typeof DomainEntityKind;
|
|
24
|
+
/**
|
|
25
|
+
* The domain entity description.
|
|
26
|
+
*/
|
|
27
|
+
info: IThing;
|
|
28
|
+
/**
|
|
29
|
+
* Optional general purpose tags for the UI.
|
|
30
|
+
*/
|
|
31
|
+
tags?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* For future use.
|
|
34
|
+
*
|
|
35
|
+
* The keys of the taxonomy items associated with the entity.
|
|
36
|
+
*/
|
|
37
|
+
taxonomy?: string[];
|
|
38
|
+
/**
|
|
39
|
+
* The ordered list of fields (properties and associations) in the schema.
|
|
40
|
+
* These only keep references to the properties and associations.
|
|
41
|
+
* The order of the fields is important as it defines the order of the
|
|
42
|
+
* properties in the schema.
|
|
43
|
+
*/
|
|
44
|
+
fields?: EntityOrderedItem[];
|
|
45
|
+
/**
|
|
46
|
+
* Whether this entity is deprecated.
|
|
47
|
+
*/
|
|
48
|
+
deprecated?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Represents an entity within a data domain model.
|
|
52
|
+
*
|
|
53
|
+
* A `DomainEntity` defines a structured data type,
|
|
54
|
+
* containing properties and associations. It's a
|
|
55
|
+
* fundamental building block for modeling complex data
|
|
56
|
+
* structures.
|
|
57
|
+
*
|
|
58
|
+
* **Key Features:**
|
|
59
|
+
*
|
|
60
|
+
* - **Properties:** Defines the data elements (fields) within the entity.
|
|
61
|
+
* - **Associations:** Defines relationships to other entities.
|
|
62
|
+
* - **Inheritance:** Supports inheriting properties and associations from parent entities.
|
|
63
|
+
* - **Metadata:** Supports tags, taxonomy, and deprecation status.
|
|
64
|
+
* - **AMF Shape Generation:** Can be serialized to an AMF (API Modeling Framework) shape.
|
|
65
|
+
* - **Example Generation:** Can generate example databased on its schema.
|
|
66
|
+
*
|
|
67
|
+
* **Usage:**
|
|
68
|
+
*
|
|
69
|
+
* The preferred way to create a `DomainEntity` is through
|
|
70
|
+
* the `DomainModel.addEntity()` method.
|
|
71
|
+
*
|
|
72
|
+
* **Example:**
|
|
73
|
+
*
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const dataDomain = new DataDomain();
|
|
76
|
+
* const userModel = dataDomain.addModel({ key: 'userModel' });
|
|
77
|
+
* const userEntity = userModel.addEntity({ key: 'user' });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare class DomainEntity extends DomainElement {
|
|
81
|
+
/**
|
|
82
|
+
* The kind of the domain element.
|
|
83
|
+
*/
|
|
84
|
+
kind: typeof DomainEntityKind;
|
|
85
|
+
/**
|
|
86
|
+
* The description of the domain entity.
|
|
87
|
+
*/
|
|
88
|
+
accessor info: Thing;
|
|
89
|
+
/**
|
|
90
|
+
* Optional general purpose tags for the UI.
|
|
91
|
+
*/
|
|
92
|
+
accessor tags: string[];
|
|
93
|
+
/**
|
|
94
|
+
* Reserved for future use.
|
|
95
|
+
*
|
|
96
|
+
* The keys of the taxonomy items associated with the entity.
|
|
97
|
+
*/
|
|
98
|
+
accessor taxonomy: string[];
|
|
99
|
+
/**
|
|
100
|
+
* The ordered list of fields (properties and associations) in the schema.
|
|
101
|
+
* These only keep references to the properties and associations.
|
|
102
|
+
* The order of the fields is important as it defines the order of the
|
|
103
|
+
* properties in the schema.
|
|
104
|
+
*/
|
|
105
|
+
accessor fields: EntityOrderedItem[];
|
|
106
|
+
/**
|
|
107
|
+
* Whether this entity is deprecated.
|
|
108
|
+
*/
|
|
109
|
+
accessor deprecated: boolean | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a full data entity schema with defaults.
|
|
112
|
+
*
|
|
113
|
+
* @param input The partial data entity schema.
|
|
114
|
+
* @returns The data entity schema.
|
|
115
|
+
*/
|
|
116
|
+
static createSchema(input?: Partial<DomainEntitySchema>): DomainEntitySchema;
|
|
117
|
+
/**
|
|
118
|
+
* Creates a new domain entity instance.
|
|
119
|
+
*
|
|
120
|
+
* You probably want to use the `DomainModel.addEntity()`
|
|
121
|
+
* method instead.
|
|
122
|
+
*
|
|
123
|
+
* @param root A reference to the root DataDomain instance.
|
|
124
|
+
* @param input The partial domain entity schema.
|
|
125
|
+
*/
|
|
126
|
+
constructor(root: DataDomain, input?: Partial<DomainEntitySchema>);
|
|
127
|
+
/**
|
|
128
|
+
* Generates a JSON representation of the entity.
|
|
129
|
+
*
|
|
130
|
+
* @returns A plain object representation of the `DomainEntity`.
|
|
131
|
+
*/
|
|
132
|
+
toJSON(): DomainEntitySchema;
|
|
133
|
+
/**
|
|
134
|
+
* Returns a parent data entity where this data property
|
|
135
|
+
* exist.
|
|
136
|
+
*
|
|
137
|
+
* @returns The parent `DomainModel` or undefined if not found.
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const parent = entity.getParentInstance();
|
|
141
|
+
* if (parent) {
|
|
142
|
+
* console.log(parent.key);
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
getParentInstance(): DomainModel | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Adds a property to this entity.
|
|
149
|
+
*
|
|
150
|
+
* @param property The partial property schema.
|
|
151
|
+
* @returns The created `DomainProperty` instance.
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* const property = entity.addProperty({
|
|
155
|
+
* key: 'name',
|
|
156
|
+
* type: 'string',
|
|
157
|
+
* required: true,
|
|
158
|
+
* })
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
addProperty(property?: Partial<DomainPropertySchema>): DomainProperty;
|
|
162
|
+
/**
|
|
163
|
+
* Removes a property from this entity.
|
|
164
|
+
*
|
|
165
|
+
* @param key The key of the property to remove.
|
|
166
|
+
* @throws {RemovePropertyException} When the property does not exist.
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* entity.removeProperty('name')
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
removeProperty(key: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* Lists all properties of this entity.
|
|
175
|
+
*
|
|
176
|
+
* Note, it accounts for the order of the properties as
|
|
177
|
+
* defined in the `fields` array.
|
|
178
|
+
*
|
|
179
|
+
* @returns A generator that yields each `DomainProperty`.
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* for (const property of entity.listProperties()) {
|
|
183
|
+
* console.log(property.key);
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
listProperties(): Generator<DomainProperty>;
|
|
188
|
+
/**
|
|
189
|
+
* Checks if this entity has any properties.
|
|
190
|
+
*
|
|
191
|
+
* @returns True if the entity has properties.
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* if (entity.hasProperties()) {
|
|
195
|
+
* // ...
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
hasProperties(): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Lists all parent entities of this entity.
|
|
202
|
+
*
|
|
203
|
+
* @returns A generator that yields each parent `DomainEntity`.
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* for (const parent of entity.listParents()) {
|
|
207
|
+
* console.log(parent.key);
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
listParents(): Generator<DomainEntity>;
|
|
212
|
+
/**
|
|
213
|
+
* Adds a parent to this entity.
|
|
214
|
+
*
|
|
215
|
+
* @param key The key of the parent entity.
|
|
216
|
+
* @param domain The key of the foreign domain the parent belongs to.
|
|
217
|
+
* @returns `this` for chaining.
|
|
218
|
+
* @throws ValidationError When the parent does not exist or a circular dependency is detected.
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* entity.addParent('baseEntity');
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
addParent(key: string, domain?: string): this;
|
|
225
|
+
/**
|
|
226
|
+
* Removes a parent from this entity.
|
|
227
|
+
*
|
|
228
|
+
* @param key The key of the parent entity to remove.
|
|
229
|
+
* @returns `this` for chaining.
|
|
230
|
+
* @throws Error When the parent does not exist.
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* entity.removeParent('baseEntity');
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
removeParent(key: string): this;
|
|
237
|
+
/**
|
|
238
|
+
* Checks if this entity has any parents.
|
|
239
|
+
*
|
|
240
|
+
* @returns True if the entity has parents.
|
|
241
|
+
* @example
|
|
242
|
+
* ```typescript
|
|
243
|
+
* if (entity.hasParents()) {
|
|
244
|
+
* // ...
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
hasParents(): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Checks if the passed entity has a circular parent
|
|
251
|
+
* relationship when attempting to add a new parent.
|
|
252
|
+
*
|
|
253
|
+
* @param key The key of the parent being added.
|
|
254
|
+
* @returns True if adding this parent would create a
|
|
255
|
+
* circular relationship.
|
|
256
|
+
*/
|
|
257
|
+
hasCircularParent(key: string): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Creates breadcrumbs from this entity to the root
|
|
260
|
+
* namespace.
|
|
261
|
+
*
|
|
262
|
+
* @returns An array of `FileBreadcrumb` instances.
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* const breadcrumbs = entity.breadcrumbs();
|
|
266
|
+
* console.log(breadcrumbs);
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
breadcrumbs(): FileBreadcrumb[];
|
|
270
|
+
/**
|
|
271
|
+
* Adds an association to this entity.
|
|
272
|
+
*
|
|
273
|
+
* @param init The association options.
|
|
274
|
+
* @param input The partial association schema.
|
|
275
|
+
* @returns The created `DomainAssociation` instance.
|
|
276
|
+
* @throws Error When the target entity does not exist.
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* const association = entity.addAssociation({
|
|
280
|
+
* key: 'address',
|
|
281
|
+
* });
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
addAssociation(init?: AssociationAddOptions, input?: Partial<DomainAssociationSchema>): DomainAssociation;
|
|
285
|
+
/**
|
|
286
|
+
* Removes an association from this entity.
|
|
287
|
+
*
|
|
288
|
+
* @param key The key of the association to remove.
|
|
289
|
+
* @throws Error When the association does not exist.
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* entity.removeAssociation('address');
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
removeAssociation(key: string): void;
|
|
296
|
+
/**
|
|
297
|
+
* Lists all associations of this entity.
|
|
298
|
+
*
|
|
299
|
+
* The order of the associations is defined in the `fields` array.
|
|
300
|
+
*
|
|
301
|
+
* @returns A generator that yields each
|
|
302
|
+
* `DomainAssociation`.
|
|
303
|
+
* @example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* for (const association of entity.listAssociations()) {
|
|
306
|
+
* console.log(association.key);
|
|
307
|
+
* }
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
listAssociations(): Generator<DomainAssociation>;
|
|
311
|
+
/**
|
|
312
|
+
* Checks if this entity has any associations.
|
|
313
|
+
*
|
|
314
|
+
* @returns True if the entity has associations.
|
|
315
|
+
* @example
|
|
316
|
+
* ```typescript
|
|
317
|
+
* if (entity.hasAssociations()) {
|
|
318
|
+
* // ...
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
hasAssociations(): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Lists all fields (properties and associations) of this entity.
|
|
325
|
+
*
|
|
326
|
+
* @returns A generator that yields each `DomainAssociation` or `DomainProperty`.
|
|
327
|
+
* @example
|
|
328
|
+
* ```typescript
|
|
329
|
+
* for (const field of entity.listFields()) {
|
|
330
|
+
* console.log(field.key);
|
|
331
|
+
* }
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
listFields(): Generator<DomainAssociation | DomainProperty>;
|
|
335
|
+
/**
|
|
336
|
+
* Checks if this entity has any fields (properties or associations).
|
|
337
|
+
*
|
|
338
|
+
* @returns True if the entity has fields.
|
|
339
|
+
* @example
|
|
340
|
+
* ```typescript
|
|
341
|
+
* if (entity.hasFields()) {
|
|
342
|
+
* // ...
|
|
343
|
+
* }
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
hasFields(): boolean;
|
|
347
|
+
private removeField;
|
|
348
|
+
/**
|
|
349
|
+
* Creates an AMF's data Shape.
|
|
350
|
+
*
|
|
351
|
+
* The property itself is auto-generated. If the `schema` is defined then it is used
|
|
352
|
+
* as the `range` of the property. Otherwise basic shape is generated for the range.
|
|
353
|
+
*
|
|
354
|
+
* This is a preferred way of reading the AMF shape as this synchronizes changed
|
|
355
|
+
* data properties with the shape definition.
|
|
356
|
+
*
|
|
357
|
+
* @returns AMF property shape definition.
|
|
358
|
+
*/
|
|
359
|
+
toApiShape(): IShapeUnion;
|
|
360
|
+
/**
|
|
361
|
+
* Reads the schema of the Entity and generates an example for it.
|
|
362
|
+
*
|
|
363
|
+
* @param mime The mime type of the example.
|
|
364
|
+
* @param opts The example generation options.
|
|
365
|
+
* @returns The generated example.
|
|
366
|
+
* @example
|
|
367
|
+
* ```typescript
|
|
368
|
+
* const example = entity.toExample('application/json');
|
|
369
|
+
* console.log(example);
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
toExample(mime: string, opts?: IShapeRenderOptions): string | number | boolean | null | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* Checks whether the entity is a child of the given namespace or data model.
|
|
375
|
+
* The relationship doesn't have to be direct, as long as the entity
|
|
376
|
+
* is in the hierarchy it will return true.
|
|
377
|
+
*
|
|
378
|
+
* @param key The key of the parent to check.
|
|
379
|
+
* @returns True if this entity is a child of the given namespace or data model.
|
|
380
|
+
*/
|
|
381
|
+
isChildOf(key: string): boolean;
|
|
382
|
+
}
|
|
383
|
+
//# sourceMappingURL=DomainEntity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomainEntity.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainEntity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD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