@api-client/core 0.11.10 → 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.
Files changed (252) hide show
  1. package/Testing.md +1 -1
  2. package/bin/plugins/events/EventPlugin.ts +61 -0
  3. package/bin/plugins/events/assert.ts +193 -0
  4. package/bin/plugins/events/types.ts +6 -0
  5. package/bin/test.ts +8 -1
  6. package/build/src/amf/AmfShapeGenerator.d.ts +6 -3
  7. package/build/src/amf/AmfShapeGenerator.d.ts.map +1 -1
  8. package/build/src/amf/AmfShapeGenerator.js +4 -1
  9. package/build/src/amf/AmfShapeGenerator.js.map +1 -1
  10. package/build/src/amf/AmfTypes.d.ts +2 -2
  11. package/build/src/amf/AmfTypes.d.ts.map +1 -1
  12. package/build/src/amf/AmfTypes.js.map +1 -1
  13. package/build/src/amf/DataValueGenerator.d.ts +15 -15
  14. package/build/src/amf/DataValueGenerator.d.ts.map +1 -1
  15. package/build/src/amf/DataValueGenerator.js +14 -14
  16. package/build/src/amf/DataValueGenerator.js.map +1 -1
  17. package/build/src/browser.d.ts +12 -9
  18. package/build/src/browser.d.ts.map +1 -1
  19. package/build/src/browser.js +11 -8
  20. package/build/src/browser.js.map +1 -1
  21. package/build/src/exceptions/attach_exception.d.ts +11 -0
  22. package/build/src/exceptions/attach_exception.d.ts.map +1 -0
  23. package/build/src/exceptions/attach_exception.js +11 -0
  24. package/build/src/exceptions/attach_exception.js.map +1 -0
  25. package/build/src/exceptions/detach_exception.d.ts +11 -0
  26. package/build/src/exceptions/detach_exception.d.ts.map +1 -0
  27. package/build/src/exceptions/detach_exception.js +11 -0
  28. package/build/src/exceptions/detach_exception.js.map +1 -0
  29. package/build/src/exceptions/remove_model_exception.d.ts +8 -0
  30. package/build/src/exceptions/remove_model_exception.d.ts.map +1 -0
  31. package/build/src/exceptions/remove_model_exception.js +8 -0
  32. package/build/src/exceptions/remove_model_exception.js.map +1 -0
  33. package/build/src/exceptions/remove_namespace_exception.d.ts +8 -0
  34. package/build/src/exceptions/remove_namespace_exception.d.ts.map +1 -0
  35. package/build/src/exceptions/remove_namespace_exception.js +8 -0
  36. package/build/src/exceptions/remove_namespace_exception.js.map +1 -0
  37. package/build/src/index.d.ts +12 -9
  38. package/build/src/index.d.ts.map +1 -1
  39. package/build/src/index.js +11 -8
  40. package/build/src/index.js.map +1 -1
  41. package/build/src/legacy.d.ts +8 -0
  42. package/build/src/legacy.d.ts.map +1 -1
  43. package/build/src/legacy.js +9 -0
  44. package/build/src/legacy.js.map +1 -1
  45. package/build/src/modeling/Bindings.d.ts +2 -2
  46. package/build/src/modeling/Bindings.d.ts.map +1 -1
  47. package/build/src/modeling/Bindings.js.map +1 -1
  48. package/build/src/modeling/DataDomain.d.ts +601 -0
  49. package/build/src/modeling/DataDomain.d.ts.map +1 -0
  50. package/build/src/modeling/DataDomain.js +1142 -0
  51. package/build/src/modeling/DataDomain.js.map +1 -0
  52. package/build/src/modeling/DataFormat.d.ts +42 -41
  53. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  54. package/build/src/modeling/DataFormat.js +30 -131
  55. package/build/src/modeling/DataFormat.js.map +1 -1
  56. package/build/src/modeling/DomainAssociation.d.ts +281 -0
  57. package/build/src/modeling/DomainAssociation.d.ts.map +1 -0
  58. package/build/src/modeling/DomainAssociation.js +440 -0
  59. package/build/src/modeling/DomainAssociation.js.map +1 -0
  60. package/build/src/modeling/DomainElement.d.ts +33 -0
  61. package/build/src/modeling/DomainElement.d.ts.map +1 -0
  62. package/build/src/modeling/DomainElement.js +32 -0
  63. package/build/src/modeling/DomainElement.js.map +1 -0
  64. package/build/src/modeling/DomainEntity.d.ts +383 -0
  65. package/build/src/modeling/DomainEntity.d.ts.map +1 -0
  66. package/build/src/modeling/DomainEntity.js +718 -0
  67. package/build/src/modeling/DomainEntity.js.map +1 -0
  68. package/build/src/modeling/DomainFile.d.ts +25 -0
  69. package/build/src/modeling/DomainFile.d.ts.map +1 -0
  70. package/build/src/modeling/DomainFile.js +86 -0
  71. package/build/src/modeling/DomainFile.js.map +1 -0
  72. package/build/src/modeling/DomainImpactAnalysis.d.ts +60 -47
  73. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  74. package/build/src/modeling/DomainImpactAnalysis.js +201 -132
  75. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  76. package/build/src/modeling/DomainModel.d.ts +226 -0
  77. package/build/src/modeling/DomainModel.d.ts.map +1 -0
  78. package/build/src/modeling/DomainModel.js +401 -0
  79. package/build/src/modeling/DomainModel.js.map +1 -0
  80. package/build/src/modeling/DomainNamespace.d.ts +268 -0
  81. package/build/src/modeling/DomainNamespace.d.ts.map +1 -0
  82. package/build/src/modeling/DomainNamespace.js +512 -0
  83. package/build/src/modeling/DomainNamespace.js.map +1 -0
  84. package/build/src/modeling/DomainProperty.d.ts +281 -0
  85. package/build/src/modeling/DomainProperty.d.ts.map +1 -0
  86. package/build/src/modeling/DomainProperty.js +560 -0
  87. package/build/src/modeling/DomainProperty.js.map +1 -0
  88. package/build/src/modeling/DomainSerialization.d.ts +40 -0
  89. package/build/src/modeling/DomainSerialization.d.ts.map +1 -0
  90. package/build/src/modeling/DomainSerialization.js +288 -0
  91. package/build/src/modeling/DomainSerialization.js.map +1 -0
  92. package/build/src/modeling/DomainVersioning.d.ts +17 -0
  93. package/build/src/modeling/DomainVersioning.d.ts.map +1 -0
  94. package/build/src/modeling/DomainVersioning.js +124 -0
  95. package/build/src/modeling/DomainVersioning.js.map +1 -0
  96. package/build/src/modeling/GraphUtils.d.ts +8 -0
  97. package/build/src/modeling/GraphUtils.d.ts.map +1 -0
  98. package/build/src/modeling/GraphUtils.js +26 -0
  99. package/build/src/modeling/GraphUtils.js.map +1 -0
  100. package/build/src/modeling/amf/ShapeGenerator.d.ts +164 -0
  101. package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -0
  102. package/build/src/modeling/amf/ShapeGenerator.js +492 -0
  103. package/build/src/modeling/amf/ShapeGenerator.js.map +1 -0
  104. package/build/src/modeling/{DataAssociation.d.ts → legacy/DataAssociation.d.ts} +10 -5
  105. package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -0
  106. package/build/src/modeling/{DataAssociation.js → legacy/DataAssociation.js} +9 -6
  107. package/build/src/modeling/legacy/DataAssociation.js.map +1 -0
  108. package/build/src/modeling/{DataEntity.d.ts → legacy/DataEntity.d.ts} +12 -7
  109. package/build/src/modeling/legacy/DataEntity.d.ts.map +1 -0
  110. package/build/src/modeling/{DataEntity.js → legacy/DataEntity.js} +19 -18
  111. package/build/src/modeling/legacy/DataEntity.js.map +1 -0
  112. package/build/src/modeling/{DataEntityBuilder.d.ts → legacy/DataEntityBuilder.d.ts} +3 -2
  113. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +1 -0
  114. package/build/src/modeling/{DataEntityBuilder.js → legacy/DataEntityBuilder.js} +3 -2
  115. package/build/src/modeling/legacy/DataEntityBuilder.js.map +1 -0
  116. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +298 -0
  117. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +1 -0
  118. package/build/src/modeling/legacy/DataImpactAnalysis.js +441 -0
  119. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +1 -0
  120. package/build/src/modeling/{DataModel.d.ts → legacy/DataModel.d.ts} +6 -4
  121. package/build/src/modeling/legacy/DataModel.d.ts.map +1 -0
  122. package/build/src/modeling/{DataModel.js → legacy/DataModel.js} +7 -6
  123. package/build/src/modeling/legacy/DataModel.js.map +1 -0
  124. package/build/src/modeling/{DataNamespace.d.ts → legacy/DataNamespace.d.ts} +22 -3
  125. package/build/src/modeling/legacy/DataNamespace.d.ts.map +1 -0
  126. package/build/src/modeling/{DataNamespace.js → legacy/DataNamespace.js} +7 -3
  127. package/build/src/modeling/legacy/DataNamespace.js.map +1 -0
  128. package/build/src/modeling/{DataProperty.d.ts → legacy/DataProperty.d.ts} +13 -5
  129. package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -0
  130. package/build/src/modeling/{DataProperty.js → legacy/DataProperty.js} +8 -5
  131. package/build/src/modeling/legacy/DataProperty.js.map +1 -0
  132. package/build/src/modeling/observed.d.ts +67 -0
  133. package/build/src/modeling/observed.d.ts.map +1 -0
  134. package/build/src/modeling/observed.js +230 -0
  135. package/build/src/modeling/observed.js.map +1 -0
  136. package/build/src/modeling/types.d.ts +165 -1
  137. package/build/src/modeling/types.d.ts.map +1 -1
  138. package/build/src/modeling/types.js.map +1 -1
  139. package/build/src/models/Thing.d.ts +26 -5
  140. package/build/src/models/Thing.d.ts.map +1 -1
  141. package/build/src/models/Thing.js +193 -91
  142. package/build/src/models/Thing.js.map +1 -1
  143. package/build/src/models/kinds.d.ts +31 -6
  144. package/build/src/models/kinds.d.ts.map +1 -1
  145. package/build/src/models/kinds.js +31 -6
  146. package/build/src/models/kinds.js.map +1 -1
  147. package/build/src/models/store/DataFile.d.ts +3 -1
  148. package/build/src/models/store/DataFile.d.ts.map +1 -1
  149. package/build/src/models/store/DataFile.js +2 -0
  150. package/build/src/models/store/DataFile.js.map +1 -1
  151. package/build/src/models/types.d.ts +12 -0
  152. package/build/src/models/types.d.ts.map +1 -0
  153. package/build/src/models/types.js +2 -0
  154. package/build/src/models/types.js.map +1 -0
  155. package/build/src/runtime/store/FilesSdk.d.ts +2 -2
  156. package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
  157. package/build/src/runtime/store/FilesSdk.js.map +1 -1
  158. package/data/models/example-generator-api.json +26 -26
  159. package/package.json +20 -6
  160. package/readme.md +1 -1
  161. package/src/amf/AmfShapeGenerator.ts +7 -4
  162. package/src/amf/AmfTypes.ts +2 -2
  163. package/src/amf/DataValueGenerator.ts +21 -21
  164. package/src/exceptions/attach_exception.ts +11 -0
  165. package/src/exceptions/detach_exception.ts +11 -0
  166. package/src/exceptions/remove_model_exception.ts +8 -0
  167. package/src/exceptions/remove_namespace_exception.ts +8 -0
  168. package/src/modeling/Bindings.ts +2 -2
  169. package/src/modeling/DataDomain.ts +1221 -0
  170. package/src/modeling/DataFormat.ts +54 -163
  171. package/src/modeling/DomainAssociation.ts +476 -0
  172. package/src/modeling/DomainElement.ts +50 -0
  173. package/src/modeling/DomainEntity.ts +769 -0
  174. package/src/modeling/DomainFile.ts +94 -0
  175. package/src/modeling/DomainImpactAnalysis.ts +218 -144
  176. package/src/modeling/DomainModel.ts +421 -0
  177. package/src/modeling/DomainNamespace.ts +537 -0
  178. package/src/modeling/DomainProperty.ts +548 -0
  179. package/src/modeling/DomainSerialization.ts +312 -0
  180. package/src/modeling/DomainVersioning.ts +144 -0
  181. package/src/modeling/GraphUtils.ts +28 -0
  182. package/src/modeling/amf/ShapeGenerator.ts +552 -0
  183. package/src/modeling/graph.md +115 -0
  184. package/src/modeling/{DataAssociation.ts → legacy/DataAssociation.ts} +13 -8
  185. package/src/modeling/{DataEntity.ts → legacy/DataEntity.ts} +28 -23
  186. package/src/modeling/{DataEntityBuilder.ts → legacy/DataEntityBuilder.ts} +4 -3
  187. package/src/modeling/legacy/DataImpactAnalysis.ts +530 -0
  188. package/src/modeling/{DataModel.ts → legacy/DataModel.ts} +10 -8
  189. package/src/modeling/{DataNamespace.ts → legacy/DataNamespace.ts} +23 -5
  190. package/src/modeling/{DataProperty.ts → legacy/DataProperty.ts} +15 -7
  191. package/src/modeling/observed.ts +267 -0
  192. package/src/modeling/types.ts +174 -1
  193. package/src/models/Thing.ts +70 -5
  194. package/src/models/kinds.ts +32 -6
  195. package/src/models/store/DataFile.ts +3 -1
  196. package/src/models/types.ts +11 -0
  197. package/src/runtime/store/FilesSdk.ts +2 -6
  198. package/tests/unit/amf/data_value_generator.spec.ts +15 -15
  199. package/tests/unit/legacy-transformers/ARC-legacy-import.spec.ts +1 -1
  200. package/tests/unit/modeling/amf/shape_generator.spec.ts +1174 -0
  201. package/tests/unit/modeling/data_domain.spec.ts +444 -0
  202. package/tests/unit/modeling/data_domain_associations.spec.ts +279 -0
  203. package/tests/unit/modeling/data_domain_change_observers.spec.ts +681 -0
  204. package/tests/unit/modeling/data_domain_entities.spec.ts +449 -0
  205. package/tests/unit/modeling/data_domain_foreign.spec.ts +355 -0
  206. package/tests/unit/modeling/data_domain_models.spec.ts +658 -0
  207. package/tests/unit/modeling/data_domain_namespaces.spec.ts +668 -0
  208. package/tests/unit/modeling/data_domain_property.spec.ts +264 -0
  209. package/tests/unit/modeling/data_domain_serialization.spec.ts +294 -0
  210. package/tests/unit/modeling/domain.property.spec.ts +822 -0
  211. package/tests/unit/modeling/domain_asociation.spec.ts +643 -0
  212. package/tests/unit/modeling/domain_asociation_targets.spec.ts +350 -0
  213. package/tests/unit/modeling/domain_entity.spec.ts +730 -0
  214. package/tests/unit/modeling/domain_entity_associations.spec.ts +330 -0
  215. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +988 -0
  216. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +1451 -0
  217. package/tests/unit/modeling/domain_entity_fields.spec.ts +113 -0
  218. package/tests/unit/modeling/domain_entity_generators.spec.ts +20 -0
  219. package/tests/unit/modeling/domain_entity_parents.spec.ts +291 -0
  220. package/tests/unit/modeling/domain_entity_properties.spec.ts +305 -0
  221. package/tests/unit/modeling/{data_file.spec.ts → domain_file.spec.ts} +29 -85
  222. package/tests/unit/modeling/domain_impact_analysis.spec.ts +452 -0
  223. package/tests/unit/modeling/domain_model.spec.ts +568 -0
  224. package/tests/unit/modeling/domain_model_entities.spec.ts +408 -0
  225. package/tests/unit/modeling/domain_namespace.spec.ts +514 -0
  226. package/tests/unit/modeling/domain_namespace_models.spec.ts +324 -0
  227. package/tests/unit/modeling/domain_namespace_namespaces.spec.ts +404 -0
  228. package/tests/unit/modeling/domain_versioning.spec.ts +140 -0
  229. package/tests/unit/{amf → modeling/legacy}/amf_shape_generator.spec.ts +11 -11
  230. package/tests/unit/modeling/{data_association.spec.ts → legacy/data_association.spec.ts} +3 -11
  231. package/tests/unit/modeling/{data_entity.spec.ts → legacy/data_entity.spec.ts} +10 -8
  232. package/tests/unit/modeling/{data_entity_generator_json.spec.ts → legacy/data_entity_generator_json.spec.ts} +1 -1
  233. package/tests/unit/modeling/{data_entity_generator_xml.spec.ts → legacy/data_entity_generator_xml.spec.ts} +1 -1
  234. package/tests/unit/modeling/{data_model.spec.ts → legacy/data_model.spec.ts} +3 -3
  235. package/tests/unit/modeling/{data_namespace.spec.ts → legacy/data_namespace.spec.ts} +3 -10
  236. package/tests/unit/modeling/{data_property.spec.ts → legacy/data_property.spec.ts} +3 -6
  237. package/tests/unit/modeling/{impact_analysis.spec.ts → legacy/impact_analysis.spec.ts} +9 -9
  238. package/tests/unit/models/File/new.spec.ts +1 -1
  239. package/tests/unit/models/HttpProject.spec.ts +3 -3
  240. package/tsconfig.node.json +35 -0
  241. package/build/src/modeling/DataAssociation.d.ts.map +0 -1
  242. package/build/src/modeling/DataAssociation.js.map +0 -1
  243. package/build/src/modeling/DataEntity.d.ts.map +0 -1
  244. package/build/src/modeling/DataEntity.js.map +0 -1
  245. package/build/src/modeling/DataEntityBuilder.d.ts.map +0 -1
  246. package/build/src/modeling/DataEntityBuilder.js.map +0 -1
  247. package/build/src/modeling/DataModel.d.ts.map +0 -1
  248. package/build/src/modeling/DataModel.js.map +0 -1
  249. package/build/src/modeling/DataNamespace.d.ts.map +0 -1
  250. package/build/src/modeling/DataNamespace.js.map +0 -1
  251. package/build/src/modeling/DataProperty.d.ts.map +0 -1
  252. package/build/src/modeling/DataProperty.js.map +0 -1
