@salesforcedevs/docs-components 1.3.169 → 1.3.171-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.169",
3
+ "version": "1.3.171-alpha.0",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "e819e60b958af0fa567045741481fd7a4e8417b3"
27
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
28
  }
@@ -2,7 +2,7 @@ import { LightningElement, api, track } from "lwc";
2
2
  import { noCase } from "no-case";
3
3
  import { sentenceCase } from "sentence-case";
4
4
  import qs from "query-string";
5
- import { AmfModelParser } from "./utils";
5
+ import { AmfModelParser } from "docUtils/amf";
6
6
  import { normalizeBoolean } from "dxUtils/normalizers";
7
7
  import { CoveoAnalyticsClient } from "coveo.analytics";
8
8
  import type {
@@ -30,18 +30,26 @@ import { restoreScroll } from "dx/scrollManager";
30
30
  import { DocPhaseInfo } from "typings/custom";
31
31
  import { oldVersionDocInfo } from "docUtils/utils";
32
32
 
33
+ type NavigationItem = {
34
+ label: string;
35
+ name: string;
36
+ isExpanded: boolean;
37
+ children: ParsedMarkdownTopic[];
38
+ isChildrenLoading: boolean;
39
+ };
40
+
33
41
  export default class AmfReference extends LightningElement {
34
- @api breadcrumbs?: string | null | undefined = null;
42
+ @api breadcrumbs: string | null = null;
35
43
  @api sidebarHeader!: string;
36
44
  @api coveoOrganizationId!: string;
37
45
  @api coveoPublicAccessToken!: string;
38
46
  @api coveoAnalyticsToken!: string;
39
47
  @api coveoAdvancedQueryConfig!: string;
40
48
  @api coveoSearchHub!: string;
41
- @api useOldSidebar?: boolean = false;
49
+ @api useOldSidebar: boolean = false;
42
50
  @api tocTitle?: string;
43
51
  @api tocOptions?: string;
44
- @track navigation = [];
52
+ @track navigation = [] as NavigationItem[];
45
53
  @track versions: Array<ReferenceVersion> = [];
46
54
  @track showVersionBanner = false;
47
55
 
@@ -125,8 +133,8 @@ export default class AmfReference extends LightningElement {
125
133
  }
126
134
 
127
135
  @api
128
- get docPhaseInfo() {
129
- return this.selectedReferenceDocPhase;
136
+ get docPhaseInfo(): string | null {
137
+ return this.selectedReferenceDocPhase || null;
130
138
  }
131
139
 
132
140
  set docPhaseInfo(value: string) {
@@ -151,12 +159,12 @@ export default class AmfReference extends LightningElement {
151
159
  protected _referenceSetConfig!: ReferenceSetConfig;
152
160
  protected _currentReferenceId = "";
153
161
 
154
- protected parentReferenceUrls = [];
162
+ protected parentReferenceUrls = [] as string[];
155
163
  protected amfMap: Record<string, AmfModelRecord> = {};
156
- protected amfFetchPromiseMap = {};
164
+ protected amfFetchPromiseMap = {} as any;
157
165
  protected metadata: { [key: string]: AmfMetadataTopic } = {};
158
166
  protected selectedTopic?: AmfMetaTopicType = undefined;
159
- protected selectedSidebarValue = undefined;
167
+ protected selectedSidebarValue: string | undefined = undefined;
160
168
 
161
169
  protected selectedVersion: ReferenceVersion | null = null;
162
170
 
@@ -347,13 +355,13 @@ export default class AmfReference extends LightningElement {
347
355
  /**
348
356
  * Returns the selected version or the first available version.
349
357
  */
350
- private getSelectedVersion(): ReferenceVersion {
358
+ private getSelectedVersion(): ReferenceVersion | null {
351
359
  const versions = this._referenceSetConfig?.versions || [];
352
360
  const selectedVersion = versions.find(
353
361
  (v: ReferenceVersion) => v.selected
354
362
  );
355
363
  // return a selected version if there is one, else return the first one.
356
- return selectedVersion || (versions.length && versions[0]);
364
+ return selectedVersion || (versions.length && versions[0]) || null;
357
365
  }
358
366
 
359
367
  private updateAmfConfigInView(): void {
@@ -367,9 +375,11 @@ export default class AmfReference extends LightningElement {
367
375
  }
368
376
  }
369
377
 
370
- private async fetchAmf(amfConfig): Promise<AmfModel | AmfModel[]> {
378
+ private async fetchAmf(
379
+ amfConfig: AmfConfig
380
+ ): Promise<AmfModel | AmfModel[]> {
371
381
  const { amf } = amfConfig;
372
- const response = await fetch(amf, {
382
+ const response = await fetch(amf!, {
373
383
  headers: {
374
384
  "Cache-Control": `max-age=86400`
375
385
  }
@@ -388,7 +398,7 @@ export default class AmfReference extends LightningElement {
388
398
  /**
389
399
  * Returns whether given url is parent reference path like ../example-project/references/reference-id
390
400
  */
391
- private isParentReferencePath(urlPath: string): boolean {
401
+ private isParentReferencePath(urlPath?: string | null): boolean {
392
402
  if (!urlPath) {
393
403
  return false;
394
404
  }
@@ -419,9 +429,9 @@ export default class AmfReference extends LightningElement {
419
429
  * Populates reference Items from amfConfigList and assigns it to navigation for sidebar
420
430
  */
421
431
  private populateReferenceItems(): void {
422
- const navAmfOrder = [];
432
+ const navAmfOrder = [] as NavigationItem[];
423
433
  for (const [index, amfConfig] of this._amfConfigList.entries()) {
424
- let navItemChildren = [];
434
+ let navItemChildren = [] as ParsedMarkdownTopic[];
425
435
  let isChildrenLoading = false;
426
436
  if (amfConfig.referenceType !== REFERENCE_TYPES.markdown) {
427
437
  if (amfConfig.isSelected) {
@@ -441,10 +451,10 @@ export default class AmfReference extends LightningElement {
441
451
  // check whether we should expand all the child nodes, this is required for Coveo to crawl.
442
452
  if (isExpandChildrenEnabled) {
443
453
  this.expandChildrenForMarkdownReferences(
444
- amfConfig.topic.children
454
+ amfConfig.topic!.children
445
455
  );
446
456
  }
447
- navItemChildren = amfConfig.topic.children;
457
+ navItemChildren = amfConfig.topic!.children;
448
458
  }
449
459
  // store nav items for each spec in order
450
460
  navAmfOrder[index] = {
@@ -465,7 +475,9 @@ export default class AmfReference extends LightningElement {
465
475
  * Returns a boolean indicating whether the children should be expanded or not.
466
476
  */
467
477
  private isExpandChildrenEnabled(referenceId: string): boolean {
468
- return this.expandChildren && this._currentReferenceId === referenceId;
478
+ return (
479
+ !!this.expandChildren && this._currentReferenceId === referenceId
480
+ );
469
481
  }
470
482
 
471
483
  /**
@@ -509,12 +521,12 @@ export default class AmfReference extends LightningElement {
509
521
  referenceId: string,
510
522
  items: ParsedTopicModel[]
511
523
  ): NavItem[] {
512
- const methodList = [];
524
+ const methodList = [] as NavItem[];
513
525
 
514
526
  items.forEach((item) => {
515
527
  item.methods?.forEach((method) => {
516
528
  const title =
517
- this.getTitleForLabel(method.label) || method.method;
529
+ this.getTitleForLabel(method.label!) || method.method;
518
530
  const meta = this.addToMetadata(
519
531
  parentReferencePath,
520
532
  referenceId,
@@ -562,7 +574,7 @@ export default class AmfReference extends LightningElement {
562
574
  const parentReferencePath = amfConfig.href;
563
575
  const model = this.amfMap[referenceId].parser.parsedModel;
564
576
 
565
- const children = [];
577
+ const children: any[] = [];
566
578
  const expandChildren = this.isExpandChildrenEnabled(referenceId);
567
579
 
568
580
  NAVIGATION_ITEMS.forEach(
@@ -589,8 +601,8 @@ export default class AmfReference extends LightningElement {
589
601
  }
590
602
  case "endpoint":
591
603
  if (
592
- model[childrenPropertyName] &&
593
- model[childrenPropertyName].length
604
+ model[childrenPropertyName!] &&
605
+ model[childrenPropertyName!].length
594
606
  ) {
595
607
  const amfTopicId = this.getFormattedIdentifier(
596
608
  referenceId,
@@ -599,7 +611,7 @@ export default class AmfReference extends LightningElement {
599
611
  const childTopics = this.assignEndpointNavItems(
600
612
  parentReferencePath,
601
613
  referenceId,
602
- model[childrenPropertyName]
614
+ model[childrenPropertyName!]
603
615
  );
604
616
  children.push({
605
617
  label,
@@ -614,23 +626,25 @@ export default class AmfReference extends LightningElement {
614
626
  break;
615
627
  case "security":
616
628
  case "type":
617
- if (model[childrenPropertyName]?.length) {
629
+ if (model[childrenPropertyName!]?.length) {
618
630
  // Sorting the types alphabetically
619
- model[childrenPropertyName].sort((typeA, typeB) => {
620
- const typeALbl = typeA.label.toLowerCase();
621
- const typeBLbl = typeB.label.toLowerCase();
622
- return typeALbl < typeBLbl
623
- ? -1
624
- : typeALbl > typeBLbl
625
- ? 1
626
- : 0;
627
- });
631
+ model[childrenPropertyName!].sort(
632
+ (typeA: any, typeB: any) => {
633
+ const typeALbl = typeA.label.toLowerCase();
634
+ const typeBLbl = typeB.label.toLowerCase();
635
+ return typeALbl < typeBLbl
636
+ ? -1
637
+ : typeALbl > typeBLbl
638
+ ? 1
639
+ : 0;
640
+ }
641
+ );
628
642
  }
629
643
  // eslint-disable-next-line no-fallthrough
630
644
  default:
631
645
  if (
632
- model[childrenPropertyName] &&
633
- model[childrenPropertyName].length
646
+ model[childrenPropertyName!] &&
647
+ model[childrenPropertyName!].length
634
648
  ) {
635
649
  const amfTopicId = this.getFormattedIdentifier(
636
650
  referenceId,
@@ -643,8 +657,8 @@ export default class AmfReference extends LightningElement {
643
657
  this.metadata[amfTopicId]?.meta
644
658
  ),
645
659
  isExpanded: expandChildren,
646
- children: model[childrenPropertyName].map(
647
- (topic) => {
660
+ children: model[childrenPropertyName!].map(
661
+ (topic: any) => {
648
662
  const meta = this.addToMetadata(
649
663
  parentReferencePath,
650
664
  referenceId,
@@ -681,12 +695,18 @@ export default class AmfReference extends LightningElement {
681
695
  type: string,
682
696
  topic: { id: string; domId: string },
683
697
  navTitle: string
684
- ): string | undefined {
685
- const { urlIdentifer, prefix } = URL_CONFIG[type];
698
+ ): string {
699
+ const config = URL_CONFIG[type as keyof typeof URL_CONFIG];
700
+ const urlIdentifer = config.urlIdentifer;
701
+ let prefix = null;
702
+ if ("prefix" in config) {
703
+ prefix = config.prefix;
704
+ }
686
705
 
687
706
  // encodeURI to avoid special characters in the URL meta.
688
707
  const identifier =
689
- topic[urlIdentifer] && this.encodeIdentifier(topic[urlIdentifer]);
708
+ urlIdentifer in topic &&
709
+ this.encodeIdentifier(topic[urlIdentifer as keyof typeof topic]);
690
710
  let meta;
691
711
  // Assuming that there will be an identifier always
692
712
  if (identifier) {
@@ -702,7 +722,7 @@ export default class AmfReference extends LightningElement {
702
722
  navTitle
703
723
  };
704
724
  }
705
- return meta;
725
+ return meta!;
706
726
  }
707
727
 
708
728
  /**
@@ -713,7 +733,7 @@ export default class AmfReference extends LightningElement {
713
733
  (metadata: AmfMetadataTopic) => {
714
734
  return routeMeta.meta === metadata.meta;
715
735
  }
716
- );
736
+ )!;
717
737
  }
718
738
 
719
739
  /**
@@ -727,7 +747,7 @@ export default class AmfReference extends LightningElement {
727
747
  return Object.values(this.metadata).find(
728
748
  (metadata: AmfMetadataTopic) =>
729
749
  referenceId === metadata.referenceId && amfId === metadata.amfId
730
- );
750
+ )!;
731
751
  }
732
752
 
733
753
  /**
@@ -742,7 +762,7 @@ export default class AmfReference extends LightningElement {
742
762
  (metadata: AmfMetadataTopic) =>
743
763
  referenceId === metadata.referenceId &&
744
764
  identifier === metadata.identifier
745
- );
765
+ )!;
746
766
  }
747
767
 
748
768
  /**
@@ -756,7 +776,7 @@ export default class AmfReference extends LightningElement {
756
776
  return Object.values(this.metadata).find(
757
777
  (metadata: AmfMetadataTopic) =>
758
778
  referenceId === metadata.referenceId && type === metadata.type
759
- );
779
+ )!;
760
780
  }
761
781
 
762
782
  /**
@@ -833,9 +853,8 @@ export default class AmfReference extends LightningElement {
833
853
  this._currentReferenceId
834
854
  );
835
855
  if (specBasedReference) {
836
- const currentMeta: RouteMeta | null = this.getReferenceMetaInfo(
837
- window.location.href
838
- );
856
+ const currentMeta: RouteMeta | undefined =
857
+ this.getReferenceMetaInfo(window.location.href);
839
858
  const metadata =
840
859
  currentMeta && this.getMetadataByUrlQuery(currentMeta);
841
860
  if (metadata) {
@@ -871,7 +890,7 @@ export default class AmfReference extends LightningElement {
871
890
  this._currentReferenceId
872
891
  );
873
892
  if (specBasedReference) {
874
- const { meta } = this.selectedTopic;
893
+ const { meta } = this.selectedTopic!;
875
894
  const metadata = this.metadata[meta];
876
895
  if (metadata) {
877
896
  const {
@@ -988,7 +1007,7 @@ export default class AmfReference extends LightningElement {
988
1007
  * 1. If the url is encoded already
989
1008
  * 2. If the url is decoded
990
1009
  */
991
- getUrlEncoded(url: string) {
1010
+ getUrlEncoded(url: string): string {
992
1011
  // if url matches, then return the encoded url.
993
1012
  if (decodeURIComponent(url) === url) {
994
1013
  return encodeURIComponent(url);
@@ -1004,7 +1023,7 @@ export default class AmfReference extends LightningElement {
1004
1023
  * For spec based references gets meta parm from url and then topicId & type from meta
1005
1024
  * For markdown based references gets topicId as last html path in the name, meta & type will be empty
1006
1025
  */
1007
- getReferenceMetaInfo(referenceUrl: string): RouteMeta | undefined {
1026
+ getReferenceMetaInfo(referenceUrl: string | null): RouteMeta | undefined {
1008
1027
  let metaReferenceInfo;
1009
1028
  if (referenceUrl) {
1010
1029
  const referenceId = this.getReferenceIdFromUrl(referenceUrl);
@@ -1046,10 +1065,10 @@ export default class AmfReference extends LightningElement {
1046
1065
  let topicTitle = "";
1047
1066
  for (let i = 0; i < topics.length; i++) {
1048
1067
  const topic = topics[i];
1049
- const meta = this.getMarkdownReferenceMeta(topic.link.href);
1068
+ const meta = this.getMarkdownReferenceMeta(topic.link!.href);
1050
1069
  const childTopics = topic.children;
1051
1070
  if (meta === topicMeta) {
1052
- referenceUrl = topic.link.href;
1071
+ referenceUrl = topic.link!.href;
1053
1072
  topicTitle = topic.label;
1054
1073
  } else if (childTopics && childTopics.length) {
1055
1074
  const referenceDetails = this.getReferenceDetailsInGivenTopics(
@@ -1160,7 +1179,7 @@ export default class AmfReference extends LightningElement {
1160
1179
  }
1161
1180
  });
1162
1181
  } else {
1163
- let invalidTopicReferenceUrl = "";
1182
+ let invalidTopicReferenceUrl: string | null = "";
1164
1183
  if (topicId) {
1165
1184
  const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1166
1185
  referenceId,
@@ -1196,7 +1215,7 @@ export default class AmfReference extends LightningElement {
1196
1215
  * set selected sidebar value as a pathname
1197
1216
  */
1198
1217
 
1199
- private loadMarkdownBasedReference(referenceUrl?: string): void {
1218
+ private loadMarkdownBasedReference(referenceUrl?: string | null): void {
1200
1219
  let referenceId = "";
1201
1220
  const currentUrl = window.location.href;
1202
1221
  if (this.isProjectRootPath()) {
@@ -1210,7 +1229,7 @@ export default class AmfReference extends LightningElement {
1210
1229
  * CASE2: This case is to navigate to respective reference when the user clicked on root item
1211
1230
  * Ex: .../references/markdown-ref should navigate to first topic.
1212
1231
  */
1213
- referenceId = this.getReferenceIdFromUrl(referenceUrl);
1232
+ referenceId = this.getReferenceIdFromUrl(referenceUrl!);
1214
1233
  } else if (this.isParentReferencePath(currentUrl)) {
1215
1234
  /**
1216
1235
  * CASE3: This case is to navigate to respective reference when the user entered url with reference id
@@ -1239,9 +1258,9 @@ export default class AmfReference extends LightningElement {
1239
1258
  const amfConfig = this.getAmfConfigWithId(referenceId);
1240
1259
  let redirectReferenceUrl = "";
1241
1260
  if (amfConfig) {
1242
- const childrenItems = amfConfig.topic.children;
1261
+ const childrenItems = amfConfig.topic!.children;
1243
1262
  if (childrenItems.length > 0) {
1244
- redirectReferenceUrl = childrenItems[0].link.href;
1263
+ redirectReferenceUrl = childrenItems[0].link!.href;
1245
1264
  }
1246
1265
  }
1247
1266
  if (redirectReferenceUrl) {
@@ -1375,7 +1394,7 @@ export default class AmfReference extends LightningElement {
1375
1394
 
1376
1395
  handleSelectedItem(): void {
1377
1396
  // update topic view
1378
- const { referenceId, amfId, type } = this.selectedTopic;
1397
+ const { referenceId, amfId, type } = this.selectedTopic!;
1379
1398
 
1380
1399
  // This updates the component in the content section.
1381
1400
  this.topicModel = {
@@ -1,4 +1,9 @@
1
- import { AmfHelperMixin } from "@api-components/amf-helper-mixin";
1
+ // @ts-nocheck not going to check this file because it deals almost entirely with the AmfHelperMixin, which is terrible and not worth messing with. We should just upgrade our LWC version instead.
2
+ import {
3
+ AmfHelperMixin,
4
+ EndPoint,
5
+ Operation
6
+ } from "@api-components/amf-helper-mixin";
2
7
  import { normalizeDomId } from "dxUtils/normalizers";
3
8
 
4
9
  const ID_PROPERTY = "@id";
@@ -7,7 +12,7 @@ const TYPE_PROPERTY = "@type";
7
12
  export class AmfModelParser extends AmfHelperMixin(Object) {
8
13
  _parsedModel = null;
9
14
 
10
- constructor(api) {
15
+ constructor(api: any) {
11
16
  super();
12
17
  if (api) {
13
18
  this.amf = Array.isArray(api) ? api[0] : api;
@@ -517,7 +522,7 @@ export class AmfModelParser extends AmfHelperMixin(Object) {
517
522
  * @param {string} selected Currently selected `@id`.
518
523
  * @return {any|undefined} Model definition for an endpoint fragment.
519
524
  */
520
- computeEndpointApiModel(model, selectedId) {
525
+ computeEndpointApiModel(model, selectedId): EndPoint {
521
526
  const webApi = this._computeApi(model);
522
527
  return this._computeEndpointModel(webApi, selectedId);
523
528
  }
@@ -529,7 +534,7 @@ export class AmfModelParser extends AmfHelperMixin(Object) {
529
534
  * @param {string} selected Currently selected `@id`.
530
535
  * @return {any|undefined} Model definition for an endpoint fragment.
531
536
  */
532
- computeMethodApiModel(model, selected) {
537
+ computeMethodApiModel(model, selected): Operation | undefined {
533
538
  const webApi = this._computeApi(model);
534
539
  return this._computeMethodModel(webApi, selected);
535
540
  }
@@ -541,7 +546,7 @@ export class AmfModelParser extends AmfHelperMixin(Object) {
541
546
  * @param {string} selected Currently selected `@id`.
542
547
  * @return {any|undefined} Model definition for an endpoint fragment.
543
548
  */
544
- computeEndpointApiMethodModel(model, selected) {
549
+ computeEndpointApiMethodModel(model, selected): EndPoint | undefined {
545
550
  const webApi = this._computeApi(model);
546
551
  return this._computeMethodEndpoint(webApi, selected);
547
552
  }
@@ -8,14 +8,15 @@ import {
8
8
  createTypeElement
9
9
  } from "./utils";
10
10
  import type { TopicModel } from "./types";
11
+ import { Json } from "typings/custom";
11
12
 
12
13
  export default class AmfTopic extends LightningElement {
13
- private _model;
14
- private amf;
15
- private type;
14
+ private _model: TopicModel | undefined;
15
+ private amf: Json;
16
+ private type: string | undefined;
16
17
 
17
18
  @api
18
- get model(): TopicModel {
19
+ get model(): TopicModel | undefined {
19
20
  return this._model;
20
21
  }
21
22
 
@@ -41,7 +42,11 @@ export default class AmfTopic extends LightningElement {
41
42
  }
42
43
 
43
44
  update(): void {
44
- const container = this.template.querySelector("div.topic-container");
45
+ if (!this.model) {
46
+ throw new Error("Amf TopicModel undefined when trying to update");
47
+ }
48
+
49
+ const container = this.template.querySelector("div.topic-container")!;
45
50
  const { id } = this.model;
46
51
  const type = this.type;
47
52
  const amf = this.amf;
@@ -79,7 +84,7 @@ export default class AmfTopic extends LightningElement {
79
84
  if (container.firstChild) {
80
85
  container.firstChild.remove();
81
86
  }
82
- container.appendChild(element);
87
+ container.appendChild(element as Node);
83
88
  }
84
89
  }
85
90
 
@@ -89,6 +94,6 @@ export default class AmfTopic extends LightningElement {
89
94
  * @param value JSON Serializable object to clone.
90
95
  * @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
91
96
  */
92
- function clone(value): object {
97
+ function clone(value: any): any {
93
98
  return JSON.parse(JSON.stringify(value));
94
99
  }
@@ -1,4 +1,11 @@
1
1
  import { Json } from "typings/custom";
2
+ import { AmfModelParser } from "docUtils/amf";
3
+ import {
4
+ DomainElement,
5
+ EndPoint,
6
+ Operation,
7
+ Shape
8
+ } from "@api-components/amf-helper-mixin";
2
9
 
3
10
  export type ApiSummaryElement = HTMLElement & {
4
11
  amf: Json;
@@ -11,44 +18,39 @@ export type ApiEndpointElement = HTMLElement & {
11
18
  inlineMethods: boolean;
12
19
  noNavigation: boolean;
13
20
  selected: string;
14
- endpoint: Json;
21
+ endpoint: EndPoint;
15
22
  noTryIt: boolean;
16
23
  };
17
24
 
18
25
  export type ApiMethodElement = HTMLElement & {
19
26
  amf: Json;
20
27
  noNavigation: boolean;
21
- endpoint: Json;
22
- method: Json;
28
+ endpoint: EndPoint | undefined;
29
+ method: Operation | undefined;
23
30
  noTryIt: boolean;
24
31
  };
25
32
 
26
33
  export type ApiSecurityElement = HTMLElement & {
27
34
  amf: Json;
28
- security: Json;
35
+ security: DomainElement | undefined;
29
36
  };
30
37
 
31
38
  export type ApiTypeElement = HTMLElement & {
32
39
  amf: Json;
33
- type: Json;
40
+ type?: Shape;
34
41
  mediaTypes: Json;
35
42
  };
36
43
 
37
44
  export type ApiDocElement = HTMLElement & {
38
45
  amf: Json;
39
- shape: Json;
46
+ shape: DomainElement | undefined;
40
47
  };
41
48
 
42
49
  export type AmfModel = Json;
43
50
 
44
- export interface AmfParser {
45
- parse(): void;
46
- parsedModel: any;
47
- }
48
-
49
51
  export interface TopicModel {
50
52
  id: string;
51
53
  type: string;
52
54
  amf: AmfModel;
53
- parser: AmfParser;
55
+ parser: AmfModelParser;
54
56
  }
@@ -1,3 +1,9 @@
1
+ import {
2
+ DomainElement,
3
+ EndPoint,
4
+ Operation,
5
+ Shape
6
+ } from "@api-components/amf-helper-mixin";
1
7
  import type {
2
8
  ApiDocElement,
3
9
  ApiEndpointElement,
@@ -37,7 +43,7 @@ export function createSummaryElement(amf: Json): HTMLElement {
37
43
  */
38
44
  export function createEndpointElement(
39
45
  amf: Json,
40
- endpointModel: Json,
46
+ endpointModel: EndPoint,
41
47
  selected: string
42
48
  ): HTMLElement {
43
49
  const el: ApiEndpointElement = document.createElement(
@@ -57,8 +63,8 @@ export function createEndpointElement(
57
63
  */
58
64
  export function createMethodElement(
59
65
  amf: Json,
60
- endpointMethodModel: Json,
61
- methodModel: Json
66
+ endpointMethodModel: EndPoint | undefined,
67
+ methodModel: Operation | undefined
62
68
  ): HTMLElement {
63
69
  const el: ApiMethodElement = document.createElement(
64
70
  "api-method-documentation"
@@ -79,7 +85,7 @@ export function createMethodElement(
79
85
  */
80
86
  export function createSecurityElement(
81
87
  amf: Json,
82
- securityModel: Json
88
+ securityModel: DomainElement | undefined
83
89
  ): HTMLElement {
84
90
  const el: ApiSecurityElement = document.createElement(
85
91
  "api-security-documentation"
@@ -98,7 +104,7 @@ export function createSecurityElement(
98
104
  */
99
105
  export function createTypeElement(
100
106
  amf: Json,
101
- typeModel: Json,
107
+ typeModel: Shape | undefined,
102
108
  mediaTypes: Json
103
109
  ): HTMLElement {
104
110
  const el: ApiTypeElement = document.createElement(
@@ -119,7 +125,7 @@ export function createTypeElement(
119
125
  */
120
126
  export function createDocumentationElement(
121
127
  amf: Json,
122
- docsModel: Json
128
+ docsModel: DomainElement | undefined
123
129
  ): HTMLElement {
124
130
  const el: ApiDocElement = document.createElement(
125
131
  "api-documentation-document"