@microsoft/api-extractor-model 7.21.0 → 7.22.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/dist/rollup.d.ts CHANGED
@@ -641,6 +641,11 @@ export declare class ApiItem {
641
641
  * Otherwise undefined is returned.
642
642
  */
643
643
  getAssociatedPackage(): ApiPackage | undefined;
644
+ /**
645
+ * If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.
646
+ * Otherwise undefined is returned.
647
+ */
648
+ getAssociatedModel(): ApiModel | undefined;
644
649
  /**
645
650
  * A text string whose value determines the sort order that is automatically applied by the
646
651
  * {@link (ApiItemContainerMixin:interface)} class.
@@ -737,6 +742,63 @@ export declare interface ApiItemContainerMixin extends ApiItem {
737
742
  * Returns a list of members with the specified name.
738
743
  */
739
744
  findMembersByName(name: string): ReadonlyArray<ApiItem>;
745
+ /**
746
+ * Finds all of the ApiItem's immediate and inherited members by walking up the inheritance tree.
747
+ *
748
+ * @remarks
749
+ *
750
+ * Given the following class heritage:
751
+ *
752
+ * ```
753
+ * export class A {
754
+ * public a: number|boolean;
755
+ * }
756
+ *
757
+ * export class B extends A {
758
+ * public a: number;
759
+ * public b: string;
760
+ * }
761
+ *
762
+ * export class C extends B {
763
+ * public c: boolean;
764
+ * }
765
+ * ```
766
+ *
767
+ * Calling `findMembersWithInheritance` on `C` will return `B.a`, `B.b`, and `C.c`. Calling the
768
+ * method on `B` will return `B.a` and `B.b`. And calling the method on `A` will return just
769
+ * `A.a`.
770
+ *
771
+ * The inherited members returned by this method may be incomplete. If so, there will be a flag
772
+ * on the result object indicating this as well as messages explaining the errors in more detail.
773
+ * Some scenarios include:
774
+ *
775
+ * - Interface extending from a type alias.
776
+ *
777
+ * - Class extending from a variable.
778
+ *
779
+ * - Extending from a declaration not present in the model (e.g. external package).
780
+ *
781
+ * - Extending from an unexported declaration (e.g. ae-forgotten-export). Common in mixin
782
+ * patterns.
783
+ *
784
+ * - Unexpected runtime errors...
785
+ *
786
+ * Lastly, be aware that the types of inherited members are returned with respect to their
787
+ * defining class as opposed to with respect to the inheriting class. For example, consider
788
+ * the following:
789
+ *
790
+ * ```
791
+ * export class A<T> {
792
+ * public a: T;
793
+ * }
794
+ *
795
+ * export class B extends A<number> {}
796
+ * ```
797
+ *
798
+ * When called on `B`, this method will return `B.a` with type `T` as opposed to type
799
+ * `number`, although the latter is more accurate.
800
+ */
801
+ findMembersWithInheritance(): IFindApiItemsResult;
740
802
  /**
741
803
  * For a given member of this container, return its `ApiItem.getMergedSiblings()` list.
742
804
  * @internal
@@ -1970,7 +2032,32 @@ export declare enum ExcerptTokenKind {
1970
2032
  }
1971
2033
 
1972
2034
  /**
1973
- * Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class.
2035
+ * Unique identifiers for messages returned as part of `IFindApiItemsResult`.
2036
+ * @beta
2037
+ */
2038
+ export declare enum FindApiItemsMessageId {
2039
+ /**
2040
+ * "Declaration resolution failed for ___. Error message: ___."
2041
+ */
2042
+ DeclarationResolutionFailed = "declaration-resolution-failed",
2043
+ /**
2044
+ * "Unable to get the associated model of ___."
2045
+ */
2046
+ MissingApiModel = "missing-api-model",
2047
+ /**
2048
+ * "Encountered unexpected excerpt tokens in ___. Excerpt: ___."
2049
+ */
2050
+ UnexpectedExcerptTokens = "unexpected-excerpt-tokens",
2051
+ /**
2052
+ * Item ___ is of unsupported kind ___."
2053
+ */
2054
+ UnsupportedKind = "unsupported-kind"
2055
+ }
2056
+
2057
+ /**
2058
+ * Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class
2059
+ * or interface.
2060
+ *
1974
2061
  * @remarks
1975
2062
  *
1976
2063
  * For example, consider this declaration:
@@ -2393,6 +2480,42 @@ export declare interface IExcerptTokenRange {
2393
2480
  endIndex: number;
2394
2481
  }
2395
2482
 
2483
+ /**
2484
+ * This object is used for messages returned as part of `IFindApiItemsResult`.
2485
+ * @public
2486
+ */
2487
+ export declare interface IFindApiItemsMessage {
2488
+ /**
2489
+ * Unique identifier for the message.
2490
+ * @beta
2491
+ */
2492
+ messageId: FindApiItemsMessageId;
2493
+ /**
2494
+ * Text description of the message.
2495
+ */
2496
+ text: string;
2497
+ }
2498
+
2499
+ /**
2500
+ * Generic result object for finding API items used by different kinds of find operations.
2501
+ * @public
2502
+ */
2503
+ export declare interface IFindApiItemsResult {
2504
+ /**
2505
+ * The API items that were found. Not guaranteed to be complete, see `maybeIncompleteResult`.
2506
+ */
2507
+ items: ApiItem[];
2508
+ /**
2509
+ * Diagnostic messages regarding the find operation.
2510
+ */
2511
+ messages: IFindApiItemsMessage[];
2512
+ /**
2513
+ * Indicates whether the result is potentially incomplete due to errors during the find operation.
2514
+ * If true, the `messages` explain the errors in more detail.
2515
+ */
2516
+ maybeIncompleteResult: boolean;
2517
+ }
2518
+
2396
2519
  /**
2397
2520
  * Constructor options for {@link Parameter}.
2398
2521
  * @public
package/lib/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export { IApiNameMixinOptions, ApiNameMixin } from './mixins/ApiNameMixin';
23
23
  export { IApiOptionalMixinOptions, ApiOptionalMixin } from './mixins/ApiOptionalMixin';
24
24
  export { IApiReadonlyMixinOptions, ApiReadonlyMixin } from './mixins/ApiReadonlyMixin';
25
25
  export { IApiInitializerMixinOptions, ApiInitializerMixin } from './mixins/ApiInitializerMixin';
26
+ export { IFindApiItemsResult, IFindApiItemsMessage, FindApiItemsMessageId } from './mixins/IFindApiItemsResult';
26
27
  export { ExcerptTokenKind, IExcerptTokenRange, IExcerptToken, ExcerptToken, Excerpt } from './mixins/Excerpt';
27
28
  export { Constructor, PropertiesOf } from './mixins/Mixin';
28
29
  export { IApiCallSignatureOptions, ApiCallSignature } from './model/ApiCallSignature';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO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E,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,kCAAkC,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.HeritageType = exports.ApiVariable = exports.TypeParameter = exports.ApiTypeAlias = exports.ApiPropertySignature = exports.ApiProperty = exports.Parameter = exports.ApiPackage = exports.ApiNamespace = exports.ApiModel = exports.ApiMethodSignature = exports.ApiMethod = exports.ApiInterface = exports.ApiIndexSignature = exports.ApiFunction = exports.EnumMemberOrder = exports.ApiEnumMember = exports.ApiEnum = exports.ApiEntryPoint = exports.ApiConstructSignature = exports.ApiConstructor = exports.ApiClass = exports.ApiCallSignature = exports.Excerpt = exports.ExcerptToken = exports.ExcerptTokenKind = exports.ApiInitializerMixin = exports.ApiReadonlyMixin = exports.ApiOptionalMixin = exports.ApiNameMixin = exports.ApiStaticMixin = exports.ApiReturnTypeMixin = exports.ApiReleaseTagMixin = exports.ApiProtectedMixin = exports.ApiItemContainerMixin = exports.ApiTypeParameterListMixin = exports.ApiParameterListMixin = exports.ApiPropertyItem = exports.ApiItem = exports.ApiItemKind = exports.ApiDocumentedItem = exports.ApiDeclaredItem = exports.ReleaseTag = exports.AedocDefinitions = void 0;
5
+ exports.HeritageType = exports.ApiVariable = exports.TypeParameter = exports.ApiTypeAlias = exports.ApiPropertySignature = exports.ApiProperty = exports.Parameter = exports.ApiPackage = exports.ApiNamespace = exports.ApiModel = exports.ApiMethodSignature = exports.ApiMethod = exports.ApiInterface = exports.ApiIndexSignature = exports.ApiFunction = exports.EnumMemberOrder = exports.ApiEnumMember = exports.ApiEnum = exports.ApiEntryPoint = exports.ApiConstructSignature = exports.ApiConstructor = exports.ApiClass = exports.ApiCallSignature = exports.Excerpt = exports.ExcerptToken = exports.ExcerptTokenKind = exports.FindApiItemsMessageId = exports.ApiInitializerMixin = exports.ApiReadonlyMixin = exports.ApiOptionalMixin = exports.ApiNameMixin = exports.ApiStaticMixin = exports.ApiReturnTypeMixin = exports.ApiReleaseTagMixin = exports.ApiProtectedMixin = exports.ApiItemContainerMixin = exports.ApiTypeParameterListMixin = exports.ApiParameterListMixin = exports.ApiPropertyItem = exports.ApiItem = exports.ApiItemKind = exports.ApiDocumentedItem = exports.ApiDeclaredItem = exports.ReleaseTag = exports.AedocDefinitions = void 0;
6
6
  /**
7
7
  * Use this library to read and write *.api.json files as defined by the
8
8
  * {@link https://api-extractor.com/ | API Extractor} tool. These files are used to generate a documentation
@@ -48,6 +48,8 @@ var ApiReadonlyMixin_1 = require("./mixins/ApiReadonlyMixin");
48
48
  Object.defineProperty(exports, "ApiReadonlyMixin", { enumerable: true, get: function () { return ApiReadonlyMixin_1.ApiReadonlyMixin; } });
49
49
  var ApiInitializerMixin_1 = require("./mixins/ApiInitializerMixin");
50
50
  Object.defineProperty(exports, "ApiInitializerMixin", { enumerable: true, get: function () { return ApiInitializerMixin_1.ApiInitializerMixin; } });
51
+ var IFindApiItemsResult_1 = require("./mixins/IFindApiItemsResult");
52
+ Object.defineProperty(exports, "FindApiItemsMessageId", { enumerable: true, get: function () { return IFindApiItemsResult_1.FindApiItemsMessageId; } });
51
53
  var Excerpt_1 = require("./mixins/Excerpt");
52
54
  Object.defineProperty(exports, "ExcerptTokenKind", { enumerable: true, get: function () { return Excerpt_1.ExcerptTokenKind; } });
53
55
  Object.defineProperty(exports, "ExcerptToken", { enumerable: true, get: function () { return Excerpt_1.ExcerptToken; } });
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;GAOG;AAEH,6DAA4D;AAAnD,oHAAA,gBAAgB,OAAA;AACzB,iDAAgD;AAAvC,wGAAA,UAAU,OAAA;AAEnB,QAAQ;AACR,2DAAmF;AAAjD,kHAAA,eAAe,OAAA;AACjD,+DAAyF;AAArD,sHAAA,iBAAiB,OAAA;AACrD,2CAA6F;AAApF,sGAAA,WAAW,OAAA;AAAmB,kGAAA,OAAO,OAAA;AAC9C,2DAAmF;AAAjD,kHAAA,eAAe,OAAA;AAEjD,SAAS;AACT,wEAIwC;AADtC,8HAAA,qBAAqB,OAAA;AAEvB,gFAI4C;AAD1C,sIAAA,yBAAyB,OAAA;AAE3B,wEAAsG;AAA9D,8HAAA,qBAAqB,OAAA;AAC7D,gEAA0F;AAAtD,sHAAA,iBAAiB,OAAA;AACrD,kEAA6F;AAAxD,wHAAA,kBAAkB,OAAA;AACvD,kEAA6F;AAAxD,w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A,WAAW,OAAA;AAEzC,qDAAoD;AAA3C,4GAAA,YAAY,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Use this library to read and write *.api.json files as defined by the\n * {@link https://api-extractor.com/ | API Extractor} tool. These files are used to generate a documentation\n * website for your TypeScript package. The files store the API signatures and doc comments that were extracted\n * from your package.\n *\n * @packageDocumentation\n */\n\nexport { AedocDefinitions } from './aedoc/AedocDefinitions';\nexport { ReleaseTag } from './aedoc/ReleaseTag';\n\n// items\nexport { IApiDeclaredItemOptions, ApiDeclaredItem } from './items/ApiDeclaredItem';\nexport { IApiDocumentedItemOptions, ApiDocumentedItem } from './items/ApiDocumentedItem';\nexport { ApiItemKind, IApiItemOptions, ApiItem, IApiItemConstructor } from './items/ApiItem';\nexport { IApiPropertyItemOptions, ApiPropertyItem } from './items/ApiPropertyItem';\n\n// mixins\nexport {\n IApiParameterListMixinOptions,\n IApiParameterOptions,\n ApiParameterListMixin\n} from './mixins/ApiParameterListMixin';\nexport {\n IApiTypeParameterOptions,\n IApiTypeParameterListMixinOptions,\n ApiTypeParameterListMixin\n} from './mixins/ApiTypeParameterListMixin';\nexport { IApiItemContainerMixinOptions, ApiItemContainerMixin } from './mixins/ApiItemContainerMixin';\nexport { IApiProtectedMixinOptions, ApiProtectedMixin } from './mixins/ApiProtectedMixin';\nexport { IApiReleaseTagMixinOptions, ApiReleaseTagMixin } from './mixins/ApiReleaseTagMixin';\nexport { IApiReturnTypeMixinOptions, ApiReturnTypeMixin } from './mixins/ApiReturnTypeMixin';\nexport { IApiStaticMixinOptions, ApiStaticMixin } from './mixins/ApiStaticMixin';\nexport { IApiNameMixinOptions, ApiNameMixin } from './mixins/ApiNameMixin';\nexport { IApiOptionalMixinOptions, ApiOptionalMixin } from './mixins/ApiOptionalMixin';\nexport { IApiReadonlyMixinOptions, ApiReadonlyMixin } from './mixins/ApiReadonlyMixin';\nexport { IApiInitializerMixinOptions, ApiInitializerMixin } from './mixins/ApiInitializerMixin';\n\nexport { ExcerptTokenKind, IExcerptTokenRange, IExcerptToken, ExcerptToken, Excerpt } from './mixins/Excerpt';\nexport { Constructor, PropertiesOf } from './mixins/Mixin';\n\n// model\nexport { IApiCallSignatureOptions, ApiCallSignature } from './model/ApiCallSignature';\nexport { IApiClassOptions, ApiClass } from './model/ApiClass';\nexport { IApiConstructorOptions, ApiConstructor } from './model/ApiConstructor';\nexport { IApiConstructSignatureOptions, ApiConstructSignature } from './model/ApiConstructSignature';\nexport { IApiEntryPointOptions, ApiEntryPoint } from './model/ApiEntryPoint';\nexport { IApiEnumOptions, ApiEnum } from './model/ApiEnum';\nexport { IApiEnumMemberOptions, ApiEnumMember, EnumMemberOrder } from './model/ApiEnumMember';\nexport { IApiFunctionOptions, ApiFunction } from './model/ApiFunction';\nexport { IApiIndexSignatureOptions, ApiIndexSignature } from './model/ApiIndexSignature';\nexport { IApiInterfaceOptions, ApiInterface } from './model/ApiInterface';\nexport { IApiMethodOptions, ApiMethod } from './model/ApiMethod';\nexport { IApiMethodSignatureOptions, ApiMethodSignature } from './model/ApiMethodSignature';\nexport { ApiModel } from './model/ApiModel';\nexport { IApiNamespaceOptions, ApiNamespace } from './model/ApiNamespace';\nexport { IApiPackageOptions, ApiPackage, IApiPackageSaveOptions } from './model/ApiPackage';\nexport { IParameterOptions, Parameter } from './model/Parameter';\nexport { IApiPropertyOptions, ApiProperty } from './model/ApiProperty';\nexport { IApiPropertySignatureOptions, ApiPropertySignature } from './model/ApiPropertySignature';\nexport { IApiTypeAliasOptions, ApiTypeAlias } from './model/ApiTypeAlias';\nexport { ITypeParameterOptions, TypeParameter } from './model/TypeParameter';\nexport { IApiVariableOptions, ApiVariable } from './model/ApiVariable';\nexport { IResolveDeclarationReferenceResult } from './model/ModelReferenceResolver';\nexport { HeritageType } from './model/HeritageType';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";A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AACjC,uDAA8F;AAA9D,8GAAA,aAAa,OAAA;AAAE,gHAAA,eAAe,OAAA;AAC9D,mDAAuE;AAAzC,0GAAA,WAAW,OAAA;AACzC,+DAAyF;AAArD,sHAAA,iBAAiB,OAAA;AACrD,qDAA0E;AAA3C,4GAAA,YAAY,OAAA;AAC3C,+CAAiE;AAArC,sGAAA,SAAS,OAAA;AACrC,iEAA4F;AAAvD,wHAAA,kBAAkB,OAAA;AACvD,6CAA4C;AAAnC,oGAAA,QAAQ,OAAA;AACjB,qDAA0E;AAA3C,4GAAA,YAAY,OAAA;AAC3C,iDAA4F;AAA/D,wGAAA,UAAU,OAAA;AACvC,+CAAiE;AAArC,sGAAA,SAAS,OAAA;AACrC,mDAAuE;AAAzC,0GAAA,WAAW,OAAA;AACzC,qEAAkG;AAA3D,4HAAA,oBAAoB,OAAA;AAC3D,qDAA0E;AAA3C,4GAAA,YAAY,OAAA;AAC3C,uDAA6E;AAA7C,8GAAA,aAAa,OAAA;AAC7C,mDAAuE;AAAzC,0GAAA,WAAW,OAAA;AAEzC,qDAAoD;AAA3C,4GAAA,YAAY,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Use this library to read and write *.api.json files as defined by the\n * {@link https://api-extractor.com/ | API Extractor} tool. These files are used to generate a documentation\n * website for your TypeScript package. The files store the API signatures and doc comments that were extracted\n * from your package.\n *\n * @packageDocumentation\n */\n\nexport { AedocDefinitions } from './aedoc/AedocDefinitions';\nexport { ReleaseTag } from './aedoc/ReleaseTag';\n\n// items\nexport { IApiDeclaredItemOptions, ApiDeclaredItem } from './items/ApiDeclaredItem';\nexport { IApiDocumentedItemOptions, ApiDocumentedItem } from './items/ApiDocumentedItem';\nexport { ApiItemKind, IApiItemOptions, ApiItem, IApiItemConstructor } from './items/ApiItem';\nexport { IApiPropertyItemOptions, ApiPropertyItem } from './items/ApiPropertyItem';\n\n// mixins\nexport {\n IApiParameterListMixinOptions,\n IApiParameterOptions,\n ApiParameterListMixin\n} from './mixins/ApiParameterListMixin';\nexport {\n IApiTypeParameterOptions,\n IApiTypeParameterListMixinOptions,\n ApiTypeParameterListMixin\n} from './mixins/ApiTypeParameterListMixin';\nexport { IApiItemContainerMixinOptions, ApiItemContainerMixin } from './mixins/ApiItemContainerMixin';\nexport { IApiProtectedMixinOptions, ApiProtectedMixin } from './mixins/ApiProtectedMixin';\nexport { IApiReleaseTagMixinOptions, ApiReleaseTagMixin } from './mixins/ApiReleaseTagMixin';\nexport { IApiReturnTypeMixinOptions, ApiReturnTypeMixin } from './mixins/ApiReturnTypeMixin';\nexport { IApiStaticMixinOptions, ApiStaticMixin } from './mixins/ApiStaticMixin';\nexport { IApiNameMixinOptions, ApiNameMixin } from './mixins/ApiNameMixin';\nexport { IApiOptionalMixinOptions, ApiOptionalMixin } from './mixins/ApiOptionalMixin';\nexport { IApiReadonlyMixinOptions, ApiReadonlyMixin } from './mixins/ApiReadonlyMixin';\nexport { IApiInitializerMixinOptions, ApiInitializerMixin } from './mixins/ApiInitializerMixin';\nexport {\n IFindApiItemsResult,\n IFindApiItemsMessage,\n FindApiItemsMessageId\n} from './mixins/IFindApiItemsResult';\n\nexport { ExcerptTokenKind, IExcerptTokenRange, IExcerptToken, ExcerptToken, Excerpt } from './mixins/Excerpt';\nexport { Constructor, PropertiesOf } from './mixins/Mixin';\n\n// model\nexport { IApiCallSignatureOptions, ApiCallSignature } from './model/ApiCallSignature';\nexport { IApiClassOptions, ApiClass } from './model/ApiClass';\nexport { IApiConstructorOptions, ApiConstructor } from './model/ApiConstructor';\nexport { IApiConstructSignatureOptions, ApiConstructSignature } from './model/ApiConstructSignature';\nexport { IApiEntryPointOptions, ApiEntryPoint } from './model/ApiEntryPoint';\nexport { IApiEnumOptions, ApiEnum } from './model/ApiEnum';\nexport { IApiEnumMemberOptions, ApiEnumMember, EnumMemberOrder } from './model/ApiEnumMember';\nexport { IApiFunctionOptions, ApiFunction } from './model/ApiFunction';\nexport { IApiIndexSignatureOptions, ApiIndexSignature } from './model/ApiIndexSignature';\nexport { IApiInterfaceOptions, ApiInterface } from './model/ApiInterface';\nexport { IApiMethodOptions, ApiMethod } from './model/ApiMethod';\nexport { IApiMethodSignatureOptions, ApiMethodSignature } from './model/ApiMethodSignature';\nexport { ApiModel } from './model/ApiModel';\nexport { IApiNamespaceOptions, ApiNamespace } from './model/ApiNamespace';\nexport { IApiPackageOptions, ApiPackage, IApiPackageSaveOptions } from './model/ApiPackage';\nexport { IParameterOptions, Parameter } from './model/Parameter';\nexport { IApiPropertyOptions, ApiProperty } from './model/ApiProperty';\nexport { IApiPropertySignatureOptions, ApiPropertySignature } from './model/ApiPropertySignature';\nexport { IApiTypeAliasOptions, ApiTypeAlias } from './model/ApiTypeAlias';\nexport { ITypeParameterOptions, TypeParameter } from './model/TypeParameter';\nexport { IApiVariableOptions, ApiVariable } from './model/ApiVariable';\nexport { IResolveDeclarationReferenceResult } from './model/ModelReferenceResolver';\nexport { HeritageType } from './model/HeritageType';\n"]}
@@ -2,6 +2,7 @@ import { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/Declara
2
2
  import { Constructor, PropertiesOf } from '../mixins/Mixin';
3
3
  import { ApiPackage } from '../model/ApiPackage';
4
4
  import { DeserializerContext } from '../model/DeserializerContext';
5
+ import { ApiModel } from '../model/ApiModel';
5
6
  /**
6
7
  * The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of
7
8
  * {@link ApiItem}.
@@ -136,6 +137,11 @@ export declare class ApiItem {
136
137
  * Otherwise undefined is returned.
137
138
  */
138
139
  getAssociatedPackage(): ApiPackage | undefined;
140
+ /**
141
+ * If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.
142
+ * Otherwise undefined is returned.
143
+ */
144
+ getAssociatedModel(): ApiModel | undefined;
139
145
  /**
140
146
  * A text string whose value determines the sort order that is automatically applied by the
141
147
  * {@link (ApiItemContainerMixin:interface)} class.
@@ -1 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B,IAAI,oBAAoB,CAUpD;IAED;;;;;;;;;OASG;IACH,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED;;;;;;;;OAQG;IACH,IAAW,WAAW,IAAI,MAAM,CAc/B;IAED;;;;;OAKG;IACH,IAAW,MAAM,IAAI,OAAO,GAAG,SAAS,CAEvC;IAED;;;;;OAKG;IACH,IAAW,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAE3C;IAED;;;;;;;;;OASG;IACI,iBAAiB,IAAI,aAAa,CAAC,OAAO,CAAC;IAQlD;;OAEG;IACI,YAAY,IAAI,aAAa,CAAC,OAAO,CAAC;IAS7C;;;;;;OAMG;IACI,0BAA0B,IAAI,MAAM;IAiC3C;;;OAGG;IACI,oBAAoB,IAAI,UAAU,GAAG,SAAS;IASrD;;;OAGG;IACI,kBAAkB,IAAI,QAAQ,GAAG,SAAS;IASjD;;;;;;;;;;OAUG;IACI,UAAU,IAAI,MAAM;IAI3B;;;;;;;OAOG;IACI,CAAC,uBAAuB,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAKnE;;;OAGG;IACH,SAAS,CAAC,uBAAuB,IAAI,oBAAoB;CAG1D;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,OAAO,CAAC;CAAG"}
@@ -224,6 +224,18 @@ class ApiItem {
224
224
  }
225
225
  return undefined;
226
226
  }
227
+ /**
228
+ * If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.
229
+ * Otherwise undefined is returned.
230
+ */
231
+ getAssociatedModel() {
232
+ for (let current = this; current !== undefined; current = current.parent) {
233
+ if (current.kind === ApiItemKind.Model) {
234
+ return current;
235
+ }
236
+ }
237
+ return undefined;
238
+ }
227
239
  /**
228
240
  * A text string whose value determines the sort order that is automatically applied by the
229
241
  * {@link (ApiItemContainerMixin:interface)} class.
@@ -1 +1 @@
1
- {"version":3,"file":"Ap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wBAC7B,sFAAsF;wBACtF,MAAM;oBACR;wBACE,IAAI,6CAAqB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;4BAChD,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;yBAC1B;iBACJ;aACF;YACD,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACzC;QAED,OAAO,aAAa,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,oBAAoB;QACzB,KAAK,IAAI,OAAO,GAAwB,IAAI,EAAE,OAAO,KAAK,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE;YAC7F,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,OAAO,EAAE;gBACxC,OAAO,OAAqB,CAAC;aAC9B;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;OAUG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACI,CAAC,+BAAuB,CAAC,CAAC,MAA2B;QAC1D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;IACvC,CAAC;IAED;;;OAGG;IACO,uBAAuB;QAC/B,MAAM,IAAI,iCAAa,CAAC,mEAAmE,CAAC,CAAC;IAC/F,CAAC;CACF;AA5OD,0BA4OC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport { Constructor, PropertiesOf } from '../mixins/Mixin';\nimport { ApiPackage } from '../model/ApiPackage';\nimport { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\nimport { DeserializerContext } from '../model/DeserializerContext';\nimport { InternalError } from '@rushstack/node-core-library';\nimport { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';\n\n/**\n * The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of\n * {@link ApiItem}.\n *\n * @public\n */\nexport enum ApiItemKind {\n CallSignature = 'CallSignature',\n Class = 'Class',\n Constructor = 'Constructor',\n ConstructSignature = 'ConstructSignature',\n EntryPoint = 'EntryPoint',\n Enum = 'Enum',\n EnumMember = 'EnumMember',\n Function = 'Function',\n IndexSignature = 'IndexSignature',\n Interface = 'Interface',\n Method = 'Method',\n MethodSignature = 'MethodSignature',\n Model = 'Model',\n Namespace = 'Namespace',\n Package = 'Package',\n Property = 'Property',\n PropertySignature = 'PropertySignature',\n TypeAlias = 'TypeAlias',\n Variable = 'Variable',\n None = 'None'\n}\n\n/**\n * Constructor options for {@link ApiItem}.\n * @public\n */\nexport interface IApiItemOptions {}\n\nexport interface IApiItemJson {\n kind: ApiItemKind;\n canonicalReference: string;\n}\n\n// PRIVATE - Allows ApiItemContainerMixin to assign the parent.\n//\nexport const apiItem_onParentChanged: unique symbol = Symbol('ApiItem._onAddToContainer');\n\n/**\n * The abstract base class for all members of an `ApiModel` object.\n *\n * @remarks\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations.\n * @public\n */\nexport class ApiItem {\n private _canonicalReference: DeclarationReference | undefined;\n private _parent: ApiItem | undefined;\n\n public constructor(options: IApiItemOptions) {\n // (\"options\" is not used here, but part of the inheritance pattern)\n }\n\n public static deserialize(jsonObject: IApiItemJson, context: DeserializerContext): ApiItem {\n // The Deserializer class is coupled with a ton of other classes, so we delay loading it\n // to avoid ES5 circular imports.\n const deserializerModule: typeof import('../model/Deserializer') = require('../model/Deserializer');\n return deserializerModule.Deserializer.deserialize(context, jsonObject);\n }\n\n /** @virtual */\n public static onDeserializeInto(\n options: Partial<IApiItemOptions>,\n context: DeserializerContext,\n jsonObject: IApiItemJson\n ): void {\n // (implemented by subclasses)\n }\n\n /** @virtual */\n public serializeInto(jsonObject: Partial<IApiItemJson>): void {\n jsonObject.kind = this.kind;\n jsonObject.canonicalReference = this.canonicalReference.toString();\n }\n\n /**\n * Identifies the subclass of the `ApiItem` base class.\n * @virtual\n */\n public get kind(): ApiItemKind {\n throw new Error('ApiItem.kind was not implemented by the child class');\n }\n\n /**\n * Warning: This API is used internally by API extractor but is not yet ready for general usage.\n *\n * @remarks\n *\n * Returns a `DeclarationReference` object using the experimental new declaration reference notation.\n *\n * @beta\n */\n public get canonicalReference(): DeclarationReference {\n if (!this._canonicalReference) {\n try {\n this._canonicalReference = this.buildCanonicalReference();\n } catch (e) {\n const name: string = this.getScopedNameWithinPackage() || this.displayName;\n throw new InternalError(`Error building canonical reference for ${name}:\\n` + (e as Error).message);\n }\n }\n return this._canonicalReference;\n }\n\n /**\n * Returns a string key that can be used to efficiently retrieve an `ApiItem` from an `ApiItemContainerMixin`.\n * The key is unique within the container. Its format is undocumented and may change at any time.\n *\n * @remarks\n * Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation\n * of this function, according to the aspects that are important for identifying it.\n *\n * @virtual\n */\n public get containerKey(): string {\n throw new InternalError('ApiItem.containerKey was not implemented by the child class');\n }\n\n /**\n * Returns a name for this object that can be used in diagnostic messages, for example.\n *\n * @remarks\n * For an object that inherits ApiNameMixin, this will return the declared name (e.g. the name of a TypeScript\n * function). Otherwise, it will return a string such as \"(call signature)\" or \"(model)\".\n *\n * @virtual\n */\n public get displayName(): string {\n switch (this.kind) {\n case ApiItemKind.CallSignature:\n return '(call)';\n case ApiItemKind.Constructor:\n return '(constructor)';\n case ApiItemKind.ConstructSignature:\n return '(new)';\n case ApiItemKind.IndexSignature:\n return '(indexer)';\n case ApiItemKind.Model:\n return '(model)';\n }\n return '(???)'; // All other types should inherit ApiNameMixin which will override this property\n }\n\n /**\n * If this item was added to a ApiItemContainerMixin item, then this returns the container item.\n * If this is an Parameter that was added to a method or function, then this returns the function item.\n * Otherwise, it returns undefined.\n * @virtual\n */\n public get parent(): ApiItem | undefined {\n return this._parent;\n }\n\n /**\n * This property supports a visitor pattern for walking the tree.\n * For items with ApiItemContainerMixin, it returns the contained items, sorted alphabetically.\n * Otherwise it returns an empty array.\n * @virtual\n */\n public get members(): ReadonlyArray<ApiItem> {\n return [];\n }\n\n /**\n * If this item has a name (i.e. extends `ApiNameMixin`), then return all items that have the same parent\n * and the same name. Otherwise, return all items that have the same parent and the same `ApiItemKind`.\n *\n * @remarks\n * Examples: For a function, this would return all overloads for the function. For a constructor, this would\n * return all overloads for the constructor. For a merged declaration (e.g. a `namespace` and `enum` with the\n * same name), this would return both declarations. If this item does not have a parent, or if it is the only\n * item of its name/kind, then the result is an array containing only this item.\n */\n public getMergedSiblings(): ReadonlyArray<ApiItem> {\n const parent: ApiItem | undefined = this._parent;\n if (parent && ApiItemContainerMixin.isBaseClassOf(parent)) {\n return parent._getMergedSiblingsForMember(this);\n }\n return [];\n }\n\n /**\n * Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.\n */\n public getHierarchy(): ReadonlyArray<ApiItem> {\n const hierarchy: ApiItem[] = [];\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n hierarchy.push(current);\n }\n hierarchy.reverse();\n return hierarchy;\n }\n\n /**\n * This returns a scoped name such as `\"Namespace1.Namespace2.MyClass.myMember()\"`. It does not include the\n * package name or entry point.\n *\n * @remarks\n * If called on an ApiEntrypoint, ApiPackage, or ApiModel item, the result is an empty string.\n */\n public getScopedNameWithinPackage(): string {\n const reversedParts: string[] = [];\n\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (\n current.kind === ApiItemKind.Model ||\n current.kind === ApiItemKind.Package ||\n current.kind === ApiItemKind.EntryPoint\n ) {\n break;\n }\n if (reversedParts.length !== 0) {\n reversedParts.push('.');\n } else {\n switch (current.kind) {\n case ApiItemKind.CallSignature:\n case ApiItemKind.ConstructSignature:\n case ApiItemKind.Constructor:\n case ApiItemKind.IndexSignature:\n // These functional forms don't have a proper name, so we don't append the \"()\" suffix\n break;\n default:\n if (ApiParameterListMixin.isBaseClassOf(current)) {\n reversedParts.push('()');\n }\n }\n }\n reversedParts.push(current.displayName);\n }\n\n return reversedParts.reverse().join('');\n }\n\n /**\n * If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned.\n * Otherwise undefined is returned.\n */\n public getAssociatedPackage(): ApiPackage | undefined {\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (current.kind === ApiItemKind.Package) {\n return current as ApiPackage;\n }\n }\n return undefined;\n }\n\n /**\n * A text string whose value determines the sort order that is automatically applied by the\n * {@link (ApiItemContainerMixin:interface)} class.\n *\n * @remarks\n * The value of this string is undocumented and may change at any time.\n * If {@link (ApiItemContainerMixin:interface).preserveMemberOrder} is enabled for the `ApiItem`'s parent,\n * then no sorting is performed, and this key is not used.\n *\n * @virtual\n */\n public getSortKey(): string {\n return this.containerKey;\n }\n\n /**\n * PRIVATE\n *\n * @privateRemarks\n * Allows ApiItemContainerMixin to assign the parent when the item is added to a container.\n *\n * @internal\n */\n public [apiItem_onParentChanged](parent: ApiItem | undefined): void {\n this._parent = parent;\n this._canonicalReference = undefined;\n }\n\n /**\n * Builds the cached object used by the `canonicalReference` property.\n * @virtual\n */\n protected buildCanonicalReference(): DeclarationReference {\n throw new InternalError('ApiItem.canonicalReference was not implemented by the child class');\n }\n}\n\n/**\n * This abstraction is used by the mixin pattern.\n * It describes a class type that inherits from {@link ApiItem}.\n *\n * @public\n */\nexport interface IApiItemConstructor extends Constructor<ApiItem>, PropertiesOf<typeof ApiItem> {}\n"]}
1
+ {"version":3,"file":"ApiItem.js","sourceRoot":"","sources":["../../src/items/ApiItem.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D,2EAAwE;AAExE,oEAA6D;AAC7D,2EAAwE;AAGxE;;;;;GAKG;AACH,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB,8CAA+B,CAAA;IAC/B,8BAAe,CAAA;IACf,0CAA2B,CAAA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AAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,oBAAoB;QACzB,KAAK,IAAI,OAAO,GAAwB,IAAI,EAAE,OAAO,KAAK,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE;YAC7F,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,OAAO,EAAE;gBACxC,OAAO,OAAqB,CAAC;aAC9B;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,KAAK,IAAI,OAAO,GAAwB,IAAI,EAAE,OAAO,KAAK,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE;YAC7F,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,KAAK,EAAE;gBACtC,OAAO,OAAmB,CAAC;aAC5B;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;OAUG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACI,CAAC,+BAAuB,CAAC,CAAC,MAA2B;QAC1D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;IACvC,CAAC;IAED;;;OAGG;IACO,uBAAuB;QAC/B,MAAM,IAAI,iCAAa,CAAC,mEAAmE,CAAC,CAAC;IAC/F,CAAC;CACF;AAzPD,0BAyPC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport { Constructor, PropertiesOf } from '../mixins/Mixin';\nimport { ApiPackage } from '../model/ApiPackage';\nimport { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\nimport { DeserializerContext } from '../model/DeserializerContext';\nimport { InternalError } from '@rushstack/node-core-library';\nimport { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';\nimport { ApiModel } from '../model/ApiModel';\n\n/**\n * The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of\n * {@link ApiItem}.\n *\n * @public\n */\nexport enum ApiItemKind {\n CallSignature = 'CallSignature',\n Class = 'Class',\n Constructor = 'Constructor',\n ConstructSignature = 'ConstructSignature',\n EntryPoint = 'EntryPoint',\n Enum = 'Enum',\n EnumMember = 'EnumMember',\n Function = 'Function',\n IndexSignature = 'IndexSignature',\n Interface = 'Interface',\n Method = 'Method',\n MethodSignature = 'MethodSignature',\n Model = 'Model',\n Namespace = 'Namespace',\n Package = 'Package',\n Property = 'Property',\n PropertySignature = 'PropertySignature',\n TypeAlias = 'TypeAlias',\n Variable = 'Variable',\n None = 'None'\n}\n\n/**\n * Constructor options for {@link ApiItem}.\n * @public\n */\nexport interface IApiItemOptions {}\n\nexport interface IApiItemJson {\n kind: ApiItemKind;\n canonicalReference: string;\n}\n\n// PRIVATE - Allows ApiItemContainerMixin to assign the parent.\n//\nexport const apiItem_onParentChanged: unique symbol = Symbol('ApiItem._onAddToContainer');\n\n/**\n * The abstract base class for all members of an `ApiModel` object.\n *\n * @remarks\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations.\n * @public\n */\nexport class ApiItem {\n private _canonicalReference: DeclarationReference | undefined;\n private _parent: ApiItem | undefined;\n\n public constructor(options: IApiItemOptions) {\n // (\"options\" is not used here, but part of the inheritance pattern)\n }\n\n public static deserialize(jsonObject: IApiItemJson, context: DeserializerContext): ApiItem {\n // The Deserializer class is coupled with a ton of other classes, so we delay loading it\n // to avoid ES5 circular imports.\n const deserializerModule: typeof import('../model/Deserializer') = require('../model/Deserializer');\n return deserializerModule.Deserializer.deserialize(context, jsonObject);\n }\n\n /** @virtual */\n public static onDeserializeInto(\n options: Partial<IApiItemOptions>,\n context: DeserializerContext,\n jsonObject: IApiItemJson\n ): void {\n // (implemented by subclasses)\n }\n\n /** @virtual */\n public serializeInto(jsonObject: Partial<IApiItemJson>): void {\n jsonObject.kind = this.kind;\n jsonObject.canonicalReference = this.canonicalReference.toString();\n }\n\n /**\n * Identifies the subclass of the `ApiItem` base class.\n * @virtual\n */\n public get kind(): ApiItemKind {\n throw new Error('ApiItem.kind was not implemented by the child class');\n }\n\n /**\n * Warning: This API is used internally by API extractor but is not yet ready for general usage.\n *\n * @remarks\n *\n * Returns a `DeclarationReference` object using the experimental new declaration reference notation.\n *\n * @beta\n */\n public get canonicalReference(): DeclarationReference {\n if (!this._canonicalReference) {\n try {\n this._canonicalReference = this.buildCanonicalReference();\n } catch (e) {\n const name: string = this.getScopedNameWithinPackage() || this.displayName;\n throw new InternalError(`Error building canonical reference for ${name}:\\n` + (e as Error).message);\n }\n }\n return this._canonicalReference;\n }\n\n /**\n * Returns a string key that can be used to efficiently retrieve an `ApiItem` from an `ApiItemContainerMixin`.\n * The key is unique within the container. Its format is undocumented and may change at any time.\n *\n * @remarks\n * Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation\n * of this function, according to the aspects that are important for identifying it.\n *\n * @virtual\n */\n public get containerKey(): string {\n throw new InternalError('ApiItem.containerKey was not implemented by the child class');\n }\n\n /**\n * Returns a name for this object that can be used in diagnostic messages, for example.\n *\n * @remarks\n * For an object that inherits ApiNameMixin, this will return the declared name (e.g. the name of a TypeScript\n * function). Otherwise, it will return a string such as \"(call signature)\" or \"(model)\".\n *\n * @virtual\n */\n public get displayName(): string {\n switch (this.kind) {\n case ApiItemKind.CallSignature:\n return '(call)';\n case ApiItemKind.Constructor:\n return '(constructor)';\n case ApiItemKind.ConstructSignature:\n return '(new)';\n case ApiItemKind.IndexSignature:\n return '(indexer)';\n case ApiItemKind.Model:\n return '(model)';\n }\n return '(???)'; // All other types should inherit ApiNameMixin which will override this property\n }\n\n /**\n * If this item was added to a ApiItemContainerMixin item, then this returns the container item.\n * If this is an Parameter that was added to a method or function, then this returns the function item.\n * Otherwise, it returns undefined.\n * @virtual\n */\n public get parent(): ApiItem | undefined {\n return this._parent;\n }\n\n /**\n * This property supports a visitor pattern for walking the tree.\n * For items with ApiItemContainerMixin, it returns the contained items, sorted alphabetically.\n * Otherwise it returns an empty array.\n * @virtual\n */\n public get members(): ReadonlyArray<ApiItem> {\n return [];\n }\n\n /**\n * If this item has a name (i.e. extends `ApiNameMixin`), then return all items that have the same parent\n * and the same name. Otherwise, return all items that have the same parent and the same `ApiItemKind`.\n *\n * @remarks\n * Examples: For a function, this would return all overloads for the function. For a constructor, this would\n * return all overloads for the constructor. For a merged declaration (e.g. a `namespace` and `enum` with the\n * same name), this would return both declarations. If this item does not have a parent, or if it is the only\n * item of its name/kind, then the result is an array containing only this item.\n */\n public getMergedSiblings(): ReadonlyArray<ApiItem> {\n const parent: ApiItem | undefined = this._parent;\n if (parent && ApiItemContainerMixin.isBaseClassOf(parent)) {\n return parent._getMergedSiblingsForMember(this);\n }\n return [];\n }\n\n /**\n * Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.\n */\n public getHierarchy(): ReadonlyArray<ApiItem> {\n const hierarchy: ApiItem[] = [];\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n hierarchy.push(current);\n }\n hierarchy.reverse();\n return hierarchy;\n }\n\n /**\n * This returns a scoped name such as `\"Namespace1.Namespace2.MyClass.myMember()\"`. It does not include the\n * package name or entry point.\n *\n * @remarks\n * If called on an ApiEntrypoint, ApiPackage, or ApiModel item, the result is an empty string.\n */\n public getScopedNameWithinPackage(): string {\n const reversedParts: string[] = [];\n\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (\n current.kind === ApiItemKind.Model ||\n current.kind === ApiItemKind.Package ||\n current.kind === ApiItemKind.EntryPoint\n ) {\n break;\n }\n if (reversedParts.length !== 0) {\n reversedParts.push('.');\n } else {\n switch (current.kind) {\n case ApiItemKind.CallSignature:\n case ApiItemKind.ConstructSignature:\n case ApiItemKind.Constructor:\n case ApiItemKind.IndexSignature:\n // These functional forms don't have a proper name, so we don't append the \"()\" suffix\n break;\n default:\n if (ApiParameterListMixin.isBaseClassOf(current)) {\n reversedParts.push('()');\n }\n }\n }\n reversedParts.push(current.displayName);\n }\n\n return reversedParts.reverse().join('');\n }\n\n /**\n * If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned.\n * Otherwise undefined is returned.\n */\n public getAssociatedPackage(): ApiPackage | undefined {\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (current.kind === ApiItemKind.Package) {\n return current as ApiPackage;\n }\n }\n return undefined;\n }\n\n /**\n * If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned.\n * Otherwise undefined is returned.\n */\n public getAssociatedModel(): ApiModel | undefined {\n for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {\n if (current.kind === ApiItemKind.Model) {\n return current as ApiModel;\n }\n }\n return undefined;\n }\n\n /**\n * A text string whose value determines the sort order that is automatically applied by the\n * {@link (ApiItemContainerMixin:interface)} class.\n *\n * @remarks\n * The value of this string is undocumented and may change at any time.\n * If {@link (ApiItemContainerMixin:interface).preserveMemberOrder} is enabled for the `ApiItem`'s parent,\n * then no sorting is performed, and this key is not used.\n *\n * @virtual\n */\n public getSortKey(): string {\n return this.containerKey;\n }\n\n /**\n * PRIVATE\n *\n * @privateRemarks\n * Allows ApiItemContainerMixin to assign the parent when the item is added to a container.\n *\n * @internal\n */\n public [apiItem_onParentChanged](parent: ApiItem | undefined): void {\n this._parent = parent;\n this._canonicalReference = undefined;\n }\n\n /**\n * Builds the cached object used by the `canonicalReference` property.\n * @virtual\n */\n protected buildCanonicalReference(): DeclarationReference {\n throw new InternalError('ApiItem.canonicalReference was not implemented by the child class');\n }\n}\n\n/**\n * This abstraction is used by the mixin pattern.\n * It describes a class type that inherits from {@link ApiItem}.\n *\n * @public\n */\nexport interface IApiItemConstructor extends Constructor<ApiItem>, PropertiesOf<typeof ApiItem> {}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { ApiItem, IApiItemJson, IApiItemOptions, IApiItemConstructor } from '../items/ApiItem';
2
+ import { IFindApiItemsResult } from './IFindApiItemsResult';
2
3
  /**
3
4
  * Constructor options for {@link (ApiItemContainerMixin:interface)}.
4
5
  * @public
@@ -67,6 +68,63 @@ export interface ApiItemContainerMixin extends ApiItem {
67
68
  * Returns a list of members with the specified name.
68
69
  */
69
70
  findMembersByName(name: string): ReadonlyArray<ApiItem>;
71
+ /**
72
+ * Finds all of the ApiItem's immediate and inherited members by walking up the inheritance tree.
73
+ *
74
+ * @remarks
75
+ *
76
+ * Given the following class heritage:
77
+ *
78
+ * ```
79
+ * export class A {
80
+ * public a: number|boolean;
81
+ * }
82
+ *
83
+ * export class B extends A {
84
+ * public a: number;
85
+ * public b: string;
86
+ * }
87
+ *
88
+ * export class C extends B {
89
+ * public c: boolean;
90
+ * }
91
+ * ```
92
+ *
93
+ * Calling `findMembersWithInheritance` on `C` will return `B.a`, `B.b`, and `C.c`. Calling the
94
+ * method on `B` will return `B.a` and `B.b`. And calling the method on `A` will return just
95
+ * `A.a`.
96
+ *
97
+ * The inherited members returned by this method may be incomplete. If so, there will be a flag
98
+ * on the result object indicating this as well as messages explaining the errors in more detail.
99
+ * Some scenarios include:
100
+ *
101
+ * - Interface extending from a type alias.
102
+ *
103
+ * - Class extending from a variable.
104
+ *
105
+ * - Extending from a declaration not present in the model (e.g. external package).
106
+ *
107
+ * - Extending from an unexported declaration (e.g. ae-forgotten-export). Common in mixin
108
+ * patterns.
109
+ *
110
+ * - Unexpected runtime errors...
111
+ *
112
+ * Lastly, be aware that the types of inherited members are returned with respect to their
113
+ * defining class as opposed to with respect to the inheriting class. For example, consider
114
+ * the following:
115
+ *
116
+ * ```
117
+ * export class A<T> {
118
+ * public a: T;
119
+ * }
120
+ *
121
+ * export class B extends A<number> {}
122
+ * ```
123
+ *
124
+ * When called on `B`, this method will return `B.a` with type `T` as opposed to type
125
+ * `number`, although the latter is more accurate.
126
+ */
127
+ findMembersWithInheritance(): IFindApiItemsResult;
70
128
  /**
71
129
  * For a given member of this container, return its `ApiItem.getMergedSiblings()` list.
72
130
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"ApiItemContainerMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiItemContainerMixin.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EAEP,YAAY,EACZ,eAAe,EACf,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAK1B;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,eAAe;IACpE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AASD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IAEtC;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAEjC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAE7D;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAExD;;;OAGG;IACH,2BAA2B,CAAC,aAAa,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAE5E,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,mBAAmB,EAC1E,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CA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ACH,2BAA2B,CAAC,aAAa,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAE5E,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,mBAAmB,EAC1E,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,qBAAqB,CAAC,CAqU9D;AAED;;;GAGG;AACH,yBAAiB,qBAAqB,CAAC;IACrC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAEhF;CACF"}
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ApiItemContainerMixin = void 0;
6
6
  const ApiItem_1 = require("../items/ApiItem");
7
7
  const ApiNameMixin_1 = require("./ApiNameMixin");
8
+ const Excerpt_1 = require("./Excerpt");
9
+ const IFindApiItemsResult_1 = require("./IFindApiItemsResult");
8
10
  const node_core_library_1 = require("@rushstack/node-core-library");
9
11
  const _members = Symbol('ApiItemContainerMixin._members');
10
12
  const _membersSorted = Symbol('ApiItemContainerMixin._membersSorted');
@@ -82,6 +84,147 @@ function ApiItemContainerMixin(baseClass
82
84
  this._ensureMemberMaps();
83
85
  return this[_membersByName].get(name) || [];
84
86
  }
87
+ findMembersWithInheritance() {
88
+ const messages = [];
89
+ let maybeIncompleteResult = false;
90
+ const membersByName = new Map();
91
+ const membersByKind = new Map();
92
+ const toVisit = [];
93
+ let next = this;
94
+ while (next) {
95
+ const membersToAdd = [];
96
+ // For each member, check to see if we've already seen a member with the same name
97
+ // previously in the inheritance tree. If so, we know we won't inherit it, and thus
98
+ // do not add it to our `membersToAdd` array.
99
+ for (const member of next.members) {
100
+ // We add the to-be-added members to an intermediate array instead of immediately
101
+ // to the maps themselves to support method overloads with the same name.
102
+ if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
103
+ if (!membersByName.has(member.name)) {
104
+ membersToAdd.push(member);
105
+ }
106
+ }
107
+ else {
108
+ if (!membersByKind.has(member.kind)) {
109
+ membersToAdd.push(member);
110
+ }
111
+ }
112
+ }
113
+ for (const member of membersToAdd) {
114
+ if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
115
+ const members = membersByName.get(member.name) || [];
116
+ members.push(member);
117
+ membersByName.set(member.name, members);
118
+ }
119
+ else {
120
+ const members = membersByKind.get(member.kind) || [];
121
+ members.push(member);
122
+ membersByKind.set(member.kind, members);
123
+ }
124
+ }
125
+ // Interfaces can extend multiple interfaces, so iterate through all of them.
126
+ const extendedItems = [];
127
+ let extendsTypes;
128
+ switch (next.kind) {
129
+ case ApiItem_1.ApiItemKind.Class: {
130
+ const apiClass = next;
131
+ extendsTypes = apiClass.extendsType ? [apiClass.extendsType] : [];
132
+ break;
133
+ }
134
+ case ApiItem_1.ApiItemKind.Interface: {
135
+ const apiInterface = next;
136
+ extendsTypes = apiInterface.extendsTypes;
137
+ break;
138
+ }
139
+ }
140
+ if (extendsTypes === undefined) {
141
+ messages.push({
142
+ messageId: IFindApiItemsResult_1.FindApiItemsMessageId.UnsupportedKind,
143
+ text: `Item ${next.displayName} is of unsupported kind ${next.kind}.`
144
+ });
145
+ maybeIncompleteResult = true;
146
+ break;
147
+ }
148
+ for (const extendsType of extendsTypes) {
149
+ // We want to find the reference token associated with the actual inherited declaration.
150
+ // In every case we support, this is the first reference token. For example:
151
+ //
152
+ // ```
153
+ // export class A extends B {}
154
+ // ^
155
+ // export class A extends B<C> {}
156
+ // ^
157
+ // export class A extends B.C {}
158
+ // ^^^
159
+ // ```
160
+ const firstReferenceToken = extendsType.excerpt.spannedTokens.find((token) => {
161
+ return token.kind === Excerpt_1.ExcerptTokenKind.Reference && token.canonicalReference;
162
+ });
163
+ if (!firstReferenceToken) {
164
+ messages.push({
165
+ messageId: IFindApiItemsResult_1.FindApiItemsMessageId.UnexpectedExcerptTokens,
166
+ text: `Encountered unexpected excerpt tokens in ${next.displayName}. Excerpt: ${extendsType.excerpt.text}.`
167
+ });
168
+ maybeIncompleteResult = true;
169
+ continue;
170
+ }
171
+ const apiModel = this.getAssociatedModel();
172
+ if (!apiModel) {
173
+ messages.push({
174
+ messageId: IFindApiItemsResult_1.FindApiItemsMessageId.MissingApiModel,
175
+ text: `Unable to get the associated model of ${next.displayName}.`
176
+ });
177
+ maybeIncompleteResult = true;
178
+ continue;
179
+ }
180
+ const apiItemResult = apiModel.resolveDeclarationReference(firstReferenceToken.canonicalReference, undefined);
181
+ const apiItem = apiItemResult.resolvedApiItem;
182
+ if (!apiItem) {
183
+ messages.push({
184
+ messageId: IFindApiItemsResult_1.FindApiItemsMessageId.DeclarationResolutionFailed,
185
+ text: `Declaration resolution failed for ${next.displayName}. Error message: ${apiItemResult.errorMessage}.`
186
+ });
187
+ maybeIncompleteResult = true;
188
+ continue;
189
+ }
190
+ extendedItems.push(apiItem);
191
+ }
192
+ // For classes, this array will only have one item. For interfaces, there may be multiple items. Sort the array
193
+ // into alphabetical order before adding to our list of API items to visit. This ensures that in the case
194
+ // of multiple interface inheritance, a member inherited from multiple interfaces is attributed to the interface
195
+ // earlier in alphabetical order (as opposed to source order).
196
+ //
197
+ // For example, in the code block below, `Bar.x` is reported as the inherited item, not `Foo.x`.
198
+ //
199
+ // ```
200
+ // interface Foo {
201
+ // public x: string;
202
+ // }
203
+ //
204
+ // interface Bar {
205
+ // public x: string;
206
+ // }
207
+ //
208
+ // interface FooBar extends Foo, Bar {}
209
+ // ```
210
+ node_core_library_1.LegacyAdapters.sortStable(extendedItems, (x, y) => x.getSortKey().localeCompare(y.getSortKey()));
211
+ toVisit.push(...extendedItems);
212
+ next = toVisit.shift();
213
+ }
214
+ const items = [];
215
+ for (const members of membersByName.values()) {
216
+ items.push(...members);
217
+ }
218
+ for (const members of membersByKind.values()) {
219
+ items.push(...members);
220
+ }
221
+ node_core_library_1.LegacyAdapters.sortStable(items, (x, y) => x.getSortKey().localeCompare(y.getSortKey()));
222
+ return {
223
+ items,
224
+ messages,
225
+ maybeIncompleteResult
226
+ };
227
+ }
85
228
  /** @internal */
86
229
  _getMergedSiblingsForMember(memberApiItem) {
87
230
  this._ensureMemberMaps();
@@ -1 +1 @@
1
- {"version":3,"file":"ApiItemContainerMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiItemContainerMixin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,4DAA4D;;;AAE5D,8CAO0B;AAC1B,iDAA8C;AAE9C,oEAA6E;AAgB7E,MAAM,QAAQ,GAAkB,MAAM,CAAC,gCAAgC,CAAC,CAAC;AACzE,MAAM,cAAc,GAAkB,MAAM,CAAC,sCAAsC,CAAC,CAAC;AACrF,MAAM,sBAAsB,GAAkB,MAAM,CAAC,8CAA8C,CAAC,CAAC;AACrG,MAAM,cAAc,GAAkB,MAAM,CAAC,sCAAsC,CAAC,CAAC;AACrF,MAAM,cAAc,GAAkB,MAAM,CAAC,sCAAsC,CAAC,CAAC;AACrF,MAAM,oBAAoB,GAAkB,MAAM,CAAC,4CAA4C,CAAC,CAAC;AAyEjG;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,SAAqB;AACrB,8DAA8D;;IAE9D,MAAM,UAAW,SAAQ,SAAS;QAchC,8DAA8D;QAC9D,YAAmB,GAAG,IAAW;;YAC/B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACf,MAAM,OAAO,GAAkC,IAAI,CAAC,CAAC,CAAkC,CAAC;YAExF,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;YAC7B,IAAI,CAAC,sBAAsB,CAAC,GAAG,IAAI,GAAG,EAAmB,CAAC;YAC1D,IAAI,CAAC,oBAAoB,CAAC,GAAG,MAAA,OAAO,CAAC,mBAAmB,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AAM,aAAa,GAAmB,EAAE,CAAC;YAEzC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;gBACjC,MAAM,gBAAgB,GAA0B,EAAE,CAAC;gBACnD,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;gBACvC,aAAa,CAAC,IAAI,CAAC,gBAAgC,CAAC,CAAC;aACtD;YAED,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC1D,UAAU,CAAC,OAAO,GAAG,aAAa,CAAC;QACrC,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAjKD,sDAiKC;AAED;;;GAGG;AACH,WAAiB,qBAAqB;IACpC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAFe,mCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAarC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.s\n\nimport {\n ApiItem,\n apiItem_onParentChanged,\n IApiItemJson,\n IApiItemOptions,\n IApiItemConstructor,\n ApiItemKind\n} from '../items/ApiItem';\nimport { ApiNameMixin } from './ApiNameMixin';\nimport { DeserializerContext } from '../model/DeserializerContext';\nimport { InternalError, LegacyAdapters } from '@rushstack/node-core-library';\n\n/**\n * Constructor options for {@link (ApiItemContainerMixin:interface)}.\n * @public\n */\nexport interface IApiItemContainerMixinOptions extends IApiItemOptions {\n preserveMemberOrder?: boolean;\n members?: ApiItem[];\n}\n\nexport interface IApiItemContainerJson extends IApiItemJson {\n preserveMemberOrder?: boolean;\n members: IApiItemJson[];\n}\n\nconst _members: unique symbol = Symbol('ApiItemContainerMixin._members');\nconst _membersSorted: unique symbol = Symbol('ApiItemContainerMixin._membersSorted');\nconst _membersByContainerKey: unique symbol = Symbol('ApiItemContainerMixin._membersByContainerKey');\nconst _membersByName: unique symbol = Symbol('ApiItemContainerMixin._membersByName');\nconst _membersByKind: unique symbol = Symbol('ApiItemContainerMixin._membersByKind');\nconst _preserveMemberOrder: unique symbol = Symbol('ApiItemContainerMixin._preserveMemberOrder');\n\n/**\n * The mixin base class for API items that act as containers for other child items.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * Examples of `ApiItemContainerMixin` child classes include `ApiModel`, `ApiPackage`, `ApiEntryPoint`,\n * and `ApiEnum`. But note that `Parameter` is not considered a \"member\" of an `ApiMethod`; this relationship\n * is modeled using {@link (ApiParameterListMixin:interface).parameters} instead\n * of {@link ApiItem.members}.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiItemContainerMixin extends ApiItem {\n /**\n * Disables automatic sorting of {@link ApiItem.members}.\n *\n * @remarks\n * By default `ApiItemContainerMixin` will automatically sort its members according to their\n * {@link ApiItem.getSortKey} string, which provides a standardized mostly alphabetical ordering\n * that is appropriate for most API items. When loading older .api.json files the automatic sorting\n * is reapplied and may update the ordering.\n *\n * Set `preserveMemberOrder` to true to disable automatic sorting for this container; instead, the\n * members will retain whatever ordering appeared in the {@link IApiItemContainerMixinOptions.members} array.\n * The `preserveMemberOrder` option is saved in the .api.json file.\n */\n readonly preserveMemberOrder: boolean;\n\n /**\n * Adds a new member to the container.\n *\n * @remarks\n * An ApiItem cannot be added to more than one container.\n */\n addMember(member: ApiItem): void;\n\n /**\n * Attempts to retrieve a member using its containerKey, or returns `undefined` if no matching member was found.\n *\n * @remarks\n * Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation\n * of this function, according to the aspects that are important for identifying it.\n *\n * See {@link ApiItem.containerKey} for more information.\n */\n tryGetMemberByKey(containerKey: string): ApiItem | undefined;\n\n /**\n * Returns a list of members with the specified name.\n */\n findMembersByName(name: string): ReadonlyArray<ApiItem>;\n\n /**\n * For a given member of this container, return its `ApiItem.getMergedSiblings()` list.\n * @internal\n */\n _getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem>;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link ApiDeclaredItem}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiItemContainerMixin) {\n class MixedClass extends baseClass implements ApiItemContainerMixin {\n public readonly [_members]: ApiItem[];\n public [_membersSorted]: boolean;\n public [_membersByContainerKey]: Map<string, ApiItem>;\n public [_preserveMemberOrder]: boolean;\n\n // For members of this container that extend ApiNameMixin, this stores the list of members with a given name.\n // Examples include merged declarations, overloaded functions, etc.\n public [_membersByName]: Map<string, ApiItem[]> | undefined;\n\n // For members of this container that do NOT extend ApiNameMixin, this stores the list of members\n // that share a common ApiItemKind. Examples include overloaded constructors or index signatures.\n public [_membersByKind]: Map<string, ApiItem[]> | undefined; // key is ApiItemKind\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n const options: IApiItemContainerMixinOptions = args[0] as IApiItemContainerMixinOptions;\n\n this[_members] = [];\n this[_membersSorted] = false;\n this[_membersByContainerKey] = new Map<string, ApiItem>();\n this[_preserveMemberOrder] = options.preserveMemberOrder ?? false;\n\n if (options.members) {\n for (const member of options.members) {\n this.addMember(member);\n }\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiItemContainerMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiItemContainerJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n options.preserveMemberOrder = jsonObject.preserveMemberOrder;\n options.members = [];\n for (const memberObject of jsonObject.members) {\n options.members.push(ApiItem.deserialize(memberObject, context));\n }\n }\n\n /** @override */\n public get members(): ReadonlyArray<ApiItem> {\n if (!this[_membersSorted] && !this[_preserveMemberOrder]) {\n LegacyAdapters.sortStable(this[_members], (x, y) => x.getSortKey().localeCompare(y.getSortKey()));\n this[_membersSorted] = true;\n }\n\n return this[_members];\n }\n\n public get preserveMemberOrder(): boolean {\n return this[_preserveMemberOrder];\n }\n\n public addMember(member: ApiItem): void {\n if (this[_membersByContainerKey].has(member.containerKey)) {\n throw new Error(\n `Another member has already been added with the same name (${member.displayName})` +\n ` and containerKey (${member.containerKey})`\n );\n }\n\n const existingParent: ApiItem | undefined = member.parent;\n if (existingParent !== undefined) {\n throw new Error(\n `This item has already been added to another container: \"${existingParent.displayName}\"`\n );\n }\n\n this[_members].push(member);\n this[_membersByName] = undefined; // invalidate the lookup\n this[_membersByKind] = undefined; // invalidate the lookup\n this[_membersSorted] = false;\n this[_membersByContainerKey].set(member.containerKey, member);\n\n member[apiItem_onParentChanged](this);\n }\n\n public tryGetMemberByKey(containerKey: string): ApiItem | undefined {\n return this[_membersByContainerKey].get(containerKey);\n }\n\n public findMembersByName(name: string): ReadonlyArray<ApiItem> {\n this._ensureMemberMaps();\n return this[_membersByName]!.get(name) || [];\n }\n\n /** @internal */\n public _getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem> {\n this._ensureMemberMaps();\n let result: ApiItem[] | undefined;\n if (ApiNameMixin.isBaseClassOf(memberApiItem)) {\n result = this[_membersByName]!.get(memberApiItem.name);\n } else {\n result = this[_membersByKind]!.get(memberApiItem.kind);\n }\n if (!result) {\n throw new InternalError('Item was not found in the _membersByName/_membersByKind lookup');\n }\n return result;\n }\n\n /** @internal */\n public _ensureMemberMaps(): void {\n // Build the _membersByName and _membersByKind tables if they don't already exist\n if (this[_membersByName] === undefined) {\n const membersByName: Map<string, ApiItem[]> = new Map<string, ApiItem[]>();\n const membersByKind: Map<string, ApiItem[]> = new Map<string, ApiItem[]>();\n\n for (const member of this[_members]) {\n let map: Map<string, ApiItem[]> | Map<ApiItemKind, ApiItem[]>;\n let key: string | ApiItemKind;\n\n if (ApiNameMixin.isBaseClassOf(member)) {\n map = membersByName;\n key = member.name;\n } else {\n map = membersByKind;\n key = member.kind;\n }\n\n let list: ApiItem[] | undefined = map.get(key);\n if (list === undefined) {\n list = [];\n map.set(key, list);\n }\n list.push(member);\n }\n\n this[_membersByName] = membersByName;\n this[_membersByKind] = membersByKind;\n }\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiItemContainerJson>): void {\n super.serializeInto(jsonObject);\n\n const memberObjects: IApiItemJson[] = [];\n\n for (const member of this.members) {\n const memberJsonObject: Partial<IApiItemJson> = {};\n member.serializeInto(memberJsonObject);\n memberObjects.push(memberJsonObject as IApiItemJson);\n }\n\n jsonObject.preserveMemberOrder = this.preserveMemberOrder;\n jsonObject.members = memberObjects;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiItemContainerMixin:interface)}.\n * @public\n */\nexport namespace ApiItemContainerMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiItemContainerMixin {\n return apiItem.hasOwnProperty(_members);\n }\n}\n"]}
1
+ {"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O,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAFe,mCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAarC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.s\n\nimport {\n ApiItem,\n apiItem_onParentChanged,\n IApiItemJson,\n IApiItemOptions,\n IApiItemConstructor,\n ApiItemKind\n} from '../items/ApiItem';\nimport { ApiNameMixin } from './ApiNameMixin';\nimport { DeserializerContext } from '../model/DeserializerContext';\nimport { ApiModel } from '../model/ApiModel';\nimport { ApiClass } from '../model/ApiClass';\nimport { ApiInterface } from '../model/ApiInterface';\nimport { ExcerptToken, ExcerptTokenKind } from './Excerpt';\nimport { IFindApiItemsResult, IFindApiItemsMessage, FindApiItemsMessageId } from './IFindApiItemsResult';\nimport { InternalError, LegacyAdapters } from '@rushstack/node-core-library';\nimport { HeritageType } from '../model/HeritageType';\nimport { IResolveDeclarationReferenceResult } from '../model/ModelReferenceResolver';\n\n/**\n * Constructor options for {@link (ApiItemContainerMixin:interface)}.\n * @public\n */\nexport interface IApiItemContainerMixinOptions extends IApiItemOptions {\n preserveMemberOrder?: boolean;\n members?: ApiItem[];\n}\n\nexport interface IApiItemContainerJson extends IApiItemJson {\n preserveMemberOrder?: boolean;\n members: IApiItemJson[];\n}\n\nconst _members: unique symbol = Symbol('ApiItemContainerMixin._members');\nconst _membersSorted: unique symbol = Symbol('ApiItemContainerMixin._membersSorted');\nconst _membersByContainerKey: unique symbol = Symbol('ApiItemContainerMixin._membersByContainerKey');\nconst _membersByName: unique symbol = Symbol('ApiItemContainerMixin._membersByName');\nconst _membersByKind: unique symbol = Symbol('ApiItemContainerMixin._membersByKind');\nconst _preserveMemberOrder: unique symbol = Symbol('ApiItemContainerMixin._preserveMemberOrder');\n\n/**\n * The mixin base class for API items that act as containers for other child items.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * Examples of `ApiItemContainerMixin` child classes include `ApiModel`, `ApiPackage`, `ApiEntryPoint`,\n * and `ApiEnum`. But note that `Parameter` is not considered a \"member\" of an `ApiMethod`; this relationship\n * is modeled using {@link (ApiParameterListMixin:interface).parameters} instead\n * of {@link ApiItem.members}.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiItemContainerMixin extends ApiItem {\n /**\n * Disables automatic sorting of {@link ApiItem.members}.\n *\n * @remarks\n * By default `ApiItemContainerMixin` will automatically sort its members according to their\n * {@link ApiItem.getSortKey} string, which provides a standardized mostly alphabetical ordering\n * that is appropriate for most API items. When loading older .api.json files the automatic sorting\n * is reapplied and may update the ordering.\n *\n * Set `preserveMemberOrder` to true to disable automatic sorting for this container; instead, the\n * members will retain whatever ordering appeared in the {@link IApiItemContainerMixinOptions.members} array.\n * The `preserveMemberOrder` option is saved in the .api.json file.\n */\n readonly preserveMemberOrder: boolean;\n\n /**\n * Adds a new member to the container.\n *\n * @remarks\n * An ApiItem cannot be added to more than one container.\n */\n addMember(member: ApiItem): void;\n\n /**\n * Attempts to retrieve a member using its containerKey, or returns `undefined` if no matching member was found.\n *\n * @remarks\n * Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation\n * of this function, according to the aspects that are important for identifying it.\n *\n * See {@link ApiItem.containerKey} for more information.\n */\n tryGetMemberByKey(containerKey: string): ApiItem | undefined;\n\n /**\n * Returns a list of members with the specified name.\n */\n findMembersByName(name: string): ReadonlyArray<ApiItem>;\n\n /**\n * Finds all of the ApiItem's immediate and inherited members by walking up the inheritance tree.\n *\n * @remarks\n *\n * Given the following class heritage:\n *\n * ```\n * export class A {\n * public a: number|boolean;\n * }\n *\n * export class B extends A {\n * public a: number;\n * public b: string;\n * }\n *\n * export class C extends B {\n * public c: boolean;\n * }\n * ```\n *\n * Calling `findMembersWithInheritance` on `C` will return `B.a`, `B.b`, and `C.c`. Calling the\n * method on `B` will return `B.a` and `B.b`. And calling the method on `A` will return just\n * `A.a`.\n *\n * The inherited members returned by this method may be incomplete. If so, there will be a flag\n * on the result object indicating this as well as messages explaining the errors in more detail.\n * Some scenarios include:\n *\n * - Interface extending from a type alias.\n *\n * - Class extending from a variable.\n *\n * - Extending from a declaration not present in the model (e.g. external package).\n *\n * - Extending from an unexported declaration (e.g. ae-forgotten-export). Common in mixin\n * patterns.\n *\n * - Unexpected runtime errors...\n *\n * Lastly, be aware that the types of inherited members are returned with respect to their\n * defining class as opposed to with respect to the inheriting class. For example, consider\n * the following:\n *\n * ```\n * export class A<T> {\n * public a: T;\n * }\n *\n * export class B extends A<number> {}\n * ```\n *\n * When called on `B`, this method will return `B.a` with type `T` as opposed to type\n * `number`, although the latter is more accurate.\n */\n findMembersWithInheritance(): IFindApiItemsResult;\n\n /**\n * For a given member of this container, return its `ApiItem.getMergedSiblings()` list.\n * @internal\n */\n _getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem>;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link ApiDeclaredItem}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiItemContainerMixin) {\n class MixedClass extends baseClass implements ApiItemContainerMixin {\n public readonly [_members]: ApiItem[];\n public [_membersSorted]: boolean;\n public [_membersByContainerKey]: Map<string, ApiItem>;\n public [_preserveMemberOrder]: boolean;\n\n // For members of this container that extend ApiNameMixin, this stores the list of members with a given name.\n // Examples include merged declarations, overloaded functions, etc.\n public [_membersByName]: Map<string, ApiItem[]> | undefined;\n\n // For members of this container that do NOT extend ApiNameMixin, this stores the list of members\n // that share a common ApiItemKind. Examples include overloaded constructors or index signatures.\n public [_membersByKind]: Map<string, ApiItem[]> | undefined; // key is ApiItemKind\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n const options: IApiItemContainerMixinOptions = args[0] as IApiItemContainerMixinOptions;\n\n this[_members] = [];\n this[_membersSorted] = false;\n this[_membersByContainerKey] = new Map<string, ApiItem>();\n this[_preserveMemberOrder] = options.preserveMemberOrder ?? false;\n\n if (options.members) {\n for (const member of options.members) {\n this.addMember(member);\n }\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiItemContainerMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiItemContainerJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n options.preserveMemberOrder = jsonObject.preserveMemberOrder;\n options.members = [];\n for (const memberObject of jsonObject.members) {\n options.members.push(ApiItem.deserialize(memberObject, context));\n }\n }\n\n /** @override */\n public get members(): ReadonlyArray<ApiItem> {\n if (!this[_membersSorted] && !this[_preserveMemberOrder]) {\n LegacyAdapters.sortStable(this[_members], (x, y) => x.getSortKey().localeCompare(y.getSortKey()));\n this[_membersSorted] = true;\n }\n\n return this[_members];\n }\n\n public get preserveMemberOrder(): boolean {\n return this[_preserveMemberOrder];\n }\n\n public addMember(member: ApiItem): void {\n if (this[_membersByContainerKey].has(member.containerKey)) {\n throw new Error(\n `Another member has already been added with the same name (${member.displayName})` +\n ` and containerKey (${member.containerKey})`\n );\n }\n\n const existingParent: ApiItem | undefined = member.parent;\n if (existingParent !== undefined) {\n throw new Error(\n `This item has already been added to another container: \"${existingParent.displayName}\"`\n );\n }\n\n this[_members].push(member);\n this[_membersByName] = undefined; // invalidate the lookup\n this[_membersByKind] = undefined; // invalidate the lookup\n this[_membersSorted] = false;\n this[_membersByContainerKey].set(member.containerKey, member);\n\n member[apiItem_onParentChanged](this);\n }\n\n public tryGetMemberByKey(containerKey: string): ApiItem | undefined {\n return this[_membersByContainerKey].get(containerKey);\n }\n\n public findMembersByName(name: string): ReadonlyArray<ApiItem> {\n this._ensureMemberMaps();\n return this[_membersByName]!.get(name) || [];\n }\n\n public findMembersWithInheritance(): IFindApiItemsResult {\n const messages: IFindApiItemsMessage[] = [];\n let maybeIncompleteResult: boolean = false;\n\n const membersByName: Map<string, ApiItem[]> = new Map();\n const membersByKind: Map<ApiItemKind, ApiItem[]> = new Map();\n\n const toVisit: ApiItem[] = [];\n let next: ApiItem | undefined = this;\n\n while (next) {\n const membersToAdd: ApiItem[] = [];\n\n // For each member, check to see if we've already seen a member with the same name\n // previously in the inheritance tree. If so, we know we won't inherit it, and thus\n // do not add it to our `membersToAdd` array.\n for (const member of next.members) {\n // We add the to-be-added members to an intermediate array instead of immediately\n // to the maps themselves to support method overloads with the same name.\n if (ApiNameMixin.isBaseClassOf(member)) {\n if (!membersByName.has(member.name)) {\n membersToAdd.push(member);\n }\n } else {\n if (!membersByKind.has(member.kind)) {\n membersToAdd.push(member);\n }\n }\n }\n\n for (const member of membersToAdd) {\n if (ApiNameMixin.isBaseClassOf(member)) {\n const members: ApiItem[] = membersByName.get(member.name) || [];\n members.push(member);\n membersByName.set(member.name, members);\n } else {\n const members: ApiItem[] = membersByKind.get(member.kind) || [];\n members.push(member);\n membersByKind.set(member.kind, members);\n }\n }\n\n // Interfaces can extend multiple interfaces, so iterate through all of them.\n const extendedItems: ApiItem[] = [];\n let extendsTypes: readonly HeritageType[] | undefined;\n\n switch (next.kind) {\n case ApiItemKind.Class: {\n const apiClass: ApiClass = next as ApiClass;\n extendsTypes = apiClass.extendsType ? [apiClass.extendsType] : [];\n break;\n }\n case ApiItemKind.Interface: {\n const apiInterface: ApiInterface = next as ApiInterface;\n extendsTypes = apiInterface.extendsTypes;\n break;\n }\n }\n\n if (extendsTypes === undefined) {\n messages.push({\n messageId: FindApiItemsMessageId.UnsupportedKind,\n text: `Item ${next.displayName} is of unsupported kind ${next.kind}.`\n });\n maybeIncompleteResult = true;\n break;\n }\n\n for (const extendsType of extendsTypes) {\n // We want to find the reference token associated with the actual inherited declaration.\n // In every case we support, this is the first reference token. For example:\n //\n // ```\n // export class A extends B {}\n // ^\n // export class A extends B<C> {}\n // ^\n // export class A extends B.C {}\n // ^^^\n // ```\n const firstReferenceToken: ExcerptToken | undefined = extendsType.excerpt.spannedTokens.find(\n (token: ExcerptToken) => {\n return token.kind === ExcerptTokenKind.Reference && token.canonicalReference;\n }\n );\n\n if (!firstReferenceToken) {\n messages.push({\n messageId: FindApiItemsMessageId.UnexpectedExcerptTokens,\n text: `Encountered unexpected excerpt tokens in ${next.displayName}. Excerpt: ${extendsType.excerpt.text}.`\n });\n maybeIncompleteResult = true;\n continue;\n }\n\n const apiModel: ApiModel | undefined = this.getAssociatedModel();\n if (!apiModel) {\n messages.push({\n messageId: FindApiItemsMessageId.MissingApiModel,\n text: `Unable to get the associated model of ${next.displayName}.`\n });\n maybeIncompleteResult = true;\n continue;\n }\n\n const apiItemResult: IResolveDeclarationReferenceResult = apiModel.resolveDeclarationReference(\n firstReferenceToken.canonicalReference!,\n undefined\n );\n\n const apiItem: ApiItem | undefined = apiItemResult.resolvedApiItem;\n if (!apiItem) {\n messages.push({\n messageId: FindApiItemsMessageId.DeclarationResolutionFailed,\n text: `Declaration resolution failed for ${next.displayName}. Error message: ${apiItemResult.errorMessage}.`\n });\n maybeIncompleteResult = true;\n continue;\n }\n\n extendedItems.push(apiItem);\n }\n\n // For classes, this array will only have one item. For interfaces, there may be multiple items. Sort the array\n // into alphabetical order before adding to our list of API items to visit. This ensures that in the case\n // of multiple interface inheritance, a member inherited from multiple interfaces is attributed to the interface\n // earlier in alphabetical order (as opposed to source order).\n //\n // For example, in the code block below, `Bar.x` is reported as the inherited item, not `Foo.x`.\n //\n // ```\n // interface Foo {\n // public x: string;\n // }\n //\n // interface Bar {\n // public x: string;\n // }\n //\n // interface FooBar extends Foo, Bar {}\n // ```\n LegacyAdapters.sortStable(extendedItems, (x: ApiItem, y: ApiItem) =>\n x.getSortKey().localeCompare(y.getSortKey())\n );\n\n toVisit.push(...extendedItems);\n next = toVisit.shift();\n }\n\n const items: ApiItem[] = [];\n for (const members of membersByName.values()) {\n items.push(...members);\n }\n for (const members of membersByKind.values()) {\n items.push(...members);\n }\n LegacyAdapters.sortStable(items, (x: ApiItem, y: ApiItem) =>\n x.getSortKey().localeCompare(y.getSortKey())\n );\n\n return {\n items,\n messages,\n maybeIncompleteResult\n };\n }\n\n /** @internal */\n public _getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem> {\n this._ensureMemberMaps();\n let result: ApiItem[] | undefined;\n if (ApiNameMixin.isBaseClassOf(memberApiItem)) {\n result = this[_membersByName]!.get(memberApiItem.name);\n } else {\n result = this[_membersByKind]!.get(memberApiItem.kind);\n }\n if (!result) {\n throw new InternalError('Item was not found in the _membersByName/_membersByKind lookup');\n }\n return result;\n }\n\n /** @internal */\n public _ensureMemberMaps(): void {\n // Build the _membersByName and _membersByKind tables if they don't already exist\n if (this[_membersByName] === undefined) {\n const membersByName: Map<string, ApiItem[]> = new Map<string, ApiItem[]>();\n const membersByKind: Map<string, ApiItem[]> = new Map<string, ApiItem[]>();\n\n for (const member of this[_members]) {\n let map: Map<string, ApiItem[]> | Map<ApiItemKind, ApiItem[]>;\n let key: string | ApiItemKind;\n\n if (ApiNameMixin.isBaseClassOf(member)) {\n map = membersByName;\n key = member.name;\n } else {\n map = membersByKind;\n key = member.kind;\n }\n\n let list: ApiItem[] | undefined = map.get(key);\n if (list === undefined) {\n list = [];\n map.set(key, list);\n }\n list.push(member);\n }\n\n this[_membersByName] = membersByName;\n this[_membersByKind] = membersByKind;\n }\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiItemContainerJson>): void {\n super.serializeInto(jsonObject);\n\n const memberObjects: IApiItemJson[] = [];\n\n for (const member of this.members) {\n const memberJsonObject: Partial<IApiItemJson> = {};\n member.serializeInto(memberJsonObject);\n memberObjects.push(memberJsonObject as IApiItemJson);\n }\n\n jsonObject.preserveMemberOrder = this.preserveMemberOrder;\n jsonObject.members = memberObjects;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiItemContainerMixin:interface)}.\n * @public\n */\nexport namespace ApiItemContainerMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiItemContainerMixin {\n return apiItem.hasOwnProperty(_members);\n }\n}\n"]}
@@ -0,0 +1,58 @@
1
+ import { ApiItem } from '../items/ApiItem';
2
+ /**
3
+ * Generic result object for finding API items used by different kinds of find operations.
4
+ * @public
5
+ */
6
+ export interface IFindApiItemsResult {
7
+ /**
8
+ * The API items that were found. Not guaranteed to be complete, see `maybeIncompleteResult`.
9
+ */
10
+ items: ApiItem[];
11
+ /**
12
+ * Diagnostic messages regarding the find operation.
13
+ */
14
+ messages: IFindApiItemsMessage[];
15
+ /**
16
+ * Indicates whether the result is potentially incomplete due to errors during the find operation.
17
+ * If true, the `messages` explain the errors in more detail.
18
+ */
19
+ maybeIncompleteResult: boolean;
20
+ }
21
+ /**
22
+ * This object is used for messages returned as part of `IFindApiItemsResult`.
23
+ * @public
24
+ */
25
+ export interface IFindApiItemsMessage {
26
+ /**
27
+ * Unique identifier for the message.
28
+ * @beta
29
+ */
30
+ messageId: FindApiItemsMessageId;
31
+ /**
32
+ * Text description of the message.
33
+ */
34
+ text: string;
35
+ }
36
+ /**
37
+ * Unique identifiers for messages returned as part of `IFindApiItemsResult`.
38
+ * @beta
39
+ */
40
+ export declare enum FindApiItemsMessageId {
41
+ /**
42
+ * "Declaration resolution failed for ___. Error message: ___."
43
+ */
44
+ DeclarationResolutionFailed = "declaration-resolution-failed",
45
+ /**
46
+ * "Unable to get the associated model of ___."
47
+ */
48
+ MissingApiModel = "missing-api-model",
49
+ /**
50
+ * "Encountered unexpected excerpt tokens in ___. Excerpt: ___."
51
+ */
52
+ UnexpectedExcerptTokens = "unexpected-excerpt-tokens",
53
+ /**
54
+ * Item ___ is of unsupported kind ___."
55
+ */
56
+ UnsupportedKind = "unsupported-kind"
57
+ }
58
+ //# sourceMappingURL=IFindApiItemsResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IFindApiItemsResult.d.ts","sourceRoot":"","sources":["../../src/mixins/IFindApiItemsResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,OAAO,EAAE,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IAEjC;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,SAAS,EAAE,qBAAqB,CAAC;IAEjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B;;OAEG;IACH,2BAA2B,kCAAkC;IAE7D;;OAEG;IACH,eAAe,sBAAsB;IAErC;;OAEG;IACH,uBAAuB,8BAA8B;IAErD;;OAEG;IACH,eAAe,qBAAqB;CACrC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindApiItemsMessageId = void 0;
4
+ /**
5
+ * Unique identifiers for messages returned as part of `IFindApiItemsResult`.
6
+ * @beta
7
+ */
8
+ var FindApiItemsMessageId;
9
+ (function (FindApiItemsMessageId) {
10
+ /**
11
+ * "Declaration resolution failed for ___. Error message: ___."
12
+ */
13
+ FindApiItemsMessageId["DeclarationResolutionFailed"] = "declaration-resolution-failed";
14
+ /**
15
+ * "Unable to get the associated model of ___."
16
+ */
17
+ FindApiItemsMessageId["MissingApiModel"] = "missing-api-model";
18
+ /**
19
+ * "Encountered unexpected excerpt tokens in ___. Excerpt: ___."
20
+ */
21
+ FindApiItemsMessageId["UnexpectedExcerptTokens"] = "unexpected-excerpt-tokens";
22
+ /**
23
+ * Item ___ is of unsupported kind ___."
24
+ */
25
+ FindApiItemsMessageId["UnsupportedKind"] = "unsupported-kind";
26
+ })(FindApiItemsMessageId = exports.FindApiItemsMessageId || (exports.FindApiItemsMessageId = {}));
27
+ //# sourceMappingURL=IFindApiItemsResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IFindApiItemsResult.js","sourceRoot":"","sources":["../../src/mixins/IFindApiItemsResult.ts"],"names":[],"mappings":";;;AAyCA;;;GAGG;AACH,IAAY,qBAoBX;AApBD,WAAY,qBAAqB;IAC/B;;OAEG;IACH,sFAA6D,CAAA;IAE7D;;OAEG;IACH,8DAAqC,CAAA;IAErC;;OAEG;IACH,8EAAqD,CAAA;IAErD;;OAEG;IACH,6DAAoC,CAAA;AACtC,CAAC,EApBW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAoBhC","sourcesContent":["import { ApiItem } from '../items/ApiItem';\n\n/**\n * Generic result object for finding API items used by different kinds of find operations.\n * @public\n */\nexport interface IFindApiItemsResult {\n /**\n * The API items that were found. Not guaranteed to be complete, see `maybeIncompleteResult`.\n */\n items: ApiItem[];\n\n /**\n * Diagnostic messages regarding the find operation.\n */\n messages: IFindApiItemsMessage[];\n\n /**\n * Indicates whether the result is potentially incomplete due to errors during the find operation.\n * If true, the `messages` explain the errors in more detail.\n */\n maybeIncompleteResult: boolean;\n}\n\n/**\n * This object is used for messages returned as part of `IFindApiItemsResult`.\n * @public\n */\nexport interface IFindApiItemsMessage {\n /**\n * Unique identifier for the message.\n * @beta\n */\n messageId: FindApiItemsMessageId;\n\n /**\n * Text description of the message.\n */\n text: string;\n}\n\n/**\n * Unique identifiers for messages returned as part of `IFindApiItemsResult`.\n * @beta\n */\nexport enum FindApiItemsMessageId {\n /**\n * \"Declaration resolution failed for ___. Error message: ___.\"\n */\n DeclarationResolutionFailed = 'declaration-resolution-failed',\n\n /**\n * \"Unable to get the associated model of ___.\"\n */\n MissingApiModel = 'missing-api-model',\n\n /**\n * \"Encountered unexpected excerpt tokens in ___. Excerpt: ___.\"\n */\n UnexpectedExcerptTokens = 'unexpected-excerpt-tokens',\n\n /**\n * Item ___ is of unsupported kind ___.\"\n */\n UnsupportedKind = 'unsupported-kind'\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  import { Excerpt } from '../mixins/Excerpt';
2
2
  /**
3
- * Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class.
3
+ * Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class
4
+ * or interface.
5
+ *
4
6
  * @remarks
5
7
  *
6
8
  * For example, consider this declaration:
@@ -1 +1 @@
1
- {"version":3,"file":"HeritageType.d.ts","sourceRoot":"","sources":["../../src/model/HeritageType.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAY;IACvB;;;;;;;;;;;;;OAaG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,OAAO;CAGpC"}
1
+ {"version":3,"file":"HeritageType.d.ts","sourceRoot":"","sources":["../../src/model/HeritageType.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,YAAY;IACvB;;;;;;;;;;;;;OAaG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,OAAO;CAGpC"}
@@ -4,7 +4,9 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.HeritageType = void 0;
6
6
  /**
7
- * Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class.
7
+ * Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class
8
+ * or interface.
9
+ *
8
10
  * @remarks
9
11
  *
10
12
  * For example, consider this declaration:
@@ -1 +1 @@
1
- {"version":3,"file":"HeritageType.js","sourceRoot":"","sources":["../../src/model/HeritageType.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D;;;;;;;;;;;;;;GAcG;AACH,MAAa,YAAY;IAiBvB,YAAmB,OAAgB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AApBD,oCAoBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Excerpt } from '../mixins/Excerpt';\n\n/**\n * Represents a type referenced via an \"extends\" or \"implements\" heritage clause for a TypeScript class.\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The heritage types are `Controls.WidgetBase`, `Controls.IWidget`, and `IDisposable`.\n * @public\n */\nexport class HeritageType {\n /**\n * An excerpt corresponding to the referenced type.\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The excerpt might be `Controls.WidgetBase`, `Controls.IWidget`, or `IDisposable`.\n */\n public readonly excerpt: Excerpt;\n\n public constructor(excerpt: Excerpt) {\n this.excerpt = excerpt;\n }\n}\n"]}
1
+ {"version":3,"file":"HeritageType.js","sourceRoot":"","sources":["../../src/model/HeritageType.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,YAAY;IAiBvB,YAAmB,OAAgB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AApBD,oCAoBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Excerpt } from '../mixins/Excerpt';\n\n/**\n * Represents a type referenced via an \"extends\" or \"implements\" heritage clause for a TypeScript class\n * or interface.\n *\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The heritage types are `Controls.WidgetBase`, `Controls.IWidget`, and `IDisposable`.\n * @public\n */\nexport class HeritageType {\n /**\n * An excerpt corresponding to the referenced type.\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The excerpt might be `Controls.WidgetBase`, `Controls.IWidget`, or `IDisposable`.\n */\n public readonly excerpt: Excerpt;\n\n public constructor(excerpt: Excerpt) {\n this.excerpt = excerpt;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/api-extractor-model",
3
- "version": "7.21.0",
3
+ "version": "7.22.0",
4
4
  "description": "A helper library for loading and saving the .api.json files created by API Extractor",
5
5
  "repository": {
6
6
  "type": "git",