@api-client/core 0.14.0 → 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.
Files changed (140) hide show
  1. package/build/src/amf/AmfTypes.d.ts +1 -1
  2. package/build/src/amf/AmfTypes.js +1 -1
  3. package/build/src/amf/AmfTypes.js.map +1 -1
  4. package/build/src/amf/Utils.d.ts +0 -6
  5. package/build/src/amf/Utils.d.ts.map +1 -1
  6. package/build/src/amf/Utils.js +0 -14
  7. package/build/src/amf/Utils.js.map +1 -1
  8. package/build/src/browser.d.ts +1 -0
  9. package/build/src/browser.d.ts.map +1 -1
  10. package/build/src/browser.js +1 -0
  11. package/build/src/browser.js.map +1 -1
  12. package/build/src/index.d.ts +1 -0
  13. package/build/src/index.d.ts.map +1 -1
  14. package/build/src/index.js +1 -0
  15. package/build/src/index.js.map +1 -1
  16. package/build/src/legacy.d.ts +0 -8
  17. package/build/src/legacy.d.ts.map +1 -1
  18. package/build/src/legacy.js +0 -9
  19. package/build/src/legacy.js.map +1 -1
  20. package/build/src/modeling/Bindings.d.ts +1 -1
  21. package/build/src/modeling/Bindings.js.map +1 -1
  22. package/build/src/modeling/DataDomain.js +2 -2
  23. package/build/src/modeling/DataDomain.js.map +1 -1
  24. package/build/src/modeling/DataFormat.d.ts +0 -40
  25. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  26. package/build/src/modeling/DataFormat.js +0 -27
  27. package/build/src/modeling/DataFormat.js.map +1 -1
  28. package/build/src/modeling/DomainAssociation.d.ts +28 -0
  29. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  30. package/build/src/modeling/DomainAssociation.js +73 -4
  31. package/build/src/modeling/DomainAssociation.js.map +1 -1
  32. package/build/src/modeling/DomainEntity.d.ts +25 -9
  33. package/build/src/modeling/DomainEntity.d.ts.map +1 -1
  34. package/build/src/modeling/DomainEntity.js +65 -21
  35. package/build/src/modeling/DomainEntity.js.map +1 -1
  36. package/build/src/modeling/DomainFile.d.ts +1 -1
  37. package/build/src/modeling/DomainFile.js +1 -1
  38. package/build/src/modeling/DomainFile.js.map +1 -1
  39. package/build/src/modeling/DomainImpactAnalysis.d.ts +1 -1
  40. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  41. package/build/src/modeling/DomainImpactAnalysis.js +3 -3
  42. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  43. package/build/src/modeling/DomainModel.d.ts +2 -2
  44. package/build/src/modeling/DomainModel.js +2 -2
  45. package/build/src/modeling/DomainModel.js.map +1 -1
  46. package/build/src/modeling/DomainProperty.d.ts +28 -12
  47. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  48. package/build/src/modeling/DomainProperty.js +61 -26
  49. package/build/src/modeling/DomainProperty.js.map +1 -1
  50. package/build/src/modeling/Semantics.d.ts +109 -0
  51. package/build/src/modeling/Semantics.d.ts.map +1 -0
  52. package/build/src/modeling/Semantics.js +97 -0
  53. package/build/src/modeling/Semantics.js.map +1 -0
  54. package/build/src/models/kinds.d.ts +0 -24
  55. package/build/src/models/kinds.d.ts.map +1 -1
  56. package/build/src/models/kinds.js +0 -24
  57. package/build/src/models/kinds.js.map +1 -1
  58. package/build/src/models/store/data_catalog.d.ts +1 -1
  59. package/build/src/models/store/data_catalog.js.map +1 -1
  60. package/build/tsconfig.tsbuildinfo +1 -1
  61. package/data/models/example-generator-api.json +11 -11
  62. package/package.json +1 -1
  63. package/src/amf/AmfTypes.ts +1 -1
  64. package/src/amf/Utils.ts +0 -15
  65. package/src/modeling/Bindings.ts +1 -1
  66. package/src/modeling/DataDomain.ts +2 -2
  67. package/src/modeling/DataFormat.ts +0 -48
  68. package/src/modeling/DomainAssociation.ts +66 -3
  69. package/src/modeling/DomainEntity.ts +56 -17
  70. package/src/modeling/DomainFile.ts +1 -1
  71. package/src/modeling/DomainImpactAnalysis.ts +3 -3
  72. package/src/modeling/DomainModel.ts +2 -2
  73. package/src/modeling/DomainProperty.ts +60 -21
  74. package/src/modeling/Semantics.ts +178 -0
  75. package/src/modeling/graph.md +14 -14
  76. package/src/modeling/readme.md +29 -29
  77. package/src/models/kinds.ts +0 -25
  78. package/src/models/store/data_catalog.ts +1 -1
  79. package/tests/unit/modeling/data_domain_change_observers.spec.ts +11 -10
  80. package/tests/unit/modeling/data_domain_entities.spec.ts +129 -1
  81. package/tests/unit/modeling/data_domain_property.spec.ts +1 -1
  82. package/tests/unit/modeling/domain_asociation.spec.ts +177 -0
  83. package/tests/unit/modeling/domain_entity.spec.ts +27 -26
  84. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +11 -11
  85. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +10 -10
  86. package/tests/unit/modeling/{domain.property.spec.ts → domain_property.spec.ts} +139 -23
  87. package/build/src/amf/AmfShapeGenerator.d.ts +0 -103
  88. package/build/src/amf/AmfShapeGenerator.d.ts.map +0 -1
  89. package/build/src/amf/AmfShapeGenerator.js +0 -416
  90. package/build/src/amf/AmfShapeGenerator.js.map +0 -1
  91. package/build/src/modeling/legacy/DataAssociation.d.ts +0 -284
  92. package/build/src/modeling/legacy/DataAssociation.d.ts.map +0 -1
  93. package/build/src/modeling/legacy/DataAssociation.js +0 -443
  94. package/build/src/modeling/legacy/DataAssociation.js.map +0 -1
  95. package/build/src/modeling/legacy/DataEntity.d.ts +0 -358
  96. package/build/src/modeling/legacy/DataEntity.d.ts.map +0 -1
  97. package/build/src/modeling/legacy/DataEntity.js +0 -855
  98. package/build/src/modeling/legacy/DataEntity.js.map +0 -1
  99. package/build/src/modeling/legacy/DataEntityBuilder.d.ts +0 -162
  100. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +0 -1
  101. package/build/src/modeling/legacy/DataEntityBuilder.js +0 -221
  102. package/build/src/modeling/legacy/DataEntityBuilder.js.map +0 -1
  103. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +0 -298
  104. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +0 -1
  105. package/build/src/modeling/legacy/DataImpactAnalysis.js +0 -441
  106. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +0 -1
  107. package/build/src/modeling/legacy/DataModel.d.ts +0 -99
  108. package/build/src/modeling/legacy/DataModel.d.ts.map +0 -1
  109. package/build/src/modeling/legacy/DataModel.js +0 -237
  110. package/build/src/modeling/legacy/DataModel.js.map +0 -1
  111. package/build/src/modeling/legacy/DataNamespace.d.ts +0 -340
  112. package/build/src/modeling/legacy/DataNamespace.d.ts.map +0 -1
  113. package/build/src/modeling/legacy/DataNamespace.js +0 -784
  114. package/build/src/modeling/legacy/DataNamespace.js.map +0 -1
  115. package/build/src/modeling/legacy/DataProperty.d.ts +0 -332
  116. package/build/src/modeling/legacy/DataProperty.d.ts.map +0 -1
  117. package/build/src/modeling/legacy/DataProperty.js +0 -415
  118. package/build/src/modeling/legacy/DataProperty.js.map +0 -1
  119. package/build/src/models/store/DataFile.d.ts +0 -29
  120. package/build/src/models/store/DataFile.d.ts.map +0 -1
  121. package/build/src/models/store/DataFile.js +0 -87
  122. package/build/src/models/store/DataFile.js.map +0 -1
  123. package/src/amf/AmfShapeGenerator.ts +0 -477
  124. package/src/modeling/legacy/DataAssociation.ts +0 -554
  125. package/src/modeling/legacy/DataEntity.ts +0 -1019
  126. package/src/modeling/legacy/DataEntityBuilder.ts +0 -236
  127. package/src/modeling/legacy/DataImpactAnalysis.ts +0 -530
  128. package/src/modeling/legacy/DataModel.ts +0 -276
  129. package/src/modeling/legacy/DataNamespace.ts +0 -929
  130. package/src/modeling/legacy/DataProperty.ts +0 -630
  131. package/src/models/store/DataFile.ts +0 -95
  132. package/tests/unit/modeling/legacy/amf_shape_generator.spec.ts +0 -1041
  133. package/tests/unit/modeling/legacy/data_association.spec.ts +0 -710
  134. package/tests/unit/modeling/legacy/data_entity.spec.ts +0 -2061
  135. package/tests/unit/modeling/legacy/data_entity_generator_json.spec.ts +0 -987
  136. package/tests/unit/modeling/legacy/data_entity_generator_xml.spec.ts +0 -1451
  137. package/tests/unit/modeling/legacy/data_model.spec.ts +0 -395
  138. package/tests/unit/modeling/legacy/data_namespace.spec.ts +0 -1312
  139. package/tests/unit/modeling/legacy/data_property.spec.ts +0 -887
  140. package/tests/unit/modeling/legacy/impact_analysis.spec.ts +0 -373
