Skip to content

Commit

Permalink
chore: add prettier to the project (#379)
Browse files Browse the repository at this point in the history
This PR adds prettier to the project to ensure consistent styling. 

Changes:
- two lines in .projenrc.ts
- regenerated snapshots using `cat package.json | jq '.scripts  | keys_unsorted | map ( select ( . | endswith ( ":snapshot" ) ) ) | .[]' | xargs -I {} yarn run {} `


This PR fixes #381
  • Loading branch information
psrebniak authored Oct 28, 2024
1 parent 498d182 commit ea8b8b8
Show file tree
Hide file tree
Showing 186 changed files with 5,277 additions and 4,205 deletions.
99 changes: 2 additions & 97 deletions .eslintrc.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .prettierignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .prettierrc.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .projen/files.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 15 additions & 22 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,35 @@
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
import { CdklabsConstructLibrary } from 'cdklabs-projen-project-types';
import { Stability } from 'projen/lib/cdk';
import { CdklabsConstructLibrary } from "cdklabs-projen-project-types";
import { Stability } from "projen/lib/cdk";

const cdkVersion = '2.159.1';
const cdkVersion = "2.159.1";

const project = new CdklabsConstructLibrary({
name: '@cdklabs/cdk-appflow',
author: 'Amazon Web Services',
authorAddress: '[email protected]',
name: "@cdklabs/cdk-appflow",
author: "Amazon Web Services",
authorAddress: "[email protected]",
cdkVersion,
defaultReleaseBranch: 'main',
defaultReleaseBranch: "main",
projenrcTs: true,
private: false,
repositoryUrl: 'https://github.com/cdklabs/cdk-appflow.git',
repositoryUrl: "https://github.com/cdklabs/cdk-appflow.git",
stability: Stability.EXPERIMENTAL,
docgen: true,
eslint: true,
prettier: true,
bundledDeps: [],
devDeps: [
'@types/aws-lambda',
'esbuild',
],
devDeps: ["@types/aws-lambda", "esbuild"],
peerDeps: [
`@aws-cdk/aws-redshift-alpha@${cdkVersion}-alpha.0`,
`@aws-cdk/aws-glue-alpha@${cdkVersion}-alpha.0`,
],
jsiiVersion: '~5.4.30',
keywords: [
'aws',
'appflow',
'cdk',
],
gitignore: [
'*.rest', '.vscode', '**/.DS_Store',
],
jsiiVersion: "~5.4.30",
keywords: ["aws", "appflow", "cdk"],
gitignore: ["*.rest", ".vscode", "**/.DS_Store"],
jestOptions: {
jestVersion: '^29',
jestVersion: "^29",
},
});
project.synth();
3 changes: 3 additions & 0 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 34 additions & 24 deletions src/amazonrdsforpostgresql/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
import { CfnFlow } from 'aws-cdk-lib/aws-appflow';
import { IConstruct } from 'constructs';
import { AmazonRdsForPostgreSqlConnectorProfile } from './profile';
import { AmazonRdsForPostgreSqlConnectorType } from './type';
import { AppFlowPermissionsManager } from '../core/appflow-permissions-manager';
import { ConnectorType } from '../core/connectors/connector-type';
import { ErrorHandlingConfiguration } from '../core/error-handling';
import { IFlow } from '../core/flows';
import { IDestination } from '../core/vertices/destination';
import { WriteOperationType } from '../core/write-operation';
import { CfnFlow } from "aws-cdk-lib/aws-appflow";
import { IConstruct } from "constructs";
import { AmazonRdsForPostgreSqlConnectorProfile } from "./profile";
import { AmazonRdsForPostgreSqlConnectorType } from "./type";
import { AppFlowPermissionsManager } from "../core/appflow-permissions-manager";
import { ConnectorType } from "../core/connectors/connector-type";
import { ErrorHandlingConfiguration } from "../core/error-handling";
import { IFlow } from "../core/flows";
import { IDestination } from "../core/vertices/destination";
import { WriteOperationType } from "../core/write-operation";

/**
* The definition of the Amazon AppFlow object for Amazon RDS for PostgreSQL
Expand All @@ -32,7 +32,6 @@ export interface AmazonRdsForPostgreSqlObject {
* Properties of the AmazonRdsForPostgreSqlDestination
*/
export interface AmazonRdsForPostgreSqlDestinationProps {

/**
* The profile to use with the destination
*/
Expand All @@ -58,28 +57,35 @@ export interface AmazonRdsForPostgreSqlDestinationProps {
* Represents a destination for the Amazon RDS for PostgreSQL connector
*/
export class AmazonRdsForPostgreSqlDestination implements IDestination {
private static readonly defaultApiVersion = "1.0";

private static readonly defaultApiVersion = '1.0';

public readonly connectorType: ConnectorType = AmazonRdsForPostgreSqlConnectorType.instance;
public readonly connectorType: ConnectorType =
AmazonRdsForPostgreSqlConnectorType.instance;

/**
* Creates a new instance of the AmazonRdsForPostgreSqlDestination
* @param props - properties of the destination
*/
constructor(private readonly props: AmazonRdsForPostgreSqlDestinationProps) { }
constructor(private readonly props: AmazonRdsForPostgreSqlDestinationProps) {}

bind(flow: IFlow): CfnFlow.DestinationFlowConfigProperty {

this.tryAddNodeDependency(flow, this.props.errorHandling?.errorLocation?.bucket);
AppFlowPermissionsManager.instance().grantBucketWrite(this.props.errorHandling?.errorLocation?.bucket);
this.tryAddNodeDependency(
flow,
this.props.errorHandling?.errorLocation?.bucket,
);
AppFlowPermissionsManager.instance().grantBucketWrite(
this.props.errorHandling?.errorLocation?.bucket,
);
this.tryAddNodeDependency(flow, this.props.profile);

return {
connectorType: this.connectorType.asProfileConnectorType,
apiVersion: this.props.apiVersion ?? AmazonRdsForPostgreSqlDestination.defaultApiVersion,
apiVersion:
this.props.apiVersion ??
AmazonRdsForPostgreSqlDestination.defaultApiVersion,
connectorProfileName: this.props.profile.name,
destinationConnectorProperties: this.buildDestinationConnectorProperties(),
destinationConnectorProperties:
this.buildDestinationConnectorProperties(),
};
}

Expand All @@ -88,7 +94,8 @@ export class AmazonRdsForPostgreSqlDestination implements IDestination {
customConnector: {
entityName: `${this.props.object.schema}.${this.props.object.table}`,
errorHandlingConfig: this.props.errorHandling && {
bucketName: this.props.errorHandling?.errorLocation?.bucket.bucketName,
bucketName:
this.props.errorHandling?.errorLocation?.bucket.bucketName,
bucketPrefix: this.props.errorHandling?.errorLocation?.prefix,
failOnFirstError: this.props.errorHandling.failOnFirstError,
},
Expand All @@ -97,9 +104,12 @@ export class AmazonRdsForPostgreSqlDestination implements IDestination {
};
}

private tryAddNodeDependency(scope: IConstruct, resource?: IConstruct | string): void {
if (resource && typeof resource !== 'string') {
private tryAddNodeDependency(
scope: IConstruct,
resource?: IConstruct | string,
): void {
if (resource && typeof resource !== "string") {
scope.node.addDependency(resource);
}
}
}
}
6 changes: 3 additions & 3 deletions src/amazonrdsforpostgresql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
export * from './type';
export * from './profile';
export * from './destination';
export * from "./type";
export * from "./profile";
export * from "./destination";
Loading

0 comments on commit ea8b8b8

Please sign in to comment.