Skip to content

Commit

Permalink
Update node dependencies 2024-08-29 (#249)
Browse files Browse the repository at this point in the history
* Updated lock file to latest

* Updated version

* Fixed typo in log message

* Added code that if the password checkbox is checked and the variable name field is empty it will populate with 'PASSWORD'

* Updated eslint to v9 and renamed file

* Updated eslint config to flat config

* Fixed lint errors and warnings

* Fixed type in eslint file

* Fixed the sanitizedCopy functions and their tests (lint found we weren't validating)
  • Loading branch information
tkmcmaster authored Aug 30, 2024
1 parent 4ffd309 commit 6b784e6
Show file tree
Hide file tree
Showing 29 changed files with 1,625 additions and 2,090 deletions.
80 changes: 0 additions & 80 deletions .eslintrc

This file was deleted.

13 changes: 7 additions & 6 deletions agent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-agent",
"version": "3.3.0",
"version": "3.3.1",
"description": "Agent Service for running pewpew tests",
"main": "dist/src/app.js",
"scripts": {
Expand All @@ -19,7 +19,6 @@
"type": "git",
"url": "git+https://github.com/FamilySearch/pewpew.git"
},
"author": "[email protected]",
"bugs": {
"url": "https://github.com/FamilySearch/pewpew/issues"
},
Expand All @@ -45,17 +44,19 @@
"@aws-sdk/client-s3": "^3.363.0",
"@aws-sdk/client-sqs": "^3.363.0",
"@aws-sdk/util-stream-node": "^3.363.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@types/bunyan": "~1.8.8",
"@types/chai": "^4.3.5",
"@types/express": "^4.17.17",
"@types/mocha": "^10.0.0",
"@types/node": "^20.0.0",
"@types/node": "^22.0.0",
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"axios": "~1.7.0",
"chai": "^4.3.7",
"eslint": "^8.40.0",
"eslint": "^9.8.0",
"mocha": "^10.2.0",
"nyc": "^17.0.0",
"typescript": "^5.3.0"
Expand Down
2 changes: 1 addition & 1 deletion agent/src/healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function pingS3 (): Promise<boolean> {
log("Pinging S3 succeeded at " + new Date(), LogLevel.DEBUG);
return true;
} catch (error) {
log("pingS3 failed}", LogLevel.ERROR, error);
log("pingS3 failed", LogLevel.ERROR, error);
// DO NOT REJECT. Just return false
return false;
}
Expand Down
1 change: 0 additions & 1 deletion agent/src/pewpewtest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ export class PewPewTest {
}

// Create a sanitized copy which doesn't have the environment variables which may have passwords
// eslint-disable-next-line @typescript-eslint/ban-types
public sanitizedCopy (): {
started: boolean,
pewpewRunning: boolean,
Expand Down
2 changes: 1 addition & 1 deletion common/integration/s3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe("S3Util Integration", () => {
`${UNIT_TEST_KEY_PREFIX}/${UNIT_TEST_KEY_PREFIX}/${UNIT_TEST_FILENAME}`
].map((s3Path: string) => deleteObject(s3Path).catch((error) =>
log("S3Util Integration before delete failed: " + s3Path, LogLevel.DEBUG, error))));
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// Swallow
}
});
Expand Down
12 changes: 7 additions & 5 deletions common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-common",
"version": "3.3.0",
"version": "3.3.1",
"description": "Common Code for the PewPewController and PewPewAgent",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down Expand Up @@ -41,19 +41,21 @@
},
"devDependencies": {
"@aws-sdk/util-stream-node": "^3.363.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@fs/config-wasm": "*",
"@types/bunyan": "~1.8.8",
"@types/chai": "^4.3.5",
"@types/express": "^4.17.17",
"@types/mocha": "^10.0.0",
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"@types/node": "^22.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"aws-sdk-client-mock": "^4.0.0",
"chai": "^4.3.7",
"dotenv": "^16.0.0",
"dotenv-flow": "^4.0.1",
"eslint": "^8.40.0",
"eslint": "^9.8.0",
"mocha": "^10.2.0",
"nyc": "^17.0.0",
"typescript": "^5.3.0"
Expand Down
2 changes: 1 addition & 1 deletion common/src/ppaastestmessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class PpaasTestMessage implements TestMessage {
case "TestMessage":
try {
parsedTestMessage = temp as TestMessage;
} catch (error: unknown) {
} catch (error: unknown) { // eslint-disable-line @typescript-eslint/no-unused-vars
throw new Error(`messageAttributes[${key}] was not an TestMessage = ${JSON.stringify(temp)}`);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion common/src/s3file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class PpaasS3File implements S3File {
try {
await access(this.localFilePath);
return true;
} catch (error: unknown) {
} catch (error: unknown) { // eslint-disable-line @typescript-eslint/no-unused-vars
return false;
}
}
Expand Down
2 changes: 0 additions & 2 deletions common/test/yamlparser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { expect } from "chai";
import path from "path";

const UNIT_TEST_FOLDER = process.env.UNIT_TEST_FOLDER || "test";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const BAD_FILEPATH = path.join(UNIT_TEST_FOLDER, "s3test.txt");
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const EMPTY_FILEPATH = path.join(UNIT_TEST_FOLDER, "empty.yaml");
const BASIC_FILEPATH = path.join(UNIT_TEST_FOLDER, "basic.yaml");
const BASIC_FILEPATH_WITH_VARS = path.join(UNIT_TEST_FOLDER, "basicwithvars.yaml");
Expand Down
6 changes: 5 additions & 1 deletion controller/components/StartTestForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const UploadTestButton = styled.button`
const notAuthorizedMessageOpenId = (username?: string | null): JSX.Element => <Info>
<Column>
<p>
{`'${username}'` || "User"} is not authorized to run tests.<br/>
{username ? `'${username}'` : "User"} is not authorized to run tests.<br/>
Please request 'Pewpew - User' permission if you need to be able to run tests.
</p>
<Warning>DO NOT request 'Non Prod' Permissions. Those are for internal authentication testing only.</Warning>
Expand Down Expand Up @@ -334,6 +334,10 @@ export const StartTestForm = ({
foundVar.variableName = newEnvVar.variableName !== undefined ? newEnvVar.variableName : foundVar.variableName;
foundVar.variableValue = newEnvVar.variableValue !== undefined ? newEnvVar.variableValue : foundVar.variableValue;
foundVar.type = newEnvVar.type !== undefined ? newEnvVar.type : foundVar.type;
if (newEnvVar.type === "password" && foundVar.variableName === "") {
// If we check the "password" box and the name is blank, default the name to PASSWORD
foundVar.variableName = "PASSWORD";
}
} else {
// New var
const newVar: EnvironmentVariablesState = {
Expand Down
2 changes: 1 addition & 1 deletion controller/components/StartTestForm/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const versionInitalProps: VersionInitalProps = {
let ppaasTestId: PpaasTestId;
try {
ppaasTestId = PpaasTestId.makeTestId("Story");
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder("Story/" + PpaasTestId.getDateString());
}
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestInfo/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { latestPewPewVersion } from "../../pages/api/util/clientutil";
let ppaasTestId: PpaasTestId;
try {
ppaasTestId = PpaasTestId.makeTestId("Story");
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder("Story/" + PpaasTestId.getDateString());
}
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestResults/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const minMaxTime = (testResults: any) => {
let startTime2 = Infinity;
let endTime2 = -Infinity;

// eslint-disable-next-line @typescript-eslint/no-unused-vars

for (const [_, dataPoints] of testResults) {
for (const point of dataPoints) {
if (point.startTime) {
Expand Down
2 changes: 0 additions & 2 deletions controller/components/TestResults/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { HDRHistogram } from "@fs/hdr-histogram-wasm";
type CheckType = string | ((x: unknown) => boolean);
type Check = [string, CheckType];

// eslint-disable-next-line @typescript-eslint/ban-types
function isObject (o: unknown): o is object {
return typeof o === "object" && !!o;
}
Expand Down Expand Up @@ -53,7 +52,6 @@ function isObject (o: unknown): o is object {
* @returns failed check or undefined
*/
function propertyChecker (
// eslint-disable-next-line @typescript-eslint/ban-types
o: object,
requiredChecks: Check[],
unknownCheck?: CheckType,
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestResults/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ configureURL.baseS3Url = "/";
let ppaasTestId: PpaasTestId;
try {
ppaasTestId = PpaasTestId.makeTestId("Story");
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder("Story/" + PpaasTestId.getDateString());
}
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestsList/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const makeTestData = (status: TestStatus): TestData => {
ppaasTestId = PpaasTestId.makeTestId("Story" + counter, {
dateString: PpaasTestId.getDateString(date)
});
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder(`Story${counter}/` + PpaasTestId.getDateString(date));
}
Expand Down
1 change: 0 additions & 1 deletion controller/integration/secrets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { expect } from "chai";
logger.config.LogFileName = "ppaas-controller";

describe("Secrets Integration", () => {
// eslint-disable-next-line require-await
before(async () => {
secretsConfig.secretsClient = undefined as any;
getGlobalSecretsConfig().encryptionKey = undefined;
Expand Down
16 changes: 10 additions & 6 deletions controller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-controller",
"version": "3.3.0",
"version": "3.3.1",
"description": "Controller Service for running pewpew tests",
"private": true,
"scripts": {
Expand All @@ -25,7 +25,6 @@
"type": "git",
"url": "git+https://github.com/FamilySearch/pewpew.git"
},
"author": "[email protected]",
"bugs": {
"url": "https://github.com/FamilySearch/pewpew/issues"
},
Expand All @@ -36,6 +35,9 @@
"nyc": {
"exclude": "**/*.spec.ts"
},
"overrides": {
"eslint": "^9.8.0"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.363.0",
"@aws-sdk/client-secrets-manager": "^3.363.0",
Expand Down Expand Up @@ -78,6 +80,8 @@
"devDependencies": {
"@aws-sdk/client-sqs": "^3.363.0",
"@aws-sdk/util-stream-node": "^3.363.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@next/eslint-plugin-next": "~14.2.0",
"@storybook/addon-actions": "~8.2.0",
"@storybook/addon-links": "~8.2.0",
Expand All @@ -94,21 +98,21 @@
"@types/js-cookie": "^3.0.2",
"@types/js-yaml": "^4.0.5",
"@types/mocha": "^10.0.0",
"@types/node": "^20.0.0",
"@types/node": "^22.0.0",
"@types/react": "^18.2.12",
"@types/react-dom": "^18.2.5",
"@types/react-transition-group": "^4.4.6",
"@types/semver": "^7.5.0",
"@types/yauzl": "^2.10.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"aws-sdk-client-mock": "^4.0.0",
"chai": "^4.3.7",
"copy-webpack-plugin": "^12.0.2",
"dotenv": "^16.0.0",
"dotenv-flow": "^4.0.1",
"esbuild": ">=0.17",
"eslint": "^8.40.0",
"eslint": "^9.8.0",
"eslint-config-next": "~14.2.0",
"form-data": "^4.0.0",
"glob-parent": "^6.0.2",
Expand Down
4 changes: 2 additions & 2 deletions controller/pages/api/util/healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function accessEncryptionKeyPass (): boolean {
log("accessEncryptionKeyPass", LogLevel.DEBUG, { keyPass });
return keyPass;
} catch (error) {
log("accessEncryptionKeyPass", LogLevel.WARN, { keyPass: false });
log("accessEncryptionKeyPass", LogLevel.WARN, error, { keyPass: false });
return false;
}
}
Expand All @@ -80,7 +80,7 @@ export function accessOpenIdSecretPass (): boolean {
log("accessOpenIdSecretPass", LogLevel.DEBUG, { secretPass });
return secretPass;
} catch (error) {
log("accessOpenIdSecretPass", LogLevel.WARN, { secretPass: false });
log("accessOpenIdSecretPass", LogLevel.WARN, error, { secretPass: false });
return false;
}
}
Expand Down
6 changes: 4 additions & 2 deletions controller/pages/api/util/ppaasencryptenvfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ export class PpaasEncryptEnvironmentFile extends PpaasEncryptS3File {
}

// Create a sanitized copy which doesn't have the environment variables which may have passwords
public sanitizedCopy (): Record<string, any> {
return Object.assign({}, this, {
public sanitizedCopy (): PpaasEncryptS3File {
const sanitized = Object.assign(super.sanitizedCopy(), this, {
body: undefined,
fileContents: undefined,
// Change the object into an array of just the keys (that can be JSON.stringified)
environmentVariablesFile: this.environmentVariablesFile && Object.keys(this.environmentVariablesFile)
});
return sanitized;
}

// Returns itself
Expand Down
Loading

0 comments on commit 6b784e6

Please sign in to comment.