@@ -1,416 +0,0 @@
1
- import { IAmfExampleTypes, modelTypeToAmfDataType } from './AmfTypes.js';
2
- import { AmfNamespace } from './definitions/Namespace.js';
3
- import { anyShape, arrayShape, fileShape, nodeShape, propertyShape, recursiveShape, scalarShape, unionShape, } from './definitions/Shapes.js';
4
- import { AmfDataNode } from './models/AmfDataNode.js';
5
- import { nanoid } from '../nanoid.js';
6
- import { DataEntityKind, DataPropertyKind } from '../models/kinds.js';
7
- import { DataValueGenerator } from './DataValueGenerator.js';
8
- /**
9
- * Serializes Data shapes (DataEntity, DataProperty, DataAssociation) to AMF-related shapes.
10
- *
11
- * This is used when defining entities (according to the `DataEntity` schema)
12
- * and then we want to translate this into AMF shapes.
13
- *
14
- * @deprecated This class refers to the deprecated old data domain model.
15
- * Use the `ShapeGenerator` with the new domain model.
16
- */
17
- export class AmfShapeGenerator {
18
- #valueGenerator;
19
- /**
20
- * Used with data domain value generation for entity properties.
21
- * Lazily loaded class only when functions are used.
22
- * This needs to be a class instances because some functions are incremental
23
- */
24
- get valueGenerator() {
25
- if (!this.#valueGenerator) {
26
- this.#valueGenerator = new DataValueGenerator();
27
- }
28
- return this.#valueGenerator;
29
- }
30
- /**
31
- * Serializes the Entity to the AMF node shape.
32
- *
33
- * @param input The Property to serialize.
34
- * @param generatedEntities The list keys of already generated entities. This prohibits recursive shape generation.
35
- */
36
- entity(input, generatedEntities = []) {
37
- if (generatedEntities.includes(input.key)) {
38
- // create a recursive shape.
39
- return this._recursiveShape(input);
40
- }
41
- generatedEntities.push(input.key);
42
- const result = nodeShape(input.key);
43
- result.id = input.key;
44
- this._updateBaseProperties(input, result);
45
- result.properties = [];
46
- input.properties.forEach((item) => {
47
- // we check whether the property is hidden.
48
- // This is not happening when calling the `property()` because this method
49
- // always returns the AMF shape.
50
- const wb = item.readBinding('web');
51
- if (wb && wb.hidden) {
52
- return;
53
- }
54
- const shape = this.property(item);
55
- result.properties.push(shape);
56
- });
57
- input.associations.forEach((assoc) => {
58
- const prop = this.associationProperty(assoc, generatedEntities);
59
- result.properties.push(prop);
60
- });
61
- input.getComputedParents().forEach((parent) => {
62
- const shape = this.entity(parent, generatedEntities);
63
- result.inherits.push(shape);
64
- });
65
- return result;
66
- }
67
- /**
68
- * Serializes an Entity Property to the AMF property shape.
69
- *
70
- * @param input The Property to serialize.
71
- */
72
- property(input) {
73
- const { required, key } = input;
74
- const result = propertyShape(key);
75
- result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`;
76
- if (required) {
77
- result.minCount = 1;
78
- }
79
- result.range = this._readPropertyRange(input);
80
- // for example, Example generator needs to know the name of the property
81
- // as it does not look into the "range" object.
82
- this._updateBaseProperties(input, result);
83
- // sync the name of the property shape with the range, in case it was changed by the bindings
84
- if (result.range.name) {
85
- result.name = result.range.name;
86
- }
87
- return result;
88
- }
89
- /**
90
- * Serializes an Entity property to the AMF property shape with association
91
- * targets as defined in the schema configuration.
92
- *
93
- * @param input The Property to serialize.
94
- */
95
- associationProperty(input, generatedEntities = []) {
96
- const { required, key } = input;
97
- const result = propertyShape(key);
98
- result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`;
99
- if (required) {
100
- result.minCount = 1;
101
- }
102
- result.range = this.associationShape(input, generatedEntities);
103
- this._updateBaseProperties(input, result);
104
- return result;
105
- }
106
- /**
107
- * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.
108
- *
109
- * @param input The data association instance.
110
- * @returns The range value for the PropertyShape.
111
- */
112
- associationShape(input, generatedEntities = []) {
113
- const schema = input.schema;
114
- if (schema && schema.linked) {
115
- // This is a link to the schema. In an API that would be the id
116
- // of a resource to request the data from.
117
- const range = scalarShape(input.key);
118
- range.id = `link-${input.key}`;
119
- range.dataType = modelTypeToAmfDataType('string');
120
- return range;
121
- }
122
- const items = this.associationUnion(input, generatedEntities);
123
- if (!items) {
124
- return;
125
- }
126
- const unionType = (schema && schema.unionType) || 'anyOf';
127
- if (Array.isArray(items)) {
128
- const range = unionShape(input.key);
129
- this._updateBaseProperties(input, range);
130
- range.anyOf = [];
131
- if (unionType === 'anyOf') {
132
- range.anyOf = items;
133
- }
134
- else if (unionType === 'allOf') {
135
- range.and = items;
136
- }
137
- else if (unionType === 'oneOf') {
138
- range.xone = items;
139
- }
140
- else {
141
- // not.
142
- range.not = items[0]; // ?
143
- }
144
- if (input.multiple) {
145
- return this.refactorShapeToArray(input.key, range);
146
- }
147
- return range;
148
- }
149
- if (unionType === 'not') {
150
- const wrapper = anyShape(input.key);
151
- wrapper.id = `not-shape-${input.key}`;
152
- wrapper.not = items;
153
- return wrapper;
154
- }
155
- if (input.multiple) {
156
- return this.refactorShapeToArray(input.key, items);
157
- }
158
- return items;
159
- }
160
- /**
161
- * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.
162
- *
163
- * @param input The data association instance.
164
- * @returns The range value for the PropertyShape.
165
- */
166
- associationUnion(input, generatedEntities = []) {
167
- const targets = input.getTargets().map((i) => this.entity(i, generatedEntities));
168
- if (!targets.length) {
169
- return undefined;
170
- }
171
- if (targets.length > 1) {
172
- return targets;
173
- }
174
- return targets[0];
175
- }
176
- /**
177
- * The DataProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for
178
- * default value, examples, and enum values. We also look for the `web`
179
- * bindings for more detailed definition of a shape.
180
- *
181
- * @param input
182
- * @returns
183
- */
184
- _readPropertyRange(input) {
185
- const bindings = input.readBinding('web');
186
- let schema;
187
- if (input.schema) {
188
- schema = input.schema;
189
- }
190
- return this._createAmfSchema(input, schema, bindings);
191
- }
192
- _createAmfSchema(input, schema, bindings) {
193
- const { multiple, type } = input;
194
- if (multiple) {
195
- return this._generateArrayShape(input, schema, bindings);
196
- }
197
- if (type === 'binary') {
198
- return this._generateFileShape(input, schema, bindings);
199
- }
200
- return this._generateScalarShape(input, schema, bindings);
201
- }
202
- /**
203
- * Normally this would be part of generating a scalar schema but the the property is an array this
204
- * is generated on the array and not on the range.
205
- *
206
- * @param result The scalar or array shape.
207
- * @param schema The property schema
208
- * @param type The data type of the parent property as set on the `range`
209
- * @param isArray Whether the DataProperty is multiple
210
- */
211
- _setShapeSchema(input, result, schema, type, isArray) {
212
- if (schema.defaultValue) {
213
- const { type: dfFormat } = schema.defaultValue;
214
- const { value } = schema.defaultValue;
215
- if (dfFormat === 'function') {
216
- const tmp = this.valueGenerator.generate(value, input.type);
217
- if (tmp !== DataValueGenerator.noValue) {
218
- const dt = AmfDataNode.scalar(tmp, dfFormat);
219
- result.defaultValue = dt.toJSON();
220
- }
221
- }
222
- else {
223
- const dt = AmfDataNode.scalar(value, type);
224
- result.defaultValue = dt.toJSON();
225
- }
226
- }
227
- if (Array.isArray(schema.enum)) {
228
- result.values = schema.enum.map((i) => AmfDataNode.scalar(i, type).toJSON());
229
- }
230
- if (Array.isArray(schema.examples)) {
231
- if (isArray) {
232
- result.examples = this._generateArrayExamples(schema.examples, type);
233
- }
234
- else {
235
- result.examples = this._generateExamples(schema.examples, type);
236
- }
237
- }
238
- }
239
- _generateArrayShape(input, schema, bindings) {
240
- const result = arrayShape(input.key);
241
- const { type } = input;
242
- if (type === 'binary') {
243
- // we do not pass schema to the range generator as we set schema's properties on the array shape.
244
- result.items = this._generateFileShape(input, undefined, bindings);
245
- }
246
- else {
247
- result.items = this._generateScalarShape(input, undefined, bindings);
248
- }
249
- if (schema) {
250
- const type = result.items.dataType;
251
- this._setShapeSchema(input, result, schema, type, input.multiple);
252
- }
253
- return result;
254
- }
255
- _generateScalarShape(input, schema, bindings) {
256
- const result = scalarShape(input.key);
257
- this._updateBaseProperties(input, result);
258
- this._fillScalarShapeCommonProperties(result, input, bindings);
259
- if (!result.dataType) {
260
- result.dataType = modelTypeToAmfDataType(input.type, bindings);
261
- }
262
- if (schema) {
263
- this._setShapeSchema(input, result, schema, result.dataType, input.multiple);
264
- }
265
- return result;
266
- }
267
- _generateExamples(examples, type) {
268
- return examples.map((current) => {
269
- const value = AmfDataNode.scalar(current, type).toJSON();
270
- const item = {
271
- id: nanoid(),
272
- customDomainProperties: [],
273
- strict: true,
274
- types: IAmfExampleTypes,
275
- structuredValue: value,
276
- };
277
- return item;
278
- });
279
- }
280
- _generateArrayExamples(examples, type) {
281
- const item = {
282
- id: nanoid(),
283
- customDomainProperties: [],
284
- strict: true,
285
- types: IAmfExampleTypes,
286
- };
287
- const value = new AmfDataNode('array');
288
- examples.forEach((item) => {
289
- const member = AmfDataNode.scalar(item, type);
290
- value.addMember(member);
291
- });
292
- item.structuredValue = value.toJSON();
293
- return [item];
294
- }
295
- _generateFileShape(input, schema, bindings) {
296
- // if (bindings && bindings.format === 'base64') {
297
- // // this is a binary format of a string shape
298
- // }
299
- const result = fileShape(input.key);
300
- this._updateBaseProperties(input, result);
301
- if (bindings) {
302
- if (Array.isArray(bindings.fileTypes)) {
303
- result.fileTypes = bindings.fileTypes;
304
- }
305
- this._fillScalarShapeCommonProperties(result, input, bindings);
306
- if (bindings.format === 'base64') {
307
- result.format = AmfNamespace.w3.xmlSchema.base64Binary;
308
- }
309
- }
310
- return result;
311
- }
312
- _fillScalarShapeCommonProperties(result, input, bindings) {
313
- if (bindings?.name) {
314
- result.name = bindings.name;
315
- }
316
- if (bindings?.xml) {
317
- result.xmlSerialization = bindings.xml;
318
- }
319
- if (bindings?.pattern) {
320
- result.pattern = bindings.pattern;
321
- }
322
- const { schema, type } = input;
323
- if (schema) {
324
- if (typeof schema.multipleOf === 'number') {
325
- result.multipleOf = schema.multipleOf;
326
- }
327
- if (typeof schema.minimum === 'number') {
328
- if (type === 'string') {
329
- result.minLength = schema.minimum;
330
- }
331
- else {
332
- result.minimum = schema.minimum;
333
- }
334
- }
335
- if (typeof schema.maximum === 'number') {
336
- if (type === 'string') {
337
- result.maxLength = schema.maximum;
338
- }
339
- else {
340
- result.maximum = schema.maximum;
341
- }
342
- }
343
- if (typeof schema.exclusiveMinimum === 'boolean') {
344
- result.exclusiveMinimum = schema.exclusiveMinimum;
345
- }
346
- if (typeof schema.exclusiveMaximum === 'boolean') {
347
- result.exclusiveMaximum = schema.exclusiveMaximum;
348
- }
349
- }
350
- if (bindings?.format) {
351
- switch (bindings.format) {
352
- case 'base64':
353
- result.format = AmfNamespace.w3.xmlSchema.base64Binary;
354
- break;
355
- case 'double':
356
- result.format = AmfNamespace.w3.xmlSchema.double;
357
- break;
358
- case 'float':
359
- result.format = AmfNamespace.w3.xmlSchema.float;
360
- break;
361
- case 'int32':
362
- result.format = AmfNamespace.w3.xmlSchema.integer;
363
- break;
364
- case 'int64':
365
- result.format = AmfNamespace.w3.xmlSchema.integer;
366
- break;
367
- }
368
- // result.format = bindings.format
369
- }
370
- if (typeof input.readOnly === 'boolean') {
371
- result.readOnly = input.readOnly;
372
- }
373
- if (typeof input.writeOnly === 'boolean') {
374
- result.writeOnly = input.writeOnly;
375
- }
376
- }
377
- _updateBaseProperties(input, target) {
378
- // const bindings = input.readBinding('web') as PropertyWebBindings | undefined
379
- target.name = input.info.name;
380
- target.displayName = input.info.displayName;
381
- target.description = input.info.description;
382
- if (input.kind === DataPropertyKind) {
383
- target.deprecated = input.deprecated;
384
- }
385
- else if (input.kind === DataEntityKind) {
386
- target.deprecated = input.deprecated;
387
- }
388
- }
389
- _recursiveShape(input) {
390
- return recursiveShape(input.key, input.key);
391
- }
392
- /**
393
- * Translates generated schema from an array shape to the shape defined in the `items` of the array.
394
- *
395
- * @param array The source array.
396
- * @returns The definition of the `items` of the array.
397
- */
398
- refactorArrayToShape(array) {
399
- const { items } = array;
400
- return items;
401
- }
402
- /**
403
- * Translates the shape to an array shape. This happens when data model property
404
- * is changed from 'multiple' to not-multiple and back.
405
- *
406
- * @param id The key of the parameter or an association
407
- * @param shape The shape to wrap as an array.
408
- * @returns Array shape.
409
- */
410
- refactorShapeToArray(id, shape) {
411
- const result = arrayShape(id);
412
- result.items = shape;
413
- return result;
414
- }
415
- }
416
- //# sourceMappingURL=AmfShapeGenerator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AmfShapeGenerator.js","sourceRoot":"","sources":["../../../src/amf/AmfShapeGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EAWT,SAAS,EACT,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,GACX,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IAC5B,eAAe,CAAqB;IAEpC;;;;OAIG;IACH,IAAI,cAAc;QAChB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,kBAAkB,EAAE,CAAA;QACjD,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAiB,EAAE,oBAA8B,EAAE;QACxD,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,4BAA4B;YAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;QACD,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,SAAS,CAAC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AAA;QACpC,CAAC;IACH,CAAC;IAES,qBAAqB,CAAC,KAAkD,EAAE,MAAiB;QACnG,+EAA+E;QAC/E,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAA;QAC7B,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;QAC3C,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;QAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YACpC,MAAM,CAAC,UAAU,GAAI,KAAsB,CAAC,UAAU,CAAA;QACxD,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACzC,MAAM,CAAC,UAAU,GAAI,KAAoB,CAAC,UAAU,CAAA;QACtD,CAAC;IACH,CAAC;IAES,eAAe,CAAC,KAAiB;QACzC,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAAC,KAAqB;QACxC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;QACvB,OAAO,KAAoB,CAAA;IAC7B,CAAC;IAED;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAU,EAAE,KAAkB;QACjD,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;QAC7B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { type PropertyWebBindings } from '../modeling/Bindings.js'\nimport { DataAssociation } from '../modeling/legacy/DataAssociation.js'\nimport { DataEntity } from '../modeling/legacy/DataEntity.js'\nimport { DataProperty, type DataPropertySchema } from '../modeling/legacy/DataProperty.js'\nimport { IAmfExampleTypes, modelTypeToAmfDataType } from './AmfTypes.js'\nimport { AmfNamespace } from './definitions/Namespace.js'\nimport {\n anyShape,\n arrayShape,\n fileShape,\n IApiAnyShape,\n IApiArrayShape,\n IApiDataExample,\n IApiFileShape,\n IApiNodeShape,\n IApiPropertyShape,\n IApiRecursiveShape,\n IApiScalarShape,\n IApiShape,\n IShapeUnion,\n nodeShape,\n propertyShape,\n recursiveShape,\n scalarShape,\n unionShape,\n} from './definitions/Shapes.js'\nimport { AmfDataNode } from './models/AmfDataNode.js'\nimport { nanoid } from '../nanoid.js'\nimport { DataEntityKind, DataPropertyKind } from '../models/kinds.js'\nimport { DataValueGenerator } from './DataValueGenerator.js'\n\n/**\n * Serializes Data shapes (DataEntity, DataProperty, DataAssociation) to AMF-related shapes.\n *\n * This is used when defining entities (according to the `DataEntity` schema)\n * and then we want to translate this into AMF shapes.\n *\n * @deprecated This class refers to the deprecated old data domain model.\n * Use the `ShapeGenerator` with the new domain model.\n */\nexport class AmfShapeGenerator {\n #valueGenerator?: DataValueGenerator\n\n /**\n * Used with data domain value generation for entity properties.\n * Lazily loaded class only when functions are used.\n * This needs to be a class instances because some functions are incremental\n */\n get valueGenerator(): DataValueGenerator {\n if (!this.#valueGenerator) {\n this.#valueGenerator = new DataValueGenerator()\n }\n return this.#valueGenerator\n }\n\n /**\n * Serializes the Entity to the AMF node shape.\n *\n * @param input The Property to serialize.\n * @param generatedEntities The list keys of already generated entities. This prohibits recursive shape generation.\n */\n entity(input: DataEntity, generatedEntities: string[] = []): IApiNodeShape | IApiRecursiveShape {\n if (generatedEntities.includes(input.key)) {\n // create a recursive shape.\n return this._recursiveShape(input)\n }\n generatedEntities.push(input.key)\n const result = nodeShape(input.key)\n result.id = input.key\n this._updateBaseProperties(input, result)\n result.properties = []\n input.properties.forEach((item) => {\n // we check whether the property is hidden.\n // This is not happening when calling the `property()` because this method\n // always returns the AMF shape.\n const wb = item.readBinding('web') as PropertyWebBindings | undefined\n if (wb && wb.hidden) {\n return\n }\n const shape = this.property(item)\n result.properties.push(shape)\n })\n input.associations.forEach((assoc) => {\n const prop = this.associationProperty(assoc, generatedEntities)\n result.properties.push(prop)\n })\n input.getComputedParents().forEach((parent) => {\n const shape = this.entity(parent, generatedEntities)\n result.inherits.push(shape)\n })\n return result\n }\n\n /**\n * Serializes an Entity Property to the AMF property shape.\n *\n * @param input The Property to serialize.\n */\n property(input: DataProperty): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this._readPropertyRange(input)\n\n // for example, Example generator needs to know the name of the property\n // as it does not look into the \"range\" object.\n this._updateBaseProperties(input, result)\n\n // sync the name of the property shape with the range, in case it was changed by the bindings\n if (result.range.name) {\n result.name = result.range.name\n }\n return result\n }\n\n /**\n * Serializes an Entity property to the AMF property shape with association\n * targets as defined in the schema configuration.\n *\n * @param input The Property to serialize.\n */\n associationProperty(input: DataAssociation, generatedEntities: string[] = []): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.associationShape(input, generatedEntities)\n this._updateBaseProperties(input, result)\n return result\n }\n\n /**\n * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @returns The range value for the PropertyShape.\n */\n associationShape(input: DataAssociation, generatedEntities: string[] = []): IShapeUnion | undefined {\n const schema = input.schema\n if (schema && schema.linked) {\n // This is a link to the schema. In an API that would be the id\n // of a resource to request the data from.\n const range = scalarShape(input.key)\n range.id = `link-${input.key}`\n range.dataType = modelTypeToAmfDataType('string')\n return range\n }\n const items = this.associationUnion(input, generatedEntities)\n if (!items) {\n return\n }\n const unionType = (schema && schema.unionType) || 'anyOf'\n if (Array.isArray(items)) {\n const range = unionShape(input.key)\n this._updateBaseProperties(input, range)\n range.anyOf = []\n if (unionType === 'anyOf') {\n range.anyOf = items\n } else if (unionType === 'allOf') {\n range.and = items\n } else if (unionType === 'oneOf') {\n range.xone = items\n } else {\n // not.\n range.not = items[0] // ?\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, range)\n }\n return range\n }\n if (unionType === 'not') {\n const wrapper = anyShape(input.key)\n wrapper.id = `not-shape-${input.key}`\n wrapper.not = items\n return wrapper\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, items)\n }\n return items\n }\n\n /**\n * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @returns The range value for the PropertyShape.\n */\n associationUnion(input: DataAssociation, generatedEntities: string[] = []): IShapeUnion | IShapeUnion[] | undefined {\n const targets = input.getTargets().map((i) => this.entity(i, generatedEntities))\n if (!targets.length) {\n return undefined\n }\n if (targets.length > 1) {\n return targets\n }\n return targets[0]\n }\n\n /**\n * The DataProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for\n * default value, examples, and enum values. We also look for the `web`\n * bindings for more detailed definition of a shape.\n *\n * @param input\n * @returns\n */\n protected _readPropertyRange(input: DataProperty): IApiArrayShape | IApiFileShape | IApiScalarShape {\n const bindings = input.readBinding('web') as PropertyWebBindings | undefined\n let schema: DataPropertySchema | undefined\n if (input.schema) {\n schema = input.schema\n }\n return this._createAmfSchema(input, schema, bindings)\n }\n\n protected _createAmfSchema(\n input: DataProperty,\n schema?: DataPropertySchema,\n bindings?: PropertyWebBindings\n ): IApiArrayShape | IApiFileShape | IApiScalarShape {\n const { multiple, type } = input\n if (multiple) {\n return this._generateArrayShape(input, schema, bindings)\n }\n if (type === 'binary') {\n return this._generateFileShape(input, schema, bindings)\n }\n return this._generateScalarShape(input, schema, bindings)\n }\n\n /**\n * Normally this would be part of generating a scalar schema but the the property is an array this\n * is generated on the array and not on the range.\n *\n * @param result The scalar or array shape.\n * @param schema The property schema\n * @param type The data type of the parent property as set on the `range`\n * @param isArray Whether the DataProperty is multiple\n */\n protected _setShapeSchema(\n input: DataProperty,\n result: IApiAnyShape,\n schema: DataPropertySchema,\n type: string,\n isArray?: boolean\n ): void {\n if (schema.defaultValue) {\n const { type: dfFormat } = schema.defaultValue\n const { value } = schema.defaultValue\n if (dfFormat === 'function') {\n const tmp = this.valueGenerator.generate(value, input.type)\n if (tmp !== DataValueGenerator.noValue) {\n const dt = AmfDataNode.scalar(tmp as string, dfFormat)\n result.defaultValue = dt.toJSON()\n }\n } else {\n const dt = AmfDataNode.scalar(value, type)\n result.defaultValue = dt.toJSON()\n }\n }\n if (Array.isArray(schema.enum)) {\n result.values = schema.enum.map((i) => AmfDataNode.scalar(i, type).toJSON())\n }\n if (Array.isArray(schema.examples)) {\n if (isArray) {\n result.examples = this._generateArrayExamples(schema.examples, type)\n } else {\n result.examples = this._generateExamples(schema.examples, type)\n }\n }\n }\n\n protected _generateArrayShape(\n input: DataProperty,\n schema?: DataPropertySchema,\n bindings?: PropertyWebBindings\n ): IApiArrayShape {\n const result = arrayShape(input.key)\n const { type } = input\n if (type === 'binary') {\n // we do not pass schema to the range generator as we set schema's properties on the array shape.\n result.items = this._generateFileShape(input, undefined, bindings)\n } else {\n result.items = this._generateScalarShape(input, undefined, bindings)\n }\n if (schema) {\n const type = (result.items as IApiScalarShape).dataType as string\n this._setShapeSchema(input, result, schema, type, input.multiple)\n }\n return result\n }\n\n protected _generateScalarShape(\n input: DataProperty,\n schema?: DataPropertySchema,\n bindings?: PropertyWebBindings\n ): IApiScalarShape {\n const result = scalarShape(input.key)\n this._updateBaseProperties(input, result)\n this._fillScalarShapeCommonProperties(result, input, bindings)\n if (!result.dataType) {\n result.dataType = modelTypeToAmfDataType(input.type, bindings)\n }\n if (schema) {\n this._setShapeSchema(input, result, schema, result.dataType as string, input.multiple)\n }\n return result\n }\n\n protected _generateExamples(examples: string[], type: string): IApiDataExample[] {\n return examples.map((current) => {\n const value = AmfDataNode.scalar(current, type).toJSON()\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n structuredValue: value,\n }\n return item\n })\n }\n\n protected _generateArrayExamples(examples: string[], type: string): IApiDataExample[] {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n }\n const value = new AmfDataNode('array')\n examples.forEach((item) => {\n const member = AmfDataNode.scalar(item, type)\n value.addMember(member)\n })\n item.structuredValue = value.toJSON()\n return [item]\n }\n\n protected _generateFileShape(\n input: DataProperty,\n schema?: DataPropertySchema,\n bindings?: PropertyWebBindings\n ): IApiFileShape {\n // if (bindings && bindings.format === 'base64') {\n // // this is a binary format of a string shape\n // }\n const result = fileShape(input.key)\n this._updateBaseProperties(input, result)\n if (bindings) {\n if (Array.isArray(bindings.fileTypes)) {\n result.fileTypes = bindings.fileTypes\n }\n this._fillScalarShapeCommonProperties(result, input, bindings)\n if (bindings.format === 'base64') {\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n }\n }\n return result\n }\n\n protected _fillScalarShapeCommonProperties(\n result: IApiFileShape | IApiScalarShape,\n input: DataProperty,\n bindings?: PropertyWebBindings\n ): void {\n if (bindings?.name) {\n result.name = bindings.name\n }\n if (bindings?.xml) {\n result.xmlSerialization = bindings.xml\n }\n if (bindings?.pattern) {\n result.pattern = bindings.pattern\n }\n const { schema, type } = input\n if (schema) {\n if (typeof schema.multipleOf === 'number') {\n result.multipleOf = schema.multipleOf\n }\n if (typeof schema.minimum === 'number') {\n if (type === 'string') {\n result.minLength = schema.minimum\n } else {\n result.minimum = schema.minimum\n }\n }\n if (typeof schema.maximum === 'number') {\n if (type === 'string') {\n result.maxLength = schema.maximum\n } else {\n result.maximum = schema.maximum\n }\n }\n if (typeof schema.exclusiveMinimum === 'boolean') {\n result.exclusiveMinimum = schema.exclusiveMinimum\n }\n if (typeof schema.exclusiveMaximum === 'boolean') {\n result.exclusiveMaximum = schema.exclusiveMaximum\n }\n }\n if (bindings?.format) {\n switch (bindings.format) {\n case 'base64':\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n break\n case 'double':\n result.format = AmfNamespace.w3.xmlSchema.double\n break\n case 'float':\n result.format = AmfNamespace.w3.xmlSchema.float\n break\n case 'int32':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n case 'int64':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n }\n // result.format = bindings.format\n }\n if (typeof input.readOnly === 'boolean') {\n result.readOnly = input.readOnly\n }\n if (typeof input.writeOnly === 'boolean') {\n result.writeOnly = input.writeOnly\n }\n }\n\n protected _updateBaseProperties(input: DataProperty | DataAssociation | DataEntity, target: IApiShape): void {\n // const bindings = input.readBinding('web') as PropertyWebBindings | undefined\n target.name = input.info.name\n target.displayName = input.info.displayName\n target.description = input.info.description\n if (input.kind === DataPropertyKind) {\n target.deprecated = (input as DataProperty).deprecated\n } else if (input.kind === DataEntityKind) {\n target.deprecated = (input as DataEntity).deprecated\n }\n }\n\n protected _recursiveShape(input: DataEntity): IApiRecursiveShape {\n return recursiveShape(input.key, input.key)\n }\n\n /**\n * Translates generated schema from an array shape to the shape defined in the `items` of the array.\n *\n * @param array The source array.\n * @returns The definition of the `items` of the array.\n */\n refactorArrayToShape(array: IApiArrayShape): IShapeUnion {\n const { items } = array\n return items as IShapeUnion\n }\n\n /**\n * Translates the shape to an array shape. This happens when data model property\n * is changed from 'multiple' to not-multiple and back.\n *\n * @param id The key of the parameter or an association\n * @param shape The shape to wrap as an array.\n * @returns Array shape.\n */\n refactorShapeToArray(id: string, shape: IShapeUnion): IApiArrayShape {\n const result = arrayShape(id)\n result.items = shape\n return result\n }\n}\n"]}