This commit is contained in:
2024-02-07 01:33:07 -05:00
commit c1af19d441
4088 changed files with 1260170 additions and 0 deletions

View File

@ -0,0 +1,60 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (ApiAbstractMixin:interface)}.
* @public
*/
export interface IApiAbstractMixinOptions extends IApiItemOptions {
isAbstract: boolean;
}
export interface IApiAbstractMixinJson extends IApiItemJson {
isAbstract: boolean;
}
/**
* The mixin base class for API items that have an abstract modifier.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiAbstractMixin extends ApiItem {
/**
* Indicates that the API item's value has an 'abstract' modifier.
*/
readonly isAbstract: boolean;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiAbstractMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiAbstractMixin:interface)}
* functionality.
*
* @public
*/
export declare function ApiAbstractMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiAbstractMixin);
/**
* Static members for {@link (ApiAbstractMixin:interface)}.
* @public
*/
export declare namespace ApiAbstractMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiAbstractMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiAbstractMixin;
}
//# sourceMappingURL=ApiAbstractMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiAbstractMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiAbstractMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAoCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,62 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiAbstractMixin = void 0;
const _isAbstract = Symbol('ApiAbstractMixin._isAbstract');
/**
* Mixin function for {@link (ApiAbstractMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiAbstractMixin:interface)}
* functionality.
*
* @public
*/
function ApiAbstractMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isAbstract] = options.isAbstract;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isAbstract = jsonObject.isAbstract || false;
}
get isAbstract() {
return this[_isAbstract];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isAbstract = this.isAbstract;
}
}
return MixedClass;
}
exports.ApiAbstractMixin = ApiAbstractMixin;
/**
* Static members for {@link (ApiAbstractMixin:interface)}.
* @public
*/
(function (ApiAbstractMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiAbstractMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isAbstract);
}
ApiAbstractMixin.isBaseClassOf = isBaseClassOf;
})(ApiAbstractMixin = exports.ApiAbstractMixin || (exports.ApiAbstractMixin = {}));
//# sourceMappingURL=ApiAbstractMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,83 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiExportedMixinOptions:interface)}.
* @public
*/
export interface IApiExportedMixinOptions extends IApiItemOptions {
isExported: boolean;
}
export interface IApiExportedMixinJson extends IApiItemJson {
isExported: boolean;
}
/**
* The mixin base class for API items that can be exported.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiExportedMixin extends ApiItem {
/**
* Whether the declaration is exported from its parent item container (i.e. either an `ApiEntryPoint` or an
* `ApiNamespace`).
*
* @remarks
* Suppose `index.ts` is your entry point:
*
* ```ts
* // index.ts
*
* export class A {}
* class B {}
*
* namespace n {
* export class C {}
* class D {}
* }
*
* // file.ts
* export class E {}
* ```
*
* Classes `A` and `C` are both exported, while classes `B`, `D`, and `E` are not. `E` is exported from its
* local file, but not from its parent item container (i.e. the entry point).
*
*/
readonly isExported: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiExportedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiExportedMixin:interface)} functionality.
*
* @public
*/
export declare function ApiExportedMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiExportedMixin);
/**
* Static members for {@link (ApiExportedMixin:interface)}.
* @public
*/
export declare namespace ApiExportedMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiExportedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiExportedMixin;
}
//# sourceMappingURL=ApiExportedMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiExportedMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiExportedMixin.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAyCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,67 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiExportedMixin = void 0;
/* eslint-disable @typescript-eslint/no-redeclare */
const DeclarationReference_1 = require("@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference");
const _isExported = Symbol('ApiExportedMixin._isExported');
/**
* Mixin function for {@link (ApiExportedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiExportedMixin:interface)} functionality.
*
* @public
*/
function ApiExportedMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isExported] = options.isExported;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
const declarationReference = DeclarationReference_1.DeclarationReference.parse(jsonObject.canonicalReference);
options.isExported = declarationReference.navigation === "." /* Navigation.Exports */;
}
get isExported() {
return this[_isExported];
}
/**
* The `isExported` property is intentionally not serialized because the information is already present
* in the item's `canonicalReference`.
* @override
*/
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
}
}
return MixedClass;
}
exports.ApiExportedMixin = ApiExportedMixin;
/**
* Static members for {@link (ApiExportedMixin:interface)}.
* @public
*/
(function (ApiExportedMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiExportedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isExported);
}
ApiExportedMixin.isBaseClassOf = isBaseClassOf;
})(ApiExportedMixin = exports.ApiExportedMixin || (exports.ApiExportedMixin = {}));
//# sourceMappingURL=ApiExportedMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import type { IExcerptTokenRange, Excerpt } from './Excerpt';
/**
* Constructor options for {@link (IApiInitializerMixinOptions:interface)}.
* @public
*/
export interface IApiInitializerMixinOptions extends IApiItemOptions {
initializerTokenRange?: IExcerptTokenRange;
}
export interface IApiInitializerMixinJson extends IApiItemJson {
initializerTokenRange?: IExcerptTokenRange;
}
/**
* The mixin base class for API items that can have an initializer.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiInitializerMixin extends ApiItem {
/**
* An {@link Excerpt} that describes the item's initializer.
*/
readonly initializerExcerpt?: Excerpt;
/** @override */
serializeInto(jsonObject: Partial<IApiInitializerMixinJson>): void;
}
/**
* Mixin function for {@link (ApiInitializerMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiInitializerMixin:interface)} functionality.
*
* @public
*/
export declare function ApiInitializerMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiInitializerMixin);
/**
* Static members for {@link (ApiInitializerMixin:interface)}.
* @public
*/
export declare namespace ApiInitializerMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiInitializerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiInitializerMixin;
}
//# sourceMappingURL=ApiInitializerMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiInitializerMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiInitializerMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAK7D;;;GAGG;AACH,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,qBAAqB,CAAC,EAAE,kBAAkB,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAyB,SAAQ,YAAY;IAC5D,qBAAqB,CAAC,EAAE,kBAAkB,CAAC;CAC5C;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,OAAO;IAClD;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAEtC,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC;CACpE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,SAAS,mBAAmB,EACxE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,mBAAmB,CAAC,CAgD5D;AAED;;;GAGG;AACH,yBAAiB,mBAAmB,CAAC;IACnC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAE9E;CACF"}

View File

