@api-client/core 0.6.14 → 0.6.17

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 (151) hide show
  1. package/build/browser.d.ts +9 -2
  2. package/build/browser.js +12 -2
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +9 -2
  5. package/build/index.js +12 -2
  6. package/build/index.js.map +1 -1
  7. package/build/src/amf/AmfMixin.d.ts +395 -0
  8. package/build/src/amf/AmfMixin.js +1146 -0
  9. package/build/src/amf/AmfMixin.js.map +1 -0
  10. package/build/src/amf/AmfSerializer.d.ts +136 -0
  11. package/build/src/amf/AmfSerializer.js +1913 -0
  12. package/build/src/amf/AmfSerializer.js.map +1 -0
  13. package/build/src/amf/AmfShapeGenerator.d.ts +85 -0
  14. package/build/src/amf/AmfShapeGenerator.js +385 -0
  15. package/build/src/amf/AmfShapeGenerator.js.map +1 -0
  16. package/build/src/amf/AmfTypes.d.ts +24 -0
  17. package/build/src/amf/AmfTypes.js +122 -0
  18. package/build/src/amf/AmfTypes.js.map +1 -0
  19. package/build/src/amf/ApiExampleGenerator.d.ts +36 -0
  20. package/build/src/amf/ApiExampleGenerator.js +109 -0
  21. package/build/src/amf/ApiExampleGenerator.js.map +1 -0
  22. package/build/src/amf/ApiMonacoSchemaGenerator.d.ts +67 -0
  23. package/build/src/amf/ApiMonacoSchemaGenerator.js +243 -0
  24. package/build/src/amf/ApiMonacoSchemaGenerator.js.map +1 -0
  25. package/build/src/amf/ApiSchemaGenerator.d.ts +55 -0
  26. package/build/src/amf/ApiSchemaGenerator.js +94 -0
  27. package/build/src/amf/ApiSchemaGenerator.js.map +1 -0
  28. package/build/src/amf/ApiSchemaValues.d.ts +98 -0
  29. package/build/src/amf/ApiSchemaValues.js +382 -0
  30. package/build/src/amf/ApiSchemaValues.js.map +1 -0
  31. package/build/src/amf/Utils.d.ts +41 -0
  32. package/build/src/amf/Utils.js +176 -0
  33. package/build/src/amf/Utils.js.map +1 -0
  34. package/build/src/amf/data-node/DataNodeBase.d.ts +31 -0
  35. package/build/src/amf/data-node/DataNodeBase.js +77 -0
  36. package/build/src/amf/data-node/DataNodeBase.js.map +1 -0
  37. package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts +15 -0
  38. package/build/src/amf/data-node/JsonDataNodeGenerator.js +24 -0
  39. package/build/src/amf/data-node/JsonDataNodeGenerator.js.map +1 -0
  40. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts +13 -0
  41. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js +42 -0
  42. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js.map +1 -0
  43. package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts +21 -0
  44. package/build/src/amf/data-node/XmlDataNodeGenerator.js +30 -0
  45. package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +1 -0
  46. package/build/src/amf/definitions/Amf.d.ts +362 -0
  47. package/build/src/amf/definitions/Amf.js +2 -0
  48. package/build/src/amf/definitions/Amf.js.map +1 -0
  49. package/build/src/amf/definitions/Api.d.ts +381 -0
  50. package/build/src/amf/definitions/Api.js +2 -0
  51. package/build/src/amf/definitions/Api.js.map +1 -0
  52. package/build/src/amf/definitions/Base.d.ts +11 -0
  53. package/build/src/amf/definitions/Base.js +2 -0
  54. package/build/src/amf/definitions/Base.js.map +1 -0
  55. package/build/src/amf/definitions/Namespace.d.ts +311 -0
  56. package/build/src/amf/definitions/Namespace.js +330 -0
  57. package/build/src/amf/definitions/Namespace.js.map +1 -0
  58. package/build/src/amf/definitions/Shapes.d.ts +309 -0
  59. package/build/src/amf/definitions/Shapes.js +87 -0
  60. package/build/src/amf/definitions/Shapes.js.map +1 -0
  61. package/build/src/amf/models/AmfDataNode.d.ts +68 -0
  62. package/build/src/amf/models/AmfDataNode.js +188 -0
  63. package/build/src/amf/models/AmfDataNode.js.map +1 -0
  64. package/build/src/amf/shape/ShapeBase.d.ts +75 -0
  65. package/build/src/amf/shape/ShapeBase.js +90 -0
  66. package/build/src/amf/shape/ShapeBase.js.map +1 -0
  67. package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +46 -0
  68. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +406 -0
  69. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -0
  70. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +84 -0
  71. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +820 -0
  72. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -0
  73. package/build/src/models/data/Bindings.d.ts +161 -0
  74. package/build/src/models/data/Bindings.js +2 -0
  75. package/build/src/models/data/Bindings.js.map +1 -0
  76. package/build/src/models/data/DataAssociation.d.ts +135 -14
  77. package/build/src/models/data/DataAssociation.js +154 -21
  78. package/build/src/models/data/DataAssociation.js.map +1 -1
  79. package/build/src/models/data/DataAssociationSchema.d.ts +36 -0
  80. package/build/src/models/data/DataEntity.d.ts +71 -15
  81. package/build/src/models/data/DataEntity.js +133 -53
  82. package/build/src/models/data/DataEntity.js.map +1 -1
  83. package/build/src/models/data/DataFile.d.ts +3 -0
  84. package/build/src/models/data/DataFile.js +3 -0
  85. package/build/src/models/data/DataFile.js.map +1 -1
  86. package/build/src/models/data/DataModel.d.ts +1 -1
  87. package/build/src/models/data/DataModel.js.map +1 -1
  88. package/build/src/models/data/DataNamespace.d.ts +14 -0
  89. package/build/src/models/data/DataNamespace.js +50 -0
  90. package/build/src/models/data/DataNamespace.js.map +1 -1
  91. package/build/src/models/data/DataProperty.d.ts +107 -36
  92. package/build/src/models/data/DataProperty.js +147 -17
  93. package/build/src/models/data/DataProperty.js.map +1 -1
  94. package/data/apis/oas-date/oas-date.yaml +28 -0
  95. package/data/apis/oas-types/oas-types.yaml +159 -0
  96. package/data/apis/oas-unions/oas-unions.yaml +75 -0
  97. package/data/apis/raml-date/raml-date.raml +28 -0
  98. package/data/apis/recursive/recursive.raml +14 -0
  99. package/data/apis/schema-api/examples/person.json +14 -0
  100. package/data/apis/schema-api/examples/person.raml +14 -0
  101. package/data/apis/schema-api/examples/person.url.encoded +1 -0
  102. package/data/apis/schema-api/examples/person.xml +14 -0
  103. package/data/apis/schema-api/library/demo-types.raml +43 -0
  104. package/data/apis/schema-api/schema-api.raml +644 -0
  105. package/data/apis/schema-api/schemas/person.json +104 -0
  106. package/data/apis/schema-api/schemas/person.xsd +26 -0
  107. package/data/apis/schema-api/types/DemoPerson.raml +67 -0
  108. package/data/model.js +106 -0
  109. package/data/models/oas-date.json +637 -0
  110. package/data/models/oas-types.json +5352 -0
  111. package/data/models/oas-unions.json +1881 -0
  112. package/data/models/raml-date.json +1096 -0
  113. package/data/models/recursive.json +610 -0
  114. package/data/models/schema-api.json +37319 -0
  115. package/package.json +9 -6
  116. package/src/amf/AmfMixin.ts +1623 -0
  117. package/src/amf/AmfSerializer.ts +2028 -0
  118. package/src/amf/AmfShapeGenerator.ts +400 -0
  119. package/src/amf/AmfTypes.ts +126 -0
  120. package/src/amf/ApiExampleGenerator.ts +112 -0
  121. package/src/amf/ApiMonacoSchemaGenerator.ts +296 -0
  122. package/src/amf/ApiSchemaGenerator.ts +108 -0
  123. package/src/amf/ApiSchemaValues.ts +411 -0
  124. package/src/amf/Utils.ts +182 -0
  125. package/src/amf/data-node/DataNodeBase.ts +81 -0
  126. package/src/amf/data-node/JsonDataNodeGenerator.ts +26 -0
  127. package/src/amf/data-node/README.md +3 -0
  128. package/src/amf/data-node/UrlEncodedDataNodeGenerator.ts +43 -0
  129. package/src/amf/data-node/XmlDataNodeGenerator.ts +38 -0
  130. package/src/amf/definitions/Amf.ts +443 -0
  131. package/src/amf/definitions/Api.ts +427 -0
  132. package/src/amf/definitions/Base.ts +13 -0
  133. package/src/amf/definitions/Namespace.ts +341 -0
  134. package/src/amf/definitions/Shapes.ts +414 -0
  135. package/src/amf/models/AmfDataNode.ts +200 -0
  136. package/src/amf/shape/README.md +4 -0
  137. package/src/amf/shape/ShapeBase.ts +160 -0
  138. package/src/amf/shape/ShapeJsonSchemaGenerator.ts +422 -0
  139. package/src/amf/shape/ShapeXmlSchemaGenerator.ts +876 -0
  140. package/src/models/data/Bindings.ts +186 -0
  141. package/src/models/data/DataAssociation.ts +226 -29
  142. package/src/models/data/DataAssociationSchema.ts +38 -0
  143. package/src/models/data/DataEntity.ts +162 -60
  144. package/src/models/data/DataFile.ts +3 -0
  145. package/src/models/data/DataModel.ts +1 -1
  146. package/src/models/data/DataNamespace.ts +54 -0
  147. package/src/models/data/DataProperty.ts +191 -47
  148. package/build/src/models/data/DataPropertySchema.d.ts +0 -125
  149. package/build/src/models/data/DataPropertySchema.js +0 -33
  150. package/build/src/models/data/DataPropertySchema.js.map +0 -1
  151. package/src/models/data/DataPropertySchema.ts +0 -156
