diff --git a/.changeset/orange-eyes-hide.md b/.changeset/orange-eyes-hide.md new file mode 100644 index 0000000..5cb1966 --- /dev/null +++ b/.changeset/orange-eyes-hide.md @@ -0,0 +1,5 @@ +--- +"@effect-aws/client-secrets-manager": major +--- + +implement effectful secrets manager client diff --git a/.projenrc.ts b/.projenrc.ts index d66d9f7..0179265 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -155,6 +155,14 @@ new TypeScriptLibProject({ peerDeps: commonPeerDeps, }); +new TypeScriptLibProject({ + parent: project, + name: "client-secrets-manager", + deps: [...commonDeps, "@aws-sdk/client-secrets-manager@^3"], + devDeps: commonDevDeps, + peerDeps: commonPeerDeps, +}); + new TypeScriptLibProject({ parent: project, name: "lambda", diff --git a/package.json b/package.json index aac273a..35c57a9 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", "nx": "16.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "ts-node": "^10.9.1", "tsx": "^4.7.0", @@ -89,6 +89,7 @@ "packages/client-iam", "packages/client-lambda", "packages/client-s3", + "packages/client-secrets-manager", "packages/client-sfn", "packages/client-sns", "packages/client-sqs", diff --git a/packages/client-api-gateway-management-api/package.json b/packages/client-api-gateway-management-api/package.json index 5b28964..ff78717 100644 --- a/packages/client-api-gateway-management-api/package.json +++ b/packages/client-api-gateway-management-api/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-dynamodb/package.json b/packages/client-dynamodb/package.json index 170a9ad..03780e9 100644 --- a/packages/client-dynamodb/package.json +++ b/packages/client-dynamodb/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-ec2/package.json b/packages/client-ec2/package.json index 5ccadca..773fc27 100644 --- a/packages/client-ec2/package.json +++ b/packages/client-ec2/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.2.4", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-elasticache/package.json b/packages/client-elasticache/package.json index 5e67e7f..369c411 100644 --- a/packages/client-elasticache/package.json +++ b/packages/client-elasticache/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.2.4", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-eventbridge/package.json b/packages/client-eventbridge/package.json index fde311a..ee19a1f 100644 --- a/packages/client-eventbridge/package.json +++ b/packages/client-eventbridge/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-iam/package.json b/packages/client-iam/package.json index ed9d8eb..9cdbc4b 100644 --- a/packages/client-iam/package.json +++ b/packages/client-iam/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-lambda/package.json b/packages/client-lambda/package.json index e0a9bd7..3b51166 100644 --- a/packages/client-lambda/package.json +++ b/packages/client-lambda/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-s3/package.json b/packages/client-s3/package.json index 17e868c..0a29546 100644 --- a/packages/client-s3/package.json +++ b/packages/client-s3/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-secrets-manager/.eslintrc.json b/packages/client-secrets-manager/.eslintrc.json new file mode 100644 index 0000000..c31c44d --- /dev/null +++ b/packages/client-secrets-manager/.eslintrc.json @@ -0,0 +1,126 @@ +// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +{ + "env": { + "jest": true, + "node": true + }, + "root": true, + "plugins": [ + "@typescript-eslint", + "import" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module", + "project": "./tsconfig.dev.json" + }, + "extends": [ + "plugin:import/typescript", + "plugin:prettier/recommended" + ], + "settings": { + "import/parsers": { + "@typescript-eslint/parser": [ + ".ts", + ".tsx" + ] + }, + "import/resolver": { + "node": {}, + "typescript": { + "project": "./tsconfig.dev.json", + "alwaysTryTypes": true + } + } + }, + "ignorePatterns": [ + "*.js", + "*.d.ts", + "node_modules/", + "*.generated.ts", + "coverage" + ], + "rules": { + "@typescript-eslint/no-require-imports": [ + "error" + ], + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": [ + "**/test/**", + "**/build-tools/**" + ], + "optionalDependencies": false, + "peerDependencies": true + } + ], + "import/no-unresolved": [ + "error" + ], + "import/order": [ + "warn", + { + "groups": [ + "builtin", + "external" + ], + "alphabetize": { + "order": "asc", + "caseInsensitive": true + } + } + ], + "no-duplicate-imports": [ + "error" + ], + "no-shadow": [ + "off" + ], + "@typescript-eslint/no-shadow": [ + "error" + ], + "key-spacing": [ + "error" + ], + "no-multiple-empty-lines": [ + "error" + ], + "@typescript-eslint/no-floating-promises": [ + "error" + ], + "no-return-await": [ + "off" + ], + "@typescript-eslint/return-await": [ + "error" + ], + "no-trailing-spaces": [ + "error" + ], + "dot-notation": [ + "error" + ], + "no-bitwise": [ + "error" + ], + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "public-static-field", + "public-static-method", + "protected-static-field", + "protected-static-method", + "private-static-field", + "private-static-method", + "field", + "constructor", + "method" + ] + } + ] + }, + "overrides": [] +} diff --git a/packages/client-secrets-manager/.gitattributes b/packages/client-secrets-manager/.gitattributes new file mode 100644 index 0000000..1c2be5a --- /dev/null +++ b/packages/client-secrets-manager/.gitattributes @@ -0,0 +1,21 @@ +# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/./tsconfig.esm.json linguist-generated +/.eslintrc.json linguist-generated +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc linguist-generated +/.prettierignore linguist-generated +/.prettierrc.json linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/docgen.json linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/pnpm-lock.yaml linguist-generated +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated \ No newline at end of file diff --git a/packages/client-secrets-manager/.gitignore b/packages/client-secrets-manager/.gitignore new file mode 100644 index 0000000..e4fdd83 --- /dev/null +++ b/packages/client-secrets-manager/.gitignore @@ -0,0 +1,45 @@ +# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +!/LICENSE +!/.npmignore +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +pids +*.pid +*.seed +*.pid.lock +lib-cov +coverage +*.lcov +.nyc_output +build/Release +node_modules/ +jspm_packages/ +*.tsbuildinfo +.eslintcache +*.tgz +.yarn-integrity +.cache +!/.prettierignore +!/.prettierrc.json +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.eslintrc.json +!/tsconfig.esm.json +!/project.json +!/docgen.json +docs/ diff --git a/packages/client-secrets-manager/.npmignore b/packages/client-secrets-manager/.npmignore new file mode 100644 index 0000000..277d62e --- /dev/null +++ b/packages/client-secrets-manager/.npmignore @@ -0,0 +1,20 @@ +# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/.prettierignore +/.prettierrc.json +/test/ +/tsconfig.dev.json +/src/ +!/lib/ +!/lib/**/*.js +!/lib/**/*.d.ts +dist +/tsconfig.json +/.github/ +/.vscode/ +/.idea/ +/.projenrc.js +tsconfig.tsbuildinfo +/.eslintrc.json +/tsconfig.esm.json +/.gitattributes diff --git a/packages/client-secrets-manager/.prettierignore b/packages/client-secrets-manager/.prettierignore new file mode 100644 index 0000000..46704c7 --- /dev/null +++ b/packages/client-secrets-manager/.prettierignore @@ -0,0 +1 @@ +# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". diff --git a/packages/client-secrets-manager/.prettierrc.json b/packages/client-secrets-manager/.prettierrc.json new file mode 100644 index 0000000..84c85a3 --- /dev/null +++ b/packages/client-secrets-manager/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "overrides": [] +} diff --git a/packages/client-secrets-manager/.projen/deps.json b/packages/client-secrets-manager/.projen/deps.json new file mode 100644 index 0000000..3592b7b --- /dev/null +++ b/packages/client-secrets-manager/.projen/deps.json @@ -0,0 +1,83 @@ +{ + "dependencies": [ + { + "name": "@types/node", + "version": "^18", + "type": "build" + }, + { + "name": "@typescript-eslint/eslint-plugin", + "version": "^6", + "type": "build" + }, + { + "name": "@typescript-eslint/parser", + "version": "^6", + "type": "build" + }, + { + "name": "aws-sdk-client-mock", + "type": "build" + }, + { + "name": "aws-sdk-client-mock-jest", + "type": "build" + }, + { + "name": "constructs", + "version": "^10.0.0", + "type": "build" + }, + { + "name": "eslint-config-prettier", + "type": "build" + }, + { + "name": "eslint-import-resolver-typescript", + "type": "build" + }, + { + "name": "eslint-plugin-import", + "type": "build" + }, + { + "name": "eslint-plugin-prettier", + "type": "build" + }, + { + "name": "eslint", + "version": "^8", + "type": "build" + }, + { + "name": "prettier", + "type": "build" + }, + { + "name": "projen", + "version": "^0.79.24", + "type": "build" + }, + { + "name": "typescript", + "version": "^5.4.2", + "type": "build" + }, + { + "name": "effect", + "version": ">=3.0.0 <4.0.0", + "type": "peer" + }, + { + "name": "@aws-sdk/client-secrets-manager", + "version": "^3", + "type": "runtime" + }, + { + "name": "@aws-sdk/types", + "version": "^3", + "type": "runtime" + } + ], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." +} diff --git a/packages/client-secrets-manager/.projen/files.json b/packages/client-secrets-manager/.projen/files.json new file mode 100644 index 0000000..c38792b --- /dev/null +++ b/packages/client-secrets-manager/.projen/files.json @@ -0,0 +1,20 @@ +{ + "files": [ + ".eslintrc.json", + ".gitattributes", + ".gitignore", + ".npmignore", + ".prettierignore", + ".prettierrc.json", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "docgen.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.esm.json", + "tsconfig.json" + ], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." +} diff --git a/packages/client-secrets-manager/.projen/tasks.json b/packages/client-secrets-manager/.projen/tasks.json new file mode 100644 index 0000000..6ecb00a --- /dev/null +++ b/packages/client-secrets-manager/.projen/tasks.json @@ -0,0 +1,113 @@ +{ + "tasks": { + "build": { + "name": "build", + "description": "Full release build", + "steps": [ + { + "spawn": "pre-compile" + }, + { + "spawn": "compile" + }, + { + "spawn": "post-compile" + }, + { + "spawn": "test" + }, + { + "spawn": "package" + } + ] + }, + "compile": { + "name": "compile", + "description": "Only compile", + "steps": [ + { + "exec": "tsc -b ./tsconfig.json ./tsconfig.esm.json" + } + ] + }, + "default": { + "name": "default", + "description": "Synthesize project files" + }, + "eslint": { + "name": "eslint", + "description": "Runs eslint against the codebase", + "steps": [ + { + "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern $@ src test build-tools", + "receiveArgs": true + } + ] + }, + "install": { + "name": "install", + "description": "Install project dependencies and update lockfile (non-frozen)", + "steps": [ + { + "exec": "pnpm i --no-frozen-lockfile" + } + ] + }, + "install:ci": { + "name": "install:ci", + "description": "Install project dependencies using frozen lockfile", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile" + } + ] + }, + "package": { + "name": "package", + "description": "Creates the distribution package" + }, + "post-compile": { + "name": "post-compile", + "description": "Runs after successful compilation" + }, + "pre-compile": { + "name": "pre-compile", + "description": "Prepare the project for compilation" + }, + "test": { + "name": "test", + "description": "Run tests", + "steps": [ + { + "exec": "vitest run --globals --reporter verbose", + "receiveArgs": true + }, + { + "spawn": "eslint" + } + ] + }, + "test:watch": { + "name": "test:watch", + "description": "Run tests in watch mode", + "steps": [ + { + "exec": "vitest --globals --reporter verbose" + } + ] + }, + "watch": { + "name": "watch", + "description": "Watch & compile in the background", + "steps": [ + { + "exec": "tsc --build -w" + } + ] + } + }, + "env": { + "PATH": "$(pnpm -c exec \"node --print process.env.PATH\")" + }, + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." +} diff --git a/packages/client-secrets-manager/LICENSE b/packages/client-secrets-manager/LICENSE new file mode 100644 index 0000000..7afce46 --- /dev/null +++ b/packages/client-secrets-manager/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2024 Victor Korzunin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/client-secrets-manager/README.md b/packages/client-secrets-manager/README.md new file mode 100644 index 0000000..b3fa7dd --- /dev/null +++ b/packages/client-secrets-manager/README.md @@ -0,0 +1 @@ +# replace this \ No newline at end of file diff --git a/packages/client-secrets-manager/docgen.json b/packages/client-secrets-manager/docgen.json new file mode 100644 index 0000000..b359fc7 --- /dev/null +++ b/packages/client-secrets-manager/docgen.json @@ -0,0 +1,8 @@ +{ + "$schema": "../../node_modules/@effect/docgen/schema.json", + "exclude": [ + "src/index.ts", + "src/Errors.ts" + ], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." +} diff --git a/packages/client-secrets-manager/package.json b/packages/client-secrets-manager/package.json new file mode 100644 index 0000000..3573bb3 --- /dev/null +++ b/packages/client-secrets-manager/package.json @@ -0,0 +1,56 @@ +{ + "name": "@effect-aws/client-secrets-manager", + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "eslint": "npx projen eslint", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "pre-compile": "npx projen pre-compile", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "watch": "npx projen watch", + "docgen": "docgen" + }, + "author": { + "name": "Victor Korzunin", + "email": "ifloydrose@gmail.com", + "organization": false + }, + "devDependencies": { + "@types/node": "^18", + "@typescript-eslint/eslint-plugin": "^6", + "@typescript-eslint/parser": "^6", + "aws-sdk-client-mock": "^3.0.0", + "aws-sdk-client-mock-jest": "^3.0.0", + "constructs": "^10.0.0", + "effect": "3.0.0", + "eslint": "^8", + "eslint-config-prettier": "^9.0.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-prettier": "^5.0.0", + "prettier": "^3.2.5", + "projen": "^0.79.24", + "typescript": "^5.4.2" + }, + "peerDependencies": { + "effect": ">=3.0.0 <4.0.0" + }, + "dependencies": { + "@aws-sdk/client-secrets-manager": "^3", + "@aws-sdk/types": "^3" + }, + "main": "lib/index.js", + "license": "MIT", + "homepage": "https://floydspace.github.io/effect-aws", + "publishConfig": { + "access": "public" + }, + "version": "0.0.0", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "sideEffects": [], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." +} diff --git a/packages/client-secrets-manager/project.json b/packages/client-secrets-manager/project.json new file mode 100644 index 0000000..f2ff1a8 --- /dev/null +++ b/packages/client-secrets-manager/project.json @@ -0,0 +1,77 @@ +{ + "name": "@effect-aws/client-secrets-manager", + "root": "packages/client-secrets-manager", + "targets": { + "default": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen default", + "cwd": "packages/client-secrets-manager" + } + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen pre-compile", + "cwd": "packages/client-secrets-manager" + } + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen compile", + "cwd": "packages/client-secrets-manager" + } + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-compile", + "cwd": "packages/client-secrets-manager" + } + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test", + "cwd": "packages/client-secrets-manager" + } + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen package", + "cwd": "packages/client-secrets-manager" + } + }, + "build": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen build", + "cwd": "packages/client-secrets-manager" + } + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen watch", + "cwd": "packages/client-secrets-manager" + } + }, + "eslint": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen eslint", + "cwd": "packages/client-secrets-manager" + } + }, + "test:watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test:watch", + "cwd": "packages/client-secrets-manager" + } + } + }, + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." +} diff --git a/packages/client-secrets-manager/src/Errors.ts b/packages/client-secrets-manager/src/Errors.ts new file mode 100644 index 0000000..99537b1 --- /dev/null +++ b/packages/client-secrets-manager/src/Errors.ts @@ -0,0 +1,37 @@ +import type { + DecryptionFailure, + EncryptionFailure, + InternalServiceError as InternalServiceException, + InvalidNextTokenException, + InvalidParameterException, + InvalidRequestException, + LimitExceededException, + MalformedPolicyDocumentException, + PreconditionNotMetException, + PublicPolicyException, + ResourceExistsException, + ResourceNotFoundException, +} from "@aws-sdk/client-secrets-manager"; +import * as Data from "effect/Data"; + +export type TaggedException = T & { + readonly _tag: T["name"]; +}; + +export type DecryptionError = TaggedException; +export type EncryptionError = TaggedException; +export type InternalServiceError = TaggedException; +export type InvalidNextTokenError = TaggedException; +export type InvalidParameterError = TaggedException; +export type InvalidRequestError = TaggedException; +export type LimitExceededError = TaggedException; +export type MalformedPolicyDocumentError = + TaggedException; +export type PreconditionNotMetError = + TaggedException; +export type PublicPolicyError = TaggedException; +export type ResourceExistsError = TaggedException; +export type ResourceNotFoundError = TaggedException; + +export type SdkError = TaggedException; +export const SdkError = Data.tagged("SdkError"); diff --git a/packages/client-secrets-manager/src/SecretsManagerClientInstance.ts b/packages/client-secrets-manager/src/SecretsManagerClientInstance.ts new file mode 100644 index 0000000..e8df558 --- /dev/null +++ b/packages/client-secrets-manager/src/SecretsManagerClientInstance.ts @@ -0,0 +1,46 @@ +/** + * @since 1.0.0 + */ +import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager"; +import * as Context from "effect/Context"; +import * as Effect from "effect/Effect"; +import * as Layer from "effect/Layer"; +import { + DefaultSecretsManagerClientConfigLayer, + SecretsManagerClientInstanceConfig, +} from "./SecretsManagerClientInstanceConfig"; + +/** + * @since 1.0.0 + * @category tags + */ +export class SecretsManagerClientInstance extends Context.Tag( + "@effect-aws/client-secrets-manager/SecretsManagerClientInstance", +)() {} + +/** + * @since 1.0.0 + * @category constructors + */ +export const makeSecretsManagerClientInstance = Effect.map( + SecretsManagerClientInstanceConfig, + (config) => new SecretsManagerClient(config), +); + +/** + * @since 1.0.0 + * @category layers + */ +export const SecretsManagerClientInstanceLayer = Layer.effect( + SecretsManagerClientInstance, + makeSecretsManagerClientInstance, +); + +/** + * @since 1.0.0 + * @category layers + */ +export const DefaultSecretsManagerClientInstanceLayer = + SecretsManagerClientInstanceLayer.pipe( + Layer.provide(DefaultSecretsManagerClientConfigLayer), + ); diff --git a/packages/client-secrets-manager/src/SecretsManagerClientInstanceConfig.ts b/packages/client-secrets-manager/src/SecretsManagerClientInstanceConfig.ts new file mode 100644 index 0000000..0b338aa --- /dev/null +++ b/packages/client-secrets-manager/src/SecretsManagerClientInstanceConfig.ts @@ -0,0 +1,55 @@ +/** + * @since 1.0.0 + */ +import type { SecretsManagerClientConfig } from "@aws-sdk/client-secrets-manager"; +import * as Context from "effect/Context"; +import * as Effect from "effect/Effect"; +import * as Layer from "effect/Layer"; +import * as Runtime from "effect/Runtime"; + +/** + * @since 1.0.0 + * @category tags + */ +export class SecretsManagerClientInstanceConfig extends Context.Tag( + "@effect-aws/client-secrets-manager/SecretsManagerClientInstanceConfig", +)() {} + +/** + * @since 1.0.0 + * @category constructors + */ +export const makeDefaultSecretsManagerClientInstanceConfig: Effect.Effect = + Effect.gen(function* (_) { + const runtime = yield* _(Effect.runtime()); + const runSync = Runtime.runSync(runtime); + + return { + logger: { + info(m) { + Effect.logInfo(m).pipe(runSync); + }, + warn(m) { + Effect.logWarning(m).pipe(runSync); + }, + error(m) { + Effect.logError(m).pipe(runSync); + }, + debug(m) { + Effect.logDebug(m).pipe(runSync); + }, + trace(m) { + Effect.logTrace(m).pipe(runSync); + }, + }, + }; + }); + +/** + * @since 1.0.0 + * @category layers + */ +export const DefaultSecretsManagerClientConfigLayer = Layer.effect( + SecretsManagerClientInstanceConfig, + makeDefaultSecretsManagerClientInstanceConfig, +); diff --git a/packages/client-secrets-manager/src/SecretsManagerService.ts b/packages/client-secrets-manager/src/SecretsManagerService.ts new file mode 100644 index 0000000..aa3053d --- /dev/null +++ b/packages/client-secrets-manager/src/SecretsManagerService.ts @@ -0,0 +1,575 @@ +/** + * @since 1.0.0 + */ +import { + BatchGetSecretValueCommand, + type BatchGetSecretValueCommandInput, + type BatchGetSecretValueCommandOutput, + CancelRotateSecretCommand, + type CancelRotateSecretCommandInput, + type CancelRotateSecretCommandOutput, + CreateSecretCommand, + type CreateSecretCommandInput, + type CreateSecretCommandOutput, + DeleteResourcePolicyCommand, + type DeleteResourcePolicyCommandInput, + type DeleteResourcePolicyCommandOutput, + DeleteSecretCommand, + type DeleteSecretCommandInput, + type DeleteSecretCommandOutput, + DescribeSecretCommand, + type DescribeSecretCommandInput, + type DescribeSecretCommandOutput, + GetRandomPasswordCommand, + type GetRandomPasswordCommandInput, + type GetRandomPasswordCommandOutput, + GetResourcePolicyCommand, + type GetResourcePolicyCommandInput, + type GetResourcePolicyCommandOutput, + GetSecretValueCommand, + type GetSecretValueCommandInput, + type GetSecretValueCommandOutput, + ListSecretsCommand, + type ListSecretsCommandInput, + type ListSecretsCommandOutput, + ListSecretVersionIdsCommand, + type ListSecretVersionIdsCommandInput, + type ListSecretVersionIdsCommandOutput, + PutResourcePolicyCommand, + type PutResourcePolicyCommandInput, + type PutResourcePolicyCommandOutput, + PutSecretValueCommand, + type PutSecretValueCommandInput, + type PutSecretValueCommandOutput, + RemoveRegionsFromReplicationCommand, + type RemoveRegionsFromReplicationCommandInput, + type RemoveRegionsFromReplicationCommandOutput, + ReplicateSecretToRegionsCommand, + type ReplicateSecretToRegionsCommandInput, + type ReplicateSecretToRegionsCommandOutput, + RestoreSecretCommand, + type RestoreSecretCommandInput, + type RestoreSecretCommandOutput, + RotateSecretCommand, + type RotateSecretCommandInput, + type RotateSecretCommandOutput, + SecretsManagerServiceException, + StopReplicationToReplicaCommand, + type StopReplicationToReplicaCommandInput, + type StopReplicationToReplicaCommandOutput, + TagResourceCommand, + type TagResourceCommandInput, + type TagResourceCommandOutput, + UntagResourceCommand, + type UntagResourceCommandInput, + type UntagResourceCommandOutput, + UpdateSecretCommand, + type UpdateSecretCommandInput, + type UpdateSecretCommandOutput, + UpdateSecretVersionStageCommand, + type UpdateSecretVersionStageCommandInput, + type UpdateSecretVersionStageCommandOutput, + ValidateResourcePolicyCommand, + type ValidateResourcePolicyCommandInput, + type ValidateResourcePolicyCommandOutput, +} from "@aws-sdk/client-secrets-manager"; +import { type HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; +import { Context, Data, Effect, Layer, Record } from "effect"; +import { + DecryptionError, + EncryptionError, + InternalServiceError, + InvalidNextTokenError, + InvalidParameterError, + InvalidRequestError, + LimitExceededError, + MalformedPolicyDocumentError, + PreconditionNotMetError, + PublicPolicyError, + ResourceExistsError, + ResourceNotFoundError, + SdkError, + TaggedException, +} from "./Errors"; +import { + SecretsManagerClientInstance, + SecretsManagerClientInstanceLayer, +} from "./SecretsManagerClientInstance"; +import { DefaultSecretsManagerClientConfigLayer } from "./SecretsManagerClientInstanceConfig"; + +const commands = { + BatchGetSecretValueCommand, + CancelRotateSecretCommand, + CreateSecretCommand, + DeleteResourcePolicyCommand, + DeleteSecretCommand, + DescribeSecretCommand, + GetRandomPasswordCommand, + GetResourcePolicyCommand, + GetSecretValueCommand, + ListSecretsCommand, + ListSecretVersionIdsCommand, + PutResourcePolicyCommand, + PutSecretValueCommand, + RemoveRegionsFromReplicationCommand, + ReplicateSecretToRegionsCommand, + RestoreSecretCommand, + RotateSecretCommand, + StopReplicationToReplicaCommand, + TagResourceCommand, + UntagResourceCommand, + UpdateSecretCommand, + UpdateSecretVersionStageCommand, + ValidateResourcePolicyCommand, +}; + +/** + * @since 1.0.0 + * @category models + */ +export interface SecretsManagerService { + readonly _: unique symbol; + + /** + * @see {@link BatchGetSecretValueCommand} + */ + batchGetSecretValue( + args: BatchGetSecretValueCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + BatchGetSecretValueCommandOutput, + | SdkError + | DecryptionError + | InternalServiceError + | InvalidNextTokenError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link CancelRotateSecretCommand} + */ + cancelRotateSecret( + args: CancelRotateSecretCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + CancelRotateSecretCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link CreateSecretCommand} + */ + createSecret( + args: CreateSecretCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + CreateSecretCommandOutput, + | SdkError + | DecryptionError + | EncryptionError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | LimitExceededError + | MalformedPolicyDocumentError + | PreconditionNotMetError + | ResourceExistsError + | ResourceNotFoundError + >; + + /** + * @see {@link DeleteResourcePolicyCommand} + */ + deleteResourcePolicy( + args: DeleteResourcePolicyCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + DeleteResourcePolicyCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link DeleteSecretCommand} + */ + deleteSecret( + args: DeleteSecretCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + DeleteSecretCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link DescribeSecretCommand} + */ + describeSecret( + args: DescribeSecretCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + DescribeSecretCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | ResourceNotFoundError + >; + + /** + * @see {@link GetRandomPasswordCommand} + */ + getRandomPassword( + args: GetRandomPasswordCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + GetRandomPasswordCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + >; + + /** + * @see {@link GetResourcePolicyCommand} + */ + getResourcePolicy( + args: GetResourcePolicyCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + GetResourcePolicyCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link GetSecretValueCommand} + */ + getSecretValue( + args: GetSecretValueCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + GetSecretValueCommandOutput, + | SdkError + | DecryptionError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link ListSecretsCommand} + */ + listSecrets( + args: ListSecretsCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + ListSecretsCommandOutput, + | SdkError + | InternalServiceError + | InvalidNextTokenError + | InvalidParameterError + | InvalidRequestError + >; + + /** + * @see {@link ListSecretVersionIdsCommand} + */ + listSecretVersionIds( + args: ListSecretVersionIdsCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + ListSecretVersionIdsCommandOutput, + | SdkError + | InternalServiceError + | InvalidNextTokenError + | InvalidParameterError + | ResourceNotFoundError + >; + + /** + * @see {@link PutResourcePolicyCommand} + */ + putResourcePolicy( + args: PutResourcePolicyCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + PutResourcePolicyCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | MalformedPolicyDocumentError + | PublicPolicyError + | ResourceNotFoundError + >; + + /** + * @see {@link PutSecretValueCommand} + */ + putSecretValue( + args: PutSecretValueCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + PutSecretValueCommandOutput, + | SdkError + | DecryptionError + | EncryptionError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | LimitExceededError + | ResourceExistsError + | ResourceNotFoundError + >; + + /** + * @see {@link RemoveRegionsFromReplicationCommand} + */ + removeRegionsFromReplication( + args: RemoveRegionsFromReplicationCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + RemoveRegionsFromReplicationCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link ReplicateSecretToRegionsCommand} + */ + replicateSecretToRegions( + args: ReplicateSecretToRegionsCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + ReplicateSecretToRegionsCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link RestoreSecretCommand} + */ + restoreSecret( + args: RestoreSecretCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + RestoreSecretCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link RotateSecretCommand} + */ + rotateSecret( + args: RotateSecretCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + RotateSecretCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link StopReplicationToReplicaCommand} + */ + stopReplicationToReplica( + args: StopReplicationToReplicaCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + StopReplicationToReplicaCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link TagResourceCommand} + */ + tagResource( + args: TagResourceCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + TagResourceCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link UntagResourceCommand} + */ + untagResource( + args: UntagResourceCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + UntagResourceCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | ResourceNotFoundError + >; + + /** + * @see {@link UpdateSecretCommand} + */ + updateSecret( + args: UpdateSecretCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + UpdateSecretCommandOutput, + | SdkError + | DecryptionError + | EncryptionError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | LimitExceededError + | MalformedPolicyDocumentError + | PreconditionNotMetError + | ResourceExistsError + | ResourceNotFoundError + >; + + /** + * @see {@link UpdateSecretVersionStageCommand} + */ + updateSecretVersionStage( + args: UpdateSecretVersionStageCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + UpdateSecretVersionStageCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | LimitExceededError + | ResourceNotFoundError + >; + + /** + * @see {@link ValidateResourcePolicyCommand} + */ + validateResourcePolicy( + args: ValidateResourcePolicyCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + ValidateResourcePolicyCommandOutput, + | SdkError + | InternalServiceError + | InvalidParameterError + | InvalidRequestError + | MalformedPolicyDocumentError + | ResourceNotFoundError + >; +} + +/** + * @since 1.0.0 + * @category tags + */ +export const SecretsManagerService = Context.GenericTag( + "@effect-aws/client-secrets-manager/SecretsManagerService", +); + +/** + * @since 1.0.0 + * @category constructors + */ +export const makeSecretsManagerService = Effect.gen(function* (_) { + const client = yield* _(SecretsManagerClientInstance); + + return Record.toEntries(commands).reduce((acc, [command]) => { + const CommandCtor = commands[command] as any; + const methodImpl = (args: any, options: any) => + Effect.tryPromise({ + try: () => client.send(new CommandCtor(args), options ?? {}), + catch: (e) => { + if (e instanceof SecretsManagerServiceException) { + const ServiceException = Data.tagged< + TaggedException + >(e.name); + + return ServiceException({ + ...e, + message: e.message, + stack: e.stack, + }); + } + if (e instanceof Error) { + return SdkError({ + ...e, + name: "SdkError", + message: e.message, + stack: e.stack, + }); + } + throw e; + }, + }); + const methodName = (command[0].toLowerCase() + command.slice(1)).replace( + /Command$/, + "", + ); + return { ...acc, [methodName]: methodImpl }; + }, {}) as SecretsManagerService; +}); + +/** + * @since 1.0.0 + * @category layers + */ +export const BaseSecretsManagerServiceLayer = Layer.effect( + SecretsManagerService, + makeSecretsManagerService, +); + +/** + * @since 1.0.0 + * @category layers + */ +export const SecretsManagerServiceLayer = BaseSecretsManagerServiceLayer.pipe( + Layer.provide(SecretsManagerClientInstanceLayer), +); + +/** + * @since 1.0.0 + * @category layers + */ +export const DefaultSecretsManagerServiceLayer = + SecretsManagerServiceLayer.pipe( + Layer.provide(DefaultSecretsManagerClientConfigLayer), + ); diff --git a/packages/client-secrets-manager/src/index.ts b/packages/client-secrets-manager/src/index.ts new file mode 100644 index 0000000..08a83c4 --- /dev/null +++ b/packages/client-secrets-manager/src/index.ts @@ -0,0 +1,4 @@ +export * from "./Errors"; +export * from "./SecretsManagerClientInstance"; +export * from "./SecretsManagerClientInstanceConfig"; +export * from "./SecretsManagerService"; diff --git a/packages/client-secrets-manager/test/SecretsManager.test.ts b/packages/client-secrets-manager/test/SecretsManager.test.ts new file mode 100644 index 0000000..644279f --- /dev/null +++ b/packages/client-secrets-manager/test/SecretsManager.test.ts @@ -0,0 +1,168 @@ +import { + type GetSecretValueCommandInput, + GetSecretValueCommand, + SecretsManagerClient, +} from "@aws-sdk/client-secrets-manager"; +import { mockClient } from "aws-sdk-client-mock"; +import * as Effect from "effect/Effect"; +import * as Exit from "effect/Exit"; +import { pipe } from "effect/Function"; +import * as Layer from "effect/Layer"; +import { + BaseSecretsManagerServiceLayer, + DefaultSecretsManagerClientConfigLayer, + DefaultSecretsManagerServiceLayer, + SecretsManagerClientInstance, + SecretsManagerClientInstanceConfig, + SecretsManagerService, + SecretsManagerServiceLayer, + SdkError, +} from "../src"; + +import "aws-sdk-client-mock-jest"; + +const clientMock = mockClient(SecretsManagerClient); + +describe("SecretsManagerClientImpl", () => { + it("default", async () => { + clientMock.reset().on(GetSecretValueCommand).resolves({}); + + const args: GetSecretValueCommandInput = { SecretId: "test" }; + + const program = Effect.flatMap(SecretsManagerService, (service) => + service.getSecretValue(args), + ); + + const result = await pipe( + program, + Effect.provide(DefaultSecretsManagerServiceLayer), + Effect.runPromiseExit, + ); + + expect(result).toEqual(Exit.succeed({})); + expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); + }); + + it("configurable", async () => { + clientMock.reset().on(GetSecretValueCommand).resolves({}); + + const args: GetSecretValueCommandInput = { SecretId: "test" }; + + const program = Effect.flatMap(SecretsManagerService, (service) => + service.getSecretValue(args), + ); + + const SecretsManagerClientConfigLayer = Layer.succeed( + SecretsManagerClientInstanceConfig, + { + region: "eu-central-1", + }, + ); + const CustomSecretsManagerServiceLayer = SecretsManagerServiceLayer.pipe( + Layer.provide(SecretsManagerClientConfigLayer), + ); + + const result = await pipe( + program, + Effect.provide(CustomSecretsManagerServiceLayer), + Effect.runPromiseExit, + ); + + expect(result).toEqual(Exit.succeed({})); + expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); + }); + + it("base", async () => { + clientMock.reset().on(GetSecretValueCommand).resolves({}); + + const args: GetSecretValueCommandInput = { SecretId: "test" }; + + const program = Effect.flatMap(SecretsManagerService, (service) => + service.getSecretValue(args), + ); + + const SecretsManagerClientInstanceLayer = Layer.succeed( + SecretsManagerClientInstance, + new SecretsManagerClient({ region: "eu-central-1" }), + ); + const CustomSecretsManagerServiceLayer = + BaseSecretsManagerServiceLayer.pipe( + Layer.provide(SecretsManagerClientInstanceLayer), + ); + + const result = await pipe( + program, + Effect.provide(CustomSecretsManagerServiceLayer), + Effect.runPromiseExit, + ); + + expect(result).toEqual(Exit.succeed({})); + expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); + }); + + it("extended", async () => { + clientMock.reset().on(GetSecretValueCommand).resolves({}); + + const args: GetSecretValueCommandInput = { SecretId: "test" }; + + const program = Effect.flatMap(SecretsManagerService, (service) => + service.getSecretValue(args), + ); + + const SecretsManagerClientInstanceLayer = Layer.effect( + SecretsManagerClientInstance, + Effect.map( + SecretsManagerClientInstanceConfig, + (config) => + new SecretsManagerClient({ ...config, region: "eu-central-1" }), + ), + ); + const CustomSecretsManagerServiceLayer = + BaseSecretsManagerServiceLayer.pipe( + Layer.provide(SecretsManagerClientInstanceLayer), + Layer.provide(DefaultSecretsManagerClientConfigLayer), + ); + + const result = await pipe( + program, + Effect.provide(CustomSecretsManagerServiceLayer), + Effect.runPromiseExit, + ); + + expect(result).toEqual(Exit.succeed({})); + expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); + }); + + it("fail", async () => { + clientMock.reset().on(GetSecretValueCommand).rejects(new Error("test")); + + const args: GetSecretValueCommandInput = { SecretId: "test" }; + + const program = Effect.flatMap(SecretsManagerService, (service) => + service.getSecretValue(args), + ); + + const result = await pipe( + program, + Effect.provide(DefaultSecretsManagerServiceLayer), + Effect.runPromiseExit, + ); + + expect(result).toEqual( + Exit.fail( + SdkError({ + ...new Error("test"), + name: "SdkError", + message: "test", + stack: expect.any(String), + }), + ), + ); + expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); + }); +}); diff --git a/packages/client-secrets-manager/tsconfig.dev.json b/packages/client-secrets-manager/tsconfig.dev.json new file mode 100644 index 0000000..278f027 --- /dev/null +++ b/packages/client-secrets-manager/tsconfig.dev.json @@ -0,0 +1,37 @@ +// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +{ + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "es2019", + "dom" + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + "moduleResolution": "node" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/packages/client-secrets-manager/tsconfig.esm.json b/packages/client-secrets-manager/tsconfig.esm.json new file mode 100644 index 0000000..1b04668 --- /dev/null +++ b/packages/client-secrets-manager/tsconfig.esm.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./lib/esm", + "module": "es6", + "resolveJsonModule": false, + "declaration": false + }, + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." +} diff --git a/packages/client-secrets-manager/tsconfig.json b/packages/client-secrets-manager/tsconfig.json new file mode 100644 index 0000000..576047c --- /dev/null +++ b/packages/client-secrets-manager/tsconfig.json @@ -0,0 +1,36 @@ +// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +{ + "compilerOptions": { + "rootDir": "src", + "outDir": "lib", + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "es2019", + "dom" + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + "moduleResolution": "node" + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [] +} diff --git a/packages/client-sfn/package.json b/packages/client-sfn/package.json index c302c8b..e681397 100644 --- a/packages/client-sfn/package.json +++ b/packages/client-sfn/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-sns/package.json b/packages/client-sns/package.json index 41dbed8..2f2b25b 100644 --- a/packages/client-sns/package.json +++ b/packages/client-sns/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/client-sqs/package.json b/packages/client-sqs/package.json index 5558769..4fe3b94 100644 --- a/packages/client-sqs/package.json +++ b/packages/client-sqs/package.json @@ -31,7 +31,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/lambda/package.json b/packages/lambda/package.json index 515f459..3838345 100644 --- a/packages/lambda/package.json +++ b/packages/lambda/package.json @@ -30,7 +30,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/lib-dynamodb/package.json b/packages/lib-dynamodb/package.json index 7b9dc7b..04085c7 100644 --- a/packages/lib-dynamodb/package.json +++ b/packages/lib-dynamodb/package.json @@ -32,7 +32,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/packages/powertools-logger/package.json b/packages/powertools-logger/package.json index b4bc1ea..4530245 100644 --- a/packages/powertools-logger/package.json +++ b/packages/powertools-logger/package.json @@ -30,7 +30,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "prettier": "^3.2.5", "projen": "^0.79.24", "typescript": "^5.4.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e9bb219..c446336 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -67,13 +67,13 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) nx: specifier: 16.0.0 version: 16.0.0 prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -134,10 +134,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -189,10 +189,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -244,10 +244,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.2.4 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -299,10 +299,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.2.4 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -354,10 +354,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -409,10 +409,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -464,10 +464,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -522,10 +522,65 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 + projen: + specifier: ^0.79.24 + version: 0.79.27(constructs@10.3.0) + typescript: + specifier: ^5.4.2 + version: 5.4.5 + + packages/client-secrets-manager: + dependencies: + '@aws-sdk/client-secrets-manager': + specifier: ^3 + version: 3.533.0 + '@aws-sdk/types': + specifier: ^3 + version: 3.533.0 + devDependencies: + '@types/node': + specifier: ^18 + version: 18.19.14 + '@typescript-eslint/eslint-plugin': + specifier: ^6 + version: 6.7.0(@typescript-eslint/parser@6.7.0)(eslint@8.49.0)(typescript@5.4.5) + '@typescript-eslint/parser': + specifier: ^6 + version: 6.7.0(eslint@8.49.0)(typescript@5.4.5) + aws-sdk-client-mock: + specifier: ^3.0.0 + version: 3.0.0 + aws-sdk-client-mock-jest: + specifier: ^3.0.0 + version: 3.0.0(aws-sdk-client-mock@3.0.0) + constructs: + specifier: ^10.0.0 + version: 10.3.0 + effect: + specifier: 3.0.0 + version: 3.0.0 + eslint: + specifier: ^8 + version: 8.49.0 + eslint-config-prettier: + specifier: ^9.0.0 + version: 9.0.0(eslint@8.49.0) + eslint-import-resolver-typescript: + specifier: ^3.6.1 + version: 3.6.1(@typescript-eslint/parser@6.7.0)(eslint-plugin-import@2.28.1)(eslint@8.49.0) + eslint-plugin-import: + specifier: ^2.28.1 + version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) + eslint-plugin-prettier: + specifier: ^5.0.0 + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) + prettier: + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -577,10 +632,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -632,10 +687,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -687,10 +742,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -732,10 +787,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -793,10 +848,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -842,10 +897,10 @@ importers: version: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.49.0) eslint-plugin-prettier: specifier: ^5.0.0 - version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4) + version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5) prettier: - specifier: ^3.0.3 - version: 3.2.4 + specifier: ^3.2.5 + version: 3.2.5 projen: specifier: ^0.79.24 version: 0.79.27(constructs@10.3.0) @@ -1378,6 +1433,55 @@ packages: - aws-crt dev: false + /@aws-sdk/client-secrets-manager@3.533.0: + resolution: {integrity: sha512-xwkVgN2getN7Hcd/ZVt2WusRuJwdMzg1H9TSEmBAjVxyr+o9E8vtNqLKn64cZ5tmxljkB0jaMH8vfnEWydxJTg==} + engines: {node: '>=14.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 3.0.0 + '@aws-crypto/sha256-js': 3.0.0 + '@aws-sdk/client-sts': 3.533.0(@aws-sdk/credential-provider-node@3.533.0) + '@aws-sdk/core': 3.533.0 + '@aws-sdk/credential-provider-node': 3.533.0 + '@aws-sdk/middleware-host-header': 3.533.0 + '@aws-sdk/middleware-logger': 3.533.0 + '@aws-sdk/middleware-recursion-detection': 3.533.0 + '@aws-sdk/middleware-user-agent': 3.533.0 + '@aws-sdk/region-config-resolver': 3.533.0 + '@aws-sdk/types': 3.533.0 + '@aws-sdk/util-endpoints': 3.533.0 + '@aws-sdk/util-user-agent-browser': 3.533.0 + '@aws-sdk/util-user-agent-node': 3.533.0 + '@smithy/config-resolver': 2.1.5 + '@smithy/core': 1.3.8 + '@smithy/fetch-http-handler': 2.4.5 + '@smithy/hash-node': 2.1.4 + '@smithy/invalid-dependency': 2.1.4 + '@smithy/middleware-content-length': 2.1.4 + '@smithy/middleware-endpoint': 2.4.6 + '@smithy/middleware-retry': 2.1.7 + '@smithy/middleware-serde': 2.2.1 + '@smithy/middleware-stack': 2.1.4 + '@smithy/node-config-provider': 2.2.5 + '@smithy/node-http-handler': 2.4.3 + '@smithy/protocol-http': 3.2.2 + '@smithy/smithy-client': 2.4.5 + '@smithy/types': 2.11.0 + '@smithy/url-parser': 2.1.4 + '@smithy/util-base64': 2.2.1 + '@smithy/util-body-length-browser': 2.1.1 + '@smithy/util-body-length-node': 2.2.2 + '@smithy/util-defaults-mode-browser': 2.1.7 + '@smithy/util-defaults-mode-node': 2.2.7 + '@smithy/util-endpoints': 1.1.5 + '@smithy/util-middleware': 2.1.4 + '@smithy/util-retry': 2.1.4 + '@smithy/util-utf8': 2.2.0 + tslib: 2.6.2 + uuid: 9.0.1 + transitivePeerDependencies: + - aws-crt + dev: false + /@aws-sdk/client-sfn@3.533.0: resolution: {integrity: sha512-Rgfct0cydlP/0yrO2GL7Z7zvHPUDP5k49MngERKfe9bjsFYyHaYSpB+FQ+mVo7kVADrtJmSOyTkoTolDtnyn8Q==} engines: {node: '>=14.0.0'} @@ -4793,7 +4897,7 @@ packages: - supports-color dev: true - /eslint-plugin-prettier@5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.4): + /eslint-plugin-prettier@5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@3.2.5): resolution: {integrity: sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -4809,7 +4913,7 @@ packages: dependencies: eslint: 8.49.0 eslint-config-prettier: 9.0.0(eslint@8.49.0) - prettier: 3.2.4 + prettier: 3.2.5 prettier-linter-helpers: 1.0.0 synckit: 0.8.5 dev: true @@ -6625,12 +6729,6 @@ packages: hasBin: true dev: true - /prettier@3.2.4: - resolution: {integrity: sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==} - engines: {node: '>=14'} - hasBin: true - dev: true - /prettier@3.2.5: resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} engines: {node: '>=14'} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 62bb288..640c474 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -9,6 +9,7 @@ packages: - packages/client-iam - packages/client-lambda - packages/client-s3 + - packages/client-secrets-manager - packages/client-sfn - packages/client-sns - packages/client-sqs diff --git a/scripts/codegen-client.ts b/scripts/codegen-client.ts index 7adcca4..9f38c86 100644 --- a/scripts/codegen-client.ts +++ b/scripts/codegen-client.ts @@ -40,6 +40,7 @@ type Shape = traits: { "aws.api#service": { sdkId: string; + cloudFormationName: string; }; }; } @@ -165,7 +166,7 @@ async function generateClient([ Option.getOrThrowWith(() => new TypeError("ServiceShape is not found")), ); - const { sdkId } = serviceShape.traits["aws.api#service"]; + const { cloudFormationName: sdkId } = serviceShape.traits["aws.api#service"]; const sdkName = upperFirst(sdkId); const awsClient = await import( @@ -197,7 +198,7 @@ ${pipe( exportedErrors, Array.map( (taggedError) => - `export type ${pipe(taggedError, String.replace(/(Exception|Error)$/, ""))}Error = TaggedException<${taggedError.endsWith("Error") ? `${String.replace(/Error$/, "")(taggedError)}Exception` : taggedError}>;`, + `export type ${pipe(taggedError, String.replace(/(Failure|Exception|Error)$/, ""))}Error = TaggedException<${taggedError.endsWith("Error") ? `${String.replace(/Error$/, "")(taggedError)}Exception` : taggedError}>;`, ), Array.join("\n"), )} @@ -389,7 +390,7 @@ import { import { Default${sdkName}ClientConfigLayer } from "./${sdkName}ClientInstanceConfig"; import { ${pipe( - importedErrors.map(String.replace(/(Exception|Error)$/, "")), + importedErrors.map(String.replace(/(Failure|Exception|Error)$/, "")), Array.map((error) => `${error}Error`), Array.join(","), )}, @@ -418,7 +419,7 @@ ${pipe( operationShape.errors || [], Array.map(flow(Struct.get("target"), getNameFromTarget)), Array.intersection(importedErrors), - Array.map(String.replace(/(Exception|Error)$/, "")), + Array.map(String.replace(/(Failure|Exception|Error)$/, "")), Array.map((error) => `${error}Error`), ); return ` /**