@ -0,0 +1,73 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiInitializerMixin = void 0;
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const node_core_library_1 = require("@rushstack/node-core-library");
const _initializerExcerpt = Symbol('ApiInitializerMixin._initializerExcerpt');
/**
* Mixin function for {@link (ApiInitializerMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiInitializerMixin:interface)} functionality.
*
* @public
*/
function ApiInitializerMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
if (options.initializerTokenRange) {
this[_initializerExcerpt] = this.buildExcerpt(options.initializerTokenRange);
}
}
else {
throw new node_core_library_1.InternalError('ApiInitializerMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.initializerTokenRange = jsonObject.initializerTokenRange;
}
get initializerExcerpt() {
return this[_initializerExcerpt];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
// Note that JSON does not support the "undefined" value, so we simply omit the field entirely if it is undefined
if (this.initializerExcerpt) {
jsonObject.initializerTokenRange = this.initializerExcerpt.tokenRange;
}
}
}
return MixedClass;
}
exports.ApiInitializerMixin = ApiInitializerMixin;
/**
* Static members for {@link (ApiInitializerMixin:interface)}.
* @public
*/
(function (ApiInitializerMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiInitializerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_initializerExcerpt);
}
ApiInitializerMixin.isBaseClassOf = isBaseClassOf;
})(ApiInitializerMixin = exports.ApiInitializerMixin || (exports.ApiInitializerMixin = {}));
//# sourceMappingURL=ApiInitializerMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,161 @@
import { ApiItem, type IApiItemJson, type IApiItemOptions, type IApiItemConstructor } from '../items/ApiItem';
import { type IFindApiItemsResult } from './IFindApiItemsResult';
/**
* Constructor options for {@link (ApiItemContainerMixin:interface)}.
* @public
*/
export interface IApiItemContainerMixinOptions extends IApiItemOptions {
preserveMemberOrder?: boolean;
members?: ApiItem[];
}
export interface IApiItemContainerJson extends IApiItemJson {
preserveMemberOrder?: boolean;
members: IApiItemJson[];
}
/**
* The mixin base class for API items that act as containers for other child items.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* Examples of `ApiItemContainerMixin` child classes include `ApiModel`, `ApiPackage`, `ApiEntryPoint`,
* and `ApiEnum`. But note that `Parameter` is not considered a "member" of an `ApiMethod`; this relationship
* is modeled using {@link (ApiParameterListMixin:interface).parameters} instead
* of {@link ApiItem.members}.
*
* @public
*/
export interface ApiItemContainerMixin extends ApiItem {
/**
* Disables automatic sorting of {@link ApiItem.members}.
*
* @remarks
* By default `ApiItemContainerMixin` will automatically sort its members according to their
* {@link ApiItem.getSortKey} string, which provides a standardized mostly alphabetical ordering
* that is appropriate for most API items. When loading older .api.json files the automatic sorting
* is reapplied and may update the ordering.
*
* Set `preserveMemberOrder` to true to disable automatic sorting for this container; instead, the
* members will retain whatever ordering appeared in the {@link IApiItemContainerMixinOptions.members} array.
* The `preserveMemberOrder` option is saved in the .api.json file.
*/
readonly preserveMemberOrder: boolean;
/**
* Adds a new member to the container.
*
* @remarks
* An ApiItem cannot be added to more than one container.
*/
addMember(member: ApiItem): void;
/**
* Attempts to retrieve a member using its containerKey, or returns `undefined` if no matching member was found.
*
* @remarks
* Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation
* of this function, according to the aspects that are important for identifying it.
*
* See {@link ApiItem.containerKey} for more information.
*/
tryGetMemberByKey(containerKey: string): ApiItem | undefined;
/**
* Returns a list of members with the specified name.
*/
findMembersByName(name: string): ReadonlyArray<ApiItem>;
/**
* Finds all of the ApiItem's immediate and inherited members by walking up the inheritance tree.
*
* @remarks
*
* Given the following class heritage:
*
* ```
* export class A {
* public a: number|boolean;
* }
*
* export class B extends A {
* public a: number;
* public b: string;
* }
*
* export class C extends B {
* public c: boolean;
* }
* ```
*
* Calling `findMembersWithInheritance` on `C` will return `B.a`, `B.b`, and `C.c`. Calling the
* method on `B` will return `B.a` and `B.b`. And calling the method on `A` will return just
* `A.a`.
*
* The inherited members returned by this method may be incomplete. If so, there will be a flag
* on the result object indicating this as well as messages explaining the errors in more detail.
* Some scenarios include:
*
* - Interface extending from a type alias.
*
* - Class extending from a variable.
*
* - Extending from a declaration not present in the model (e.g. external package).
*
* - Extending from an unexported declaration (e.g. ae-forgotten-export). Common in mixin
* patterns.
*
* - Unexpected runtime errors...
*
* Lastly, be aware that the types of inherited members are returned with respect to their
* defining class as opposed to with respect to the inheriting class. For example, consider
* the following:
*
* ```
* export class A<T> {
* public a: T;
* }
*
* export class B extends A<number> {}
* ```
*
* When called on `B`, this method will return `B.a` with type `T` as opposed to type
* `number`, although the latter is more accurate.
*/
findMembersWithInheritance(): IFindApiItemsResult;
/**
* For a given member of this container, return its `ApiItem.getMergedSiblings()` list.
* @internal
*/
_getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem>;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link ApiDeclaredItem}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.
*
* @public
*/
export declare function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiItemContainerMixin);
/**
* Static members for {@link (ApiItemContainerMixin:interface)}.
* @public
*/
export declare namespace ApiItemContainerMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiItemContainerMixin;
}
//# sourceMappingURL=ApiItemContainerMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiItemContainerMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiItemContainerMixin.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,OAAO,EAEP,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,uBAAuB,CAAC;AAM/B;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;IACH,0BAA0B,IAAI,mBAAmB,CAAC;IAElD;;;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,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,qBAAqB,CAAC,CAkV9D;AAED;;;GAGG;AACH,yBAAiB,qBAAqB,CAAC;IACrC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAEhF;CACF"}

View File

