@altostra/core
Version:
Core library for shared types and logic
88 lines (87 loc) • 3.33 kB
TypeScript
/// <reference types="node" />
import { inspect } from 'util';
import type { It } from "../../common/Iterable";
import type { Connection } from "../Blueprint";
import type { Blueprint } from "../Blueprint/Blueprint";
import type { Dict, ResourceId } from "../Common";
import { ConnectionsFactory } from "../Connections/Factory/ConnectionsFactory";
import { ResourceIdsManager } from "../ResourcesIdsManager";
import { BluePrintGlobalVariablesHelper } from "./BluePrintGlobalVariablesHelper";
import { BlueprintConnectionCollection as ConnectionCollection } from "./ConnectionCollection";
import { BlueprintParametersHelper } from "./ParametersHelper";
import type { RequiredFile } from "./RequiredFiles";
import { ResourceCollection } from "./ResourceCollection";
export declare type BlueprintConfiguration = Record<string, string>;
export interface BlueprintHelperOptions {
suppressParamSupportCheck?: boolean;
runMigration?: boolean;
suppressIntegrityCheck?: boolean;
}
/** +
* Manages blueprint data
*/
export declare class BlueprintHelper {
#private;
readonly blueprint: Blueprint;
/**
* Gets an iterable object that yields connections, and allow adding and deleting connections
*/
readonly connections: ConnectionCollection;
/**
* Gets an iterable object that yields resources, and allow adding and deleting resources
*/
readonly resources: ResourceCollection;
/**
* Gets an object that specifies which connections are allowed
*/
readonly connectionsFactory: ConnectionsFactory;
/**
* Gets an object that manages resources-ids, and can generate unique resource ids
*/
readonly idsManager: ResourceIdsManager;
readonly parameters: BlueprintParametersHelper;
readonly globalEnvironmentVariables: BluePrintGlobalVariablesHelper;
/**
* Creates new instance
* @param blueprint The blueprint to manage
*/
constructor(blueprint: Blueprint, { suppressParamSupportCheck, runMigration, suppressIntegrityCheck, }?: BlueprintHelperOptions);
/**
* Gets a value that indicates that the managed blueprint contains some unmanaged resources or policies
*/
get unsafe(): boolean;
/**
* Gets a promise for iterable of all required files.
*/
getRequiredFiles(): Promise<It<RequiredFile>>;
/**
* Replace all parameterized properties in the blueprint with values from the
* provided configuration
* @param config The configuration to apply
* @param options Configuration application options
*/
applyConfiguration(config: BlueprintConfiguration, options?: ApplyConfigurationOptions): ConfigurationWarnings[];
clone(): BlueprintHelper;
toJSON(): object;
[inspect.custom](): unknown;
}
export interface MissingParams {
type: 'missing-params';
key: string;
paramName: string;
resources: ResourceId[];
connections: Omit<Connection, 'type'>[];
}
export declare type ConfigurationWarnings = MissingParams;
/**
* Controls how configuration application is done
*/
export interface ApplyConfigurationOptions {
paramMapping?: Dict<string>;
/**
* Throws if a configuration is missing a value expected by
* a parameterized property \
* Defaults to `true`
*/
expectFullConfiguration?: boolean;
}