UNPKG

serverless-plugin-arn-prefixer

Version:

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

107 lines (100 loc) 2.66 kB
import * as AWS from 'aws-sdk'; import { ServerlessLogger } from '@hyperdrive.bot/serverless-utils'; /** * 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(..._args: any[]): 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; module: string | null; 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 extends ServerlessLogger { 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; /** * Reset the logged flag (useful for testing) */ resetLoggedFlag(): void; } declare class ArnPrefixerPlugin { serverless: Serverless; options: any; configurationVariablesSources: Record<string, ConfigurationVariableSource>; hooks: Record<string, () => void>; commands: Record<string, any>; private logger; private configManager; private arnPropertiesManager; private runtimeGenerator; private commandHandlers; constructor(serverless: Serverless, options: any); } export { ArnLogger, ArnPrefixerPlugin, type ArnProperties, ArnPrefixerPlugin as default };