@ -0,0 +1,323 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiItemContainerMixin = void 0;
/* eslint-disable @typescript-eslint/no-redeclare */
const ApiItem_1 = require("../items/ApiItem");
const ApiNameMixin_1 = require("./ApiNameMixin");
const Excerpt_1 = require("./Excerpt");
const IFindApiItemsResult_1 = require("./IFindApiItemsResult");
const node_core_library_1 = require("@rushstack/node-core-library");
const _members = Symbol('ApiItemContainerMixin._members');
const _membersSorted = Symbol('ApiItemContainerMixin._membersSorted');
const _membersByContainerKey = Symbol('ApiItemContainerMixin._membersByContainerKey');
const _membersByName = Symbol('ApiItemContainerMixin._membersByName');
const _membersByKind = Symbol('ApiItemContainerMixin._membersByKind');
const _preserveMemberOrder = Symbol('ApiItemContainerMixin._preserveMemberOrder');
/**
* Mixin function for {@link ApiDeclaredItem}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.
*
* @public
*/
function ApiItemContainerMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
var _a;
super(...args);
const options = args[0];
this[_members] = [];
this[_membersSorted] = false;
this[_membersByContainerKey] = new Map();
this[_preserveMemberOrder] = (_a = options.preserveMemberOrder) !== null && _a !== void 0 ? _a : false;
if (options.members) {
for (const member of options.members) {
this.addMember(member);
}
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.preserveMemberOrder = jsonObject.preserveMemberOrder;
options.members = [];
for (const memberObject of jsonObject.members) {
options.members.push(ApiItem_1.ApiItem.deserialize(memberObject, context));
}
}
/** @override */
get members() {
if (!this[_membersSorted] && !this[_preserveMemberOrder]) {
this[_members].sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
this[_membersSorted] = true;
}
return this[_members];
}
get preserveMemberOrder() {
return this[_preserveMemberOrder];
}
addMember(member) {
if (this[_membersByContainerKey].has(member.containerKey)) {
throw new Error(`Another member has already been added with the same name (${member.displayName})` +
` and containerKey (${member.containerKey})`);
}
const existingParent = member.parent;
if (existingParent !== undefined) {
throw new Error(`This item has already been added to another container: "${existingParent.displayName}"`);
}
this[_members].push(member);
this[_membersByName] = undefined; // invalidate the lookup
this[_membersByKind] = undefined; // invalidate the lookup
this[_membersSorted] = false;
this[_membersByContainerKey].set(member.containerKey, member);
member[ApiItem_1.apiItem_onParentChanged](this);
}
tryGetMemberByKey(containerKey) {
return this[_membersByContainerKey].get(containerKey);
}
findMembersByName(name) {
this._ensureMemberMaps();
return this[_membersByName].get(name) || [];
}
findMembersWithInheritance() {
const messages = [];
let maybeIncompleteResult = false;
// For API items that don't support inheritance, this method just returns the item's
// immediate members.
switch (this.kind) {
case ApiItem_1.ApiItemKind.Class:
case ApiItem_1.ApiItemKind.Interface:
break;
default: {
return {
items: this.members.concat(),
messages,
maybeIncompleteResult
};
}
}
const membersByName = new Map();
const membersByKind = new Map();
const toVisit = [];
let next = this;
while (next) {
const membersToAdd = [];
// For each member, check to see if we've already seen a member with the same name
// previously in the inheritance tree. If so, we know we won't inherit it, and thus
// do not add it to our `membersToAdd` array.
for (const member of next.members) {
// We add the to-be-added members to an intermediate array instead of immediately
// to the maps themselves to support method overloads with the same name.
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
if (!membersByName.has(member.name)) {
membersToAdd.push(member);
}
}
else {
if (!membersByKind.has(member.kind)) {
membersToAdd.push(member);
}
}
}
for (const member of membersToAdd) {
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
const members = membersByName.get(member.name) || [];
members.push(member);
membersByName.set(member.name, members);
}
else {
const members = membersByKind.get(member.kind) || [];
members.push(member);
membersByKind.set(member.kind, members);
}
}
// Interfaces can extend multiple interfaces, so iterate through all of them.
const extendedItems = [];
let extendsTypes;
switch (next.kind) {
case ApiItem_1.ApiItemKind.Class: {
const apiClass = next;
extendsTypes = apiClass.extendsType ? [apiClass.extendsType] : [];
break;
}
case ApiItem_1.ApiItemKind.Interface: {
const apiInterface = next;
extendsTypes = apiInterface.extendsTypes;
break;
}
}
if (extendsTypes === undefined) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.UnsupportedKind,
text: `Unable to analyze references of API item ${next.displayName} because it is of unsupported kind ${next.kind}`
});
maybeIncompleteResult = true;
next = toVisit.shift();
continue;
}
for (const extendsType of extendsTypes) {
// We want to find the reference token associated with the actual inherited declaration.
// In every case we support, this is the first reference token. For example:
//
// ```
// export class A extends B {}
// ^
// export class A extends B<C> {}
// ^
// export class A extends B.C {}
// ^^^
// ```
const firstReferenceToken = extendsType.excerpt.spannedTokens.find((token) => {
return token.kind === Excerpt_1.ExcerptTokenKind.Reference && token.canonicalReference;
});
if (!firstReferenceToken) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.ExtendsClauseMissingReference,
text: `Unable to analyze extends clause ${extendsType.excerpt.text} of API item ${next.displayName} because no canonical reference was found`
});
maybeIncompleteResult = true;
continue;
}
const apiModel = this.getAssociatedModel();
if (!apiModel) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.NoAssociatedApiModel,
text: `Unable to analyze references of API item ${next.displayName} because it is not associated with an ApiModel`
});
maybeIncompleteResult = true;
continue;
}
const canonicalReference = firstReferenceToken.canonicalReference;
const apiItemResult = apiModel.resolveDeclarationReference(canonicalReference, undefined);
const apiItem = apiItemResult.resolvedApiItem;
if (!apiItem) {
messages.push({
messageId: IFindApiItemsResult_1.FindApiItemsMessageId.DeclarationResolutionFailed,
text: `Unable to resolve declaration reference within API item ${next.displayName}: ${apiItemResult.errorMessage}`
});
maybeIncompleteResult = true;
continue;
}
extendedItems.push(apiItem);
}
// For classes, this array will only have one item. For interfaces, there may be multiple items. Sort the array
// into alphabetical order before adding to our list of API items to visit. This ensures that in the case
// of multiple interface inheritance, a member inherited from multiple interfaces is attributed to the interface
// earlier in alphabetical order (as opposed to source order).
//
// For example, in the code block below, `Bar.x` is reported as the inherited item, not `Foo.x`.
//
// ```
// interface Foo {
// public x: string;
// }
//
// interface Bar {
// public x: string;
// }
//
// interface FooBar extends Foo, Bar {}
// ```
extendedItems.sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
toVisit.push(...extendedItems);
next = toVisit.shift();
}
const items = [];
for (const members of membersByName.values()) {
items.push(...members);
}
for (const members of membersByKind.values()) {
items.push(...members);
}
items.sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
return {
items,
messages,
maybeIncompleteResult
};
}
/** @internal */
_getMergedSiblingsForMember(memberApiItem) {
this._ensureMemberMaps();
let result;
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(memberApiItem)) {
result = this[_membersByName].get(memberApiItem.name);
}
else {
result = this[_membersByKind].get(memberApiItem.kind);
}
if (!result) {
throw new node_core_library_1.InternalError('Item was not found in the _membersByName/_membersByKind lookup');
}
return result;
}
/** @internal */
_ensureMemberMaps() {
// Build the _membersByName and _membersByKind tables if they don't already exist
if (this[_membersByName] === undefined) {
const membersByName = new Map();
const membersByKind = new Map();
for (const member of this[_members]) {
let map;
let key;
if (ApiNameMixin_1.ApiNameMixin.isBaseClassOf(member)) {
map = membersByName;
key = member.name;
}
else {
map = membersByKind;
key = member.kind;
}
let list = map.get(key);
if (list === undefined) {
list = [];
map.set(key, list);
}
list.push(member);
}
this[_membersByName] = membersByName;
this[_membersByKind] = membersByKind;
}
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
const memberObjects = [];
for (const member of this.members) {
const memberJsonObject = {};
member.serializeInto(memberJsonObject);
memberObjects.push(memberJsonObject);
}
jsonObject.preserveMemberOrder = this.preserveMemberOrder;
jsonObject.members = memberObjects;
}
}
return MixedClass;
}
exports.ApiItemContainerMixin = ApiItemContainerMixin;
/**
* Static members for {@link (ApiItemContainerMixin:interface)}.
* @public
*/
(function (ApiItemContainerMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_members);
}
ApiItemContainerMixin.isBaseClassOf = isBaseClassOf;
})(ApiItemContainerMixin = exports.ApiItemContainerMixin || (exports.ApiItemContainerMixin = {}));
//# sourceMappingURL=ApiItemContainerMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,64 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiNameMixinOptions:interface)}.
* @public
*/
export interface IApiNameMixinOptions extends IApiItemOptions {
name: string;
}
export interface IApiNameMixinJson extends IApiItemJson {
name: string;
}
/**
* The mixin base class for API items that have a name. For example, a class has a name, but a class constructor
* does not.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiNameMixin extends ApiItem {
/**
* The exported name of this API item.
*
* @remarks
* Note that due tue type aliasing, the exported name may be different from the locally declared name.
*/
readonly name: string;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiNameMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiNameMixin:interface)} functionality.
*
* @public
*/
export declare function ApiNameMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiNameMixin);
/**
* Static members for {@link (ApiNameMixin:interface)}.
* @public
*/
export declare namespace ApiNameMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiNameMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiNameMixin;
}
//# sourceMappingURL=ApiNameMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiNameMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiNameMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,IAAI,EAAE,MAAM,CAAC;CACd;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,YAAa,SAAQ,OAAO;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,UAAU,SAAS,mBAAmB,EACjE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,CAyCrD;AAED;;;GAGG;AACH,yBAAiB,YAAY,CAAC;IAC5B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,YAAY,CAEvE;CACF"}

View File