@@ -1,12 +1,24 @@
1
+ import { Core as JsonCore } from '@api-client/json';
2
+ import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js';
1
3
  import v4 from '../../lib/uuid.js';
2
4
  import { Thing } from "../Thing.js";
3
5
  export const Kind = 'Core#DataAssociation';
6
+ /**
7
+ * Describes an association between entities. An association is another property of an entity. The `name` is the name of the
8
+ * property and the value is the associated target or targets.
9
+ *
10
+ * An association can have multiple targets to allow describing the model as `allOf`, `anyOf` and `oneOf` schemas.
11
+ * When the association has only one target, then generated schema cannot have union types.
12
+ *
13
+ * Depending on the schema translation an association can be embedded as a sub-object in the generated schema
14
+ * or can be references via a primary key.
15
+ */
4
16
  export class DataAssociation {
5
17
  root;
6
18
  kind = Kind;
7
19
  key = '';
8
20
  /**
9
- * The description of the data namespace.
21
+ * The description of the data association.
10
22
  */
11
23
  info = Thing.fromName('');
12
24
  /**
@@ -18,22 +30,59 @@ export class DataAssociation {
18
30
  */
19
31
  multiple;
20
32
  /**
21
- * The target entity of this association.
33
+ * Whether the attribute is hidden in the schema (not a part of it).
34
+ * The hidden attribute should only appear in the adapted attribute.
35
+ * Has no effect when added to the "main" attribute.
36
+ */
37
+ hidden;
38
+ /**
39
+ * The list of keys associated with the entity through this association.
22
40
  * An association without a target is considered invalid and discarded when processing the values.
23
41
  */
24
- target;
42
+ targets = [];
25
43
  /**
26
44
  * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)
27
45
  *
28
- * Implementation note, when an entity is removed this property is not changed. The target can't
29
- * be read but it can be tracked to a deleted entity.
46
+ * When this is defined then it is used as the schema. When this is not defined it uses
47
+ * referenced entities schemas. Note, changes in the referenced entities may not be propagated
48
+ * to schemas altered by the user.
49
+ *
50
+ * Note, schema can only occur on an adapted property. Has no effect on the "main"
51
+ * property.
30
52
  */
31
53
  schema;
54
+ /**
55
+ * The key of the association that is adapted by this association.
56
+ * Adapted associations can manipulate the shape of the schema for the association.
57
+ *
58
+ * Each value defined on the adapted association changes the original value defined on
59
+ * the association.
60
+ */
61
+ adapts;
62
+ /**
63
+ * Returns true when the association has 0 or 1 targets.
64
+ */
65
+ get isSingle() {
66
+ return this.targets.length < 2;
67
+ }
68
+ /**
69
+ * Creates an instance of DataAssociation from a target entity key.
70
+ * Note, this entity will have no name. The default name is used instead.
71
+ *
72
+ * @param root The namespace root.
73
+ * @param target The target entity key.
74
+ */
32
75
  static fromTarget(root, target) {
33
76
  const assoc = new DataAssociation(root);
34
- assoc.target = target;
77
+ assoc.targets = [target];
35
78
  return assoc;
36
79
  }
80
+ /**
81
+ * Creates an instance of DataAssociation from a name, without defining a target.
82
+ *
83
+ * @param root The namespace root.
84
+ * @param name The name of the association.
85
+ */
37
86
  static fromName(root, name) {
38
87
  const assoc = new DataAssociation(root);
39
88
  assoc.info = Thing.fromName(name);
@@ -55,7 +104,7 @@ export class DataAssociation {
55
104
  init = {
56
105
  kind: Kind,
57
106
  key: v4(),
58
- info: Thing.fromName('').toJSON(),
107
+ info: Thing.fromName('Unnamed association').toJSON(),
59
108
  };
60
109
  }
61
110
  this.new(init);
@@ -64,7 +113,7 @@ export class DataAssociation {
64
113
  if (!DataAssociation.isDataAssociation(init)) {
65
114
  throw new Error(`Not a data association.`);
66
115
  }
67
- const { info, key = v4(), kind = Kind, schema, multiple, required, target } = init;
116
+ const { info, key = v4(), kind = Kind, schema, multiple, required, targets, adapts, hidden, } = init;
68
117
  this.kind = kind;
69
118
  this.key = key;
70
119
  if (info) {
@@ -74,7 +123,7 @@ export class DataAssociation {
74
123
  this.info = Thing.fromName('');
75
124
  }
76
125
  if (schema) {
77
- this.schema = { ...schema };
126
+ this.schema = JsonCore.clone(schema);
78
127
  }
79
128
  else {
80
129
  this.schema = undefined;
@@ -91,11 +140,23 @@ export class DataAssociation {
91
140
  else {
92
141
  this.required = undefined;
93
142
  }
94
- if (typeof target === 'string') {
95
- this.target = target;
143
+ if (Array.isArray(targets)) {
144
+ this.targets = [...targets];
145
+ }
146
+ else {
147
+ this.targets = [];
148
+ }
149
+ if (typeof hidden === 'boolean') {
150
+ this.hidden = hidden;
151
+ }
152
+ else {
153
+ this.hidden = undefined;
154
+ }
155
+ if (typeof adapts === 'string') {
156
+ this.adapts = adapts;
96
157
  }
97
158
  else {
98
- this.target = undefined;
159
+ this.adapts = undefined;
99
160
  }
100
161
  }
101
162
  static isDataAssociation(input) {
@@ -112,7 +173,7 @@ export class DataAssociation {
112
173
  info: this.info.toJSON(),
113
174
  };
114
175
  if (this.schema) {
115
- result.schema = { ...this.schema };
176
+ result.schema = JsonCore.clone(this.schema);
116
177
  }
117
178
  if (typeof this.multiple === 'boolean') {
118
179
  result.multiple = this.multiple;
@@ -120,17 +181,23 @@ export class DataAssociation {
120
181
  if (typeof this.required === 'boolean') {
121
182
  result.required = this.required;
122
183
  }
123
- if (typeof this.target === 'string') {
124
- result.target = this.target;
184
+ if (Array.isArray(this.targets) && this.targets.length) {
185
+ result.targets = [...this.targets];
186
+ }
187
+ if (typeof this.hidden === 'boolean') {
188
+ result.hidden = this.hidden;
189
+ }
190
+ if (this.adapts) {
191
+ result.adapts = this.adapts;
125
192
  }
126
193
  return result;
127
194
  }
128
- getTarget() {
129
- const { root, target } = this;
130
- if (!target) {
131
- return undefined;
132
- }
133
- return root.definitions.entities.find(i => i.key === target);
195
+ /**
196
+ * @returns The list of DataEntity definitions for the current targets.
197
+ */
198
+ getTargets() {
199
+ const { root, targets } = this;
200
+ return root.definitions.entities.filter(item => targets.some(i => i === item.key));
134
201
  }
135
202
  /**
136
203
  * Removes self from the parent entity and the namespace definition.
@@ -147,5 +214,71 @@ export class DataAssociation {
147
214
  this.root.definitions.associations.splice(defIndex, 1);
148
215
  }
149
216
  }
217
+ /**
218
+ * @param init The key of an entity, its instance, or schema.
219
+ */
220
+ addTarget(init) {
221
+ if (typeof init === 'string') {
222
+ this.targets.push(init);
223
+ }
224
+ else {
225
+ const { key } = init;
226
+ this.targets.push(key);
227
+ }
228
+ }
229
+ /**
230
+ * Removes a target entity from the targets list.
231
+ *
232
+ * @param init The key of an entity, its instance, or schema.
233
+ */
234
+ removeTarget(init) {
235
+ let key;
236
+ if (typeof init === 'string') {
237
+ key = init;
238
+ }
239
+ else {
240
+ key = init.key;
241
+ }
242
+ const index = this.targets.indexOf(key);
243
+ if (index >= 0) {
244
+ this.targets.splice(index, 1);
245
+ }
246
+ }
247
+ /**
248
+ * Creates a Property Shape of AMF.
249
+ * The property itself is auto-generated. If the `schema` is defined then it is used
250
+ * as the `range` of the property. Otherwise basic shape is generated for the range.
251
+ *
252
+ * This is a preferred way of reading the AMF shape as this synchronizes changed
253
+ * data properties with the shape definition.
254
+ *
255
+ * @returns AMF property shape definition.
256
+ */
257
+ toApiShape() {
258
+ const serializer = new AmfShapeGenerator();
259
+ return serializer.associationProperty(this);
260
+ }
261
+ /**
262
+ * @returns The adapted association, if any
263
+ */
264
+ readAdapted() {
265
+ const { adapts } = this;
266
+ if (!adapts) {
267
+ return undefined;
268
+ }
269
+ return this.root.definitions.associations.find(i => i.key === adapts);
270
+ }
271
+ /**
272
+ * Creates new adapted association and associates it with this association.
273
+ * @returns The instance of the created association.
274
+ */
275
+ createAdapted() {
276
+ const association = new DataAssociation(this.root);
277
+ // disallow defaults as this would influence the schema generation
278
+ association.info.name = undefined;
279
+ this.root.definitions.associations.push(association);
280
+ this.adapts = association.key;
281
+ return association;
282
+ }
150
283
  }
151
284
  //# sourceMappingURL=DataAssociation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataAssociation.js","sourceRoot":"","sources":["../../../../src/models/data/DataAssociation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnC,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AAK5C,MAAM,CAAC,MAAM,IAAI,GAAG,sBAAsB,CAAC;AA+B3C,MAAM,OAAO,eAAe;IAiDJ;IAhDtB,IAAI,GAAG,IAAI,CAAC;IAEZ,GAAG,GAAG,EAAE,CAAC;IAET;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAW;IAEnB;;OAEG;IACH,QAAQ,CAAW;IAEnB;;;OAGG;IACH,MAAM,CAAU;IAEhB;;;;;OAKG;IACH,MAAM,CAA0B;IAEhC,MAAM,CAAC,UAAU,CAAC,IAAmB,EAAE,MAAc;QACnD,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QACxC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAmB,EAAE,IAAY;QAC/C,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QACxC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,YAAsB,IAAmB,EAAE,KAAiC;QAAtD,SAAI,GAAJ,IAAI,CAAe;QACvC,IAAI,IAAsB,CAAC;QAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,IAA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MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,kEAAkE;QAClE,WAAW,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"}
@@ -29,4 +29,40 @@ export interface IDataAssociationSchema {
29
29
  * ```
30
30
  */
31
31
  embedded?: boolean;
32
+ /**
33
+ * Describes XML specific serialization.
34
+ */
35
+ xml?: {
36
+ /**
37
+ * The name of the attribute or a wrapped property to use when serializing the property.
38
+ *
39
+ * ```
40
+ * <Person fullName="John Doe"></Person>
41
+ * ```
42
+ */
43
+ name?: string;
44
+ /**
45
+ * When the property is an array (has the `multiple` set to true)
46
+ * then it tells that the list of values should be wrapped with a parent
47
+ * element:
48
+ *
49
+ * ```
50
+ * <Person>
51
+ * <Person fullName="John Doe"></Person>
52
+ * </Person>
53
+ * ```
54
+ *
55
+ * Use this with the combination with `name` to describe the name of the wrapped
56
+ * element
57
+ *
58
+ * ```
59
+ * <people>
60
+ * <Person fullName="John Doe"></Person>
61
+ * </people>
62
+ * ```
63
+ *
64
+ * Note, this is mutually exclusive with `attribute`.
65
+ */
66
+ wrapped?: boolean;
67
+ };
32
68
  }
@@ -4,6 +4,7 @@ import { DataProperty, DataPropertyType } from "./DataProperty.js";
4
4
  import { DataAssociation } from "./DataAssociation.js";
5
5
  import { IBreadcrumb } from "../store/Breadcrumb.js";
6
6
  import { DataModel } from "./DataModel.js";
7
+ import { INodeShape, IShapeUnion } from "../../amf/definitions/Shapes.js";
7
8
  export declare const Kind = "Core#DataEntity";
8
9
  /**
9
10
  * Data entity is the smallest description of a data in the system
@@ -51,13 +52,29 @@ export interface IDataEntity {
51
52
  * Whether this entity is deprecated.
52
53
  */
53
54
  deprecated?: boolean;
55
+ /**
56
+ * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)
57
+ *
58
+ * Schema limitations:
59
+ *
60
+ * - can only occur on an adapted property. Has no effect on the "main" property.
61
+ */
62
+ schema?: INodeShape;
63
+ /**
64
+ * The key of the entity that is adapted by this entity.
65
+ * Adapted entities can manipulate the shape of the schema for the entity.
66
+ *
67
+ * Each value defined on the adapted entity changes the original value defined on
68
+ * the entity.
69
+ */
70
+ adapts?: string;
54
71
  }
55
72
  /**
56
73
  * Data entity is the smallest description of a data in the system
57
74
  * It contains properties and associations. At least one entity describe a data model.
58
75
  */
59
76
  export declare class DataEntity {
60
- protected root: DataNamespace;
77
+ root: DataNamespace;
61
78
  kind: string;
62
79
  key: string;
63
80
  /**
@@ -96,6 +113,14 @@ export declare class DataEntity {
96
113
  * Whether this entity is deprecated.
97
114
  */
98
115
  deprecated?: boolean;
116
+ /**
117
+ * The key of the entity that is adapted by this entity.
118
+ * Adapted entities can manipulate the shape of the schema for the entity.
119
+ *
120
+ * Each value defined on the adapted entity changes the original value defined on
121
+ * the entity.
122
+ */
123
+ adapts?: string;
99
124
  static fromName(root: DataNamespace, name: string): DataEntity;
100
125
  /**
101
126
  * @param input The data entity definition to restore.
@@ -111,7 +136,7 @@ export declare class DataEntity {
111
136
  * @param type The type of the property
112
137
  * @returns The created property
113
138
  */
114
- addTypedProperty(type: DataPropertyType): DataProperty;
139
+ addTypedProperty(type: DataPropertyType, name?: string): DataProperty;
115
140
  /**
116
141
  * Creates a property with a passed type.
117
142
  * @param name The name of the property.
@@ -134,7 +159,7 @@ export declare class DataEntity {
134
159
  * @param target The target entity key of the association
135
160
  * @returns The created association
136
161
  */
137
- addTargetAssociation(target: string): DataAssociation;
162
+ addTargetAssociation(target: string, name?: string): DataAssociation;
138
163
  /**
139
164
  * Removes an association from the entity and namespace definitions.
140
165
  * @param key The key of the association to remove.
@@ -143,8 +168,9 @@ export declare class DataEntity {
143
168
  /**
144
169
  * Reads the list of parents for the entity, inside the root namespace. The computed list contains the list of all
145
170
  * parents in the inheritance chain in no particular order.
171
+ * @param recursive Whether to include parent parents as well.
146
172
  */
147
- getComputedParents(): DataEntity[];
173
+ getComputedParents(recursive?: boolean): DataEntity[];
148
174
  /**
149
175
  * Computes list of all children, inside the root namespace, that extends this entity.
150
176
  * The children are not ordered.
@@ -183,19 +209,20 @@ export declare class DataEntity {
183
209
  */
184
210
  associationPath(toEntity: string): Generator<string[]>;
185
211
  /**
186
- * The actual implementation of the graph search.
212
+ * Returns a list of entities that are association with this entity through an association
213
+ * that the target property points to this entity.
187
214
  *
188
- * @param from The current from node
189
- * @param to The target node
190
- * @param g The graph
191
- * @param path The current list of entity ids.
192
- * @param visited The list of visited paths to avoid cycles
193
- */
194
- protected _associationPath(from: string, to: string, g: Record<string, string[]>, path?: string[], visited?: Set<string>): Generator<string[]>;
195
- /**
196
- * @returns The graph of associations where keys are the source entities and the value is the list of all target entities.
215
+ * In other words, if entity `A` has association target with `B`, then asking `B` for related entities will
216
+ * result with `[A]`.
217
+ *
218
+ * ```plain
219
+ * A -> B -> C
220
+ * D -> C
221
+ *
222
+ * C => [B, D]
223
+ * ```
197
224
  */
198
- protected _associationGraph(): Record<string, string[]>;
225
+ getRelatedEntities(): DataEntity[];
199
226
  /**
200
227
  * Creates breadcrumbs from this entity to the root namespace.
201
228
  */
@@ -214,4 +241,33 @@ export declare class DataEntity {
214
241
  * @param tag The tag to remove.
215
242
  */
216
243
  removeTag(tag: string): void;
244
+ /**
245
+ * Creates a Shape of AMF.
246
+ * The property itself is auto-generated. If the `schema` is defined then it is used
247
+ * as the `range` of the property. Otherwise basic shape is generated for the range.
248
+ *
249
+ * This is a preferred way of reading the AMF shape as this synchronizes changed
250
+ * data properties with the shape definition.
251
+ *
252
+ * @returns AMF property shape definition.
253
+ */
254
+ toApiShape(): IShapeUnion;
255
+ /**
256
+ * Reads the schema of the Entity and generates an example for it.
257
+ */
258
+ toExample(mime: string): string | number | boolean | null | undefined;
259
+ /**
260
+ * @returns The adapted entity, if any
261
+ */
262
+ readAdapted(): DataEntity | undefined;
263
+ /**
264
+ * Creates new adapted entity and associates it with this entity.
265
+ * @returns The instance of the created entity.
266
+ */
267
+ createAdapted(): DataEntity;
268
+ /**
269
+ * Checks whether the `target` creates a cycle in the graph (whether this creates a recursive association).
270
+ * @param target
271
+ */
272
+ hasForwardCycle(target: string, g?: Record<string, string[]>, key?: string): boolean;
217
273
  }