@api-client/core 0.7.12 → 0.8.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 (88) hide show
  1. package/SECURITY.md +14 -0
  2. package/build/browser.d.ts +6 -0
  3. package/build/browser.js +6 -0
  4. package/build/browser.js.map +1 -1
  5. package/build/index.d.ts +6 -0
  6. package/build/index.js +6 -0
  7. package/build/index.js.map +1 -1
  8. package/build/src/amf/AmfMixin.d.ts +55 -42
  9. package/build/src/amf/AmfMixin.js +9 -3
  10. package/build/src/amf/AmfMixin.js.map +1 -1
  11. package/build/src/amf/AmfSerializer.d.ts +72 -72
  12. package/build/src/amf/AmfSerializer.js +9 -4
  13. package/build/src/amf/AmfSerializer.js.map +1 -1
  14. package/build/src/amf/AmfShapeGenerator.d.ts +17 -17
  15. package/build/src/amf/AmfShapeGenerator.js +3 -3
  16. package/build/src/amf/AmfShapeGenerator.js.map +1 -1
  17. package/build/src/amf/AmfTypes.d.ts +16 -16
  18. package/build/src/amf/AmfTypes.js +16 -16
  19. package/build/src/amf/AmfTypes.js.map +1 -1
  20. package/build/src/amf/ApiExampleGenerator.d.ts +3 -3
  21. package/build/src/amf/ApiExampleGenerator.js.map +1 -1
  22. package/build/src/amf/ApiMonacoSchemaGenerator.d.ts +6 -6
  23. package/build/src/amf/ApiMonacoSchemaGenerator.js.map +1 -1
  24. package/build/src/amf/ApiSchemaGenerator.d.ts +2 -2
  25. package/build/src/amf/ApiSchemaGenerator.js.map +1 -1
  26. package/build/src/amf/ApiSchemaValues.d.ts +12 -12
  27. package/build/src/amf/ApiSchemaValues.js.map +1 -1
  28. package/build/src/amf/Parsing.d.ts +5 -5
  29. package/build/src/amf/Utils.d.ts +6 -6
  30. package/build/src/amf/Utils.js.map +1 -1
  31. package/build/src/amf/data-node/DataNodeBase.d.ts +5 -5
  32. package/build/src/amf/data-node/DataNodeBase.js.map +1 -1
  33. package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts +2 -2
  34. package/build/src/amf/data-node/JsonDataNodeGenerator.js.map +1 -1
  35. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts +2 -2
  36. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js.map +1 -1
  37. package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts +2 -2
  38. package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +1 -1
  39. package/build/src/amf/definitions/Amf.d.ts +339 -339
  40. package/build/src/amf/definitions/Api.d.ts +158 -158
  41. package/build/src/amf/definitions/Base.d.ts +5 -5
  42. package/build/src/amf/definitions/Shapes.d.ts +46 -46
  43. package/build/src/amf/definitions/Shapes.js +11 -11
  44. package/build/src/amf/definitions/Shapes.js.map +1 -1
  45. package/build/src/amf/models/AmfDataNode.d.ts +5 -5
  46. package/build/src/amf/models/AmfDataNode.js +4 -4
  47. package/build/src/amf/models/AmfDataNode.js.map +1 -1
  48. package/build/src/amf/shape/ShapeBase.d.ts +13 -13
  49. package/build/src/amf/shape/ShapeBase.js.map +1 -1
  50. package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +13 -13
  51. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -1
  52. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +16 -16
  53. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
  54. package/build/src/events/amf/AmfEvents.d.ts +4 -4
  55. package/build/src/events/amf/AmfEvents.js.map +1 -1
  56. package/build/src/models/data/Bindings.d.ts +2 -2
  57. package/build/src/models/data/DataAssociation.d.ts +4 -4
  58. package/build/src/models/data/DataAssociation.js.map +1 -1
  59. package/build/src/models/data/DataEntity.d.ts +2 -2
  60. package/build/src/models/data/DataProperty.d.ts +2 -2
  61. package/package.json +1 -1
  62. package/src/amf/AmfMixin.ts +124 -117
  63. package/src/amf/AmfSerializer.ts +245 -240
  64. package/src/amf/AmfShapeGenerator.ts +23 -23
  65. package/src/amf/AmfTypes.ts +16 -16
  66. package/src/amf/ApiExampleGenerator.ts +4 -4
  67. package/src/amf/ApiMonacoSchemaGenerator.ts +11 -11
  68. package/src/amf/ApiSchemaGenerator.ts +3 -3
  69. package/src/amf/ApiSchemaValues.ts +21 -21
  70. package/src/amf/Parsing.ts +5 -5
  71. package/src/amf/Utils.ts +15 -15
  72. package/src/amf/data-node/DataNodeBase.ts +8 -8
  73. package/src/amf/data-node/JsonDataNodeGenerator.ts +2 -2
  74. package/src/amf/data-node/UrlEncodedDataNodeGenerator.ts +2 -2
  75. package/src/amf/data-node/XmlDataNodeGenerator.ts +2 -2
  76. package/src/amf/definitions/Amf.ts +315 -314
  77. package/src/amf/definitions/Api.ts +158 -157
  78. package/src/amf/definitions/Base.ts +5 -5
  79. package/src/amf/definitions/Shapes.ts +60 -60
  80. package/src/amf/models/AmfDataNode.ts +17 -17
  81. package/src/amf/shape/ShapeBase.ts +16 -16
  82. package/src/amf/shape/ShapeJsonSchemaGenerator.ts +27 -27
  83. package/src/amf/shape/ShapeXmlSchemaGenerator.ts +42 -42
  84. package/src/events/amf/AmfEvents.ts +7 -7
  85. package/src/models/data/Bindings.ts +2 -2
  86. package/src/models/data/DataAssociation.ts +4 -4
  87. package/src/models/data/DataEntity.ts +2 -2
  88. package/src/models/data/DataProperty.ts +2 -2
@@ -1,3 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+ /* eslint-disable @typescript-eslint/ban-types */
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1
5
  /**
2
6
  @license
3
7
  Copyright 2018 The Advanced REST client authors <arc@mulesoft.com>
@@ -11,9 +15,10 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
15
  License for the specific language governing permissions and limitations under
12
16
  the License.
13
17
  */
18
+
14
19
  // @ts-ignore
15
20
  import { AmfModelExpander, JsonLdOptions, JsonLd } from 'amf-json-ld-lib';
16
- import { AmfDocument, DomainElement, EndPoint, LdValue, SecurityScheme, Shape, WebApi, Operation, AsyncApi, Server, Request } from './definitions/Amf.js';
21
+ import { IAmfDocument, IAmfDomainElement, IAmfEndPoint, IAmfLdValue, IAmfSecurityScheme, IAmfShape, IAmfWebApi, IAmfOperation, IAmfAsyncApi, IAmfServer, IAmfRequest } from './definitions/Amf.js';
17
22
  import { AmfNamespace as ns } from './definitions/Namespace.js';
18
23
 
19
24
  export const expandKey = Symbol('expandKey');