@ -0,0 +1,65 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiNameMixin = void 0;
const _name = Symbol('ApiNameMixin._name');
/**
* Mixin function for {@link (ApiNameMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiNameMixin:interface)} functionality.
*
* @public
*/
function ApiNameMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_name] = options.name;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.name = jsonObject.name;
}
get name() {
return this[_name];
}
/** @override */
get displayName() {
return this[_name];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.name = this.name;
}
}
return MixedClass;
}
exports.ApiNameMixin = ApiNameMixin;
/**
* Static members for {@link (ApiNameMixin:interface)}.
* @public
*/
(function (ApiNameMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiNameMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_name);
}
ApiNameMixin.isBaseClassOf = isBaseClassOf;
})(ApiNameMixin = exports.ApiNameMixin || (exports.ApiNameMixin = {}));
//# sourceMappingURL=ApiNameMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,69 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiOptionalMixinOptions:interface)}.
* @public
*/
export interface IApiOptionalMixinOptions extends IApiItemOptions {
isOptional: boolean;
}
export interface IApiOptionalMixinJson extends IApiItemJson {
isOptional: boolean;
}
/**
* The mixin base class for API items that can be marked as optional by appending a `?` to them.
* For example, a property of an interface can be optional.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiOptionalMixin extends ApiItem {
/**
* True if this is an optional property.
* @remarks
* For example:
* ```ts
* interface X {
* y: string; // not optional
* z?: string; // optional
* }
* ```
*/
readonly isOptional: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiOptionalMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiOptionalMixin:interface)} functionality.
*
* @public
*/
export declare function ApiOptionalMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiOptionalMixin);
/**
* Optional members for {@link (ApiOptionalMixin:interface)}.
* @public
*/
export declare namespace ApiOptionalMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiOptionalMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiOptionalMixin;
}
//# sourceMappingURL=ApiOptionalMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiOptionalMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiOptionalMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAoCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,61 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiOptionalMixin = void 0;
const _isOptional = Symbol('ApiOptionalMixin._isOptional');
/**
* Mixin function for {@link (ApiOptionalMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiOptionalMixin:interface)} functionality.
*
* @public
*/
function ApiOptionalMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isOptional] = !!options.isOptional;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isOptional = !!jsonObject.isOptional;
}
get isOptional() {
return this[_isOptional];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isOptional = this.isOptional;
}
}
return MixedClass;
}
exports.ApiOptionalMixin = ApiOptionalMixin;
/**
* Optional members for {@link (ApiOptionalMixin:interface)}.
* @public
*/
(function (ApiOptionalMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiOptionalMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isOptional);
}
ApiOptionalMixin.isBaseClassOf = isBaseClassOf;
})(ApiOptionalMixin = exports.ApiOptionalMixin || (exports.ApiOptionalMixin = {}));
//# sourceMappingURL=ApiOptionalMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,100 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import { Parameter } from '../model/Parameter';
import type { IExcerptTokenRange } from './Excerpt';
/**
* Represents parameter information that is part of {@link IApiParameterListMixinOptions}
* @public
*/
export interface IApiParameterOptions {
parameterName: string;
parameterTypeTokenRange: IExcerptTokenRange;
isOptional: boolean;
}
/**
* Constructor options for {@link (ApiParameterListMixin:interface)}.
* @public
*/
export interface IApiParameterListMixinOptions extends IApiItemOptions {
overloadIndex: number;
parameters: IApiParameterOptions[];
}
export interface IApiParameterListJson extends IApiItemJson {
overloadIndex: number;
parameters: IApiParameterOptions[];
}
/**
* The mixin base class for API items that can have function parameters (but not necessarily a return value).
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiParameterListMixin extends ApiItem {
/**
* When a function has multiple overloaded declarations, this one-based integer index can be used to uniquely
* identify them.
*
* @remarks
*
* Consider this overloaded declaration:
*
* ```ts
* export namespace Versioning {
* // TSDoc: Versioning.(addVersions:1)
* export function addVersions(x: number, y: number): number;
*
* // TSDoc: Versioning.(addVersions:2)
* export function addVersions(x: string, y: string): string;
*
* // (implementation)
* export function addVersions(x: number|string, y: number|string): number|string {
* // . . .
* }
* }
* ```
*
* In the above example, there are two overloaded declarations. The overload using numbers will have
* `overloadIndex = 1`. The overload using strings will have `overloadIndex = 2`. The third declaration that
* accepts all possible inputs is considered part of the implementation, and is not processed by API Extractor.
*/
readonly overloadIndex: number;
/**
* The function parameters.
*/
readonly parameters: ReadonlyArray<Parameter>;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.
*
* @public
*/
export declare function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiParameterListMixin);
/**
* Static members for {@link (ApiParameterListMixin:interface)}.
* @public
*/
export declare namespace ApiParameterListMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiParameterListMixin;
}
//# sourceMappingURL=ApiParameterListMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiParameterListMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiParameterListMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAIpD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,kBAAkB,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,eAAe;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,EAAE,CAAC;CACpC;AAKD;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAE9C,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,CAyE9D;AAED;;;GAGG;AACH,yBAAiB,qBAAqB,CAAC;IACrC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAEhF;CACF"}

View File

@ -0,0 +1,96 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiParameterListMixin = void 0;
const Parameter_1 = require("../model/Parameter");
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const node_core_library_1 = require("@rushstack/node-core-library");
const _overloadIndex = Symbol('ApiParameterListMixin._overloadIndex');
const _parameters = Symbol('ApiParameterListMixin._parameters');
/**
* Mixin function for {@link (ApiParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.
*
* @public
*/
function ApiParameterListMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_overloadIndex] = options.overloadIndex;
this[_parameters] = [];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
if (options.parameters) {
for (const parameterOptions of options.parameters) {
const parameter = new Parameter_1.Parameter({
name: parameterOptions.parameterName,
parameterTypeExcerpt: this.buildExcerpt(parameterOptions.parameterTypeTokenRange),
// Prior to ApiJsonSchemaVersion.V_1005 this input will be undefined
isOptional: !!parameterOptions.isOptional,
parent: this
});
this[_parameters].push(parameter);
}
}
}
else {
throw new node_core_library_1.InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.overloadIndex = jsonObject.overloadIndex;
options.parameters = jsonObject.parameters || [];
}
get overloadIndex() {
return this[_overloadIndex];
}
get parameters() {
return this[_parameters];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.overloadIndex = this.overloadIndex;
const parameterObjects = [];
for (const parameter of this.parameters) {
parameterObjects.push({
parameterName: parameter.name,
parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange,
isOptional: parameter.isOptional
});
}
jsonObject.parameters = parameterObjects;
}
}
return MixedClass;
}
exports.ApiParameterListMixin = ApiParameterListMixin;
/**
* Static members for {@link (ApiParameterListMixin:interface)}.
* @public
*/
(function (ApiParameterListMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_parameters);
}
ApiParameterListMixin.isBaseClassOf = isBaseClassOf;
})(ApiParameterListMixin = exports.ApiParameterListMixin || (exports.ApiParameterListMixin = {}));
//# sourceMappingURL=ApiParameterListMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,60 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiProtectedMixinOptions:interface)}.
* @public
*/
export interface IApiProtectedMixinOptions extends IApiItemOptions {
isProtected: boolean;
}
export interface IApiProtectedMixinJson extends IApiItemJson {
isProtected: boolean;
}
/**
* The mixin base class for API items that can have the TypeScript `protected` keyword applied to them.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiProtectedMixin extends ApiItem {
/**
* Whether the declaration has the TypeScript `protected` keyword.
*/
readonly isProtected: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiProtectedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiProtectedMixin:interface)} functionality.
*
* @public
*/
export declare function ApiProtectedMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiProtectedMixin);
/**
* Static members for {@link (ApiProtectedMixin:interface)}.
* @public
*/
export declare namespace ApiProtectedMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiProtectedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiProtectedMixin;
}
//# sourceMappingURL=ApiProtectedMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiProtectedMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiProtectedMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,WAAW,EAAE,OAAO,CAAC;CACtB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,iBAAkB,SAAQ,OAAO;IAChD;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,SAAS,mBAAmB,EACtE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,iBAAiB,CAAC,CAoC1D;AAED;;;GAGG;AACH,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,iBAAiB,CAE5E;CACF"}

View File

