Skip to content

Commit

Permalink
style: fix eslint rule lines-between-class-members (aws-amplify#1681)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch authored Jul 19, 2023
1 parent 924168f commit cd79b23
Show file tree
Hide file tree
Showing 80 changed files with 449 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { contextUtil } from './context-util';
*/
export class SchemaReader {
private schemaPath: string;

private schemaDocument: DocumentNode;

private preProcessedSchemaDocument: DocumentNode;

getSchemaPath = async (resourceDir: string): Promise<string> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ export class AmplifyCLIFeatureFlagAdapterBase implements FeatureFlagProvider {
getBoolean(featureName: string, defaultValue?: boolean): boolean {
return this.getValue<boolean>(featureName, 'boolean', defaultValue);
}

getNumber(featureName: string, defaultValue?: number): number {
return this.getValue<number>(featureName, 'number', defaultValue);
}

getObject(): object {
// Todo: for future extensibility
throw new Error('Not implemented');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export function applyFileBasedOverride(stackManager: StackManager, overrideDirPa
*/
export class InvalidOverrideError extends Error {
details: string;

resolution: string;

constructor(error: Error) {
super('Executing overrides failed.');
this.name = 'InvalidOverrideError';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ import * as fs from 'fs-extra';
import { AppSyncCLIInputs } from '../service-walkthrough-types/appsync-user-input-types';

export class AppsyncApiInputState {
#cliInputsFilePath: string; // cli-inputs.json (output) filepath
#resourceName: string; // user friendly name provided by user
#category: string; // category of the resource
#service: string; // AWS service for the resource
#cliInputsFilePath: string; //cli-inputs.json (output) filepath

#resourceName: string; //user friendly name provided by user

#category: string; //category of the resource

#service: string; //AWS service for the resource

#buildFilePath: string;

constructor(private readonly context: $TSContext, resourceName: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import { ApigwWalkthroughReturnPromise } from './service-walkthrough-types/apigw

export class ApigwInputState {
projectRootPath: string;

resourceName: string;

paths: { [pathName: string]: Path };

constructor(private readonly context: $TSContext, resourceName?: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,39 @@ export type ContainersStackProps = Readonly<{
}>;
export abstract class ContainersStack extends cdk.Stack {
protected readonly vpcId: string;

private readonly vpcCidrBlock: string;

protected readonly subnets: ReadonlyArray<string>;

private readonly clusterName: string;

private readonly zipPath: string;

private readonly cloudMapNamespaceId: string;

protected readonly vpcLinkId: string;

private readonly pipelineWithAwaiter: PipelineWithAwaiter;

protected readonly cloudMapService: cloudmap.CfnService | undefined;

protected readonly ecsService: ecs.CfnService;

protected readonly isAuthCondition: cdk.CfnCondition;

protected readonly appClientId: string | undefined;

protected readonly userPoolId: string | undefined;

protected readonly ecsServiceSecurityGroup: ec2.CfnSecurityGroup;

protected readonly parameters: ReadonlyMap<string, cdk.CfnParameter>;

protected readonly envName: string;

protected readonly deploymentBucketName: string;

protected readonly awaiterS3Key: string;

constructor(scope: Construct, id: string, private readonly props: ContainersStackProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ const ROOT_CFN_DESCRIPTION = 'API Gateway Resource for AWS Amplify CLI';

export class AmplifyApigwResourceStack extends cdk.Stack implements AmplifyApigwResourceTemplate {
restApi: apigw.CfnRestApi;

deploymentResource: apigw.CfnDeployment;

paths: Record<string, any>;

policies: { [pathName: string]: ApigwPathPolicy };

private _scope: Construct;

private _props: ApigwInputs;

private _cfnParameterMap: Map<string, cdk.CfnParameter> = new Map();

private _cfnParameterValues: Record<string, any>;

private _seenLogicalIds: Set<string>;

constructor(scope: Construct, id: string, props: ApigwInputs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ import { AmplifyApigwResourceStack, ApigwInputs, CrudOperation, Path } from '.';

export class ApigwStackTransform {
cliInputs: ApigwInputs;

resourceTemplateObj: AmplifyApigwResourceStack | undefined;

cliInputsState: ApigwInputState;

cfn: Template;

cfnInputParams: Record<string, any>;

resourceName: string;

private _app: cdk.App;

constructor(context: $TSContext, resourceName: string, cliInputState?: ApigwInputState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,29 @@ class Container implements IContainerDefinitions {
};

build: string | IBuildConfig | undefined;

name: string;

portMappings: PortMappings;

logConfiguration = this.defaultLogConfiguration;

command?: string[];

entrypoint?: string[];

env_file?: string[];

environment?: Record<string, string>;

image?: string;

healthcheck?: ContainerHealthCheck;

working_dir?: string;

user?: string;

secrets: Set<string>;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ const DEFAULT_CONTAINER_MEMORY_CPU = {

class Service implements IServiceDefinition {
containers: Container[] = [];

apiHealthcheck?: ServiceHealthCheck;

taskResources: TaskConfig = DEFAULT_TASK_MEMORY_CPU;

containerResources: ContainerConfig = DEFAULT_CONTAINER_MEMORY_CPU;

deploymentConfiguration: DeploymentConfiguration = DEFAULT_SERVICE_DEPLYMENT_CONFIG;

desiredCount: number = DEFAULT_DESIRED_COUNT;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class PipelineAwaiter extends Construct {

export class PipelineWithAwaiter extends Construct {
pipelineName: string;

constructor(
scope: Construct,
id: string,
Expand Down Expand Up @@ -251,11 +252,17 @@ export class PipelineWithAwaiter extends Construct {
clusterName: service.cluster,
env: {},
} as ecs.ICluster;

serviceArn = cdk.Fn.ref(service.attrServiceArn);

serviceName = service.serviceName;

stack = cdk.Stack.of(this);

env = {} as any;

node = service.node;

public applyRemovalPolicy(policy: cdk.RemovalPolicy): void {
// TODO: This is added for CDK upgrade. Modify the behavior if required.
}
Expand Down
9 changes: 9 additions & 0 deletions packages/amplify-e2e-core/src/asciinema-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ export type Recording = {

export class Recorder {
private isPaused: boolean = false;

private childProcess: pty.IPty;

private onDataHandlers: ((data: string) => void)[] = [];

private onExitHandlers: ((exitCode: number, signal: string | number) => void)[] = [];

private startTime: number;

private recording: Recording;

private cwd: string;

private exitCode: number | undefined;

constructor(
private cmd: string,
private args: string[],
Expand Down Expand Up @@ -83,6 +91,7 @@ export class Recorder {
addOnExitHandlers(fn: (code: number, signal: string | number) => void) {
this.onExitHandlers.push(fn);
}

removeOnExitHandlers(fn: (code: number, signal: string | number) => void): boolean {
const idx = this.onExitHandlers.indexOf(fn);
if (idx === -1) {
Expand Down
1 change: 1 addition & 0 deletions packages/amplify-e2e-core/src/cli-version-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as e2eCore from '.';
*/
class CLIVersionController {
#getCLIPathSpy: jest.SpyInstance<string>;

/**
* All CLI calls (that use getCLIVersion) will use the specified CLI version
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ type ResourceOperationInput = {
*/
export class AccessControlMatrix {
private name: string;

private roles: Array<string>;

private operations: Array<ModelOperation>;

private resources: Array<string>;

private matrix: Array<Array<Array<boolean>>>;

constructor(config: ACMConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,31 @@ const getReadRolesForField = (acm: AccessControlMatrix, readRoles: Array<string>
*/
export class AuthTransformer extends TransformerAuthBase implements TransformerAuthProvider {
private config: AuthTransformerConfig;

private configuredAuthProviders: ConfiguredAuthProviders;

private rules: AuthRule[];

// access control
private roleMap: Map<string, RoleDefinition>;

private authModelConfig: Map<string, AccessControlMatrix>;

private authNonModelConfig: Map<string, AccessControlMatrix>;

// model config
private modelDirectiveConfig: Map<string, ModelDirectiveConfiguration>;

// schema generation
private seenNonModelTypes: Map<string, Set<string>>;

// iam policy generation
private generateIAMPolicyForUnauthRole: boolean;

private generateIAMPolicyForAuthRole: boolean;

private authPolicyResources = new Set<string>();

private unauthPolicyResources = new Set<string>();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,32 @@ interface Indexable {

export class TypeValidators implements Indexable {
[key: string]: any;

ID = validateString;

String = validateString;

Int = validateInt;

Float = validateFloat;

Boolean = validateBoolean;

AWSJSON = validateJson;

AWSDate = validateAwsDate;

AWSTime = validateAwsTime;

AWSDateTime = validateAwsDateTime;

AWSTimestamp = validateAwsTimestamp;

AWSEmail = validateAwsEmail;

AWSURL = validateAwsUrl;

AWSPhone = validateAwsPhone;

AWSIPAddress = validateAwsIpAddress;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const directiveDefinition = `
*/
export class IndexTransformer extends TransformerPluginBase {
private directiveList: IndexDirectiveConfiguration[] = [];

private resolverMap: Map<TransformerResolverProvider, string> = new Map();

constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const directiveDefinition = `

export class PrimaryKeyTransformer extends TransformerPluginBase {
private directiveList: PrimaryKeyDirectiveConfiguration[] = [];

private resolverMap: Map<TransformerResolverProvider, string> = new Map();

constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,24 @@ const DDB_DATASOURCE_TYPE = { dbType: DDB_DB_TYPE, provisioned: true };
*/
export class ModelTransformer extends TransformerModelBase implements TransformerModelProvider {
private options: ModelTransformerOptions;

private datasourceMap: Record<string, DataSourceProvider> = {};

private ddbTableMap: Record<string, ITable> = {};

private resolverMap: Record<string, TransformerResolverProvider> = {};

private typesWithModelDirective: Set<string> = new Set();

private resourceGeneratorMap: Map<string, ModelResourceGenerator> = new Map<string, ModelResourceGenerator>();

private modelToDatasourceMap: Map<string, DatasourceType> = new Map<string, DatasourceType>();

/**
* A Map to hold the directive configuration
*/
private modelDirectiveConfig: Map<string, ModelDirectiveConfiguration> = new Map();

constructor(options: ModelTransformerOptions = {}) {
super('amplify-model-transformer', directiveDefinition);
this.options = this.getOptions(options);
Expand Down
Loading

0 comments on commit cd79b23

Please sign in to comment.