@salesforce/packaging
Version:
Packaging library for the Salesforce packaging platform
121 lines (120 loc) • 4.81 kB
TypeScript
import { DirectedGraph } from 'graphology';
import { AsyncCreatable } from '@salesforce/kit';
import { AncestryRepresentationProducer, AncestryRepresentationProducerOptions, PackageAncestryNodeData, PackageAncestryNodeOptions, PackageAncestryOptions } from '../interfaces';
import { VersionNumber } from './versionNumber';
/**
* A class that represents the package ancestry graph.
* Given a package Id (0Ho) or a package version Id (04t), it will build a graph of the package's ancestors.
*/
export declare class PackageAncestry extends AsyncCreatable<PackageAncestryOptions> {
private options;
private roots;
private graph;
private packageId;
constructor(options: PackageAncestryOptions);
get requestedPackageId(): string | undefined;
private static createAttributes;
init(): Promise<void>;
/**
* Returns the internal representation of the requested package ancestry graph.
*/
getAncestryGraph(): DirectedGraph;
/**
* Convenience method to get the json representation of the package ancestry graph.
*/
getJsonProducer(): AncestryRepresentationProducer;
/**
* Convenience method to get the CliUx.Tree representation of the package ancestry graph.
*/
getTreeProducer(verbose: boolean): AncestryRepresentationProducer;
/**
* Convenience method to get the dot representation of the package ancestry graph.
*/
getDotProducer(): AncestryRepresentationProducer;
/**
* Returns the producer representation of the package ancestry graph.
*
* @param producerCtor - function that returns a new instance of the producer
* @param rootPackageId - the subscriber package version id of the root node
*/
getRepresentationProducer(producerCtor: (options: AncestryRepresentationProducerOptions) => AncestryRepresentationProducer, rootPackageId: string | undefined): AncestryRepresentationProducer;
/**
* Returns a list of ancestry nodes that represent the path from subscriber package version id to the root of the
* package ancestry tree.
*
* @param subscriberPackageVersionId
*/
getLeafPathToRoot(subscriberPackageVersionId?: string): PackageAncestryNode[][];
private buildAncestryTree;
private getRootsFromRequestedId;
private findRootsForPackageVersion;
private validatePackageType;
private getPackageVersion;
private findRootsForPackage;
private buildAncestryTreeFromRoots;
private addDescendantsFromPackageVersion;
private addToGraph;
private getDescendants;
}
declare class Tree {
nodes: {
[key: string]: Tree;
};
display(logger?: (text: string) => void): void;
insert(child: string, value?: Tree): Tree;
search(key: string): Tree | undefined;
}
export declare class AncestryTreeProducer extends Tree implements AncestryRepresentationProducer {
label: string;
options?: AncestryRepresentationProducerOptions;
private readonly verbose;
constructor(options?: AncestryRepresentationProducerOptions);
addNode(node: AncestryTreeProducer): void;
produce(): void;
private createLabel;
}
export declare class AncestryJsonProducer implements AncestryRepresentationProducer {
label: string;
options?: AncestryRepresentationProducerOptions;
private children;
private readonly data;
constructor(options: AncestryRepresentationProducerOptions);
addNode(node: AncestryJsonProducer): void;
produce(): PackageAncestryNodeData;
}
export declare class AncestryDotProducer implements AncestryRepresentationProducer {
label: string;
options?: AncestryRepresentationProducerOptions;
private children;
constructor(options?: AncestryRepresentationProducerOptions);
/**
* Builds a node line in DOT, of the form nodeID [label="MAJOR.MINOR.PATCH"]
*
* @param currentNode
*/
static buildDotNode(currentNode: AncestryDotProducer): string;
/**
* Builds an edge line in DOT, of the form fromNode -- toNode
*
* @param fromNode
* @param toNode
*/
static buildDotEdge(fromNode: AncestryDotProducer, toNode: AncestryDotProducer): string;
addNode(node: AncestryDotProducer): void;
produce(): string;
}
export declare class PackageAncestryNode extends AsyncCreatable<PackageAncestryNodeOptions> {
options: PackageAncestryNodeOptions;
readonly version: VersionNumber;
readonly MajorVersion: number;
readonly MinorVersion: number;
readonly PatchVersion: number;
readonly BuildNumber: number | string;
readonly AncestorId: string | undefined;
readonly SubscriberPackageVersionId: string;
readonly depthCounter = 0;
constructor(options: PackageAncestryNodeOptions);
getVersion(): string;
protected init(): Promise<void>;
}
export {};