@@ -51,14 +56,14 @@ export interface ServerQueryOptions {
51
56
  type Constructor<T = {}> = new (...args: any[]) => T;
52
57
 
53
58
  export declare class AmfMixinInterface {
54
- amf?: AmfDocument;
59
+ amf?: IAmfDocument;
55
60
  /**
56
61
  * This is an abstract method to be implemented by the components.
57
62
  * If, instead, the component uses `amf` setter you must use `super.amf` to
58
63
  * set the value.
59
64
  * @param amf Current AMF model. Can be undefined.
60
65
  */
61
- _amfChanged(amf?: AmfDocument): void;
66
+ _amfChanged(amf?: IAmfDocument): void;
62
67
 
63
68
  /**
64
69
  * Expands flattened AMF model
@@ -71,7 +76,7 @@ export declare class AmfMixinInterface {
71
76
  * @param context A context to use. If not set, it looks for the context of the passed model
72
77
  * @returns Compact model property name or the same value if value not found in the context.
73
78
  */
74
- _getAmfKey(property?: string, context?: Record<string, string>): string | undefined;
79
+ _getAmfKey(property?: string, context?: Record<string, string>): string;
75
80
 
76
81
  /**
77
82
  * Ensures that the model is AMF object.
@@ -79,7 +84,7 @@ export declare class AmfMixinInterface {
79
84
  * @param amf AMF json/ld model
80
85
  * @returns The API spec
81
86
  */
82
- _ensureAmfModel(amf: any): AmfDocument | undefined;
87
+ _ensureAmfModel(amf: any): IAmfDocument | undefined;
83
88
 
84
89
  /**
85
90
  * Ensures that the value is an array.
@@ -98,7 +103,7 @@ export declare class AmfMixinInterface {
98
103
  * @param context A context to use. If not set, it looks for the context of the passed model
99
104
  * @returns Value for key
100
105
  */
101
- _getValue(model: DomainElement, untrustedKey: string, context?: Record<string, string>): string | number | boolean | undefined | null;
106
+ _getValue(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): string | number | boolean | undefined | null;
102
107
 
103
108
  /**
104
109
  * Gets values from a model as an array of `@value` properties.
@@ -107,7 +112,7 @@ export declare class AmfMixinInterface {
107
112
  * @param context A context to use. If not set, it looks for the context of the passed model
108
113
  * @returns The value for key
109
114
  */
110
- _getValueArray(model: DomainElement, untrustedKey: string, context?: Record<string, string>): (string | number | boolean | null)[] | undefined;
115
+ _getValueArray(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): (string | number | boolean | null)[] | undefined;
111
116
 
112
117
  /**
113
118
  * Reads an array from the model.
@@ -117,7 +122,7 @@ export declare class AmfMixinInterface {
117
122
  * @param context A context to use. If not set, it looks for the context of the passed model
118
123
  * @returns Value for the key
119
124
  */
120
- [getArrayItems](model?: DomainElement, untrustedKey?: string, context?: Record<string, string>): DomainElement[] | undefined;
125
+ [getArrayItems](model?: IAmfDomainElement, untrustedKey?: string, context?: Record<string, string>): IAmfDomainElement[] | undefined;
121
126
 
122
127
  /**
123
128
  * Reads the value of the `@id` property.
@@ -125,7 +130,7 @@ export declare class AmfMixinInterface {
125
130
  * @param untrustedKey Model key to search for the @id
126
131
  * @param context A context to use. If not set, it looks for the context of the passed model
127
132
  */
128
- _getLinkValue(model: DomainElement, untrustedKey: string, context?: Record<string, string>): string | undefined;
133
+ _getLinkValue(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): string | undefined;
129
134
 
130
135
  /**
131
136
  * Reads the list of value for the `@id` property.
@@ -133,7 +138,7 @@ export declare class AmfMixinInterface {
133
138
  * @param untrustedKey Model key to search for the @id
134
139
  * @param context A context to use. If not set, it looks for the context of the passed model
135
140
  */
136
- _getLinkValues(model: DomainElement, untrustedKey: string, context?: Record<string, string>): string[] | undefined;
141
+ _getLinkValues(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): string[] | undefined;
137
142
 
138
143
  /**
139
144
  * Checks if a model has a type.
@@ -142,7 +147,7 @@ export declare class AmfMixinInterface {
142
147
  * @param context A context to use. If not set, it looks for the context of the passed model
143
148
  * @returns True if model has a type.
144
149
  */
145
- _hasType(model?: DomainElement, type?: string, context?: Record<string, string>): boolean;
150
+ _hasType(model?: IAmfDomainElement, type?: string, context?: Record<string, string>): boolean;
146
151
 
147
152
  /**
148
153
  * Checks if a shape has a property.
@@ -150,7 +155,7 @@ export declare class AmfMixinInterface {
150
155
  * @param untrustedKey Property name to test
151
156
  * @param context A context to use. If not set, it looks for the context of the passed model
152
157
  */
153
- _hasProperty(shape: DomainElement, untrustedKey: string, context?: Record<string, string>): boolean;
158
+ _hasProperty(shape: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): boolean;
154
159
 
155
160
  /**
156
161
  * Computes array value of a property in a model (shape).
@@ -159,7 +164,7 @@ export declare class AmfMixinInterface {
159
164
  * @param untrustedKey Property name
160
165
  * @param context A context to use. If not set, it looks for the context of the passed model
161
166
  */
162
- _computePropertyArray(shape?: DomainElement, untrustedKey?: string, context?: Record<string, string>): (string|number|boolean|null|Object)[] | undefined;
167
+ _computePropertyArray(shape?: IAmfDomainElement, untrustedKey?: string, context?: Record<string, string>): (string | number | boolean | null | Object)[] | undefined;
163
168
 
164
169
  /**
165
170
  * Computes API version from the AMF model.
@@ -167,7 +172,7 @@ export declare class AmfMixinInterface {
167
172
  * @param amf
168
173
  * @param context A context to use. If not set, it looks for the context of the passed model
169
174
  */
170
- _computeApiVersion(amf?: AmfDocument, context?: Record<string, string>): string | undefined;
175
+ _computeApiVersion(amf?: IAmfDocument, context?: Record<string, string>): string | undefined;
171
176
 
172
177
  /**
173
178
  * Computes model's `encodes` property.
@@ -176,7 +181,7 @@ export declare class AmfMixinInterface {
176
181
  * @param context A context to use. If not set, it looks for the context of the passed model
177
182
  * @returns List of encodes
178
183
  */
179
- _computeEncodes(model?: AmfDocument, context?: Record<string, string>): DomainElement | undefined;
184
+ _computeEncodes(model?: IAmfDocument, context?: Record<string, string>): IAmfDomainElement | undefined;
180
185
 
181
186
  /**
182
187
  * Computes list of declarations in the AMF api model.
@@ -185,7 +190,7 @@ export declare class AmfMixinInterface {
185
190
  * @param context A context to use. If not set, it looks for the context of the passed model
186
191
  * @returns List of declarations
187
192
  */
188
- _computeDeclares(model?: AmfDocument, context?: Record<string, string>): DomainElement[] | undefined;
193
+ _computeDeclares(model?: IAmfDocument, context?: Record<string, string>): IAmfDomainElement[] | undefined;
189
194
 
190
195
  /**
191
196
  * Computes list of references in the AMF api model.
@@ -194,7 +199,7 @@ export declare class AmfMixinInterface {
194
199
  * @param context A context to use. If not set, it looks for the context of the passed model
195
200
  * @returns List of declarations
196
201
  */
197
- _computeReferences(model?: AmfDocument, context?: Record<string, string>): DomainElement[] | undefined;
202
+ _computeReferences(model?: IAmfDocument, context?: Record<string, string>): IAmfDomainElement[] | undefined;
198
203
 
199
204
  /**
200
205
  * Computes AMF's `http://schema.org/WebAPI` model
@@ -203,7 +208,7 @@ export declare class AmfMixinInterface {
203
208
  * @param context A context to use. If not set, it looks for the context of the passed model
204
209
  * @returns Web API declaration.
205
210
  */
206
- _computeWebApi(model?: AmfDocument, context?: Record<string, string>): WebApi|undefined;
211
+ _computeWebApi(model?: IAmfDocument, context?: Record<string, string>): IAmfWebApi | undefined;
207
212
 
208
213
  /**
209
214
  * Computes AMF's `http://schema.org/API` model
@@ -212,7 +217,7 @@ export declare class AmfMixinInterface {
212
217
  * @param context A context to use. If not set, it looks for the context of the passed model
213
218
  * @returns API declaration.
214
219
  */
215
- _computeApi(model?: AmfDocument, context?: Record<string, string>): AsyncApi|WebApi|undefined;
220
+ _computeApi(model?: IAmfDocument, context?: Record<string, string>): IAmfAsyncApi | IAmfWebApi | undefined;
216
221
 
217
222
  /**
218
223
  * Returns whether an AMF node is a WebAPI node
@@ -220,7 +225,7 @@ export declare class AmfMixinInterface {
220
225
  * @param model AMF json/ld model for an API
221
226
  * @param context A context to use. If not set, it looks for the context of the passed model
222
227
  */
223
- _isWebAPI(model?: AmfDocument, context?: Record<string, string>): boolean;
228
+ _isWebAPI(model?: IAmfDocument, context?: Record<string, string>): boolean;
224
229
 
225
230
  /**
226
231
  * Returns whether an AMF node is an AsyncAPI node
@@ -228,7 +233,7 @@ export declare class AmfMixinInterface {
228
233
  * @param model AMF json/ld model for an API
229
234
  * @param context A context to use. If not set, it looks for the context of the passed model
230
235
  */
231
- _isAsyncAPI(model?: AmfDocument, context?: Record<string, string>): boolean;
236
+ _isAsyncAPI(model?: IAmfDocument, context?: Record<string, string>): boolean;
232
237
 
233
238
  /**
234
239
  * Returns whether an AMF node is an API node
@@ -236,7 +241,7 @@ export declare class AmfMixinInterface {
236
241
  * @param model AMF json/ld model for an API
237
242
  * @param context A context to use. If not set, it looks for the context of the passed model
238
243
  */
239
- _isAPI(model?: AmfDocument, context?: Record<string, string>): boolean;
244
+ _isAPI(model?: IAmfDocument, context?: Record<string, string>): boolean;
240
245
 
241
246
  /**
242
247
  * Determines whether a partial model is valid for reading servers from
@@ -249,14 +254,14 @@ export declare class AmfMixinInterface {
249
254
  * to read servers
250
255
  * @private
251
256
  */
252
- _isValidServerPartial(model: DomainElement, context?: Record<string, string>): boolean;
257
+ _isValidServerPartial(model: IAmfDomainElement, context?: Record<string, string>): boolean;
253
258
 
254
259
  /**
255
260
  * @param options Server query options
256
261
  * @param context A context to use. If not set, it looks for the context of the passed model
257
262
  * @returns List of servers for method, if defined, or endpoint, if defined, or root level
258
263
  */
259
- _getServers(options?: ServersQueryOptions, context?: Record<string, string>): Server[] | undefined;
264
+ _getServers(options?: ServersQueryOptions, context?: Record<string, string>): IAmfServer[] | undefined;
260
265
 
261
266
  /**
262
267
  * Computes value for the `expects` property.
@@ -264,7 +269,7 @@ export declare class AmfMixinInterface {
264
269
  * @param method AMF `supportedOperation` model
265
270
  * @param context A context to use. If not set, it looks for the context of the passed model
266
271
  */
267
- _computeExpects(method?: Operation, context?: Record<string, string>): Request | undefined;
272
+ _computeExpects(method?: IAmfOperation, context?: Record<string, string>): IAmfRequest | undefined;
268
273
 
269
274
  /**
270
275
  * Computes list of endpoints from a WebApi model.
@@ -272,7 +277,7 @@ export declare class AmfMixinInterface {
272
277
  * @param context A context to use. If not set, it looks for the context of the passed model
273
278
  * @returns An array of endpoints.
274
279
  */
275
- _computeEndpoints(webApi?: WebApi, context?: Record<string, string>): EndPoint[] | undefined;
280
+ _computeEndpoints(webApi?: IAmfWebApi, context?: Record<string, string>): IAmfEndPoint[] | undefined;
276
281
  /**
277
282
  * Computes model for an endpoint documentation.
278
283
  *
@@ -281,7 +286,7 @@ export declare class AmfMixinInterface {
281
286
  * @param context A context to use. If not set, it looks for the context of the passed model
282
287
  * @returns An endpoint definition
283
288
  */
284
- _computeEndpointModel(webApi?: WebApi, id?: string, context?: Record<string, string>): EndPoint | undefined;
289
+ _computeEndpointModel(webApi?: IAmfWebApi, id?: string, context?: Record<string, string>): IAmfEndPoint | undefined;
285
290
 
286
291
  /**
287
292
  * Computes method for the method documentation.
@@ -291,7 +296,7 @@ export declare class AmfMixinInterface {
291
296
  * @param context A context to use. If not set, it looks for the context of the passed model
292
297
  * @returns A method definition
293
298
  */
294
- _computeMethodModel(webApi?: WebApi, selected?: string, context?: Record<string, string>): Operation | undefined;
299
+ _computeMethodModel(webApi?: IAmfWebApi, selected?: string, context?: Record<string, string>): IAmfOperation | undefined;
295
300
 
296
301
  /**
297
302
  * Computes an endpoint for a method.
@@ -300,7 +305,7 @@ export declare class AmfMixinInterface {
300
305
  * @param context A context to use. If not set, it looks for the context of the passed model
301
306
  * @returns An endpoint model of undefined.
302
307
  */
303
- _computeMethodEndpoint(webApi?: WebApi, methodId?: string, context?: Record<string, string>): EndPoint|undefined;
308
+ _computeMethodEndpoint(webApi?: IAmfWebApi, methodId?: string, context?: Record<string, string>): IAmfEndPoint | undefined;
304
309
 
305
310
  /**
306
311
  * Computes a list of methods for an endpoint that contains a method with
@@ -311,7 +316,7 @@ export declare class AmfMixinInterface {
311
316
  * @param context A context to use. If not set, it looks for the context of the passed model
312
317
  * @returns A list of sibling methods or undefined.
313
318
  */
314
- __computeMethodsListForMethod(webApi?: WebApi, methodId?: string, context?: Record<string, string>): Operation[] | undefined;
319
+ __computeMethodsListForMethod(webApi?: IAmfWebApi, methodId?: string, context?: Record<string, string>): IAmfOperation[] | undefined;
315
320
 
316
321
  /**
317
322
  * Computes a type documentation model.
@@ -322,7 +327,7 @@ export declare class AmfMixinInterface {
322
327
  * @param context A context to use. If not set, it looks for the context of the passed model
323
328
  * @returns A type definition
324
329
  */
325
- _computeType(declares?: DomainElement[], references?: DomainElement[], selected?: string, context?: Record<string, string>): Shape | undefined;
330
+ _computeType(declares?: IAmfDomainElement[], references?: IAmfDomainElement[], selected?: string, context?: Record<string, string>): IAmfShape | undefined;
326
331
 
327
332
  /**
328
333
  * Finds a type in the model declares and references.
@@ -330,7 +335,7 @@ export declare class AmfMixinInterface {
330
335
  * @param context A context to use. If not set, it looks for the context of the passed model
331
336
  * @returns The AMF shape or undefined when not found.
332
337
  */
333
- [findAmfType](domainId?: string, context?: Record<string, string>): Shape|undefined;
338
+ [findAmfType](domainId?: string, context?: Record<string, string>): IAmfShape | undefined;
334
339
 
335
340
  /**
336
341
  * Searches for an object in model's references list.
@@ -340,7 +345,7 @@ export declare class AmfMixinInterface {
340
345
  * @param context A context to use. If not set, it looks for the context of the passed model
341
346
  * @returns The domain object or undefined.
342
347
  */
343
- [findReferenceObject](domainId: string, context?: Record<string, string>): DomainElement | undefined;
348
+ [findReferenceObject](domainId: string, context?: Record<string, string>): IAmfDomainElement | undefined;
344
349
 
345
350
  /**
346
351
  * Computes a type model from a reference (library for example).
@@ -349,7 +354,7 @@ export declare class AmfMixinInterface {
349
354
  * @param context A context to use. If not set, it looks for the context of the passed model
350
355
  * @returns Type definition or undefined if not found.
351
356
  */
352
- _computeReferenceType(reference?: DomainElement, selected?: string, context?: Record<string, string>): Shape|undefined;
357
+ _computeReferenceType(reference?: IAmfDomainElement, selected?: string, context?: Record<string, string>): IAmfShape | undefined;
353
358
 
354
359
  /**
355
360
  * Computes a documentation model.
@@ -358,7 +363,7 @@ export declare class AmfMixinInterface {
358
363
  * @param selected Selected shape
359
364
  * @param context A context to use. If not set, it looks for the context of the passed model
360
365
  */
361
- _computeDocument(webApi?: DomainElement, selected?: string, context?: Record<string, string>): DomainElement|undefined;
366
+ _computeDocument(webApi?: IAmfDomainElement, selected?: string, context?: Record<string, string>): IAmfDomainElement | undefined;
362
367
 
363
368
  /**
364
369
  * Resolves a reference to an external fragment.
@@ -375,7 +380,7 @@ export declare class AmfMixinInterface {
375
380
  * @param context A context to use. If not set, it looks for the context of the passed model
376
381
  * @returns Resolved shape for given reference, undefined otherwise
377
382
  */
378
- _getLinkTarget(amf?: AmfDocument, id?: string , context?: Record<string, string>): DomainElement | undefined;
383
+ _getLinkTarget(amf?: IAmfDocument, id?: string, context?: Record<string, string>): IAmfDomainElement | undefined;
379
384
 
380
385
  /**
381
386
  * Resolves the shape of a given reference.
@@ -385,7 +390,7 @@ export declare class AmfMixinInterface {
385
390
  * @param context A context to use. If not set, it looks for the context of the passed model
386
391
  * @returns Resolved shape for given reference, undefined otherwise
387
392
  */
388
- _obtainShapeFromReferences(references?: DomainElement[], id?: string, context?: Record<string, string>): DomainElement | undefined;
393
+ _obtainShapeFromReferences(references?: IAmfDomainElement[], id?: string, context?: Record<string, string>): IAmfDomainElement | undefined;
389
394
 
390
395
  /**
391
396
  * Searches a node with a given ID in an array
@@ -394,9 +399,9 @@ export declare class AmfMixinInterface {
394
399
  * @param id Id to search for
395
400
  * @returns Node with the given ID when found, undefined otherwise
396
401
  */
397
- _findById(array?: DomainElement[], id?: string): DomainElement | undefined;
402
+ _findById(array?: IAmfDomainElement[], id?: string): IAmfDomainElement | undefined;
398
403
 
399
- _getReferenceId(amf?: AmfDocument, id?: string, context?: Record<string, string>): DomainElement | undefined;
404
+ _getReferenceId(amf?: IAmfDocument, id?: string, context?: Record<string, string>): IAmfDomainElement | undefined;
400
405
 
401
406
  _resolveRecursive(shape: any, context?: Record<string, string>): void;
402
407
 
@@ -435,7 +440,7 @@ export declare class AmfMixinInterface {
435
440
  * @param context A context to use. If not set, it looks for the context of the passed model
436
441
  * @returns Type definition or undefined if not found.
437
442
  */
438
- findSecurityScheme(domainId: string, context?: Record<string, string>): SecurityScheme | undefined;
443
+ findSecurityScheme(domainId: string, context?: Record<string, string>): IAmfSecurityScheme | undefined;
439
444
 
440
445
  /**
441
446
  * Computes a security model from a reference (library for example).
@@ -444,7 +449,7 @@ export declare class AmfMixinInterface {
444
449
  * @param context A context to use. If not set, it looks for the context of the passed model
445
450
  * @returns Type definition or undefined if not found.
446
451
  */
447
- [computeReferenceSecurity](reference: DomainElement, selected: string, context?: Record<string, string>): SecurityScheme | undefined;
452
+ [computeReferenceSecurity](reference: IAmfDomainElement, selected: string, context?: Record<string, string>): IAmfSecurityScheme | undefined;
448
453
 
449
454
  /**
450
455
  * Collects domain objects by a domain type.
@@ -452,7 +457,7 @@ export declare class AmfMixinInterface {
452
457
  * @param type The domain type
453
458
  * @param context A context to use. If not set, it looks for the context of the passed model
454
459
  */
455
- getByType(source: DomainElement, type: string, context?: Record<string, string>): DomainElement[];
460
+ getByType(source: IAmfDomainElement, type: string, context?: Record<string, string>): IAmfDomainElement[];
456
461
  }
457
462
 
458
463
  /**
@@ -460,15 +465,15 @@ export declare class AmfMixinInterface {
460
465
  */
461
466
  export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor<AmfMixinInterface> & T => {
462
467
  class AmfMixin extends superClass {
463
- _amf?: AmfDocument;
468
+ _amf?: IAmfDocument;
464
469
  _flattenedAmf?: any;
465
470
  __cachedKeys?: any;
466
471
 
467
- get amf(): AmfDocument | undefined {
472
+ get amf(): IAmfDocument | undefined {
468
473
  return this._amf;
469
474
  }
470
475
 
471
- set amf(value: AmfDocument | undefined) {
476
+ set amf(value: IAmfDocument | undefined) {
472
477
  const old = this._amf;
473
478
  if (old === value) {
474
479
  return;
@@ -499,7 +504,9 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
499
504
  * @param amf Current AMF model. Can be undefined.
500
505
  */
501
506
  /* eslint-disable-next-line no-unused-vars */
502
- _amfChanged(amf?: AmfDocument): void { }
507
+ _amfChanged(amf?: IAmfDocument): void {
508
+ // ...
509
+ }
503
510
 
504
511
  /**
505
512
  * Expands flattened AMF model
@@ -522,9 +529,9 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
522
529
  * @param context A context to use. If not set, it looks for the context of the passed model
523
530
  * @returns Compact model property name or the same value if value not found in the context.
524
531
  */
525
- _getAmfKey(property?: string, context?: Record<string, string>): string | undefined {
532
+ _getAmfKey(property?: string, context?: Record<string, string>): string {
526
533
  if (!property) {
527
- return undefined;
534
+ return '';
528
535
  }
529
536
  let { amf } = this;
530
537
  if (!amf && !context) {
@@ -572,7 +579,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
572
579
  * @param amf AMF json/ld model
573
580
  * @returns The API spec
574
581
  */
575
- _ensureAmfModel(amf: any): AmfDocument | undefined {
582
+ _ensureAmfModel(amf: any): IAmfDocument | undefined {
576
583
  if (!amf) {
577
584
  return undefined;
578
585
  }
@@ -610,12 +617,12 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
610
617
  * @param context A context to use. If not set, it looks for the context of the passed model
611
618
  * @returns Value for key
612
619
  */
613
- _getValue(model: DomainElement, untrustedKey: string, context?: Record<string, string>): string | number | boolean | undefined | null {
620
+ _getValue(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): string | number | boolean | undefined | null {
614
621
  const key = this._getAmfKey(untrustedKey, context);
615
622
  if (!key) {
616
623
  return undefined;
617
624
  }
618
- let data = model && model[key as keyof DomainElement] as string | number | boolean | undefined | null;
625
+ let data = model && model[key as keyof IAmfDomainElement] as string | number | boolean | undefined | null;
619
626
  if (!data) {
620
627
  // This includes "undefined", "false", "null" and "0"
621
628
  return data;
@@ -630,7 +637,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
630
637
  if (['string', 'number', 'boolean', 'undefined'].includes(type)) {
631
638
  return data;
632
639
  }
633
- return ((data as unknown) as LdValue<any>)['@value'];
640
+ return ((data as unknown) as IAmfLdValue<any>)['@value'];
634
641
  }
635
642
 
636
643
  /**
@@ -640,7 +647,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
640
647
  * @param context A context to use. If not set, it looks for the context of the passed model
641
648
  * @returns The value for key
642
649
  */
643
- _getValueArray(model: DomainElement, untrustedKey: string, context?: Record<string, string>): (string | number | boolean | null)[] | undefined {
650
+ _getValueArray(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): (string | number | boolean | null)[] | undefined {
644
651
  const key = this._getAmfKey(untrustedKey, context);
645
652
  if (!key) {
646
653
  return undefined;
@@ -660,12 +667,12 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
660
667
  * @param context A context to use. If not set, it looks for the context of the passed model
661
668
  * @returns Value for the key
662
669
  */
663
- [getArrayItems](model?: DomainElement, untrustedKey?: string, context?: Record<string, string>): DomainElement[] | undefined {
670
+ [getArrayItems](model?: IAmfDomainElement, untrustedKey?: string, context?: Record<string, string>): IAmfDomainElement[] | undefined {
664
671
  const k = this._getAmfKey(untrustedKey, context);
665
672
  if (!k) {
666
673
  return undefined;
667
674
  }
668
- const data = model && this._ensureArray((model as any)[k]) as DomainElement[];
675
+ const data = model && this._ensureArray((model as any)[k]) as IAmfDomainElement[];
669
676
  if (!Array.isArray(data)) {
670
677
  return undefined;
671
678
  }
@@ -678,7 +685,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
678
685
  * @param untrustedKey Model key to search for the @id
679
686
  * @param context A context to use. If not set, it looks for the context of the passed model
680
687
  */
681
- _getLinkValue(model: DomainElement, untrustedKey: string, context?: Record<string, string>): string | undefined {
688
+ _getLinkValue(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): string | undefined {
682
689
  const k = this._getAmfKey(untrustedKey, context);
683
690
  if (!k) {
684
691
  return undefined;
@@ -702,12 +709,12 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
702
709
  * @param untrustedKey Model key to search for the @id
703
710
  * @param context A context to use. If not set, it looks for the context of the passed model
704
711
  */
705
- _getLinkValues(model: DomainElement, untrustedKey: string, context?: Record<string, string>): string[] | undefined {
712
+ _getLinkValues(model: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): string[] | undefined {
706
713
  const k = this._getAmfKey(untrustedKey, context);
707
714
  if (!k) {
708
715
  return undefined;
709
716
  }
710
- let data = (model && (model as any)[k]) as DomainElement[] | undefined;
717
+ let data = (model && (model as any)[k]) as IAmfDomainElement[] | undefined;
711
718
  if (!data) {
712
719
  return undefined;
713
720
  }
@@ -724,7 +731,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
724
731
  * @param context A context to use. If not set, it looks for the context of the passed model
725
732
  * @returns True if model has a type.
726
733
  */
727
- _hasType(model?: DomainElement, type?: string, context?: Record<string, string>): boolean {
734
+ _hasType(model?: IAmfDomainElement, type?: string, context?: Record<string, string>): boolean {
728
735
  const types = this._ensureArray(model && model['@type']);
729
736
  if (!types || !types.length) {
730
737
  return false;
@@ -744,8 +751,8 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
744
751
  * @param untrustedKey Property name to test
745
752
  * @param context A context to use. If not set, it looks for the context of the passed model
746
753
  */
747
- _hasProperty(shape: DomainElement, untrustedKey: string, context?: Record<string, string>): boolean {
748
- const key = this._getAmfKey(untrustedKey, context)!;
754
+ _hasProperty(shape: IAmfDomainElement, untrustedKey: string, context?: Record<string, string>): boolean {
755
+ const key = this._getAmfKey(untrustedKey, context) as string;
749
756
  return !!(shape && key && key in shape);
750
757
  }
751
758
 
@@ -756,7 +763,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
756
763
  * @param untrustedKey Property name
757
764
  * @param context A context to use. If not set, it looks for the context of the passed model
758
765
  */
759
- _computePropertyArray(shape?: DomainElement, untrustedKey?: string, context?: Record<string, string>): (string|number|boolean|null|Object)[] | undefined {
766
+ _computePropertyArray(shape?: IAmfDomainElement, untrustedKey?: string, context?: Record<string, string>): (string | number | boolean | null | Object)[] | undefined {
760
767
  if (!shape) {
761
768
  return undefined;
762
769
  }
@@ -778,7 +785,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
778
785
  * @param amf
779
786
  * @param context A context to use. If not set, it looks for the context of the passed model
780
787
  */
781
- _computeApiVersion(amf?: AmfDocument, context?: Record<string, string>): string | undefined {
788
+ _computeApiVersion(amf?: IAmfDocument, context?: Record<string, string>): string | undefined {
782
789
  const api = this._computeApi(amf);
783
790
  if (!api) {
784
791
  return undefined;
@@ -793,7 +800,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
793
800
  * @param context A context to use. If not set, it looks for the context of the passed model
794
801
  * @returns List of encodes
795
802
  */
796
- _computeEncodes(model?: AmfDocument, context?: Record<string, string>): DomainElement | undefined {
803
+ _computeEncodes(model?: IAmfDocument, context?: Record<string, string>): IAmfDomainElement | undefined {
797
804
  if (!model) {
798
805
  return undefined;
799
806
  }
@@ -818,7 +825,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
818
825
  * @param context A context to use. If not set, it looks for the context of the passed model
819
826
  * @returns List of declarations
820
827
  */
821
- _computeDeclares(model?: AmfDocument, context?: Record<string, string>): DomainElement[] | undefined {
828
+ _computeDeclares(model?: IAmfDocument, context?: Record<string, string>): IAmfDomainElement[] | undefined {
822
829
  if (!model) {
823
830
  return undefined;
824
831
  }
@@ -832,7 +839,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
832
839
  if (!key) {
833
840
  return undefined;
834
841
  }
835
- const data = this._ensureArray((model as any)[key]) as DomainElement[];
842
+ const data = this._ensureArray((model as any)[key]) as IAmfDomainElement[];
836
843
  return Array.isArray(data) ? data : undefined;
837
844
  }
838
845
 
@@ -843,7 +850,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
843
850
  * @param context A context to use. If not set, it looks for the context of the passed model
844
851
  * @returns List of declarations
845
852
  */
846
- _computeReferences(model?: AmfDocument, context?: Record<string, string>): DomainElement[] | undefined {
853
+ _computeReferences(model?: IAmfDocument, context?: Record<string, string>): IAmfDomainElement[] | undefined {
847
854
  if (!model) {
848
855
  return undefined;
849
856
  }
@@ -857,7 +864,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
857
864
  if (!key) {
858
865
  return undefined;
859
866
  }
860
- const data = this._ensureArray((model as any)[key]) as DomainElement[];
867
+ const data = this._ensureArray((model as any)[key]) as IAmfDomainElement[];
861
868
  return data instanceof Array ? data : undefined;
862
869
  }
863
870
 
@@ -868,7 +875,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
868
875
  * @param context A context to use. If not set, it looks for the context of the passed model
869
876
  * @returns Web API declaration.
870
877
  */
871
- _computeWebApi(model?: AmfDocument, context?: Record<string, string>): WebApi|undefined {
878
+ _computeWebApi(model?: IAmfDocument, context?: Record<string, string>): IAmfWebApi | undefined {
872
879
  const enc = this._computeEncodes(model, context);
873
880
  if (!enc) {
874
881
  return undefined;
@@ -886,7 +893,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
886
893
  * @param context A context to use. If not set, it looks for the context of the passed model
887
894
  * @returns API declaration.
888
895
  */
889
- _computeApi(model?: AmfDocument, context?: Record<string, string>): AsyncApi|WebApi|undefined {
896
+ _computeApi(model?: IAmfDocument, context?: Record<string, string>): IAmfAsyncApi | IAmfWebApi | undefined {
890
897
  const enc = this._computeEncodes(model, context);
891
898
  if (!enc) {
892
899
  return undefined;
@@ -903,7 +910,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
903
910
  * @param model AMF json/ld model for an API
904
911
  * @param context A context to use. If not set, it looks for the context of the passed model
905
912
  */
906
- _isWebAPI(model?: AmfDocument, context?: Record<string, string>): boolean {
913
+ _isWebAPI(model?: IAmfDocument, context?: Record<string, string>): boolean {
907
914
  const enc = this._computeEncodes(model, context);
908
915
  if (!enc) {
909
916
  return false;
@@ -917,7 +924,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
917
924
  * @param model AMF json/ld model for an API
918
925
  * @param context A context to use. If not set, it looks for the context of the passed model
919
926
  */
920
- _isAsyncAPI(model?: AmfDocument, context?: Record<string, string>): boolean {
927
+ _isAsyncAPI(model?: IAmfDocument, context?: Record<string, string>): boolean {
921
928
  const enc = this._computeEncodes(model, context);
922
929
  if (!enc) {
923
930
  return false;
@@ -931,7 +938,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
931
938
  * @param model AMF json/ld model for an API
932
939
  * @param context A context to use. If not set, it looks for the context of the passed model
933
940
  */
934
- _isAPI(model?: AmfDocument, context?: Record<string, string>): boolean {
941
+ _isAPI(model?: IAmfDocument, context?: Record<string, string>): boolean {
935
942
  const enc = this._computeEncodes(model, context);
936
943
  if (!enc) {
937
944
  return false;
@@ -950,7 +957,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
950
957
  * to read servers
951
958
  * @private
952
959
  */
953
- _isValidServerPartial(model: DomainElement, context?: Record<string, string>): boolean {
960
+ _isValidServerPartial(model: IAmfDomainElement, context?: Record<string, string>): boolean {
954
961
  if (Array.isArray(model)) {
955
962
  [model] = model;
956
963
  }
@@ -974,7 +981,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
974
981
  * @param context A context to use. If not set, it looks for the context of the passed model
975
982
  * @returns List of servers for method, if defined, or endpoint, if defined, or root level
976
983
  */
977
- _getServers(options: ServersQueryOptions = {}, context?: Record<string, string>): Server[] | undefined {
984
+ _getServers(options: ServersQueryOptions = {}, context?: Record<string, string>): IAmfServer[] | undefined {
978
985
  const { endpointId, methodId } = options;
979
986
  const { amf } = this;
980
987
  if (!amf) {
@@ -994,18 +1001,18 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
994
1001
 
995
1002
  const serverKey = this._getAmfKey(ns.aml.vocabularies.apiContract.server, context);
996
1003
 
997
- const getRootServers = (): Server[] | undefined => (this[getArrayItems](api, serverKey, context) as Server[]);
998
- const getEndpointServers = (): Server[] | undefined => {
1004
+ const getRootServers = (): IAmfServer[] | undefined => (this[getArrayItems](api, serverKey, context) as IAmfServer[]);
1005
+ const getEndpointServers = (): IAmfServer[] | undefined => {
999
1006
  const endpoint = this._computeEndpointModel(api, endpointId, context);
1000
- const servers = (this[getArrayItems](endpoint, serverKey, context) as Server[]);
1007
+ const servers = (this[getArrayItems](endpoint, serverKey, context) as IAmfServer[]);
1001
1008
  if (servers) {
1002
1009
  return servers;
1003
1010
  }
1004
1011
  return getRootServers();
1005
1012
  };
1006
- const getMethodServers = (): Server[] | undefined => {
1013
+ const getMethodServers = (): IAmfServer[] | undefined => {
1007
1014
  const method = this._computeMethodModel(api, methodId, context);
1008
- const servers = (this[getArrayItems](method, serverKey, context)) as Server[];
1015
+ const servers = (this[getArrayItems](method, serverKey, context)) as IAmfServer[];
1009
1016
  if (servers) {
1010
1017
  return servers;
1011
1018
  }
@@ -1026,11 +1033,11 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1026
1033
  * @param method AMF `supportedOperation` model
1027
1034
  * @param context A context to use. If not set, it looks for the context of the passed model
1028
1035
  */
1029
- _computeExpects(method?: Operation, context?: Record<string, string>): Request | undefined {
1036
+ _computeExpects(method?: IAmfOperation, context?: Record<string, string>): IAmfRequest | undefined {
1030
1037
  const operationKey = ns.aml.vocabularies.apiContract.Operation;
1031
1038
  const expectsKey = ns.aml.vocabularies.apiContract.expects;
1032
1039
  if (this._hasType(method, operationKey, context)) {
1033
- const key = this._getAmfKey(expectsKey, context)!;
1040
+ const key = this._getAmfKey(expectsKey, context) as string;
1034
1041
  const expects = this._ensureArray((method as any)[key]);
1035
1042
  if (expects) {
1036
1043
  return Array.isArray(expects) ? expects[0] : expects;
@@ -1045,13 +1052,13 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1045
1052
  * @param context A context to use. If not set, it looks for the context of the passed model
1046
1053
  * @returns An array of endpoints.
1047
1054
  */
1048
- _computeEndpoints(webApi?: WebApi, context?: Record<string, string>): EndPoint[] | undefined {
1055
+ _computeEndpoints(webApi?: IAmfWebApi, context?: Record<string, string>): IAmfEndPoint[] | undefined {
1049
1056
  if (!webApi) {
1050
1057
  return [];
1051
1058
  }
1052
1059
  const endpointKey = ns.aml.vocabularies.apiContract.endpoint;
1053
- const key = this._getAmfKey(endpointKey, context)!;
1054
- return this._ensureArray((webApi as any)[key]) as EndPoint[];
1060
+ const key = this._getAmfKey(endpointKey, context) as string;
1061
+ return this._ensureArray((webApi as any)[key]) as IAmfEndPoint[];
1055
1062
  }
1056
1063
 
1057
1064
  /**
@@ -1062,7 +1069,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1062
1069
  * @param context A context to use. If not set, it looks for the context of the passed model
1063
1070
  * @returns An endpoint definition
1064
1071
  */
1065
- _computeEndpointModel(webApi?: WebApi, id?: string, context?: Record<string, string>): EndPoint | undefined {
1072
+ _computeEndpointModel(webApi?: IAmfWebApi, id?: string, context?: Record<string, string>): IAmfEndPoint | undefined {
1066
1073
  if (this._hasType(webApi, ns.aml.vocabularies.apiContract.EndPoint, context)) {
1067
1074
  return webApi;
1068
1075
  }
@@ -1081,7 +1088,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1081
1088
  * @param context A context to use. If not set, it looks for the context of the passed model
1082
1089
  * @returns A method definition
1083
1090
  */
1084
- _computeMethodModel(webApi?: WebApi, selected?: string, context?: Record<string, string>): Operation | undefined {
1091
+ _computeMethodModel(webApi?: IAmfWebApi, selected?: string, context?: Record<string, string>): IAmfOperation | undefined {
1085
1092
  const methods = this.__computeMethodsListForMethod(webApi, selected, context);
1086
1093
  if (!methods) {
1087
1094
  return undefined;
@@ -1096,7 +1103,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1096
1103
  * @param context A context to use. If not set, it looks for the context of the passed model
1097
1104
  * @returns An endpoint model of undefined.
1098
1105
  */
1099
- _computeMethodEndpoint(webApi?: WebApi, methodId?: string, context?: Record<string, string>): EndPoint|undefined {
1106
+ _computeMethodEndpoint(webApi?: IAmfWebApi, methodId?: string, context?: Record<string, string>): IAmfEndPoint | undefined {
1100
1107
  if (!webApi || !methodId) {
1101
1108
  return undefined;
1102
1109
  }
@@ -1107,10 +1114,10 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1107
1114
  if (!endpoints) {
1108
1115
  return undefined;
1109
1116
  }
1110
- const opKey = this._getAmfKey(ns.aml.vocabularies.apiContract.supportedOperation, context)!;
1117
+ const opKey = this._getAmfKey(ns.aml.vocabularies.apiContract.supportedOperation, context);
1111
1118
  for (let i = 0, len = endpoints.length; i < len; i++) {
1112
1119
  const endpoint = endpoints[i];
1113
- let methods = (endpoint as any)[opKey] as Operation[];
1120
+ let methods = (endpoint as any)[opKey] as IAmfOperation[];
1114
1121
  if (!methods) {
1115
1122
  continue;
1116
1123
  }
@@ -1135,13 +1142,13 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1135
1142
  * @param context A context to use. If not set, it looks for the context of the passed model
1136
1143
  * @returns A list of sibling methods or undefined.
1137
1144
  */
1138
- __computeMethodsListForMethod(webApi?: WebApi, methodId?: string, context?: Record<string, string>): Operation[] | undefined {
1145
+ __computeMethodsListForMethod(webApi?: IAmfWebApi, methodId?: string, context?: Record<string, string>): IAmfOperation[] | undefined {
1139
1146
  const endpoint = this._computeMethodEndpoint(webApi, methodId, context);
1140
1147
  if (!endpoint) {
1141
1148
  return undefined;
1142
1149
  }
1143
- const opKey = this._getAmfKey(ns.aml.vocabularies.apiContract.supportedOperation, context)!;
1144
- return this._ensureArray((endpoint as any)[opKey]) as Operation[] | undefined;
1150
+ const opKey = this._getAmfKey(ns.aml.vocabularies.apiContract.supportedOperation, context);
1151
+ return this._ensureArray((endpoint as any)[opKey]) as IAmfOperation[] | undefined;
1145
1152
  }
1146
1153
 
1147
1154
  /**
@@ -1153,7 +1160,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1153
1160
  * @param context A context to use. If not set, it looks for the context of the passed model
1154
1161
  * @returns A type definition
1155
1162
  */
1156
- _computeType(declares?: DomainElement[], references?: DomainElement[], selected?: string, context?: Record<string, string>): Shape | undefined {
1163
+ _computeType(declares?: IAmfDomainElement[], references?: IAmfDomainElement[], selected?: string, context?: Record<string, string>): IAmfShape | undefined {
1157
1164
  if ((!declares && !references) || !selected) {
1158
1165
  return undefined;
1159
1166
  }
@@ -1181,7 +1188,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1181
1188
  * @param context A context to use. If not set, it looks for the context of the passed model
1182
1189
  * @returns The AMF shape or undefined when not found.
1183
1190
  */
1184
- [findAmfType](domainId?: string, context?: Record<string, string>): Shape|undefined {
1191
+ [findAmfType](domainId?: string, context?: Record<string, string>): IAmfShape | undefined {
1185
1192
  let { amf } = this;
1186
1193
  if (!amf || !domainId) {
1187
1194
  return undefined;
@@ -1208,7 +1215,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1208
1215
  * @param context A context to use. If not set, it looks for the context of the passed model
1209
1216
  * @returns The domain object or undefined.
1210
1217
  */
1211
- [findReferenceObject](domainId: string, context?: Record<string, string>): DomainElement | undefined {
1218
+ [findReferenceObject](domainId: string, context?: Record<string, string>): IAmfDomainElement | undefined {
1212
1219
  let { amf } = this;
1213
1220
  if (Array.isArray(amf)) {
1214
1221
  [amf] = amf;
@@ -1222,7 +1229,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1222
1229
  }
1223
1230
  const compactId = domainId.replace('amf://id', '');
1224
1231
  for (let i = 0, len = references.length; i < len; i++) {
1225
- const ref = /** @type AmfDocument */ (references[i]);
1232
+ const ref = /** @type IAmfDocument */ (references[i]);
1226
1233
  const declares = this._computeDeclares(ref, context);
1227
1234
  if (!Array.isArray(declares)) {
1228
1235
  continue;
@@ -1247,7 +1254,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1247
1254
  * @param context A context to use. If not set, it looks for the context of the passed model
1248
1255
  * @returns Type definition or undefined if not found.
1249
1256
  */
1250
- _computeReferenceType(reference?: DomainElement, selected?: string, context?: Record<string, string>): Shape|undefined {
1257
+ _computeReferenceType(reference?: IAmfDomainElement, selected?: string, context?: Record<string, string>): IAmfShape | undefined {
1251
1258
  const declare = this._computeDeclares(reference, context);
1252
1259
  if (!declare || !selected) {
1253
1260
  return undefined;
@@ -1275,12 +1282,12 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1275
1282
  * @param selected Selected shape
1276
1283
  * @param context A context to use. If not set, it looks for the context of the passed model
1277
1284
  */
1278
- _computeDocument(webApi?: DomainElement, selected?: string, context?: Record<string, string>): DomainElement|undefined {
1285
+ _computeDocument(webApi?: IAmfDomainElement, selected?: string, context?: Record<string, string>): IAmfDomainElement | undefined {
1279
1286
  if (!webApi || !selected) {
1280
1287
  return undefined;
1281
1288
  }
1282
- const key = this._getAmfKey(ns.aml.vocabularies.core.documentation, context)!;
1283
- const docs = this._ensureArray((webApi as any)[key]) as DomainElement[];
1289
+ const key = this._getAmfKey(ns.aml.vocabularies.core.documentation, context);
1290
+ const docs = this._ensureArray((webApi as any)[key]) as IAmfDomainElement[];
1284
1291
  return docs && docs.find((item) => (item as any)['@id'] as string === selected);
1285
1292
  }
1286
1293
 
@@ -1296,8 +1303,8 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1296
1303
  if (typeof shape !== 'object' || Array.isArray(shape) || !amf || shape.__apicResolved) {
1297
1304
  return shape;
1298
1305
  }
1299
- let refKey = this._getAmfKey(ns.aml.vocabularies.document.linkTarget, context)!;
1300
- let refValue = this._ensureArray(shape[refKey]) as DomainElement[];
1306
+ let refKey = this._getAmfKey(ns.aml.vocabularies.document.linkTarget, context);
1307
+ let refValue = this._ensureArray(shape[refKey]) as IAmfDomainElement[];
1301
1308
  let refData;
1302
1309
  if (refValue) {
1303
1310
  const rk = refValue[0]['@id'];
@@ -1308,8 +1315,8 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1308
1315
  }
1309
1316
  refData = this._getLinkTarget(amf, rk, context);
1310
1317
  } else {
1311
- refKey = this._getAmfKey(ns.aml.vocabularies.document.referenceId, context)!;
1312
- refValue = this._ensureArray(shape[refKey]) as DomainElement[];
1318
+ refKey = this._getAmfKey(ns.aml.vocabularies.document.referenceId, context);
1319
+ refValue = this._ensureArray(shape[refKey]) as IAmfDomainElement[];
1313
1320
  if (refValue) {
1314
1321
  const rk = refValue[0]['@id'];
1315
1322
  if (rk === shape['@id']) {
@@ -1348,7 +1355,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1348
1355
  * @param context A context to use. If not set, it looks for the context of the passed model
1349
1356
  * @returns Resolved shape for given reference, undefined otherwise
1350
1357
  */
1351
- _getLinkTarget(amf?: AmfDocument, id?: string , context?: Record<string, string>): DomainElement | undefined {
1358
+ _getLinkTarget(amf?: IAmfDocument, id?: string, context?: Record<string, string>): IAmfDomainElement | undefined {
1352
1359
  if (!amf || !id) {
1353
1360
  return undefined;
1354
1361
  }
@@ -1377,7 +1384,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1377
1384
  * @param context A context to use. If not set, it looks for the context of the passed model
1378
1385
  * @returns Resolved shape for given reference, undefined otherwise
1379
1386
  */
1380
- _obtainShapeFromReferences(references?: DomainElement[], id?: string, context?: Record<string, string>): DomainElement | undefined {
1387
+ _obtainShapeFromReferences(references?: IAmfDomainElement[], id?: string, context?: Record<string, string>): IAmfDomainElement | undefined {
1381
1388
  if (!Array.isArray(references) || !references.length) {
1382
1389
  return undefined;
1383
1390
  }
@@ -1406,7 +1413,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1406
1413
  * @param id Id to search for
1407
1414
  * @returns Node with the given ID when found, undefined otherwise
1408
1415
  */
1409
- _findById(array?: DomainElement[], id?: string): DomainElement | undefined {
1416
+ _findById(array?: IAmfDomainElement[], id?: string): IAmfDomainElement | undefined {
1410
1417
  if (!array) return undefined;
1411
1418
  let target;
1412
1419
  for (let i = 0; i < array.length; i++) {
@@ -1419,7 +1426,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1419
1426
  return target;
1420
1427
  }
1421
1428
 
1422
- _getReferenceId(amf?: AmfDocument, id?: string, context?: Record<string, string>): DomainElement | undefined {
1429
+ _getReferenceId(amf?: IAmfDocument, id?: string, context?: Record<string, string>): IAmfDomainElement | undefined {
1423
1430
  if (!amf || !id) {
1424
1431
  return undefined;
1425
1432
  }
@@ -1465,7 +1472,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1465
1472
  const merged = { ...shapeA, ...shapeB };
1466
1473
  const specialMerges = [
1467
1474
  {
1468
- key: this._getAmfKey(ns.aml.vocabularies.docSourceMaps.sources, context)!,
1475
+ key: this._getAmfKey(ns.aml.vocabularies.docSourceMaps.sources, context),
1469
1476
  merger: this._mergeSourceMapsSources.bind(this)
1470
1477
  },
1471
1478
  ];
@@ -1488,7 +1495,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1488
1495
  * @private
1489
1496
  */
1490
1497
  _mergeSourceMapsSources(shapeA: any, shapeB: any, context?: Record<string, string>): (any | {})[] {
1491
- const sourcesKey = this._getAmfKey(ns.aml.vocabularies.docSourceMaps.sources, context)!;
1498
+ const sourcesKey = this._getAmfKey(ns.aml.vocabularies.docSourceMaps.sources, context);
1492
1499
  let aSources = shapeA[sourcesKey] || {};
1493
1500
  if (Array.isArray(aSources)) {
1494
1501
  aSources = aSources[0];
@@ -1534,7 +1541,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1534
1541
  * @param context A context to use. If not set, it looks for the context of the passed model
1535
1542
  * @returns Type definition or undefined if not found.
1536
1543
  */
1537
- findSecurityScheme(domainId: string, context?: Record<string, string>): SecurityScheme | undefined {
1544
+ findSecurityScheme(domainId: string, context?: Record<string, string>): IAmfSecurityScheme | undefined {
1538
1545
  const { amf } = this;
1539
1546
  const declares = this._computeDeclares(amf, context);
1540
1547
  let result;
@@ -1567,7 +1574,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1567
1574
  * @param context A context to use. If not set, it looks for the context of the passed model
1568
1575
  * @returns Type definition or undefined if not found.
1569
1576
  */
1570
- [computeReferenceSecurity](reference: DomainElement, selected: string, context?: Record<string, string>): SecurityScheme | undefined {
1577
+ [computeReferenceSecurity](reference: IAmfDomainElement, selected: string, context?: Record<string, string>): IAmfSecurityScheme | undefined {
1571
1578
  const declare = this._computeDeclares(reference, context);
1572
1579
  if (!declare) {
1573
1580
  return undefined;
@@ -1591,17 +1598,17 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1591
1598
  * @param type The domain type
1592
1599
  * @param context A context to use. If not set, it looks for the context of the passed model
1593
1600
  */
1594
- getByType(source: DomainElement, type: string, context?: Record<string, string>): DomainElement[] {
1601
+ getByType(source: IAmfDomainElement, type: string, context?: Record<string, string>): IAmfDomainElement[] {
1595
1602
  if (!source) {
1596
1603
  return [];
1597
1604
  }
1598
- let result: DomainElement[] = [];
1605
+ let result: IAmfDomainElement[] = [];
1599
1606
  const declares = this._computeDeclares(source);
1600
1607
  const key = this._getAmfKey(type, context);
1601
1608
  if (declares && declares.length) {
1602
1609
  declares.forEach((declared) => {
1603
1610
  if (this._hasType(declared, key)) {
1604
- result.push(declared as DomainElement);
1611
+ result.push(declared as IAmfDomainElement);
1605
1612
  }
1606
1613
  });
1607
1614
  }
@@ -1609,7 +1616,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
1609
1616
  if (Array.isArray(references) && references.length) {
1610
1617
  for (const ref of references) {
1611
1618
  if (this._hasType(ref, ns.aml.vocabularies.document.Module)) {
1612
- const items = this.getByType(ref as DomainElement, type, context);
1619
+ const items = this.getByType(ref as IAmfDomainElement, type, context);
1613
1620
  if (items.length) {
1614
1621
  result = result.concat(items);
1615
1622
  }