@@ -0,0 +1,268 @@
1
+ import type { DataDomain } from './DataDomain.js';
2
+ import { DomainNamespaceKind } from '../models/kinds.js';
3
+ import { DomainElement, DomainElementSchema } from './DomainElement.js';
4
+ import { IThing, Thing } from '../models/Thing.js';
5
+ import { DomainModel, DomainModelSchema } from './DomainModel.js';
6
+ export interface NamespaceOrderedItem {
7
+ /**
8
+ * The type of the ordered item.
9
+ */
10
+ type: 'namespace' | 'model';
11
+ /**
12
+ * The key of the ordered item.
13
+ */
14
+ key: string;
15
+ }
16
+ export interface DomainNamespaceSchema extends DomainElementSchema {
17
+ kind: typeof DomainNamespaceKind;
18
+ /**
19
+ * The data namespace description.
20
+ */
21
+ info: IThing;
22
+ /**
23
+ * The ordered list of fields (namespace and models) in the schema.
24
+ * These only keep references to define the order of these properties
25
+ * in the schema as graph won't do it.
26
+ */
27
+ fields?: NamespaceOrderedItem[];
28
+ /**
29
+ * Whether this namespace is deprecated.
30
+ */
31
+ deprecated?: boolean;
32
+ }
33
+ /**
34
+ * The domain namespace is a way to create a logical structure around data models.
35
+ * It groups data models that represent a whole schema, like a Product data namespace
36
+ * can have data models that describe: the product data model, price history data model,
37
+ * product location, etc.
38
+ *
39
+ * It is optional to have a namespace, but it is recommended to have one for complex
40
+ * data domains.
41
+ *
42
+ * A data domain can be a child of another data domain. It can also contain multiple
43
+ * data domains and data models.
44
+ */
45
+ export declare class DomainNamespace extends DomainElement {
46
+ kind: typeof DomainNamespaceKind;
47
+ /**
48
+ * The description of the domain namespace.
49
+ */
50
+ accessor info: Thing;
51
+ /**
52
+ * The ordered list of fields (namespace and models) in the schema.
53
+ * These only keep references to define the order of these properties
54
+ * in the schema as graph won't do it.
55
+ */
56
+ accessor fields: NamespaceOrderedItem[];
57
+ /**
58
+ * Whether this namespace is deprecated.
59
+ */
60
+ accessor deprecated: boolean | undefined;
61
+ /**
62
+ * Creates a full namespace schema with defaults.
63
+ * @param input The partial namespace schema.
64
+ * @returns The namespace schema.
65
+ */
66
+ static createSchema(input?: Partial<DomainNamespaceSchema>): DomainNamespaceSchema;
67
+ /**
68
+ * Creates a new namespace instance.
69
+ * It does not add it to the graph.
70
+ * You need to call the `addNamespace` method of the graph to add it.
71
+ *
72
+ * @param root A reference to the root DataDomain instance.
73
+ * @param input The partial namespace schema.
74
+ * @returns Created namespace instance.
75
+ */
76
+ constructor(root: DataDomain, input?: Partial<DomainNamespaceSchema>);
77
+ toJSON(): DomainNamespaceSchema;
78
+ /**
79
+ * Adds a child namespace to the current namespace.
80
+ *
81
+ * @param value The partial namespace schema.
82
+ * @returns The created namespace instance.
83
+ * @example
84
+ * ```typescript
85
+ * const property = namespace.addNamespace({
86
+ * key: 'e-commerce'
87
+ * })
88
+ * ```
89
+ */
90
+ addNamespace(value?: Partial<DomainNamespaceSchema>): DomainNamespace;
91
+ /**
92
+ * Removes a namespace from the current namespace.
93
+ *
94
+ * @param key The key of the namespace to remove.
95
+ * @throws {RemoveNamespaceException} If the namespace does not exist.
96
+ * @example
97
+ * ```typescript
98
+ * namespace.removeNamespace('e-commerce')
99
+ * ```
100
+ */
101
+ removeNamespace(key: string): this;
102
+ /**
103
+ * Attaches a namespace to the current namespace. It changes the parent of the namespace
104
+ * to the current namespace in the graph.
105
+ *
106
+ * The attached namespace must be already a child of another namespace.
107
+ *
108
+ * @param key The key of the namespace to attach.
109
+ * @throws {Error} If the namespace does not exist.
110
+ * @example
111
+ * ```typescript
112
+ * namespace.attachNamespace('e-commerce')
113
+ * ```
114
+ */
115
+ attachNamespace(key: string): this;
116
+ /**
117
+ * Detaches a namespace from the current namespace. It changes the parent of the namespace
118
+ * to the root graph.
119
+ * Unlike remove, it doesn't remove the namespace from the graph nor notifies the change.
120
+ * @param key The key of the namespace to detach.
121
+ * @throws {RemoveNamespaceException} If the namespace does not exist.
122
+ */
123
+ detachNamespace(key: string): this;
124
+ /**
125
+ * Lists all namespaces of this namespaces.
126
+ *
127
+ * Note, it accounts for the order of the namespaces as
128
+ * defined in the `fields` array.
129
+ *
130
+ * @returns A generator that yields each `DomainNamespace`.
131
+ * @example
132
+ * ```typescript
133
+ * for (const ns of namespace.listNamespaces()) {
134
+ * console.log(ns.key);
135
+ * }
136
+ * ```
137
+ */
138
+ listNamespaces(): Generator<DomainNamespace>;
139
+ /**
140
+ * Checks if this namespace has any namespaces.
141
+ *
142
+ * @returns True if the namespace has namespaces.
143
+ * @example
144
+ * ```typescript
145
+ * if (namespace.hasNamespaces()) {
146
+ * // ...
147
+ * }
148
+ * ```
149
+ */
150
+ hasNamespaces(): boolean;
151
+ /**
152
+ * Adds a data model to the current namespace.
153
+ * @param value The partial data model schema.
154
+ * @returns The created data model instance.
155
+ * @example
156
+ * ```typescript
157
+ * const property = namespace.addModel({
158
+ * key: 'inventory'
159
+ * })
160
+ * ```
161
+ */
162
+ addModel(input?: Partial<DomainModelSchema>): DomainModel;
163
+ /**
164
+ * Removes a data model from the current namespace.
165
+ *
166
+ * @param key The key of the data model to remove.
167
+ * @throws {RemoveModelException} If the data model does not exist.
168
+ * @example
169
+ * ```typescript
170
+ * namespace.removeModel('inventory')
171
+ * ```
172
+ */
173
+ removeModel(key: string): this;
174
+ /**
175
+ * Attaches a model to the current namespace and sets its parent to the current namespace.
176
+ *
177
+ * The attached model is already a child of another namespace.
178
+ * This method only adds this model to its internal list of fields.
179
+ *
180
+ * Unlike `addModel`, it doesn't create a new model or add it to the graph.
181
+ * It only adds the model to the list of fields.
182
+ *
183
+ * @param key The key of the model to attach.
184
+ * @throws {AttachException} If the model does not exist.
185
+ * @throws {AttachException} If the model is not a model.
186
+ * @throws {AttachException} If the model is not in the same domain.
187
+ * @throws {AttachException} If the model is already a child of this namespace.
188
+ * @example
189
+ * ```typescript
190
+ * namespace.attachModel('inventory')
191
+ * ```
192
+ */
193
+ attachModel(key: string): this;
194
+ /**
195
+ * Detaches a model from the current namespace and sets its parent to the root graph.
196
+ * Unlike remove, it doesn't remove the model from the graph nor notifies the change.
197
+ * @param key The key of the model to detach.
198
+ * @throws {DetachException} If the model does not exist.
199
+ * @throws {DetachException} If the model is not a model.
200
+ * @throws {DetachException} If the model is not a child of this namespace.
201
+ */
202
+ detachModel(key: string): this;
203
+ /**
204
+ * Lists all models of this namespaces.
205
+ *
206
+ * Note, it accounts for the order of the models as
207
+ * defined in the `fields` array.
208
+ *
209
+ * @returns A generator that yields each `DomainModel`.
210
+ * @example
211
+ * ```typescript
212
+ * for (const ns of namespace.listModels()) {
213
+ * console.log(ns.key);
214
+ * }
215
+ * ```
216
+ */
217
+ listModels(): Generator<DomainModel>;
218
+ /**
219
+ * Checks if this namespace has any models.
220
+ *
221
+ * @returns True if the namespace has models.
222
+ * @example
223
+ * ```typescript
224
+ * if (namespace.hasModels()) {
225
+ * // ...
226
+ * }
227
+ * ```
228
+ */
229
+ hasModels(): boolean;
230
+ /**
231
+ * Returns a parent data namespace or the data domain where this data namespace exist.
232
+ */
233
+ getParentInstance(): DomainNamespace | DataDomain;
234
+ /**
235
+ * Lists all fields (namespace and models) of this namespace.
236
+ *
237
+ * @returns A generator that yields each `DomainAssociation` or `DomainProperty`.
238
+ * @example
239
+ * ```typescript
240
+ * for (const field of namespace.listFields()) {
241
+ * console.log(field.key);
242
+ * }
243
+ * ```
244
+ */
245
+ listFields(): Generator<DomainNamespace | DomainModel>;
246
+ /**
247
+ * Checks if this namespace has any fields (namespace and models).
248
+ *
249
+ * @returns True if the namespace has fields.
250
+ * @example
251
+ * ```typescript
252
+ * if (namespace.hasFields()) {
253
+ * // ...
254
+ * }
255
+ * ```
256
+ */
257
+ hasFields(): boolean;
258
+ private removeField;
259
+ /**
260
+ * Checks whether the namespace is a child of the given namespace.
261
+ * The relationship doesn't have to be direct, as long as the namespace is in the hierarchy it will return true.
262
+ *
263
+ * @param key The key of the parent namespace to check.
264
+ * @returns True if this namespace is a child of the given namespace.
265
+ */
266
+ isChildOf(key: string): boolean;
267
+ }
268
+ //# sourceMappingURL=DomainNamespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomainNamespace.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainNamespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAmB,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEvE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,WA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