UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

40 lines (39 loc) 2.47 kB
import { Schema, SchemaValues, SchemaPartialValues } from '@sprucelabs/schema'; import { Templates } from '@sprucelabs/spruce-templates'; import { GlobalEmitter } from '../GlobalEmitter'; import { ServiceProvider, Service, ServiceMap } from '../services/ServiceFactory'; import { StoreCode, CreateStoreOptions, StoreMap } from '../stores/StoreFactory'; import { ApiClient, ApiClientFactoryOptions } from '../types/apiClient.types'; import { GraphicsInterface } from '../types/cli.types'; import { WriterOptions } from '../writers/AbstractWriter'; import { WriterCode, WriterMap } from '../writers/WriterFactory'; import AbstractFeature from './AbstractFeature'; import FeatureInstaller from './FeatureInstaller'; import { FeatureAction, FeatureActionResponse, ActionOptions, FeatureCode } from './features.types'; export default abstract class AbstractAction<S extends Schema = Schema> implements FeatureAction<S>, ServiceProvider { abstract optionsSchema: S; readonly commandAliases: string[]; abstract invocationMessage: string; protected parent: AbstractFeature; protected features: FeatureInstaller; protected cwd: string; protected templates: Templates; protected ui: GraphicsInterface; protected emitter: GlobalEmitter; private serviceFactory; private storeFactory; private writerFactory; private apiClientFactory; private actionExecuter; constructor(options: ActionOptions); abstract execute(options: SchemaValues<S>): Promise<FeatureActionResponse>; protected Action(featureCode: FeatureCode, actionCode: string): FeatureAction<Schema>; Service<S extends Service>(type: S, cwd?: string): ServiceMap[S]; protected Store<C extends StoreCode>(code: C, options?: CreateStoreOptions<C>): StoreMap[C]; protected Writer<C extends WriterCode>(code: C, options?: Partial<WriterOptions>): WriterMap[C]; protected getFeature<C extends FeatureCode>(code: C): import("./features.types").FeatureMap[C]; protected getFeatureCodes(): FeatureCode[]; protected validateAndNormalizeOptions(options: SchemaPartialValues<S>): import("@sprucelabs/schema").SchemaValuesWithDefaults<S> extends infer T extends Record<string, any> ? { [K in keyof T]: Exclude<T[K], null>; } : never; protected resolveVersion(userSuppliedVersion: string | null | undefined, resolvedDestination: string): Promise<string>; protected connectToApi(options?: ApiClientFactoryOptions): Promise<ApiClient>; }