@salesforcedevs/docs-components 0.54.0 → 0.54.1-a01

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 (44) hide show
  1. package/lwc.config.json +6 -2
  2. package/package.json +12 -4
  3. package/src/modules/README.md +41 -0
  4. package/src/modules/doc/amfReference/amfReference.css +5 -0
  5. package/src/modules/doc/amfReference/amfReference.html +47 -0
  6. package/src/modules/doc/amfReference/amfReference.ts +1309 -0
  7. package/src/modules/doc/amfReference/constants.ts +76 -0
  8. package/src/modules/doc/amfReference/types.ts +133 -0
  9. package/src/modules/doc/amfReference/utils.ts +669 -0
  10. package/src/modules/doc/amfTopic/amfTopic.css +1 -0
  11. package/src/modules/doc/amfTopic/amfTopic.html +3 -0
  12. package/src/modules/doc/amfTopic/amfTopic.ts +94 -0
  13. package/src/modules/doc/amfTopic/types.ts +54 -0
  14. package/src/modules/doc/amfTopic/utils.ts +130 -0
  15. package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +4 -3
  16. package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +1 -1
  17. package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +17 -1
  18. package/src/modules/doc/breadcrumbs/breadcrumbs.css +11 -3
  19. package/src/modules/doc/breadcrumbs/breadcrumbs.html +12 -2
  20. package/src/modules/doc/breadcrumbs/breadcrumbs.ts +50 -9
  21. package/src/modules/doc/content/content.css +35 -11
  22. package/src/modules/doc/content/content.ts +18 -3
  23. package/src/modules/doc/contentCallout/contentCallout.css +4 -4
  24. package/src/modules/doc/contentCallout/contentCallout.ts +5 -0
  25. package/src/modules/doc/contentLayout/contentLayout.css +98 -0
  26. package/src/modules/doc/contentLayout/contentLayout.html +48 -0
  27. package/src/modules/doc/contentLayout/contentLayout.ts +287 -0
  28. package/src/modules/doc/header/header.css +1 -1
  29. package/src/modules/doc/header/header.ts +5 -5
  30. package/src/modules/doc/headingAnchor/headingAnchor.css +1 -1
  31. package/src/modules/doc/headingContent/headingContent.css +5 -1
  32. package/src/modules/doc/phase/phase.css +3 -3
  33. package/src/modules/doc/phase/phase.ts +1 -1
  34. package/src/modules/doc/xmlContent/types.ts +114 -0
  35. package/src/modules/doc/xmlContent/utils.ts +161 -0
  36. package/src/modules/doc/xmlContent/xmlContent.css +32 -0
  37. package/src/modules/doc/xmlContent/xmlContent.html +39 -0
  38. package/src/modules/doc/xmlContent/xmlContent.ts +651 -0
  39. package/src/modules/docBaseElements/lightningElementWithState/lightningElementWithState.ts +93 -0
  40. package/src/modules/docHelpers/amfStyle/amfStyle.css +390 -0
  41. package/src/modules/docHelpers/phaseContentLayout/phaseContentLayout.css +39 -0
  42. package/src/modules/{helpers → docHelpers}/status/status.css +0 -0
  43. package/src/modules/docUtils/SearchSyncer/SearchSyncer.ts +85 -0
  44. package/LICENSE +0 -12
