diff --git a/package.json b/package.json index 17747eb..a57788e 100644 --- a/package.json +++ b/package.json @@ -30,12 +30,14 @@ "author": "", "license": "ISC", "dependencies": { + "@aws-sdk/client-s3": "^3.590.0", "@prisma/client": "5.13.0", "chalk": "^4.0.0", "cors": "^2.8.5", "dotenv": "^16.4.5", "express": "^4.19.2", "firebase-admin": "^12.0.0", + "node-cron": "^3.0.3", "resend": "^3.2.0", "uuid": "^9.0.1", "zod": "^3.23.5" @@ -48,6 +50,7 @@ "@types/express": "^4.17.21", "@types/mocha": "^10.0.6", "@types/node": "^20.11.24", + "@types/node-cron": "^3.0.11", "@types/rewire": "^2.5.30", "@types/sinon": "^17.0.3", "@types/uuid": "^9.0.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bdaf984..4039966 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + '@aws-sdk/client-s3': + specifier: ^3.590.0 + version: 3.590.0 '@prisma/client': specifier: 5.13.0 version: 5.13.0(prisma@5.13.0) @@ -23,6 +26,9 @@ dependencies: firebase-admin: specifier: ^12.0.0 version: 12.1.0 + node-cron: + specifier: ^3.0.3 + version: 3.0.3 resend: specifier: ^3.2.0 version: 3.2.0 @@ -55,6 +61,9 @@ devDependencies: '@types/node': specifier: ^20.11.24 version: 20.12.7 + '@types/node-cron': + specifier: ^3.0.11 + version: 3.0.11 '@types/rewire': specifier: ^2.5.30 version: 2.5.30 @@ -132,6 +141,638 @@ packages: engines: {node: '>=0.10.0'} dev: true + /@aws-crypto/crc32@3.0.0: + resolution: {integrity: sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==} + dependencies: + '@aws-crypto/util': 3.0.0 + '@aws-sdk/types': 3.577.0 + tslib: 1.14.1 + dev: false + + /@aws-crypto/crc32c@3.0.0: + resolution: {integrity: sha512-ENNPPManmnVJ4BTXlOjAgD7URidbAznURqD0KvfREyc4o20DPYdEldU1f5cQ7Jbj0CJJSPaMIk/9ZshdB3210w==} + dependencies: + '@aws-crypto/util': 3.0.0 + '@aws-sdk/types': 3.577.0 + tslib: 1.14.1 + dev: false + + /@aws-crypto/ie11-detection@3.0.0: + resolution: {integrity: sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==} + dependencies: + tslib: 1.14.1 + dev: false + + /@aws-crypto/sha1-browser@3.0.0: + resolution: {integrity: sha512-NJth5c997GLHs6nOYTzFKTbYdMNA6/1XlKVgnZoaZcQ7z7UJlOgj2JdbHE8tiYLS3fzXNCguct77SPGat2raSw==} + dependencies: + '@aws-crypto/ie11-detection': 3.0.0 + '@aws-crypto/supports-web-crypto': 3.0.0 + '@aws-crypto/util': 3.0.0 + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-locate-window': 3.568.0 + '@aws-sdk/util-utf8-browser': 3.259.0 + tslib: 1.14.1 + dev: false + + /@aws-crypto/sha256-browser@3.0.0: + resolution: {integrity: sha512-8VLmW2B+gjFbU5uMeqtQM6Nj0/F1bro80xQXCW6CQBWgosFWXTx77aeOF5CAIAmbOK64SdMBJdNr6J41yP5mvQ==} + dependencies: + '@aws-crypto/ie11-detection': 3.0.0 + '@aws-crypto/sha256-js': 3.0.0 + '@aws-crypto/supports-web-crypto': 3.0.0 + '@aws-crypto/util': 3.0.0 + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-locate-window': 3.568.0 + '@aws-sdk/util-utf8-browser': 3.259.0 + tslib: 1.14.1 + dev: false + + /@aws-crypto/sha256-js@3.0.0: + resolution: {integrity: sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==} + dependencies: + '@aws-crypto/util': 3.0.0 + '@aws-sdk/types': 3.577.0 + tslib: 1.14.1 + dev: false + + /@aws-crypto/supports-web-crypto@3.0.0: + resolution: {integrity: sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==} + dependencies: + tslib: 1.14.1 + dev: false + + /@aws-crypto/util@3.0.0: + resolution: {integrity: sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==} + dependencies: + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-utf8-browser': 3.259.0 + tslib: 1.14.1 + dev: false + + /@aws-sdk/client-s3@3.590.0: + resolution: {integrity: sha512-so+pNua0ihsHaSdskw8HCwruoYTAfYSEs3ix4GD1++83C96KaJp3udAutYiCA+84JXg9zitFa7eK7ORJAVZmTw==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha1-browser': 3.0.0 + '@aws-crypto/sha256-browser': 3.0.0 + '@aws-crypto/sha256-js': 3.0.0 + '@aws-sdk/client-sso-oidc': 3.590.0(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/client-sts': 3.590.0 + '@aws-sdk/core': 3.588.0 + '@aws-sdk/credential-provider-node': 3.590.0(@aws-sdk/client-sso-oidc@3.590.0)(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/middleware-bucket-endpoint': 3.587.0 + '@aws-sdk/middleware-expect-continue': 3.577.0 + '@aws-sdk/middleware-flexible-checksums': 3.587.0 + '@aws-sdk/middleware-host-header': 3.577.0 + '@aws-sdk/middleware-location-constraint': 3.577.0 + '@aws-sdk/middleware-logger': 3.577.0 + '@aws-sdk/middleware-recursion-detection': 3.577.0 + '@aws-sdk/middleware-sdk-s3': 3.587.0 + '@aws-sdk/middleware-signing': 3.587.0 + '@aws-sdk/middleware-ssec': 3.577.0 + '@aws-sdk/middleware-user-agent': 3.587.0 + '@aws-sdk/region-config-resolver': 3.587.0 + '@aws-sdk/signature-v4-multi-region': 3.587.0 + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-endpoints': 3.587.0 + '@aws-sdk/util-user-agent-browser': 3.577.0 + '@aws-sdk/util-user-agent-node': 3.587.0 + '@aws-sdk/xml-builder': 3.575.0 + '@smithy/config-resolver': 3.0.1 + '@smithy/core': 2.2.0 + '@smithy/eventstream-serde-browser': 3.0.0 + '@smithy/eventstream-serde-config-resolver': 3.0.0 + '@smithy/eventstream-serde-node': 3.0.0 + '@smithy/fetch-http-handler': 3.0.1 + '@smithy/hash-blob-browser': 3.0.0 + '@smithy/hash-node': 3.0.0 + '@smithy/hash-stream-node': 3.0.0 + '@smithy/invalid-dependency': 3.0.0 + '@smithy/md5-js': 3.0.0 + '@smithy/middleware-content-length': 3.0.0 + '@smithy/middleware-endpoint': 3.0.1 + '@smithy/middleware-retry': 3.0.3 + '@smithy/middleware-serde': 3.0.0 + '@smithy/middleware-stack': 3.0.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/node-http-handler': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/url-parser': 3.0.0 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.3 + '@smithy/util-defaults-mode-node': 3.0.3 + '@smithy/util-endpoints': 2.0.1 + '@smithy/util-retry': 3.0.0 + '@smithy/util-stream': 3.0.1 + '@smithy/util-utf8': 3.0.0 + '@smithy/util-waiter': 3.0.0 + tslib: 2.6.2 + transitivePeerDependencies: + - aws-crt + dev: false + + /@aws-sdk/client-sso-oidc@3.590.0(@aws-sdk/client-sts@3.590.0): + resolution: {integrity: sha512-3yCLPjq6WFfDpdUJKk/gSz4eAPDTjVknXaveMPi2QoVBCshneOnJsV16uNKlpVF1frTHrrDRfKYmbaVh6nFBvQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 3.0.0 + '@aws-crypto/sha256-js': 3.0.0 + '@aws-sdk/client-sts': 3.590.0 + '@aws-sdk/core': 3.588.0 + '@aws-sdk/credential-provider-node': 3.590.0(@aws-sdk/client-sso-oidc@3.590.0)(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/middleware-host-header': 3.577.0 + '@aws-sdk/middleware-logger': 3.577.0 + '@aws-sdk/middleware-recursion-detection': 3.577.0 + '@aws-sdk/middleware-user-agent': 3.587.0 + '@aws-sdk/region-config-resolver': 3.587.0 + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-endpoints': 3.587.0 + '@aws-sdk/util-user-agent-browser': 3.577.0 + '@aws-sdk/util-user-agent-node': 3.587.0 + '@smithy/config-resolver': 3.0.1 + '@smithy/core': 2.2.0 + '@smithy/fetch-http-handler': 3.0.1 + '@smithy/hash-node': 3.0.0 + '@smithy/invalid-dependency': 3.0.0 + '@smithy/middleware-content-length': 3.0.0 + '@smithy/middleware-endpoint': 3.0.1 + '@smithy/middleware-retry': 3.0.3 + '@smithy/middleware-serde': 3.0.0 + '@smithy/middleware-stack': 3.0.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/node-http-handler': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/url-parser': 3.0.0 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.3 + '@smithy/util-defaults-mode-node': 3.0.3 + '@smithy/util-endpoints': 2.0.1 + '@smithy/util-middleware': 3.0.0 + '@smithy/util-retry': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + transitivePeerDependencies: + - '@aws-sdk/client-sts' + - aws-crt + dev: false + + /@aws-sdk/client-sso@3.590.0: + resolution: {integrity: sha512-6xbC6oQVJKBRTyXyR3C15ksUsPOyW4p+uCj7dlKYWGJvh4vGTV8KhZKS53oPG8t4f1+OMJWjr5wKuXRoaFsmhQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 3.0.0 + '@aws-crypto/sha256-js': 3.0.0 + '@aws-sdk/core': 3.588.0 + '@aws-sdk/middleware-host-header': 3.577.0 + '@aws-sdk/middleware-logger': 3.577.0 + '@aws-sdk/middleware-recursion-detection': 3.577.0 + '@aws-sdk/middleware-user-agent': 3.587.0 + '@aws-sdk/region-config-resolver': 3.587.0 + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-endpoints': 3.587.0 + '@aws-sdk/util-user-agent-browser': 3.577.0 + '@aws-sdk/util-user-agent-node': 3.587.0 + '@smithy/config-resolver': 3.0.1 + '@smithy/core': 2.2.0 + '@smithy/fetch-http-handler': 3.0.1 + '@smithy/hash-node': 3.0.0 + '@smithy/invalid-dependency': 3.0.0 + '@smithy/middleware-content-length': 3.0.0 + '@smithy/middleware-endpoint': 3.0.1 + '@smithy/middleware-retry': 3.0.3 + '@smithy/middleware-serde': 3.0.0 + '@smithy/middleware-stack': 3.0.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/node-http-handler': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/url-parser': 3.0.0 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.3 + '@smithy/util-defaults-mode-node': 3.0.3 + '@smithy/util-endpoints': 2.0.1 + '@smithy/util-middleware': 3.0.0 + '@smithy/util-retry': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + transitivePeerDependencies: + - aws-crt + dev: false + + /@aws-sdk/client-sts@3.590.0: + resolution: {integrity: sha512-f4R1v1LSn4uLYZ5qj4DyL6gp7PXXzJeJsm2seheiJX+53LSF5L7XSDnQVtX1p9Tevv0hp2YUWUTg6QYwIVSuGg==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 3.0.0 + '@aws-crypto/sha256-js': 3.0.0 + '@aws-sdk/client-sso-oidc': 3.590.0(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/core': 3.588.0 + '@aws-sdk/credential-provider-node': 3.590.0(@aws-sdk/client-sso-oidc@3.590.0)(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/middleware-host-header': 3.577.0 + '@aws-sdk/middleware-logger': 3.577.0 + '@aws-sdk/middleware-recursion-detection': 3.577.0 + '@aws-sdk/middleware-user-agent': 3.587.0 + '@aws-sdk/region-config-resolver': 3.587.0 + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-endpoints': 3.587.0 + '@aws-sdk/util-user-agent-browser': 3.577.0 + '@aws-sdk/util-user-agent-node': 3.587.0 + '@smithy/config-resolver': 3.0.1 + '@smithy/core': 2.2.0 + '@smithy/fetch-http-handler': 3.0.1 + '@smithy/hash-node': 3.0.0 + '@smithy/invalid-dependency': 3.0.0 + '@smithy/middleware-content-length': 3.0.0 + '@smithy/middleware-endpoint': 3.0.1 + '@smithy/middleware-retry': 3.0.3 + '@smithy/middleware-serde': 3.0.0 + '@smithy/middleware-stack': 3.0.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/node-http-handler': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/url-parser': 3.0.0 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.3 + '@smithy/util-defaults-mode-node': 3.0.3 + '@smithy/util-endpoints': 2.0.1 + '@smithy/util-middleware': 3.0.0 + '@smithy/util-retry': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + transitivePeerDependencies: + - aws-crt + dev: false + + /@aws-sdk/core@3.588.0: + resolution: {integrity: sha512-O1c2+9ce46Z+iiid+W3iC1IvPbfIo5ev9CBi54GdNB9SaI8/3+f8MJcux0D6c9toCF0ArMersN/gp8ek57e9uQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/core': 2.2.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/signature-v4': 3.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + fast-xml-parser: 4.2.5 + tslib: 2.6.2 + dev: false + + /@aws-sdk/credential-provider-env@3.587.0: + resolution: {integrity: sha512-Hyg/5KFECIk2k5o8wnVEiniV86yVkhn5kzITUydmNGCkXdBFHMHRx6hleQ1bqwJHbBskyu8nbYamzcwymmGwmw==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/property-provider': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/credential-provider-http@3.587.0: + resolution: {integrity: sha512-Su1SRWVRCuR1e32oxX3C1V4c5hpPN20WYcRfdcr2wXwHqSvys5DrnmuCC+JoEnS/zt3adUJhPliTqpfKgSdMrA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/fetch-http-handler': 3.0.1 + '@smithy/node-http-handler': 3.0.0 + '@smithy/property-provider': 3.1.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/util-stream': 3.0.1 + tslib: 2.6.2 + dev: false + + /@aws-sdk/credential-provider-ini@3.590.0(@aws-sdk/client-sso-oidc@3.590.0)(@aws-sdk/client-sts@3.590.0): + resolution: {integrity: sha512-Y5cFciAK38VIvRgZeND7HvFNR32thGtQb8Xop6cMn33FC78uwcRIu9Hc9699XTclCZqz4+Xl1WU+dZ+rnFn2AA==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@aws-sdk/client-sts': ^3.590.0 + dependencies: + '@aws-sdk/client-sts': 3.590.0 + '@aws-sdk/credential-provider-env': 3.587.0 + '@aws-sdk/credential-provider-http': 3.587.0 + '@aws-sdk/credential-provider-process': 3.587.0 + '@aws-sdk/credential-provider-sso': 3.590.0(@aws-sdk/client-sso-oidc@3.590.0) + '@aws-sdk/credential-provider-web-identity': 3.587.0(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/types': 3.577.0 + '@smithy/credential-provider-imds': 3.1.0 + '@smithy/property-provider': 3.1.0 + '@smithy/shared-ini-file-loader': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + transitivePeerDependencies: + - '@aws-sdk/client-sso-oidc' + - aws-crt + dev: false + + /@aws-sdk/credential-provider-node@3.590.0(@aws-sdk/client-sso-oidc@3.590.0)(@aws-sdk/client-sts@3.590.0): + resolution: {integrity: sha512-Ky38mNFoXobGrDQ11P3dU1e+q1nRJ7eZl8l15KUpvZCe/hOudbxQi/epQrCazD/gRYV2fTyczdLlZzB5ZZ8DhQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/credential-provider-env': 3.587.0 + '@aws-sdk/credential-provider-http': 3.587.0 + '@aws-sdk/credential-provider-ini': 3.590.0(@aws-sdk/client-sso-oidc@3.590.0)(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/credential-provider-process': 3.587.0 + '@aws-sdk/credential-provider-sso': 3.590.0(@aws-sdk/client-sso-oidc@3.590.0) + '@aws-sdk/credential-provider-web-identity': 3.587.0(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/types': 3.577.0 + '@smithy/credential-provider-imds': 3.1.0 + '@smithy/property-provider': 3.1.0 + '@smithy/shared-ini-file-loader': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + transitivePeerDependencies: + - '@aws-sdk/client-sso-oidc' + - '@aws-sdk/client-sts' + - aws-crt + dev: false + + /@aws-sdk/credential-provider-process@3.587.0: + resolution: {integrity: sha512-V4xT3iCqkF8uL6QC4gqBJg/2asd/damswP1h9HCfqTllmPWzImS+8WD3VjgTLw5b0KbTy+ZdUhKc0wDnyzkzxg==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/property-provider': 3.1.0 + '@smithy/shared-ini-file-loader': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/credential-provider-sso@3.590.0(@aws-sdk/client-sso-oidc@3.590.0): + resolution: {integrity: sha512-v+0j/I+je9okfwXsgmLppmwIE+TuMp5WqLz7r7PHz9KjzLyKaKTDvfllFD+8oPpBqnmOWiJ9qTGPkrfhB7a/fQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/client-sso': 3.590.0 + '@aws-sdk/token-providers': 3.587.0(@aws-sdk/client-sso-oidc@3.590.0) + '@aws-sdk/types': 3.577.0 + '@smithy/property-provider': 3.1.0 + '@smithy/shared-ini-file-loader': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + transitivePeerDependencies: + - '@aws-sdk/client-sso-oidc' + - aws-crt + dev: false + + /@aws-sdk/credential-provider-web-identity@3.587.0(@aws-sdk/client-sts@3.590.0): + resolution: {integrity: sha512-XqIx/I2PG7kyuw3WjAP9wKlxy8IvFJwB8asOFT1xPFoVfZYKIogjG9oLP5YiRtfvDkWIztHmg5MlVv3HdJDGRw==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@aws-sdk/client-sts': ^3.587.0 + dependencies: + '@aws-sdk/client-sts': 3.590.0 + '@aws-sdk/types': 3.577.0 + '@smithy/property-provider': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-bucket-endpoint@3.587.0: + resolution: {integrity: sha512-HkFXLPl8pr6BH/Q0JpOESqEKL0ZK3sk7aSZ1S6GE4RXET7H5R94THULXqQFZzD48gZcyFooO/yNKZTqrZFaWKg==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-arn-parser': 3.568.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-config-provider': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-expect-continue@3.577.0: + resolution: {integrity: sha512-6dPp8Tv4F0of4un5IAyG6q++GrRrNQQ4P2NAMB1W0VO4JoEu1C8GievbbDLi88TFIFmtKpnHB0ODCzwnoe8JsA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-flexible-checksums@3.587.0: + resolution: {integrity: sha512-URMwp/budDvKhIvZ4a6zIBfFTun/iDlPWXqsGKYjEtHt8jz27OSjCZtDtIeqW4WTBdKL8KZgQcl+DdaE5M1qiQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/crc32': 3.0.0 + '@aws-crypto/crc32c': 3.0.0 + '@aws-sdk/types': 3.577.0 + '@smithy/is-array-buffer': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-host-header@3.577.0: + resolution: {integrity: sha512-9ca5MJz455CODIVXs0/sWmJm7t3QO4EUa1zf8pE8grLpzf0J94bz/skDWm37Pli13T3WaAQBHCTiH2gUVfCsWg==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-location-constraint@3.577.0: + resolution: {integrity: sha512-DKPTD2D2s+t2QUo/IXYtVa/6Un8GZ+phSTBkyBNx2kfZz4Kwavhl/JJzSqTV3GfCXkVdFu7CrjoX7BZ6qWeTUA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-logger@3.577.0: + resolution: {integrity: sha512-aPFGpGjTZcJYk+24bg7jT4XdIp42mFXSuPt49lw5KygefLyJM/sB0bKKqPYYivW0rcuZ9brQ58eZUNthrzYAvg==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-recursion-detection@3.577.0: + resolution: {integrity: sha512-pn3ZVEd2iobKJlR3H+bDilHjgRnNrQ6HMmK9ZzZw89Ckn3Dcbv48xOv4RJvu0aU8SDLl/SNCxppKjeLDTPGBNA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-sdk-s3@3.587.0: + resolution: {integrity: sha512-vtXTGEiw1E9Fax4LmcU2Z208gbrC8ShrdsSLmGcRPpu5NPOGBFBSDG5sy5EDNClrFxIl/Le8coQnD0EDBtx+uQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-arn-parser': 3.568.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/signature-v4': 3.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/util-config-provider': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-signing@3.587.0: + resolution: {integrity: sha512-tiZaTDj4RvhXGRAlncFn7CSEfL3iNPO67WSaxAq+Ls5j1VgczPhu5262cWONNoMgth3nXR1hhLC4ITSl/a6AzA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/property-provider': 3.1.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/signature-v4': 3.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-middleware': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-ssec@3.577.0: + resolution: {integrity: sha512-i2BPJR+rp8xmRVIGc0h1kDRFcM2J9GnClqqpc+NLSjmYadlcg4mPklisz9HzwFVcRPJ5XcGf3U4BYs5G8+iTyg==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/middleware-user-agent@3.587.0: + resolution: {integrity: sha512-SyDomN+IOrygLucziG7/nOHkjUXES5oH5T7p8AboO8oakMQJdnudNXiYWTicQWO52R51U6CR27rcMPTGeMedYA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@aws-sdk/util-endpoints': 3.587.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/region-config-resolver@3.587.0: + resolution: {integrity: sha512-93I7IPZtulZQoRK+O20IJ4a1syWwYPzoO2gc3v+/GNZflZPV3QJXuVbIm0pxBsu0n/mzKGUKqSOLPIaN098HcQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/types': 3.0.0 + '@smithy/util-config-provider': 3.0.0 + '@smithy/util-middleware': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/signature-v4-multi-region@3.587.0: + resolution: {integrity: sha512-TR9+ZSjdXvXUz54ayHcCihhcvxI9W7102J1OK6MrLgBlPE7uRhAx42BR9L5lLJ86Xj3LuqPWf//o9d/zR9WVIg==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/middleware-sdk-s3': 3.587.0 + '@aws-sdk/types': 3.577.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/signature-v4': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/token-providers@3.587.0(@aws-sdk/client-sso-oidc@3.590.0): + resolution: {integrity: sha512-ULqhbnLy1hmJNRcukANBWJmum3BbjXnurLPSFXoGdV0llXYlG55SzIla2VYqdveQEEjmsBuTZdFvXAtNpmS5Zg==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@aws-sdk/client-sso-oidc': ^3.587.0 + dependencies: + '@aws-sdk/client-sso-oidc': 3.590.0(@aws-sdk/client-sts@3.590.0) + '@aws-sdk/types': 3.577.0 + '@smithy/property-provider': 3.1.0 + '@smithy/shared-ini-file-loader': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/types@3.577.0: + resolution: {integrity: sha512-FT2JZES3wBKN/alfmhlo+3ZOq/XJ0C7QOZcDNrpKjB0kqYoKjhVKZ/Hx6ArR0czkKfHzBBEs6y40ebIHx2nSmA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/util-arn-parser@3.568.0: + resolution: {integrity: sha512-XUKJWWo+KOB7fbnPP0+g/o5Ulku/X53t7i/h+sPHr5xxYTJJ9CYnbToo95mzxe7xWvkLrsNtJ8L+MnNn9INs2w==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@aws-sdk/util-endpoints@3.587.0: + resolution: {integrity: sha512-8I1HG6Em8wQWqKcRW6m358mqebRVNpL8XrrEoT4In7xqkKkmYtHRNVYP6lcmiQh5pZ/c/FXu8dSchuFIWyEtqQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/types': 3.0.0 + '@smithy/util-endpoints': 2.0.1 + tslib: 2.6.2 + dev: false + + /@aws-sdk/util-locate-window@3.568.0: + resolution: {integrity: sha512-3nh4TINkXYr+H41QaPelCceEB2FXP3fxp93YZXB/kqJvX0U9j0N0Uk45gvsjmEPzG8XxkPEeLIfT2I1M7A6Lig==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@aws-sdk/util-user-agent-browser@3.577.0: + resolution: {integrity: sha512-zEAzHgR6HWpZOH7xFgeJLc6/CzMcx4nxeQolZxVZoB5pPaJd3CjyRhZN0xXeZB0XIRCWmb4yJBgyiugXLNMkLA==} + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/types': 3.0.0 + bowser: 2.11.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/util-user-agent-node@3.587.0: + resolution: {integrity: sha512-Pnl+DUe/bvnbEEDHP3iVJrOtE3HbFJBPgsD6vJ+ml/+IYk1Eq49jEG+EHZdNTPz3SDG0kbp2+7u41MKYJHR/iQ==} + engines: {node: '>=16.0.0'} + peerDependencies: + aws-crt: '>=1.0.0' + peerDependenciesMeta: + aws-crt: + optional: true + dependencies: + '@aws-sdk/types': 3.577.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@aws-sdk/util-utf8-browser@3.259.0: + resolution: {integrity: sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==} + dependencies: + tslib: 2.6.2 + dev: false + + /@aws-sdk/xml-builder@3.575.0: + resolution: {integrity: sha512-cWgAwmbFYNCFzPwxL705+lWps0F3ZvOckufd2KKoEZUmtpVw9/txUXNrPySUXSmRTSRhoatIMABNfStWR043bQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + /@cspotcode/source-map-support@0.8.1: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -585,6 +1226,461 @@ packages: resolution: {integrity: sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==} dev: true + /@smithy/abort-controller@3.0.0: + resolution: {integrity: sha512-p6GlFGBt9K4MYLu72YuJ523NVR4A8oHlC5M2JO6OmQqN8kAc/uh1JqLE+FizTokrSJGg0CSvC+BrsmGzKtsZKA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/chunked-blob-reader-native@3.0.0: + resolution: {integrity: sha512-VDkpCYW+peSuM4zJip5WDfqvg2Mo/e8yxOv3VF1m11y7B8KKMKVFtmZWDe36Fvk8rGuWrPZHHXZ7rR7uM5yWyg==} + dependencies: + '@smithy/util-base64': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/chunked-blob-reader@3.0.0: + resolution: {integrity: sha512-sbnURCwjF0gSToGlsBiAmd1lRCmSn72nu9axfJu5lIx6RUEgHu6GwTMbqCdhQSi0Pumcm5vFxsi9XWXb2mTaoA==} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/config-resolver@3.0.1: + resolution: {integrity: sha512-hbkYJc20SBDz2qqLzttjI/EqXemtmWk0ooRznLsiXp3066KQRTvuKHa7U4jCZCJq6Dozqvy0R1/vNESC9inPJg==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/node-config-provider': 3.1.0 + '@smithy/types': 3.0.0 + '@smithy/util-config-provider': 3.0.0 + '@smithy/util-middleware': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/core@2.2.0: + resolution: {integrity: sha512-ygLZSSKgt9bR8HAxR9mK+U5obvAJBr6zlQuhN5soYWx/amjDoQN4dTkydTypgKe6rIbUjTILyLU+W5XFwXr4kg==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/middleware-endpoint': 3.0.1 + '@smithy/middleware-retry': 3.0.3 + '@smithy/middleware-serde': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/util-middleware': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/credential-provider-imds@3.1.0: + resolution: {integrity: sha512-q4A4d38v8pYYmseu/jTS3Z5I3zXlEOe5Obi+EJreVKgSVyWUHOd7/yaVCinC60QG4MRyCs98tcxBH1IMC0bu7Q==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/node-config-provider': 3.1.0 + '@smithy/property-provider': 3.1.0 + '@smithy/types': 3.0.0 + '@smithy/url-parser': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/eventstream-codec@3.0.0: + resolution: {integrity: sha512-PUtyEA0Oik50SaEFCZ0WPVtF9tz/teze2fDptW6WRXl+RrEenH8UbEjudOz8iakiMl3lE3lCVqYf2Y+znL8QFQ==} + dependencies: + '@aws-crypto/crc32': 3.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-hex-encoding': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/eventstream-serde-browser@3.0.0: + resolution: {integrity: sha512-NB7AFiPN4NxP/YCAnrvYR18z2/ZsiHiF7VtG30gshO9GbFrIb1rC8ep4NGpJSWrz6P64uhPXeo4M0UsCLnZKqw==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/eventstream-serde-universal': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/eventstream-serde-config-resolver@3.0.0: + resolution: {integrity: sha512-RUQG3vQ3LX7peqqHAbmayhgrF5aTilPnazinaSGF1P0+tgM3vvIRWPHmlLIz2qFqB9LqFIxditxc8O2Z6psrRw==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/eventstream-serde-node@3.0.0: + resolution: {integrity: sha512-baRPdMBDMBExZXIUAoPGm/hntixjt/VFpU6+VmCyiYJYzRHRxoaI1MN+5XE+hIS8AJ2GCHLMFEIOLzq9xx1EgQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/eventstream-serde-universal': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/eventstream-serde-universal@3.0.0: + resolution: {integrity: sha512-HNFfShmotWGeAoW4ujP8meV9BZavcpmerDbPIjkJbxKbN8RsUcpRQ/2OyIxWNxXNH2GWCAxuSB7ynmIGJlQ3Dw==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/eventstream-codec': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/fetch-http-handler@3.0.1: + resolution: {integrity: sha512-uaH74i5BDj+rBwoQaXioKpI0SHBJFtOVwzrCpxZxphOW0ki5jhj7dXvDMYM2IJem8TpdFvS2iC08sjOblfFGFg==} + dependencies: + '@smithy/protocol-http': 4.0.0 + '@smithy/querystring-builder': 3.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-base64': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/hash-blob-browser@3.0.0: + resolution: {integrity: sha512-/Wbpdg+bwJvW7lxR/zpWAc1/x/YkcqguuF2bAzkJrvXriZu1vm8r+PUdE4syiVwQg7PPR2dXpi3CLBb9qRDaVQ==} + dependencies: + '@smithy/chunked-blob-reader': 3.0.0 + '@smithy/chunked-blob-reader-native': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/hash-node@3.0.0: + resolution: {integrity: sha512-84qXstNemP3XS5jcof0el6+bDfjzuvhJPQTEfro3lgtbCtKgzPm3MgiS6ehXVPjeQ5+JS0HqmTz8f/RYfzHVxw==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + '@smithy/util-buffer-from': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/hash-stream-node@3.0.0: + resolution: {integrity: sha512-J0i7de+EgXDEGITD4fxzmMX8CyCNETTIRXlxjMiNUvvu76Xn3GJ31wQR85ynlPk2wI1lqoknAFJaD1fiNDlbIA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/invalid-dependency@3.0.0: + resolution: {integrity: sha512-F6wBBaEFgJzj0s4KUlliIGPmqXemwP6EavgvDqYwCH40O5Xr2iMHvS8todmGVZtuJCorBkXsYLyTu4PuizVq5g==} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/is-array-buffer@3.0.0: + resolution: {integrity: sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/md5-js@3.0.0: + resolution: {integrity: sha512-Tm0vrrVzjlD+6RCQTx7D3Ls58S3FUH1ZCtU1MIh/qQmaOo1H9lMN2as6CikcEwgattnA9SURSdoJJ27xMcEfMA==} + dependencies: + '@smithy/types': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/middleware-content-length@3.0.0: + resolution: {integrity: sha512-3C4s4d/iGobgCtk2tnWW6+zSTOBg1PRAm2vtWZLdriwTroFbbWNSr3lcyzHdrQHnEXYCC5K52EbpfodaIUY8sg==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/middleware-endpoint@3.0.1: + resolution: {integrity: sha512-lQ/UOdGD4KM5kLZiAl0q8Qy3dPbynvAXKAdXnYlrA1OpaUwr+neSsVokDZpY6ZVb5Yx8jnus29uv6XWpM9P4SQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/middleware-serde': 3.0.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/shared-ini-file-loader': 3.1.0 + '@smithy/types': 3.0.0 + '@smithy/url-parser': 3.0.0 + '@smithy/util-middleware': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/middleware-retry@3.0.3: + resolution: {integrity: sha512-Wve1qzJb83VEU/6q+/I0cQdAkDnuzELC6IvIBwDzUEiGpKqXgX1v10FUuZGbRS6Ov/P+HHthcAoHOJZQvZNAkA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/node-config-provider': 3.1.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/service-error-classification': 3.0.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + '@smithy/util-middleware': 3.0.0 + '@smithy/util-retry': 3.0.0 + tslib: 2.6.2 + uuid: 9.0.1 + dev: false + + /@smithy/middleware-serde@3.0.0: + resolution: {integrity: sha512-I1vKG1foI+oPgG9r7IMY1S+xBnmAn1ISqployvqkwHoSb8VPsngHDTOgYGYBonuOKndaWRUGJZrKYYLB+Ane6w==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/middleware-stack@3.0.0: + resolution: {integrity: sha512-+H0jmyfAyHRFXm6wunskuNAqtj7yfmwFB6Fp37enytp2q047/Od9xetEaUbluyImOlGnGpaVGaVfjwawSr+i6Q==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/node-config-provider@3.1.0: + resolution: {integrity: sha512-ngfB8QItUfTFTfHMvKuc2g1W60V1urIgZHqD1JNFZC2tTWXahqf2XvKXqcBS7yZqR7GqkQQZy11y/lNOUWzq7Q==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/property-provider': 3.1.0 + '@smithy/shared-ini-file-loader': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/node-http-handler@3.0.0: + resolution: {integrity: sha512-3trD4r7NOMygwLbUJo4eodyQuypAWr7uvPnebNJ9a70dQhVn+US8j/lCnvoJS6BXfZeF7PkkkI0DemVJw+n+eQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/abort-controller': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/querystring-builder': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/property-provider@3.1.0: + resolution: {integrity: sha512-Tj3+oVhqdZgemjCiWjFlADfhvLF4C/uKDuKo7/tlEsRQ9+3emCreR2xndj970QSRSsiCEU8hZW3/8JQu+n5w4Q==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/protocol-http@4.0.0: + resolution: {integrity: sha512-qOQZOEI2XLWRWBO9AgIYuHuqjZ2csyr8/IlgFDHDNuIgLAMRx2Bl8ck5U5D6Vh9DPdoaVpuzwWMa0xcdL4O/AQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/querystring-builder@3.0.0: + resolution: {integrity: sha512-bW8Fi0NzyfkE0TmQphDXr1AmBDbK01cA4C1Z7ggwMAU5RDz5AAv/KmoRwzQAS0kxXNf/D2ALTEgwK0U2c4LtRg==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + '@smithy/util-uri-escape': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/querystring-parser@3.0.0: + resolution: {integrity: sha512-UzHwthk0UEccV4dHzPySnBy34AWw3V9lIqUTxmozQ+wPDAO9csCWMfOLe7V9A2agNYy7xE+Pb0S6K/J23JSzfQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/service-error-classification@3.0.0: + resolution: {integrity: sha512-3BsBtOUt2Gsnc3X23ew+r2M71WwtpHfEDGhHYHSDg6q1t8FrWh15jT25DLajFV1H+PpxAJ6gqe9yYeRUsmSdFA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + dev: false + + /@smithy/shared-ini-file-loader@3.1.0: + resolution: {integrity: sha512-dAM7wSX0NR3qTNyGVN/nwwpEDzfV9T/3AN2eABExWmda5VqZKSsjlINqomO5hjQWGv+IIkoXfs3u2vGSNz8+Rg==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/signature-v4@3.0.0: + resolution: {integrity: sha512-kXFOkNX+BQHe2qnLxpMEaCRGap9J6tUGLzc3A9jdn+nD4JdMwCKTJ+zFwQ20GkY+mAXGatyTw3HcoUlR39HwmA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/is-array-buffer': 3.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-hex-encoding': 3.0.0 + '@smithy/util-middleware': 3.0.0 + '@smithy/util-uri-escape': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/smithy-client@3.1.1: + resolution: {integrity: sha512-tj4Ku7MpzZR8cmVuPcSbrLFVxmptWktmJMwST/uIEq4sarabEdF8CbmQdYB7uJ/X51Qq2EYwnRsoS7hdR4B7rA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/middleware-endpoint': 3.0.1 + '@smithy/middleware-stack': 3.0.0 + '@smithy/protocol-http': 4.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-stream': 3.0.1 + tslib: 2.6.2 + dev: false + + /@smithy/types@3.0.0: + resolution: {integrity: sha512-VvWuQk2RKFuOr98gFhjca7fkBS+xLLURT8bUjk5XQoV0ZLm7WPwWPPY3/AwzTLuUBDeoKDCthfe1AsTUWaSEhw==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/url-parser@3.0.0: + resolution: {integrity: sha512-2XLazFgUu+YOGHtWihB3FSLAfCUajVfNBXGGYjOaVKjLAuAxx3pSBY3hBgLzIgB17haf59gOG3imKqTy8mcrjw==} + dependencies: + '@smithy/querystring-parser': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-base64@3.0.0: + resolution: {integrity: sha512-Kxvoh5Qtt0CDsfajiZOCpJxgtPHXOKwmM+Zy4waD43UoEMA+qPxxa98aE/7ZhdnBFZFXMOiBR5xbcaMhLtznQQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/util-buffer-from': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-body-length-browser@3.0.0: + resolution: {integrity: sha512-cbjJs2A1mLYmqmyVl80uoLTJhAcfzMOyPgjwAYusWKMdLeNtzmMz9YxNl3/jRLoxSS3wkqkf0jwNdtXWtyEBaQ==} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/util-body-length-node@3.0.0: + resolution: {integrity: sha512-Tj7pZ4bUloNUP6PzwhN7K386tmSmEET9QtQg0TgdNOnxhZvCssHji+oZTUIuzxECRfG8rdm2PMw2WCFs6eIYkA==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/util-buffer-from@3.0.0: + resolution: {integrity: sha512-aEOHCgq5RWFbP+UDPvPot26EJHjOC+bRgse5A8V3FSShqd5E5UN4qc7zkwsvJPPAVsf73QwYcHN1/gt/rtLwQA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/is-array-buffer': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-config-provider@3.0.0: + resolution: {integrity: sha512-pbjk4s0fwq3Di/ANL+rCvJMKM5bzAQdE5S/6RL5NXgMExFAi6UgQMPOm5yPaIWPpr+EOXKXRonJ3FoxKf4mCJQ==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/util-defaults-mode-browser@3.0.3: + resolution: {integrity: sha512-3DFON2bvXJAukJe+qFgPV/rorG7ZD3m4gjCXHD1V5z/tgKQp5MCTCLntrd686tX6tj8Uli3lefWXJudNg5WmCA==} + engines: {node: '>= 10.0.0'} + dependencies: + '@smithy/property-provider': 3.1.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + bowser: 2.11.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-defaults-mode-node@3.0.3: + resolution: {integrity: sha512-D0b8GJXecT00baoSQ3Iieu3k3mZ7GY8w1zmg8pdogYrGvWJeLcIclqk2gbkG4K0DaBGWrO6v6r20iwIFfDYrmA==} + engines: {node: '>= 10.0.0'} + dependencies: + '@smithy/config-resolver': 3.0.1 + '@smithy/credential-provider-imds': 3.1.0 + '@smithy/node-config-provider': 3.1.0 + '@smithy/property-provider': 3.1.0 + '@smithy/smithy-client': 3.1.1 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-endpoints@2.0.1: + resolution: {integrity: sha512-ZRT0VCOnKlVohfoABMc8lWeQo/JEFuPWctfNRXgTHbyOVssMOLYFUNWukxxiHRGVAhV+n3c0kPW+zUqckjVPEA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/node-config-provider': 3.1.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-hex-encoding@3.0.0: + resolution: {integrity: sha512-eFndh1WEK5YMUYvy3lPlVmYY/fZcQE1D8oSf41Id2vCeIkKJXPcYDCZD+4+xViI6b1XSd7tE+s5AmXzz5ilabQ==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/util-middleware@3.0.0: + resolution: {integrity: sha512-q5ITdOnV2pXHSVDnKWrwgSNTDBAMHLptFE07ua/5Ty5WJ11bvr0vk2a7agu7qRhrCFRQlno5u3CneU5EELK+DQ==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-retry@3.0.0: + resolution: {integrity: sha512-nK99bvJiziGv/UOKJlDvFF45F00WgPLKVIGUfAK+mDhzVN2hb/S33uW2Tlhg5PVBoqY7tDVqL0zmu4OxAHgo9g==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/service-error-classification': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-stream@3.0.1: + resolution: {integrity: sha512-7F7VNNhAsfMRA8I986YdOY5fE0/T1/ZjFF6OLsqkvQVNP3vZ/szYDfGCyphb7ioA09r32K/0qbSFfNFU68aSzA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/fetch-http-handler': 3.0.1 + '@smithy/node-http-handler': 3.0.0 + '@smithy/types': 3.0.0 + '@smithy/util-base64': 3.0.0 + '@smithy/util-buffer-from': 3.0.0 + '@smithy/util-hex-encoding': 3.0.0 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-uri-escape@3.0.0: + resolution: {integrity: sha512-LqR7qYLgZTD7nWLBecUi4aqolw8Mhza9ArpNEQ881MJJIU2sE5iHCK6TdyqqzcDLy0OPe10IY4T8ctVdtynubg==} + engines: {node: '>=16.0.0'} + dependencies: + tslib: 2.6.2 + dev: false + + /@smithy/util-utf8@3.0.0: + resolution: {integrity: sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/util-buffer-from': 3.0.0 + tslib: 2.6.2 + dev: false + + /@smithy/util-waiter@3.0.0: + resolution: {integrity: sha512-+fEXJxGDLCoqRKVSmo0auGxaqbiCo+8oph+4auefYjaNxjOLKSY2MxVQfRzo65PaZv4fr+5lWg+au7vSuJJ/zw==} + engines: {node: '>=16.0.0'} + dependencies: + '@smithy/abort-controller': 3.0.0 + '@smithy/types': 3.0.0 + tslib: 2.6.2 + dev: false + /@tootallnate/once@2.0.0: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} @@ -703,6 +1799,10 @@ packages: resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} dev: true + /@types/node-cron@3.0.11: + resolution: {integrity: sha512-0ikrnug3/IyneSHqCBeslAhlK2aBfYek1fGo4bP4QnZPmiqSGRK+Oy7ZMisLWkesffJvQ1cqAcBnJC+8+nxIAg==} + dev: true + /@types/node@20.12.7: resolution: {integrity: sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==} dependencies: @@ -1189,6 +2289,10 @@ packages: - supports-color dev: false + /bowser@2.11.0: + resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==} + dev: false + /brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} dependencies: @@ -2146,6 +3250,13 @@ packages: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} dev: true + /fast-xml-parser@4.2.5: + resolution: {integrity: sha512-B9/wizE4WngqQftFPmdaMYlXoJlJOYxGQOanC77fq9k8+Z0v5dDSVh+3glErdIROP//s/jgb7ZuxKfB8nVyo0g==} + hasBin: true + dependencies: + strnum: 1.0.5 + dev: false + /fast-xml-parser@4.3.6: resolution: {integrity: sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw==} hasBin: true @@ -3497,6 +4608,13 @@ packages: resolution: {integrity: sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==} dev: false + /node-cron@3.0.3: + resolution: {integrity: sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==} + engines: {node: '>=6.0.0'} + dependencies: + uuid: 8.3.2 + dev: false + /node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -4283,7 +5401,6 @@ packages: resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} requiresBuild: true dev: false - optional: true /stubs@3.0.0: resolution: {integrity: sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==} @@ -4465,6 +5582,10 @@ packages: strip-json-comments: 2.0.1 dev: true + /tslib@1.14.1: + resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + dev: false + /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} @@ -4593,7 +5714,6 @@ packages: hasBin: true requiresBuild: true dev: false - optional: true /uuid@9.0.1: resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} diff --git a/src/core/infra/providers/prisma.provider.ts b/src/core/infra/providers/prisma.provider.ts new file mode 100644 index 0000000..d05bbdd --- /dev/null +++ b/src/core/infra/providers/prisma.provider.ts @@ -0,0 +1,3 @@ +import { PrismaClient } from '@prisma/client'; + +export const Prisma: PrismaClient = new PrismaClient(); diff --git a/src/core/infra/providers/s3.provider.ts b/src/core/infra/providers/s3.provider.ts new file mode 100644 index 0000000..ae88fe7 --- /dev/null +++ b/src/core/infra/providers/s3.provider.ts @@ -0,0 +1,45 @@ +import { DeleteObjectCommand, PutObjectCommand, S3Client } from '@aws-sdk/client-s3'; +import fs from 'fs'; +import path from 'path'; +import { EnvConfigKeys } from '../../../utils/constants'; + +const bucketName = process.env[EnvConfigKeys.AWS_BACKUP_BUCKET] as string; + +const s3Client = new S3Client({ + region: process.env.AWS_REGION, + credentials: { + accessKeyId: `${process.env[EnvConfigKeys.AWS_ACCESS_KEY_ID]}`, + secretAccessKey: `${process.env[EnvConfigKeys.AWS_SECRET_ACCESS_KEY]}`, + }, +}); + +export async function uploadToS3(filePath: string) { + const fileStream = fs.createReadStream(filePath); + + const uploadParams = { + Bucket: bucketName, + Key: path.basename(filePath), + Body: fileStream, + }; + + try { + const data = await s3Client.send(new PutObjectCommand(uploadParams)); + console.log('Upload successful', data); + } catch (err) { + console.error('Error', err); + } +} + +export async function deleteFromS3(fileName: string) { + const deleteParams = { + Bucket: bucketName, + Key: fileName, + }; + + try { + const data = await s3Client.send(new DeleteObjectCommand(deleteParams)); + console.log('Successfully deleted old backup', data); + } catch (err) { + console.error('Error deleting old backup', err); + } +} diff --git a/src/core/infra/repositories/company.repository.ts b/src/core/infra/repositories/company.repository.ts index 98ea0b4..7ecb8be 100644 --- a/src/core/infra/repositories/company.repository.ts +++ b/src/core/infra/repositories/company.repository.ts @@ -1,7 +1,7 @@ -import { Prisma } from '../../..'; import { CompanyEntity } from '../../domain/entities/company.entity'; import { NotFoundError } from '../../errors/not-found.error'; import { mapCompanyEntityFromDbModel } from '../mappers/company-entity-from-db-model.mapper'; +import { Prisma } from '../providers/prisma.provider'; const RESOURCE_NAME = 'Company'; diff --git a/src/core/infra/repositories/department.repository.ts b/src/core/infra/repositories/department.repository.ts index 6949470..fe1fae3 100644 --- a/src/core/infra/repositories/department.repository.ts +++ b/src/core/infra/repositories/department.repository.ts @@ -1,7 +1,7 @@ -import { Prisma } from '../../..'; import { DepartmentEntity } from '../../domain/entities/department.entity'; import { NotFoundError } from '../../errors/not-found.error'; import { mapDepartmentEntityFromDbModelToDbModel } from '../mappers/department-entity-from-db-model.mapper'; +import { Prisma } from '../providers/prisma.provider'; async function findById(id: string): Promise { try { diff --git a/src/core/infra/repositories/employee-task.repository.ts b/src/core/infra/repositories/employee-task.repository.ts index 88349e8..9c5ea45 100644 --- a/src/core/infra/repositories/employee-task.repository.ts +++ b/src/core/infra/repositories/employee-task.repository.ts @@ -1,7 +1,7 @@ -import { Prisma } from '../../..'; import { EmployeeTask } from '../../domain/entities/employee-task.entity'; import { NotFoundError } from '../../errors/not-found.error'; import { mapEmployeeTaskEntityFromDbModel } from '../mappers/employee-task-entity-from-db-model-mapper'; +import { Prisma } from '../providers/prisma.provider'; const RESOURCE_NAME = 'EmployeeTask'; diff --git a/src/core/infra/repositories/employee.repository.ts b/src/core/infra/repositories/employee.repository.ts index ab1cad2..c96944d 100644 --- a/src/core/infra/repositories/employee.repository.ts +++ b/src/core/infra/repositories/employee.repository.ts @@ -1,7 +1,7 @@ -import { Prisma } from '../../..'; import { EmployeeEntity } from '../../domain/entities/employee.entity'; import { NotFoundError } from '../../errors/not-found.error'; import { mapEmployeeEntityFromDbModel } from '../mappers/employee-entity-from-db-model.mapper'; +import { Prisma } from '../providers/prisma.provider'; const RESOURCE_NAME = 'Employee'; diff --git a/src/core/infra/repositories/expense.repository.ts b/src/core/infra/repositories/expense.repository.ts index 8f9353d..a524181 100644 --- a/src/core/infra/repositories/expense.repository.ts +++ b/src/core/infra/repositories/expense.repository.ts @@ -1,4 +1,3 @@ -import { Prisma } from '../../..'; import { ExpenseReportStatus } from '../../../utils/enums'; import { ExpenseEntity, ExpenseReport } from '../../domain/entities/expense.entity'; import { NotFoundError } from '../../errors/not-found.error'; @@ -6,6 +5,7 @@ import { mapExpenseEntityFromDbModel, mapExpenseReportEntityFromDbModel, } from '../mappers/expense-entity-from-db-model.mapper'; +import { Prisma } from '../providers/prisma.provider'; const RESOURCE_NAME = 'Expense report'; diff --git a/src/core/infra/repositories/project.repository.ts b/src/core/infra/repositories/project.repository.ts index 8d26041..35b2f66 100644 --- a/src/core/infra/repositories/project.repository.ts +++ b/src/core/infra/repositories/project.repository.ts @@ -1,9 +1,9 @@ import { Decimal } from '@prisma/client/runtime/library'; -import { Prisma } from '../../..'; import { ProjectStatus, SupportedDepartments, SupportedRoles } from '../../../utils/enums'; import { ProjectEntity } from '../../domain/entities/project.entity'; import { NotFoundError } from '../../errors/not-found.error'; import { mapProjectEntityFromDbModel } from '../mappers/project-entity-from-db-model-mapper'; +import { Prisma } from '../providers/prisma.provider'; const RESOURCE_NAME = 'Project info'; diff --git a/src/core/infra/repositories/role.repository.ts b/src/core/infra/repositories/role.repository.ts index ca3bc40..bd9d16a 100644 --- a/src/core/infra/repositories/role.repository.ts +++ b/src/core/infra/repositories/role.repository.ts @@ -1,8 +1,8 @@ -import { Prisma } from '../../..'; import { SupportedRoles } from '../../../utils/enums'; import { RoleEntity } from '../../domain/entities/role.entity'; import { NotFoundError } from '../../errors/not-found.error'; import { mapRoleEntityFromDbModelToDbModel } from '../mappers/role-entity-from-db-model.mapper'; +import { Prisma } from '../providers/prisma.provider'; /** * Retrieves the role of an employee by email diff --git a/src/core/infra/repositories/tasks.repository.ts b/src/core/infra/repositories/tasks.repository.ts index 91997e0..4011e88 100644 --- a/src/core/infra/repositories/tasks.repository.ts +++ b/src/core/infra/repositories/tasks.repository.ts @@ -1,8 +1,8 @@ -import { Prisma } from '../../..'; import { TaskStatus } from '../../../utils/enums'; import { Task, UpdatedTask } from '../../domain/entities/task.entity'; import { NotFoundError } from '../../errors/not-found.error'; import { mapTaskEntityFromDbModel } from '../mappers/task-entity-from-db-model-mapper'; +import { Prisma } from '../providers/prisma.provider'; const RESOURCE_NAME = 'Task'; diff --git a/src/index.ts b/src/index.ts index e82f31f..34813da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,3 @@ -import { PrismaClient } from '@prisma/client'; import cors from 'cors'; import 'dotenv/config'; import express, { Express } from 'express'; @@ -6,7 +5,6 @@ import { baseRouter } from './api/routes/index.routes'; import { EnvConfigKeys } from './utils/constants'; import { logger } from './utils/logger'; -export const Prisma: PrismaClient = new PrismaClient(); const app: Express = express(); const HOST: string = process.env[EnvConfigKeys.HOST] || 'localhost'; diff --git a/src/utils/backup/postgres.backup.ts b/src/utils/backup/postgres.backup.ts new file mode 100644 index 0000000..c4229b0 --- /dev/null +++ b/src/utils/backup/postgres.backup.ts @@ -0,0 +1,62 @@ +import { exec } from 'child_process'; +import fs from 'fs'; +import cron from 'node-cron'; +import { deleteFromS3, uploadToS3 } from '../../core/infra/providers/s3.provider'; +import { EnvConfigKeys, ExecutionEnv } from '../constants'; + +const PG_USER = process.env[EnvConfigKeys.PG_USER]; +const PG_PASSWORD = process.env[EnvConfigKeys.PG_PASSWORD]; +const PG_DATABASE = process.env[EnvConfigKeys.PG_DATABASE]; + +const formatDate = (date: Date) => { + const d = new Date(date), + month = '' + (d.getMonth() + 1), + day = '' + d.getDate(), + year = d.getFullYear(); + + return [year, month.padStart(2, '0'), day.padStart(2, '0')].join('-'); +}; + +function performBackup() { + const todayFormatted = formatDate(new Date()); + const fifteenDaysAgo = new Date(); + fifteenDaysAgo.setDate(fifteenDaysAgo.getDate() - 15); + const fifteenDaysAgoFormatted = formatDate(fifteenDaysAgo); + + const backupFileName = `backup-${todayFormatted}.sql`; + const oldBackupFileName = `backup-${fifteenDaysAgoFormatted}.sql`; + + process.env.PGPASSWORD = PG_PASSWORD; + + const consoleCommand = `pg_dump -U ${PG_USER} -h localhost -d ${PG_DATABASE} > backup-${backupFileName}.sql`; + + exec(consoleCommand, (error, stdout, stderr) => { + if (process.env[ExecutionEnv.PRODUCTION] !== ExecutionEnv.PRODUCTION) { + console.log('Backup skipped: not in production environment'); + return; + } + + if (error) { + console.error(`exec error: ${error}`); + return; + } + console.log(`stdout: ${stdout}`); + console.error(`stderr: ${stderr}`); + + try { + const result = uploadToS3(backupFileName); + console.log('Backup uploaded successfully:', result); + + const deleteResult = deleteFromS3(oldBackupFileName); + console.log('Old backup deleted successfully:', deleteResult); + + fs.unlinkSync(backupFileName); + } catch (error) { + console.error(error); + } + }); + + delete process.env.PGPASSWORD; +} + +cron.schedule('0 0 */15 * *', performBackup); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 6e3d17e..af5bd3a 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -15,14 +15,18 @@ export enum EnvConfigKeys { PORT = 'PORT', CLIENT_URL = 'CLIENT_URL', DATABASE_URL = 'DATABASE_URL', + // Postgres + PG_USER = 'PG_USER', + PG_PASSWORD = 'PG_PASSWORD', + PG_DATABASE = 'PG_DATABASE', // Firebase - FIREBASE_API_KEY = 'FIREBASE_API_KEY', - FIREBASE_AUTH_DOMAIN = 'FIREBASE_AUTH_DOMAIN', - FIREBASE_PROJECT_ID = 'FIREBASE_PROJECT_ID', - FIREBASE_STORAGE_BUCKET = 'FIREBASE_STORAGE_BUCKET', - FIREBASE_MESSAGING_SENDER_ID = 'FIREBASE_MESSAGING_SENDER_ID', - FIREBASE_APP_ID = 'FIREBASE_APP_ID', FIREBASE_PRIVATE_KEY = 'FIREBASE_PRIVATE_KEY', + // Resend RESEND_API_KEY = 'RESEND_API_KEY', RESEND_EMAIL_FROM = 'RESEND_EMAIL_FROM', + // AWS + AWS_REGION = 'AWS_REGION', + AWS_ACCESS_KEY_ID = 'AWS_ACCESS_KEY_ID', + AWS_SECRET_ACCESS_KEY = 'AWS_SECRET_ACCESS_KEY', + AWS_BACKUP_BUCKET = 'AWS_BACKUP_BUCKET', }