Skip to content

Commit

Permalink
JavaScript (v3): Ramdectomy (awsdocs#5481)
Browse files Browse the repository at this point in the history
* JavaScript (v3): Ramdaectomy - Remove ramda usage from cognito-identity-provider.

* JavaScript (v3): Ramdaectomy - Remove ramda usage from aurora-serverless-app.

* JavaScript (v3): Ramdaectomy - Remove ramda usage from glue.

* JavaScript (v3): Ramdaectomy - Remove ramda usage from lambda.

* JavaScript (v3): Ramdaectomy - Remove ramda usage cmd-runner.

* JavaScript (v3): Ramdaectomy - Remove remaining ramda usage.

* JavaScript (v3): Ramdaectomy - Add missing copyright.

---------

Co-authored-by: ford prior <[email protected]>
  • Loading branch information
cpyle0819 and ford-at-aws authored Oct 11, 2023
1 parent 8e1fbe4 commit 341c6ad
Show file tree
Hide file tree
Showing 51 changed files with 12,602 additions and 14,821 deletions.
1 change: 0 additions & 1 deletion javascriptv3/example_code/cloudwatch-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@aws-sdk/client-cloudwatch-logs": "^3.215.0",
"@aws-sdk/client-iam": "^3.216.0",
"@aws-sdk/client-lambda": "^3.216.0",
"ramda": "^0.28.0",
"libs": "*"
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion javascriptv3/example_code/cloudwatch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"integration-test": "vitest run **/*.integration.test.js"
},
"devDependencies": {
"ramda": "^0.28.0",
"uuid": "^9.0.0",
"vitest": "^0.25.2"
}
Expand Down
11 changes: 5 additions & 6 deletions javascriptv3/example_code/cognito-identity-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
"integration-test": "vitest run **/*.integration.test.js"
},
"dependencies": {
"@aws-sdk/client-cognito-identity-provider": "^3.183.0",
"@aws-sdk/client-ses": "^3.183.0",
"@aws-sdk/client-cognito-identity-provider": "^3.423.0",
"@aws-sdk/client-ses": "^3.423.0",
"@types/qrcode-terminal": "^0.12.0",
"amazon-cognito-identity-js": "^5.2.10",
"aws-amplify": "^4.3.37",
"amazon-cognito-identity-js": "^6.3.6",
"aws-amplify": "^5.3.11",
"crypto-js": "^4.1.1",
"qrcode-terminal": "^0.12.0",
"ramda": "^0.28.0"
"qrcode-terminal": "^0.12.0"
},
"devDependencies": {
"vitest": "^0.26.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { pipe, otherwise, map, join } from "ramda";
import { promiseAll } from "libs/ext-ramda.js";
import { deleteFiles } from "libs/utils/util-fs.js";
import { log } from "libs/utils/util-log.js";
import { deleteUserPool } from "../../../actions/delete-user-pool.js";
import { FILE_USER_POOLS } from "./constants.js";
import { getFirstValuesFromEntries } from "libs/utils/util-csv.js";

const cleanUpUserPools = pipe(
map(pipe(deleteUserPool, otherwise(log))),
promiseAll,
);
/**
* @param {string[]} userPoolIds
*/
function cleanUpUserPools(userPoolIds) {
const deletePromises = userPoolIds.map((id) =>
deleteUserPool(id).catch((err) => log(err)),
);
return Promise.all(deletePromises);
}

const createUserPoolList = pipe(
map((x) => `• ${x}`),
join("\n"),
);
/**
* @param {string[]} userPoolIds
*/
function createUserPoolList(userPoolIds) {
return userPoolIds.map((id) => `• ${id}`).join("\n");
}

const cleanUpHandler = async () => {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import { createUserPool } from "../../../actions/create-user-pool.js";
import { FILE_USER_POOLS, NAME_CLIENT } from "./constants.js";
import { setUserPoolMfaConfig } from "../../../actions/set-user-pool-mfa-config.js";
import { createUserPoolClient } from "../../../actions/create-user-pool-client.js";
import { join } from "ramda";

const storeUserPoolMeta = (...args) => {
const tmp = getTmp(FILE_USER_POOLS);
const entry = join(",", args);
const entry = args.join(",");
setTmp(FILE_USER_POOLS, tmp ? `${tmp}\n${entry}` : entry);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
*/
import { createInterface } from "readline";
import { stdin as input, stdout as output } from "process";
import { startsWith } from "ramda";

import { readCommands } from "libs/cmd-runner.js";
import { log } from "libs/utils/util-log.js";
import { startsWith } from "libs/utils/util-array.js";

import { createUserPoolHandler } from "./command-handlers/create-user-pool-handler.js";
import { cleanUpHandler } from "./command-handlers/clean-up-handler.js";
import { signUpHandler } from "./command-handlers/sign-up-handler.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"express": "^5.0.0-beta.1",
"mimetext": "^2.0.10",
"prettier": "^2.7.1",
"ramda": "^0.28.0",
"uuid": "^9.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
import { pipe, zipWith, fromPairs } from "ramda";
import { Item } from "src/types/item.js";
import { Item } from "../types/item.js";

const makePairs = (key: string, value: DBRecordValue) => {
if (key === "archived") {
return [key, Boolean(value.longValue)];
} else {
return [key, value.stringValue];
}
const parseItem = (record: DBRecord): Item => {
return {
id: `${record[0].stringValue}`,
description: `${record[1].stringValue}`,
guide: `${record[2].stringValue}`,
status: `${record[3].stringValue}`,
name: `${record[4].stringValue}`,
archived: Boolean(record[5].longValue),
};
};

const parseItem: (record: DBRecord) => Item = pipe(
zipWith(makePairs, [
"id",
"description",
"guide",
"status",
"name",
"archived",
]),
fromPairs
);

export { parseItem };
Loading

0 comments on commit 341c6ad

Please sign in to comment.