@ -0,0 +1,61 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiProtectedMixin = void 0;
const _isProtected = Symbol('ApiProtectedMixin._isProtected');
/**
* Mixin function for {@link (ApiProtectedMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiProtectedMixin:interface)} functionality.
*
* @public
*/
function ApiProtectedMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isProtected] = options.isProtected;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isProtected = jsonObject.isProtected;
}
get isProtected() {
return this[_isProtected];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isProtected = this.isProtected;
}
}
return MixedClass;
}
exports.ApiProtectedMixin = ApiProtectedMixin;
/**
* Static members for {@link (ApiProtectedMixin:interface)}.
* @public
*/
(function (ApiProtectedMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiProtectedMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isProtected);
}
ApiProtectedMixin.isBaseClassOf = isBaseClassOf;
})(ApiProtectedMixin = exports.ApiProtectedMixin || (exports.ApiProtectedMixin = {}));
//# sourceMappingURL=ApiProtectedMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,82 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (ApiReadonlyMixin:interface)}.
* @public
*/
export interface IApiReadonlyMixinOptions extends IApiItemOptions {
isReadonly: boolean;
}
export interface IApiReadonlyMixinJson extends IApiItemJson {
isReadonly: boolean;
}
/**
* The mixin base class for API items that cannot be modified after instantiation.
* Examples such as the readonly modifier and only having a getter but no setter.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiReadonlyMixin extends ApiItem {
/**
* Indicates that the API item's value cannot be assigned by an external consumer.
*
* @remarks
* Examples of API items that would be considered "read only" by API Extractor:
*
* - A class or interface's property that has the `readonly` modifier.
*
* - A variable that has the `const` modifier.
*
* - A property or variable whose TSDoc comment includes the `@readonly` tag.
*
* - A property declaration with a getter but no setter.
*
* Note that if the `readonly` keyword appears in a type annotation, this does not
* guarantee that that the API item will be considered readonly. For example:
*
* ```ts
* declare class C {
* // isReadonly=false in this case, because C.x is assignable
* public x: readonly string[];
* }
* ```
*/
readonly isReadonly: boolean;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiReadonlyMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReadonlyMixin:interface)}
* functionality.
*
* @public
*/
export declare function ApiReadonlyMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiReadonlyMixin);
/**
* Static members for {@link (ApiReadonlyMixin:interface)}.
* @public
*/
export declare namespace ApiReadonlyMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReadonlyMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiReadonlyMixin;
}
//# sourceMappingURL=ApiReadonlyMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiReadonlyMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiReadonlyMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,mBAAmB,EACrE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAgB,CAAC,CAoCzD;AAED;;;GAGG;AACH,yBAAiB,gBAAgB,CAAC;IAChC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAE3E;CACF"}

View File

@ -0,0 +1,62 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiReadonlyMixin = void 0;
const _isReadonly = Symbol('ApiReadonlyMixin._isReadonly');
/**
* Mixin function for {@link (ApiReadonlyMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReadonlyMixin:interface)}
* functionality.
*
* @public
*/
function ApiReadonlyMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isReadonly] = options.isReadonly;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isReadonly = jsonObject.isReadonly || false;
}
get isReadonly() {
return this[_isReadonly];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isReadonly = this.isReadonly;
}
}
return MixedClass;
}
exports.ApiReadonlyMixin = ApiReadonlyMixin;
/**
* Static members for {@link (ApiReadonlyMixin:interface)}.
* @public
*/
(function (ApiReadonlyMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReadonlyMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isReadonly);
}
ApiReadonlyMixin.isBaseClassOf = isBaseClassOf;
})(ApiReadonlyMixin = exports.ApiReadonlyMixin || (exports.ApiReadonlyMixin = {}));
//# sourceMappingURL=ApiReadonlyMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,66 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import { ReleaseTag } from '../aedoc/ReleaseTag';
/**
* Constructor options for {@link (ApiReleaseTagMixin:interface)}.
* @public
*/
export interface IApiReleaseTagMixinOptions extends IApiItemOptions {
releaseTag: ReleaseTag;
}
export interface IApiReleaseTagMixinJson extends IApiItemJson {
releaseTag: string;
}
/**
* The mixin base class for API items that can be attributed with a TSDoc tag such as `@internal`,
* `@alpha`, `@beta`, or `@public`. These "release tags" indicate the support level for an API.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiReleaseTagMixin extends ApiItem {
/**
* The effective release tag for this declaration. If it is not explicitly specified, the value may be
* inherited from a containing declaration.
*
* @remarks
* For example, an `ApiEnumMember` may inherit its release tag from the containing `ApiEnum`.
*/
readonly releaseTag: ReleaseTag;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiReleaseTagMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReleaseTagMixin:interface)} functionality.
*
* @public
*/
export declare function ApiReleaseTagMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiReleaseTagMixin);
/**
* Static members for {@link (ApiReleaseTagMixin:interface)}.
* @public
*/
export declare namespace ApiReleaseTagMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReleaseTagMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiReleaseTagMixin;
}
//# sourceMappingURL=ApiReleaseTagMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiReleaseTagMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiReleaseTagMixin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,UAAU,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAEhC,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,SAAS,mBAAmB,EACvE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,kBAAkB,CAAC,CA4C3D;AAED;;;GAGG;AACH,yBAAiB,kBAAkB,CAAC;IAClC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAE7E;CACF"}

View File

@ -0,0 +1,69 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiReleaseTagMixin = void 0;
/* eslint-disable @typescript-eslint/no-redeclare */
const node_core_library_1 = require("@rushstack/node-core-library");
const ReleaseTag_1 = require("../aedoc/ReleaseTag");
const _releaseTag = Symbol('ApiReleaseTagMixin._releaseTag');
/**
* Mixin function for {@link (ApiReleaseTagMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReleaseTagMixin:interface)} functionality.
*
* @public
*/
function ApiReleaseTagMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_releaseTag] = options.releaseTag;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
const deserializedReleaseTag = node_core_library_1.Enum.tryGetValueByKey(ReleaseTag_1.ReleaseTag, // eslint-disable-line
jsonObject.releaseTag);
if (deserializedReleaseTag === undefined) {
throw new Error(`Failed to deserialize release tag ${JSON.stringify(jsonObject.releaseTag)}`);
}
options.releaseTag = deserializedReleaseTag;
}
get releaseTag() {
return this[_releaseTag];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.releaseTag = ReleaseTag_1.ReleaseTag[this.releaseTag];
}
}
return MixedClass;
}
exports.ApiReleaseTagMixin = ApiReleaseTagMixin;
/**
* Static members for {@link (ApiReleaseTagMixin:interface)}.
* @public
*/
(function (ApiReleaseTagMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReleaseTagMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_releaseTag);
}
ApiReleaseTagMixin.isBaseClassOf = isBaseClassOf;
})(ApiReleaseTagMixin = exports.ApiReleaseTagMixin || (exports.ApiReleaseTagMixin = {}));
//# sourceMappingURL=ApiReleaseTagMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import type { IExcerptTokenRange, Excerpt } from './Excerpt';
/**
* Constructor options for {@link (ApiReturnTypeMixin:interface)}.
* @public
*/
export interface IApiReturnTypeMixinOptions extends IApiItemOptions {
returnTypeTokenRange: IExcerptTokenRange;
}
export interface IApiReturnTypeMixinJson extends IApiItemJson {
returnTypeTokenRange: IExcerptTokenRange;
}
/**
* The mixin base class for API items that are functions that return a value.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiReturnTypeMixin extends ApiItem {
/**
* An {@link Excerpt} that describes the type of the function's return value.
*/
readonly returnTypeExcerpt: Excerpt;
/** @override */
serializeInto(jsonObject: Partial<IApiReturnTypeMixinJson>): void;
}
/**
* Mixin function for {@link (ApiReturnTypeMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReturnTypeMixin:interface)} functionality.
*
* @public
*/
export declare function ApiReturnTypeMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiReturnTypeMixin);
/**
* Static members for {@link (ApiReturnTypeMixin:interface)}.
* @public
*/
export declare namespace ApiReturnTypeMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReturnTypeMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiReturnTypeMixin;
}
//# sourceMappingURL=ApiReturnTypeMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiReturnTypeMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiReturnTypeMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAK7D;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,oBAAoB,EAAE,kBAAkB,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,oBAAoB,EAAE,kBAAkB,CAAC;CAC1C;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD;;OAEG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAEpC,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;CACnE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,SAAS,mBAAmB,EACvE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,kBAAkB,CAAC,CAyC3D;AAED;;;GAGG;AACH,yBAAiB,kBAAkB,CAAC;IAClC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAE7E;CACF"}