@@ -0,0 +1,669 @@
1
+ import { AmfHelperMixin } from "@api-components/amf-helper-mixin";
2
+ import { normalizeDomId } from "dxUtils/normalizers";
3
+
4
+ const ID_PROPERTY = "@id";
5
+ const TYPE_PROPERTY = "@type";
6
+
7
+ export class AmfModelParser extends AmfHelperMixin(Object) {
8
+ _parsedModel = null;
9
+
10
+ constructor(api) {
11
+ super();
12
+ if (api) {
13
+ this.amf = Array.isArray(api) ? api[0] : api;
14
+ }
15
+ }
16
+
17
+ parse() {
18
+ let model = this.amf;
19
+ let data = {};
20
+ let isFragment = true;
21
+ const moduleKey = this._getAmfKey(
22
+ this.ns.aml.vocabularies.document.Module
23
+ );
24
+ if (this._hasType(model, this.ns.aml.vocabularies.document.Document)) {
25
+ isFragment = false;
26
+ model = this._ensureAmfModel(model);
27
+ data = this._collectData(model);
28
+ } else if (
29
+ this._hasType(
30
+ model,
31
+ this.ns.aml.vocabularies.security.SecuritySchemeFragment
32
+ )
33
+ ) {
34
+ data = this._collectSecurityData(model);
35
+ } else if (
36
+ this._hasType(
37
+ model,
38
+ this.ns.aml.vocabularies.apiContract.UserDocumentationFragment
39
+ )
40
+ ) {
41
+ data = this._collectDocumentationData(model);
42
+ } else if (
43
+ this._hasType(
44
+ model,
45
+ this.ns.aml.vocabularies.shapes.DataTypeFragment
46
+ )
47
+ ) {
48
+ data = this._collectTypeData(model);
49
+ } else if (
50
+ model[TYPE_PROPERTY] &&
51
+ moduleKey === model[TYPE_PROPERTY][0]
52
+ ) {
53
+ data = this._collectData(model);
54
+ }
55
+
56
+ this._collectName(model, data);
57
+
58
+ const summaryId = data.title + "Summary";
59
+
60
+ return {
61
+ title: data.title,
62
+ summary: {
63
+ id: summaryId,
64
+ label: "Summary",
65
+ domId: normalizeDomId(summaryId)
66
+ },
67
+ types: data.types,
68
+ security: data.securitySchemes,
69
+ endpoints: data.endpoints,
70
+ docs: data.documentation,
71
+ isFragment
72
+ };
73
+ }
74
+
75
+ get parsedModel() {
76
+ if (!this._parsedModel) {
77
+ this._parsedModel = this.parse();
78
+ }
79
+
80
+ return this._parsedModel;
81
+ }
82
+
83
+ /**
84
+ * Collects the information about the API and creates data model
85
+ * for the navigation element
86
+ *
87
+ * @param {object} model
88
+ * @return {Object} Data model for the API navigation
89
+ */
90
+ _collectData(model) {
91
+ const result = {
92
+ documentation: [],
93
+ types: [],
94
+ securitySchemes: [],
95
+ endpoints: []
96
+ };
97
+ if (!model) {
98
+ return result;
99
+ }
100
+ result._typeIds = [];
101
+ result._basePaths = [];
102
+ this._traverseDeclarations(model, result);
103
+ this._traverseReferences(model, result);
104
+ this._traverseEncodes(model, result);
105
+ delete result._typeIds;
106
+ delete result._basePaths;
107
+ return result;
108
+ }
109
+
110
+ /**
111
+ * Collects the data from the security fragment
112
+ * @param {object} model Security fragment model
113
+ * @return {Object|undefined}
114
+ */
115
+ _collectSecurityData(model) {
116
+ const result = {
117
+ securitySchemes: []
118
+ };
119
+ const encodes = this._computeEncodes(model);
120
+ if (!encodes) {
121
+ return undefined;
122
+ }
123
+ this._appendSecurityItem(encodes, result);
124
+ return result;
125
+ }
126
+
127
+ /**
128
+ * Collects the data from the documentation fragment
129
+ * @param {object} model Documentation fragment model
130
+ * @return {Object|undefined}
131
+ */
132
+ _collectDocumentationData(model) {
133
+ const result = {
134
+ documentation: []
135
+ };
136
+ const encodes = this._computeEncodes(model);
137
+ if (!encodes) {
138
+ return undefined;
139
+ }
140
+ this._appendDocumentationItem(encodes, result);
141
+ return result;
142
+ }
143
+
144
+ /**
145
+ * Collects the data from the type fragment
146
+ * @param {object} model Type fragment model
147
+ * @return {Object|undefined}
148
+ */
149
+ _collectTypeData(model) {
150
+ const result = {
151
+ types: [],
152
+ _typeIds: []
153
+ };
154
+ const encodes = this._computeEncodes(model);
155
+ if (!encodes) {
156
+ return undefined;
157
+ }
158
+ this._appendTypeItem(encodes, result);
159
+ delete result._typeIds;
160
+ return result;
161
+ }
162
+
163
+ /**
164
+ * Traverses the `http://raml.org/vocabularies/document#declares`
165
+ * node to find types and security schemes.
166
+ *
167
+ * @param {object} model AMF model
168
+ * @param {TargetModel} target Target object where to put data.
169
+ */
170
+ _traverseDeclarations(model, target) {
171
+ const declares = this._computeDeclares(model);
172
+ if (!declares) {
173
+ return;
174
+ }
175
+ declares.forEach((item) => this._appendModelItem(item, target));
176
+ }
177
+
178
+ /**
179
+ * Traverses the `http://raml.org/vocabularies/document#references`
180
+ *
181
+ * @param {object} model AMF model
182
+ * @param {TargetModel} target Target object where to put data.
183
+ */
184
+ _traverseReferences(model, target) {
185
+ const refs = this._computeReferences(model);
186
+ if (!refs) {
187
+ return;
188
+ }
189
+ refs.forEach((item) => {
190
+ if (
191
+ !this._hasType(item, this.ns.aml.vocabularies.document.Module)
192
+ ) {
193
+ return;
194
+ }
195
+ this._traverseDeclarations(item, target);
196
+ });
197
+ }
198
+
199
+ /**
200
+ * Traverses the `http://raml.org/vocabularies/document#encodes`
201
+ * node to find documentation and endpoints.
202
+ *
203
+ * @param {object} model AMF model
204
+ * @param {TargetModel} target Target object where to put data.
205
+ */
206
+ _traverseEncodes(model, target) {
207
+ const webApi = this._computeWebApi(model);
208
+ const endpoints = this._computeEndpoints(webApi);
209
+
210
+ if (endpoints) {
211
+ endpoints.forEach((item) => this._appendModelItem(item, target));
212
+ }
213
+ const dkey = this._getAmfKey(
214
+ this.ns.aml.vocabularies.core.documentation
215
+ );
216
+ const documentation = this._ensureArray(webApi[dkey]);
217
+ if (documentation) {
218
+ documentation.forEach((item) =>
219
+ this._appendModelItem(item, target)
220
+ );
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Extract API title from `http://raml.org/vocabularies/document#encodes`
226
+ *
227
+ * @param {object} model AMF model
228
+ * @param {TargetModel} target Target object where to put data.
229
+ */
230
+ _collectName(model, target) {
231
+ const encodes = this._computeEncodes(model);
232
+ if (!encodes) {
233
+ return;
234
+ }
235
+
236
+ target.title = this._getValue(
237
+ encodes,
238
+ this._getAmfKey(this.ns.aml.vocabularies.core.name)
239
+ );
240
+ }
241
+
242
+ /**
243
+ * Appends declaration of navigation data model to the target if
244
+ * it matches documentation or security types.
245
+ *
246
+ * @param {Object} item AMF model item to check for data.
247
+ * @param {TargetModel} target The target to which append values.
248
+ * @return {void}
249
+ */
250
+ _appendModelItem(item, target) {
251
+ if (this._hasType(item, this.ns.w3.shacl.Shape)) {
252
+ this._appendTypeItem(item, target);
253
+ } else if (
254
+ this._hasType(
255
+ item,
256
+ this.ns.aml.vocabularies.security.SecurityScheme
257
+ )
258
+ ) {
259
+ this._appendSecurityItem(item, target);
260
+ } else if (
261
+ this._hasType(item, this.ns.aml.vocabularies.core.CreativeWork)
262
+ ) {
263
+ this._appendDocumentationItem(item, target);
264
+ } else if (
265
+ this._hasType(item, this.ns.aml.vocabularies.apiContract.EndPoint)
266
+ ) {
267
+ this._appendEndpointItem(item, target);
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Appends "type" item to the results.
273
+ *
274
+ * @param {Object} item Type item declaration
275
+ * @param {TargetModel} target
276
+ * @return {void}
277
+ */
278
+ _appendTypeItem(item, target) {
279
+ const w3name = this._getValue(item, this.ns.w3.shacl.name);
280
+ if (w3name && w3name.indexOf("amf_inline_type") === 0) {
281
+ // https://www.mulesoft.org/jira/browse/APIMF-972
282
+ return;
283
+ }
284
+ let name = this._getValue(item, this.ns.aml.vocabularies.core.name);
285
+ if (!name && w3name) {
286
+ name = w3name;
287
+ } else if (!name) {
288
+ return;
289
+ }
290
+ const id = item[ID_PROPERTY];
291
+ if (!id) {
292
+ return;
293
+ }
294
+ const rfIdKey = this._getAmfKey(
295
+ this.ns.aml.vocabularies.document.referenceId
296
+ );
297
+ const compareId = id;
298
+ const refNode = this._ensureArray(item[rfIdKey]);
299
+ const refId = refNode ? refNode[0][ID_PROPERTY] : undefined;
300
+ const idIndex = target._typeIds.indexOf(compareId);
301
+ const refIndex = refId ? target._typeIds.indexOf(refId) : -1;
302
+ if (idIndex === -1 && refIndex === -1) {
303
+ target._typeIds[target._typeIds.length] = id;
304
+ if (refId) {
305
+ target._typeIds[target._typeIds.length] = refId;
306
+ }
307
+ target.types.push({
308
+ label: name,
309
+ id,
310
+ domId: normalizeDomId(id)
311
+ });
312
+ }
313
+ }
314
+
315
+ /**
316
+ * Appends "security" item to the results.
317
+ *
318
+ * @param {Object} item Type item declaration
319
+ * @param {TargetModel} target
320
+ * @return {void}
321
+ */
322
+ _appendSecurityItem(item, target) {
323
+ const voc = this.ns.aml.vocabularies;
324
+ let name = this._getValue(item, voc.core.displayName);
325
+ if (!name) {
326
+ name = this._getValue(item, voc.security.name);
327
+ }
328
+ if (!name) {
329
+ const apiName = this._getValue(item, voc.core.name);
330
+ const secType = this._getValue(item, voc.security.type);
331
+ let result = "";
332
+ if (apiName) {
333
+ result = `${apiName} - `;
334
+ }
335
+ name = result + this._mapAuthName(secType);
336
+ }
337
+ const id = item[ID_PROPERTY];
338
+ target.securitySchemes.push({
339
+ label: String(name),
340
+ id,
341
+ domId: normalizeDomId(id)
342
+ });
343
+ }
344
+
345
+ /**
346
+ * Maps authorization scheme name to a label
347
+ * @param {string} name
348
+ * @return {string}
349
+ */
350
+ _mapAuthName(name) {
351
+ switch (name) {
352
+ case "http":
353
+ return "HTTP";
354
+ case "openIdConnect":
355
+ return "OpenID Connect";
356
+ default:
357
+ return name;
358
+ }
359
+ }
360
+
361
+ /**
362
+ * Checks if url is valid and return it, otherwise returns 'about:blank'.
363
+ * @param {string} url
364
+ * @return {string}
365
+ */
366
+ _validUrl(url) {
367
+ return url.startsWith("http://") || url.startsWith("https://")
368
+ ? url
369
+ : "about:blank";
370
+ }
371
+
372
+ /**
373
+ * Appends "documentation" item to the results.
374
+ *
375
+ * @param {Object} item Type item declaration
376
+ * @param {TargetModel} target
377
+ * @return {void}
378
+ */
379
+ _appendDocumentationItem(item, target) {
380
+ const { core } = this.ns.aml.vocabularies;
381
+ const id = item[ID_PROPERTY];
382
+ const urlNode = item[this._getAmfKey(core.url)];
383
+ const title = this._getValue(item, core.title);
384
+ const description = this._getValue(item, core.description);
385
+ const label = title ? String(title) : String(description);
386
+ let isExternal = false;
387
+ let url = urlNode ? (urlNode[0] || urlNode)[ID_PROPERTY] : undefined;
388
+ if (url) {
389
+ url = this._validUrl(url);
390
+ isExternal = true;
391
+ }
392
+ const result = {
393
+ id,
394
+ label,
395
+ isExternal,
396
+ url,
397
+ domId: normalizeDomId(id)
398
+ };
399
+ target.documentation.push(result);
400
+ }
401
+
402
+ /**
403
+ * Appends "endpoint" item to the results.
404
+ * This also iterates over methods to extract method data.
405
+ *
406
+ * @param {Object} item Endpoint item declaration
407
+ * @param {TargetModel} target
408
+ * @return {void}
409
+ */
410
+ _appendEndpointItem(item, target) {
411
+ const result = {};
412
+
413
+ let name = this._getValue(item, this.ns.aml.vocabularies.core.name);
414
+ const path = this._getValue(
415
+ item,
416
+ this.ns.raml.vocabularies.apiContract.path
417
+ );
418
+ result.path = path;
419
+
420
+ let tmpPath = path;
421
+ if (tmpPath[0] === "/") {
422
+ tmpPath = tmpPath.substr(1);
423
+ }
424
+ const parts = tmpPath.split("/");
425
+ let indent = 0;
426
+ target._basePaths[target._basePaths.length] = path;
427
+ if (parts.length > 1) {
428
+ const lowerParts = parts.slice(0, parts.length - 1);
429
+ if (lowerParts.length) {
430
+ for (let i = lowerParts.length - 1; i >= 0; i--) {
431
+ const currentPath = `/${lowerParts
432
+ .slice(0, i + 1)
433
+ .join("/")}`;
434
+ if (target._basePaths.indexOf(currentPath) !== -1) {
435
+ indent++;
436
+ }
437
+ }
438
+ }
439
+ }
440
+ if (!name) {
441
+ result.renderPath = false;
442
+ if (indent > 0) {
443
+ try {
444
+ name = this._computePathName(
445
+ path,
446
+ parts,
447
+ indent,
448
+ target._basePaths
449
+ );
450
+ } catch (_) {
451
+ name = path;
452
+ }
453
+ } else {
454
+ name = path;
455
+ }
456
+ } else {
457
+ result.renderPath = true;
458
+ }
459
+ const id = item[ID_PROPERTY];
460
+ const key = this._getAmfKey(this.ns.w3.hydra.supportedOperation);
461
+ const operations = this._ensureArray(item[key]) || [];
462
+ const methods = operations.map((op) => this._createOperationModel(op));
463
+ result.label = String(name);
464
+ result.id = id;
465
+ result.indent = indent;
466
+ result.methods = methods;
467
+ result.domId = normalizeDomId(id);
468
+ target.endpoints.push(result);
469
+ }
470
+
471
+ /**
472
+ * Computes label for an endpoint when name is missing and the endpoint
473
+ * is indented, hence name should be truncated.
474
+ * @param {string} currentPath Endpoint's path
475
+ * @param {string[]} parts Path parts
476
+ * @param {number} indent Endpoint indentation
477
+ * @param {string[]} basePaths List of base paths already used.
478
+ * @return {string} Name of the path to render.
479
+ */
480
+ _computePathName(currentPath, parts, indent, basePaths) {
481
+ let path = "";
482
+ for (let i = 0, len = parts.length; i < len; i++) {
483
+ path += `/${parts[i]}`;
484
+ if (basePaths.indexOf(path) !== -1) {
485
+ indent--;
486
+ }
487
+ if (indent === 0) {
488
+ break;
489
+ }
490
+ }
491
+ return currentPath.replace(path, "");
492
+ }
493
+
494
+ /**
495
+ * Creates the view model for an opration.
496
+ *
497
+ * @param {Object} item Operation AMF model
498
+ * @return {Object} Method view model
499
+ */
500
+ _createOperationModel(item) {
501
+ const label = this._getValue(item, this.ns.aml.vocabularies.core.name);
502
+ const methodKey = this.ns.aml.vocabularies.apiContract.method;
503
+ const id = item[ID_PROPERTY];
504
+ const method = this._getValue(item, methodKey);
505
+ return {
506
+ label,
507
+ id,
508
+ method,
509
+ domId: normalizeDomId(id)
510
+ };
511
+ }
512
+
513
+ /**
514
+ * Computes Endpoint definition model from web API and current selection.
515
+ *
516
+ * @param {any} model WebApi AMF model. Do not use an array here.
517
+ * @param {string} selected Currently selected `@id`.
518
+ * @return {any|undefined} Model definition for an endpoint fragment.
519
+ */
520
+ computeEndpointApiModel(model, selectedId) {
521
+ const webApi = this._computeApi(model);
522
+ return this._computeEndpointModel(webApi, selectedId);
523
+ }
524
+
525
+ /**
526
+ * Computes Method definition model from web API and current selection.
527
+ *
528
+ * @param {any} model WebApi AMF model. Do not use an array here.
529
+ * @param {string} selected Currently selected `@id`.
530
+ * @return {any|undefined} Model definition for an endpoint fragment.
531
+ */
532
+ computeMethodApiModel(model, selected) {
533
+ const webApi = this._computeApi(model);
534
+ return this._computeMethodModel(webApi, selected);
535
+ }
536
+
537
+ /**
538
+ * Computes Endpoint definition model for a method from web API and current selection.
539
+ *
540
+ * @param {any} model WebApi AMF model. Do not use an array here.
541
+ * @param {string} selected Currently selected `@id`.
542
+ * @return {any|undefined} Model definition for an endpoint fragment.
543
+ */
544
+ computeEndpointApiMethodModel(model, selected) {
545
+ const webApi = this._computeApi(model);
546
+ return this._computeMethodEndpoint(webApi, selected);
547
+ }
548
+
549
+ /**
550
+ * Computes security scheme definition model from web API and current selection.
551
+ * It looks for the definition in both `declares` and `references` properties.
552
+ * Returned value is already resolved AMF model (references are resolved).
553
+ *
554
+ * @param {any} model WebApi AMF model. Do not use an array here.
555
+ * @param {string} selected Currently selected `@id`.
556
+ * @return {any|undefined} Model definition for the security scheme.
557
+ */
558
+ computeSecurityApiModel(model, selected) {
559
+ const declares = this._computeDeclares(model);
560
+ let result;
561
+ if (declares) {
562
+ result = declares.find((item) => item["@id"] === selected);
563
+ }
564
+ if (!result) {
565
+ const references = this._computeReferences(model);
566
+ if (references && references.length) {
567
+ for (let i = 0, len = references.length; i < len; i++) {
568
+ if (
569
+ !this._hasType(
570
+ references[i],
571
+ this.ns.aml.vocabularies.document.Module
572
+ )
573
+ ) {
574
+ continue;
575
+ }
576
+ result = this._computeReferenceSecurity(
577
+ references[i],
578
+ selected
579
+ );
580
+ if (result) {
581
+ break;
582
+ }
583
+ }
584
+ }
585
+ } else {
586
+ result = this._resolve(result);
587
+ }
588
+ return result;
589
+ }
590
+
591
+ /**
592
+ * Computes documentation definition model from web API and current selection.
593
+ *
594
+ * @param {any} model WebApi AMF model. Do not use an array here.
595
+ * @param {string} selected Currently selected `@id`.
596
+ * @return {any|undefined} Model definition for a documentation fragment.
597
+ */
598
+ computeDocsApiModel(model, selected) {
599
+ const webApi = this._computeApi(model);
600
+ return this._computeDocument(webApi, selected);
601
+ }
602
+
603
+ /**
604
+ * Computes type definition model from web API and current selection.
605
+ * It looks for the definition in both `declares` and `references` properties.
606
+ * Returned value is already resolved AMF model (references are resolved).
607
+ *
608
+ * @param {any} model WebApi AMF model. Do not use an array here.
609
+ * @param {string} selected Currently selected `@id`.
610
+ * @return {any|undefined} Model definition for a type.
611
+ */
612
+ computeTypeApiModel(model, selected) {
613
+ const declares = this._computeDeclares(model);
614
+ const references = this._computeReferences(model);
615
+ return this._computeType(declares, references, selected);
616
+ }
617
+
618
+ /**
619
+ * Computes a security model from a reference (library for example).
620
+ * @param {any|any[]} reference AMF model for a reference to extract the data from
621
+ * @param {string} selected Node ID to look for
622
+ * @return {any|undefined} Type definition or undefined if not found.
623
+ */
624
+ _computeReferenceSecurity(reference, selected) {
625
+ const declare = this._computeDeclares(reference);
626
+ if (!declare) {
627
+ return undefined;
628
+ }
629
+ let result = declare.find((item) => {
630
+ if (Array.isArray(item)) {
631
+ [item] = item;
632
+ }
633
+ return item["@id"] === selected;
634
+ });
635
+ if (Array.isArray(result)) {
636
+ [result] = result;
637
+ }
638
+ return this._resolve(result);
639
+ }
640
+
641
+ /**
642
+ * Computes API's media types when requesting type documentation view.
643
+ * This is passed to the type documentation to render examples in the type
644
+ * according to API's defined media type.
645
+ *
646
+ * @param {any} model API model.
647
+ * @return {string[]|undefined} List of supported media types or undefined.
648
+ */
649
+ computeApiMediaTypes(model) {
650
+ if (Array.isArray(model)) {
651
+ [model] = model;
652
+ }
653
+ let webApi = this._computeWebApi(model);
654
+ if (!webApi) {
655
+ return undefined;
656
+ }
657
+ if (Array.isArray(webApi)) {
658
+ [webApi] = webApi;
659
+ }
660
+ const key = this._getAmfKey(
661
+ this.ns.aml.vocabularies.apiContract.accepts
662
+ );
663
+ const value = this._ensureArray(webApi[key]);
664
+ if (value) {
665
+ return value.map((item) => item["@value"]);
666
+ }
667
+ return undefined;
668
+ }
669
+ }
@@ -0,0 +1 @@
1
+ @import "docHelpers/amfStyle";
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <div class="topic-container" lwc:dom="manual"></div>
3
+ </template>