UNPKG

serverless-plugin-arn-prefixer

Version:

A serverless plugin that injects custom ARN properties for building AWS resource ARNs

139 lines (132 loc) 3.35 kB
import * as AWS from 'aws-sdk'; /** * TypeScript types and interfaces for the ARN Prefixer Plugin */ interface ServerlessProvider { stage?: string; region?: string; credentials?: AWS.Config['credentials']; } interface ServerlessService { service: string; provider?: ServerlessProvider; custom?: Record<string, any>; } interface ServerlessCLI { log(message: string): void; } interface Serverless { service: ServerlessService; cli: ServerlessCLI; } interface VariableResolverParams { address: string; params?: any; resolveConfigurationProperty?: Function; options?: any; } interface ConfigurationVariableSource { resolve(params: VariableResolverParams): Promise<{ value: any; }>; } interface ArnProperties { accountId: string; stage: string; service: string; region: string; prefix: string; regionalPrefix: string; globalPrefix: string; arnBase: string; accountRegion: string; dynamodb: string; s3: string; lambda: string; iam: string; sns: string; sqs: string; apigateway: string; events: string; logs: string; kinesis: string; firehose: string; stepfunctions: string; stateMachine: string; } /** * Enhanced logging utilities for ARN Prefixer Plugin * Provides colorful, structured console output with optional verbose mode */ declare class ArnLogger { private serverless; private prefix; private verbose; private loggedOnce; constructor(serverless: any, options?: any); /** * Log ARN properties injection with concise or verbose output */ logArnPropertiesInjection(properties: ArnProperties): void; /** * Log concise version - just the essentials */ private logConciseProperties; /** * Log verbose version - all the details */ private logVerboseProperties; /** * Log a single property with color coding */ private logProperty; /** * Log an info message */ info(message: string): void; /** * Log a success message */ success(message: string): void; /** * Log a warning message */ warning(message: string): void; /** * Log an error message */ error(message: string): void; /** * Log a process step */ step(message: string): void; /** * Reset the logged flag (useful for testing) */ resetLoggedFlag(): void; /** * Output text to console via Serverless CLI or fallback to console.log */ private output; } declare class ArnPrefixerPlugin { serverless: Serverless; options: any; arnProperties: ArnProperties; configurationVariablesSources: Record<string, ConfigurationVariableSource>; hooks: Record<string, () => void>; commands: Record<string, any>; private logger; private config; constructor(serverless: Serverless, options: any); private initializeArnProperties; private resolveArnVariable; private logArnPropertiesOnce; private initializeAndGenerate; private showArnInfo; private generateRuntimeFile; private generateRuntimeFileContent; private generateRuntimeDtsContent; private generateRuntimeFileSync; } export { ArnLogger, ArnPrefixerPlugin, type ArnProperties, ArnPrefixerPlugin as default };