View File

@ -0,0 +1,68 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiReturnTypeMixin = void 0;
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const node_core_library_1 = require("@rushstack/node-core-library");
const _returnTypeExcerpt = Symbol('ApiReturnTypeMixin._returnTypeExcerpt');
/**
* Mixin function for {@link (ApiReturnTypeMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiReturnTypeMixin:interface)} functionality.
*
* @public
*/
function ApiReturnTypeMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
this[_returnTypeExcerpt] = this.buildExcerpt(options.returnTypeTokenRange);
}
else {
throw new node_core_library_1.InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.returnTypeTokenRange = jsonObject.returnTypeTokenRange;
}
get returnTypeExcerpt() {
return this[_returnTypeExcerpt];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.returnTypeTokenRange = this.returnTypeExcerpt.tokenRange;
}
}
return MixedClass;
}
exports.ApiReturnTypeMixin = ApiReturnTypeMixin;
/**
* Static members for {@link (ApiReturnTypeMixin:interface)}.
* @public
*/
(function (ApiReturnTypeMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiReturnTypeMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_returnTypeExcerpt);
}
ApiReturnTypeMixin.isBaseClassOf = isBaseClassOf;
})(ApiReturnTypeMixin = exports.ApiReturnTypeMixin || (exports.ApiReturnTypeMixin = {}));
//# sourceMappingURL=ApiReturnTypeMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,60 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
/**
* Constructor options for {@link (IApiStaticMixinOptions:interface)}.
* @public
*/
export interface IApiStaticMixinOptions extends IApiItemOptions {
isStatic: boolean;
}
export interface IApiStaticMixinJson extends IApiItemJson {
isStatic: boolean;
}
/**
* The mixin base class for API items that can have the TypeScript `static` keyword applied to them.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiStaticMixin extends ApiItem {
/**
* Whether the declaration has the TypeScript `static` keyword.
*/
readonly isStatic: boolean;
/** @override */
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiStaticMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiStaticMixin:interface)} functionality.
*
* @public
*/
export declare function ApiStaticMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiStaticMixin);
/**
* Static members for {@link (ApiStaticMixin:interface)}.
* @public
*/
export declare namespace ApiStaticMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiStaticMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiStaticMixin;
}
//# sourceMappingURL=ApiStaticMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiStaticMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiStaticMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,gBAAgB;IAChB,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAS,mBAAmB,EACnE,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,cAAc,CAAC,CAoCvD;AAED;;;GAGG;AACH,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,cAAc,CAEzE;CACF"}

View File

@ -0,0 +1,61 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiStaticMixin = void 0;
const _isStatic = Symbol('ApiStaticMixin._isStatic');
/**
* Mixin function for {@link (ApiStaticMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiStaticMixin:interface)} functionality.
*
* @public
*/
function ApiStaticMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_isStatic] = options.isStatic;
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.isStatic = jsonObject.isStatic;
}
get isStatic() {
return this[_isStatic];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
jsonObject.isStatic = this.isStatic;
}
}
return MixedClass;
}
exports.ApiStaticMixin = ApiStaticMixin;
/**
* Static members for {@link (ApiStaticMixin:interface)}.
* @public
*/
(function (ApiStaticMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiStaticMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_isStatic);
}
ApiStaticMixin.isBaseClassOf = isBaseClassOf;
})(ApiStaticMixin = exports.ApiStaticMixin || (exports.ApiStaticMixin = {}));
//# sourceMappingURL=ApiStaticMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,71 @@
import type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';
import type { IExcerptTokenRange } from './Excerpt';
import { TypeParameter } from '../model/TypeParameter';
/**
* Represents parameter information that is part of {@link IApiTypeParameterListMixinOptions}
* @public
*/
export interface IApiTypeParameterOptions {
typeParameterName: string;
constraintTokenRange: IExcerptTokenRange;
defaultTypeTokenRange: IExcerptTokenRange;
}
/**
* Constructor options for {@link (ApiTypeParameterListMixin:interface)}.
* @public
*/
export interface IApiTypeParameterListMixinOptions extends IApiItemOptions {
typeParameters: IApiTypeParameterOptions[];
}
export interface IApiTypeParameterListMixinJson extends IApiItemJson {
typeParameters: IApiTypeParameterOptions[];
}
/**
* The mixin base class for API items that can have type parameters.
*
* @remarks
*
* This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of
* API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use
* TypeScript "mixin" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various
* features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class
* to extend more than one base class). The "mixin" is a TypeScript merged declaration with three components:
* the function that generates a subclass, an interface that describes the members of the subclass, and
* a namespace containing static members of the class.
*
* @public
*/
export interface ApiTypeParameterListMixin extends ApiItem {
/**
* The type parameters.
*/
readonly typeParameters: ReadonlyArray<TypeParameter>;
serializeInto(jsonObject: Partial<IApiItemJson>): void;
}
/**
* Mixin function for {@link (ApiTypeParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiTypeParameterListMixin:interface)}
* functionality.
*
* @public
*/
export declare function ApiTypeParameterListMixin<TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => ApiTypeParameterListMixin);
/**
* Static members for {@link (ApiTypeParameterListMixin:interface)}.
* @public
*/
export declare namespace ApiTypeParameterListMixin {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem: ApiItem): apiItem is ApiTypeParameterListMixin;
}
//# sourceMappingURL=ApiTypeParameterListMixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ApiTypeParameterListMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiTypeParameterListMixin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,kBAAkB,CAAC;IACzC,qBAAqB,EAAE,kBAAkB,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,WAAW,iCAAkC,SAAQ,eAAe;IACxE,cAAc,EAAE,wBAAwB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,8BAA+B,SAAQ,YAAY;IAClE,cAAc,EAAE,wBAAwB,EAAE,CAAC;CAC5C;AAID;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,yBAA0B,SAAQ,OAAO;IACxD;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAEtD,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,SAAS,mBAAmB,EAC9E,SAAS,EAAE,UAAU,GAEpB,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,yBAAyB,CAAC,CAqElE;AAED;;;GAGG;AACH,yBAAiB,yBAAyB,CAAC;IACzC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,yBAAyB,CAEpF;CACF"}

View File

@ -0,0 +1,93 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiTypeParameterListMixin = void 0;
const TypeParameter_1 = require("../model/TypeParameter");
const node_core_library_1 = require("@rushstack/node-core-library");
const ApiDeclaredItem_1 = require("../items/ApiDeclaredItem");
const _typeParameters = Symbol('ApiTypeParameterListMixin._typeParameters');
/**
* Mixin function for {@link (ApiTypeParameterListMixin:interface)}.
*
* @param baseClass - The base class to be extended
* @returns A child class that extends baseClass, adding the {@link (ApiTypeParameterListMixin:interface)}
* functionality.
*
* @public
*/
function ApiTypeParameterListMixin(baseClass
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
class MixedClass extends baseClass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
super(...args);
const options = args[0];
this[_typeParameters] = [];
if (this instanceof ApiDeclaredItem_1.ApiDeclaredItem) {
if (options.typeParameters) {
for (const typeParameterOptions of options.typeParameters) {
const defaultTypeExcerpt = this.buildExcerpt(typeParameterOptions.defaultTypeTokenRange);
const typeParameter = new TypeParameter_1.TypeParameter({
name: typeParameterOptions.typeParameterName,
constraintExcerpt: this.buildExcerpt(typeParameterOptions.constraintTokenRange),
defaultTypeExcerpt,
isOptional: !defaultTypeExcerpt.isEmpty,
parent: this
});
this[_typeParameters].push(typeParameter);
}
}
}
else {
throw new node_core_library_1.InternalError('ApiTypeParameterListMixin expects a base class that inherits from ApiDeclaredItem');
}
}
/** @override */
static onDeserializeInto(options, context, jsonObject) {
baseClass.onDeserializeInto(options, context, jsonObject);
options.typeParameters = jsonObject.typeParameters || [];
}
get typeParameters() {
return this[_typeParameters];
}
/** @override */
serializeInto(jsonObject) {
super.serializeInto(jsonObject);
const typeParameterObjects = [];
for (const typeParameter of this.typeParameters) {
typeParameterObjects.push({
typeParameterName: typeParameter.name,
constraintTokenRange: typeParameter.constraintExcerpt.tokenRange,
defaultTypeTokenRange: typeParameter.defaultTypeExcerpt.tokenRange
});
}
if (typeParameterObjects.length > 0) {
jsonObject.typeParameters = typeParameterObjects;
}
}
}
return MixedClass;
}
exports.ApiTypeParameterListMixin = ApiTypeParameterListMixin;
/**
* Static members for {@link (ApiTypeParameterListMixin:interface)}.
* @public
*/
(function (ApiTypeParameterListMixin) {
/**
* A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
*
* @remarks
*
* The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
* the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
* the TypeScript type system cannot invoke a runtime test.)
*/
function isBaseClassOf(apiItem) {
return apiItem.hasOwnProperty(_typeParameters);
}
ApiTypeParameterListMixin.isBaseClassOf = isBaseClassOf;
})(ApiTypeParameterListMixin = exports.ApiTypeParameterListMixin || (exports.ApiTypeParameterListMixin = {}));
//# sourceMappingURL=ApiTypeParameterListMixin.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,113 @@
import type { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
/** @public */
export declare enum ExcerptTokenKind {
/**
* Generic text without any special properties
*/
Content = "Content",
/**
* A reference to an API declaration
*/
Reference = "Reference"
}
/**
* Used by {@link Excerpt} to indicate a range of indexes within an array of `ExcerptToken` objects.
*
* @public
*/
export interface IExcerptTokenRange {
/**
* The starting index of the span.
*/
startIndex: number;
/**
* The index of the last member of the span, plus one.
*
* @remarks
*
* If `startIndex` and `endIndex` are the same number, then the span is empty.
*/
endIndex: number;
}
/** @public */
export interface IExcerptToken {
readonly kind: ExcerptTokenKind;
text: string;
canonicalReference?: string;
}
/**
* Represents a fragment of text belonging to an {@link Excerpt} object.
*
* @public
*/
export declare class ExcerptToken {
private readonly _kind;
private readonly _text;
private readonly _canonicalReference;
constructor(kind: ExcerptTokenKind, text: string, canonicalReference?: DeclarationReference);
/**
* Indicates the kind of token.
*/
get kind(): ExcerptTokenKind;
/**
* The text fragment.
*/
get text(): string;
/**
* The hyperlink target for a token whose type is `ExcerptTokenKind.Reference`. For other token types,
* this property will be `undefined`.
*/
get canonicalReference(): DeclarationReference | undefined;
}
/**
* The `Excerpt` class is used by {@link ApiDeclaredItem} to represent a TypeScript code fragment that may be
* annotated with hyperlinks to declared types (and in the future, source code locations).
*
* @remarks
* API Extractor's .api.json file format stores excerpts compactly as a start/end indexes into an array of tokens.
* Every `ApiDeclaredItem` has a "main excerpt" corresponding to the full list of tokens. The declaration may
* also have have "captured" excerpts that correspond to subranges of tokens.
*
* For example, if the main excerpt is:
*
* ```
* function parse(s: string): Vector | undefined;
* ```
*
* ...then this entire signature is the "main excerpt", whereas the function's return type `Vector | undefined` is a
* captured excerpt. The `Vector` token might be a hyperlink to that API item.
*
* An excerpt may be empty (i.e. a token range containing zero tokens). For example, if a function's return value
* is not explicitly declared, then the returnTypeExcerpt will be empty. By contrast, a class constructor cannot
* have a return value, so ApiConstructor has no returnTypeExcerpt property at all.
*
* @public
*/
export declare class Excerpt {
/**
* The complete list of tokens for the source code fragment that this excerpt is based upon.
* If this object is the main excerpt, then it will span all of the tokens; otherwise, it will correspond to
* a range within the array.
*/
readonly tokens: ReadonlyArray<ExcerptToken>;
/**
* Specifies the excerpt's range within the `tokens` array.
*/
readonly tokenRange: Readonly<IExcerptTokenRange>;
/**
* The tokens spanned by this excerpt. It is the range of the `tokens` array as specified by the `tokenRange`
* property.
*/
readonly spannedTokens: ReadonlyArray<ExcerptToken>;
private _text;
constructor(tokens: ReadonlyArray<ExcerptToken>, tokenRange: IExcerptTokenRange);
/**
* The excerpted text, formed by concatenating the text of the `spannedTokens` strings.
*/
get text(): string;
/**
* Returns true if the excerpt is an empty range.
*/
get isEmpty(): boolean;
}
//# sourceMappingURL=Excerpt.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Excerpt.d.ts","sourceRoot":"","sources":["../../src/mixins/Excerpt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAGpG,cAAc;AACd,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,SAAS,cAAc;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,cAAc;AACd,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAmC;gBAEpD,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,oBAAoB;IAUlG;;OAEG;IACH,IAAW,IAAI,IAAI,gBAAgB,CAElC;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;OAGG;IACH,IAAW,kBAAkB,IAAI,oBAAoB,GAAG,SAAS,CAEhE;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,OAAO;IAClB;;;;OAIG;IACH,SAAgB,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAEpD;;OAEG;IACH,SAAgB,UAAU,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEzD;;;OAGG;IACH,SAAgB,aAAa,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAE3D,OAAO,CAAC,KAAK,CAAqB;gBAEf,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,kBAAkB;IAetF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAKxB;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;CACF"}

View File

@ -0,0 +1,106 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Excerpt = exports.ExcerptToken = exports.ExcerptTokenKind = void 0;
const node_core_library_1 = require("@rushstack/node-core-library");
/** @public */
var ExcerptTokenKind;
(function (ExcerptTokenKind) {
/**
* Generic text without any special properties
*/
ExcerptTokenKind["Content"] = "Content";
/**
* A reference to an API declaration
*/
ExcerptTokenKind["Reference"] = "Reference";
})(ExcerptTokenKind = exports.ExcerptTokenKind || (exports.ExcerptTokenKind = {}));
/**
* Represents a fragment of text belonging to an {@link Excerpt} object.
*
* @public
*/
class ExcerptToken {
constructor(kind, text, canonicalReference) {
this._kind = kind;
// Standardize the newlines across operating systems. Even though this may deviate from the actual
// input source file that was parsed, it's useful because the newline gets serialized inside
// a string literal in .api.json, which cannot be automatically normalized by Git.
this._text = node_core_library_1.Text.convertToLf(text);
this._canonicalReference = canonicalReference;
}
/**
* Indicates the kind of token.
*/
get kind() {
return this._kind;
}
/**
* The text fragment.
*/
get text() {
return this._text;
}
/**
* The hyperlink target for a token whose type is `ExcerptTokenKind.Reference`. For other token types,
* this property will be `undefined`.
*/
get canonicalReference() {
return this._canonicalReference;
}
}
exports.ExcerptToken = ExcerptToken;
/**
* The `Excerpt` class is used by {@link ApiDeclaredItem} to represent a TypeScript code fragment that may be
* annotated with hyperlinks to declared types (and in the future, source code locations).
*
* @remarks
* API Extractor's .api.json file format stores excerpts compactly as a start/end indexes into an array of tokens.
* Every `ApiDeclaredItem` has a "main excerpt" corresponding to the full list of tokens. The declaration may
* also have have "captured" excerpts that correspond to subranges of tokens.
*
* For example, if the main excerpt is:
*
* ```
* function parse(s: string): Vector | undefined;
* ```
*
* ...then this entire signature is the "main excerpt", whereas the function's return type `Vector | undefined` is a
* captured excerpt. The `Vector` token might be a hyperlink to that API item.
*
* An excerpt may be empty (i.e. a token range containing zero tokens). For example, if a function's return value
* is not explicitly declared, then the returnTypeExcerpt will be empty. By contrast, a class constructor cannot
* have a return value, so ApiConstructor has no returnTypeExcerpt property at all.
*
* @public
*/
class Excerpt {
constructor(tokens, tokenRange) {
this.tokens = tokens;
this.tokenRange = tokenRange;
if (this.tokenRange.startIndex < 0 ||
this.tokenRange.endIndex > this.tokens.length ||
this.tokenRange.startIndex > this.tokenRange.endIndex) {
throw new Error('Invalid token range');
}
this.spannedTokens = this.tokens.slice(this.tokenRange.startIndex, this.tokenRange.endIndex);
}
/**
* The excerpted text, formed by concatenating the text of the `spannedTokens` strings.
*/
get text() {
if (this._text === undefined) {
this._text = this.spannedTokens.map((x) => x.text).join('');
}
return this._text;
}
/**
* Returns true if the excerpt is an empty range.
*/
get isEmpty() {
return this.tokenRange.startIndex === this.tokenRange.endIndex;
}
}
exports.Excerpt = Excerpt;
//# sourceMappingURL=Excerpt.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,58 @@
import type { ApiItem } from '../items/ApiItem';
/**
* Generic result object for finding API items used by different kinds of find operations.
* @public
*/
export interface IFindApiItemsResult {
/**
* The API items that were found. Not guaranteed to be complete, see `maybeIncompleteResult`.
*/
items: ApiItem[];
/**
* Diagnostic messages regarding the find operation.
*/
messages: IFindApiItemsMessage[];
/**
* Indicates whether the result is potentially incomplete due to errors during the find operation.
* If true, the `messages` explain the errors in more detail.
*/
maybeIncompleteResult: boolean;
}
/**
* This object is used for messages returned as part of `IFindApiItemsResult`.
* @public
*/
export interface IFindApiItemsMessage {
/**
* Unique identifier for the message.
* @beta
*/
messageId: FindApiItemsMessageId;
/**
* Text description of the message.
*/
text: string;
}
/**
* Unique identifiers for messages returned as part of `IFindApiItemsResult`.
* @public
*/
export declare enum FindApiItemsMessageId {
/**
* "Unable to resolve declaration reference within API item ___: ___"
*/
DeclarationResolutionFailed = "declaration-resolution-failed",
/**
* "Unable to analyze extends clause ___ of API item ___ because no canonical reference was found."
*/
ExtendsClauseMissingReference = "extends-clause-missing-reference",
/**
* "Unable to analyze references of API item ___ because it is not associated with an ApiModel"
*/
NoAssociatedApiModel = "no-associated-api-model",
/**
* "Unable to analyze references of API item ___ because it is of unsupported kind ___"
*/
UnsupportedKind = "unsupported-kind"
}
//# sourceMappingURL=IFindApiItemsResult.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"IFindApiItemsResult.d.ts","sourceRoot":"","sources":["../../src/mixins/IFindApiItemsResult.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;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,6BAA6B,qCAAqC;IAElE;;OAEG;IACH,oBAAoB,4BAA4B;IAEhD;;OAEG;IACH,eAAe,qBAAqB;CACrC"}

View File

@ -0,0 +1,29 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.FindApiItemsMessageId = void 0;
/**
* Unique identifiers for messages returned as part of `IFindApiItemsResult`.
* @public
*/
var FindApiItemsMessageId;
(function (FindApiItemsMessageId) {
/**
* "Unable to resolve declaration reference within API item ___: ___"
*/
FindApiItemsMessageId["DeclarationResolutionFailed"] = "declaration-resolution-failed";
/**
* "Unable to analyze extends clause ___ of API item ___ because no canonical reference was found."
*/
FindApiItemsMessageId["ExtendsClauseMissingReference"] = "extends-clause-missing-reference";
/**
* "Unable to analyze references of API item ___ because it is not associated with an ApiModel"
*/
FindApiItemsMessageId["NoAssociatedApiModel"] = "no-associated-api-model";
/**
* "Unable to analyze references of API item ___ because it is of unsupported kind ___"
*/
FindApiItemsMessageId["UnsupportedKind"] = "unsupported-kind";
})(FindApiItemsMessageId = exports.FindApiItemsMessageId || (exports.FindApiItemsMessageId = {}));
//# sourceMappingURL=IFindApiItemsResult.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"IFindApiItemsResult.js","sourceRoot":"","sources":["../../src/mixins/IFindApiItemsResult.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AA2C3D;;;GAGG;AACH,IAAY,qBAoBX;AApBD,WAAY,qBAAqB;IAC/B;;OAEG;IACH,sFAA6D,CAAA;IAE7D;;OAEG;IACH,2FAAkE,CAAA;IAElE;;OAEG;IACH,yEAAgD,CAAA;IAEhD;;OAEG;IACH,6DAAoC,CAAA;AACtC,CAAC,EApBW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAoBhC","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 type { 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 * @public\n */\nexport enum FindApiItemsMessageId {\n /**\n * \"Unable to resolve declaration reference within API item ___: ___\"\n */\n DeclarationResolutionFailed = 'declaration-resolution-failed',\n\n /**\n * \"Unable to analyze extends clause ___ of API item ___ because no canonical reference was found.\"\n */\n ExtendsClauseMissingReference = 'extends-clause-missing-reference',\n\n /**\n * \"Unable to analyze references of API item ___ because it is not associated with an ApiModel\"\n */\n NoAssociatedApiModel = 'no-associated-api-model',\n\n /**\n * \"Unable to analyze references of API item ___ because it is of unsupported kind ___\"\n */\n UnsupportedKind = 'unsupported-kind'\n}\n"]}

View File

@ -0,0 +1,16 @@
/**
* This abstraction is used by the mixin pattern.
* It describes a class constructor.
* @public
*/
export type Constructor<T = {}> = new (...args: any[]) => T;
/**
* This abstraction is used by the mixin pattern.
* It describes the "static side" of a class.
*
* @public
*/
export type PropertiesOf<T> = {
[K in keyof T]: T[K];
};
//# sourceMappingURL=Mixin.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/Mixin.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}

View File

@ -0,0 +1,5 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Mixin.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Mixin.js","sourceRoot":"","sources":["../../src/mixins/Mixin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 * This abstraction is used by the mixin pattern.\n * It describes a class constructor.\n * @public\n */\nexport type Constructor<T = {}> = new (...args: any[]) => T; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n/**\n * This abstraction is used by the mixin pattern.\n * It describes the \"static side\" of a class.\n *\n * @public\n */\nexport type PropertiesOf<T> = { [K in keyof T]: T[K] };\n"]}