diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 24a5942..490245c 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -5,7 +5,7 @@ name: Node.js Package on: release: - types: [created] + types: [published] jobs: build: diff --git a/jest-dynamodb-config.js b/jest-dynamodb-config.js new file mode 100644 index 0000000..a18fe70 --- /dev/null +++ b/jest-dynamodb-config.js @@ -0,0 +1,61 @@ +module.exports = { + port: 5002, + options: ['-sharedDb', '-inMemory'], + tables: [ + { + TableName: 'onetable', + BillingMode: 'PAY_PER_REQUEST', + AttributeDefinitions: [ + { AttributeName: 'pk', AttributeType: 'S' }, + { AttributeName: 'sk', AttributeType: 'S' }, + { AttributeName: 'gsi1pk', AttributeType: 'S' }, + { AttributeName: 'gsi1sk', AttributeType: 'S' }, + { AttributeName: 'gsi2pk', AttributeType: 'S' }, + { AttributeName: 'gsi2sk', AttributeType: 'S' }, + { AttributeName: 'lsi1sk', AttributeType: 'S' } + ], + KeySchema: [ + { AttributeName: 'pk', KeyType: 'HASH' }, + { AttributeName: 'sk', KeyType: 'RANGE' } + ], + GlobalSecondaryIndexes: [ + { + IndexName: 'gsi1', + KeySchema: [ + { AttributeName: 'gsi1pk', KeyType: 'HASH' }, + { AttributeName: 'gsi1sk', KeyType: 'RANGE' } + ], + Projection: { + ProjectionType: 'ALL' + } + }, + { + IndexName: 'gsi2', + KeySchema: [ + { AttributeName: 'gsi2pk', KeyType: 'HASH' }, + { AttributeName: 'gsi2sk', KeyType: 'RANGE' } + ], + Projection: { + ProjectionType: 'ALL' + } + } + ], + LocalSecondaryIndexes: [ + { + IndexName: 'lsi1', + KeySchema: [ + { AttributeName: 'pk', KeyType: 'HASH' }, + { AttributeName: 'lsi1sk', KeyType: 'RANGE' } + ], + Projection: { + ProjectionType: 'ALL' + } + } + ], + StreamSpecification: { + StreamEnabled: true, + StreamViewType: 'NEW_AND_OLD_IMAGES' + } + } + ] +}; diff --git a/jest.config.js b/jest.config.js index 1d48c8e..7da5c9d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,5 @@ module.exports = { + preset: '@shelf/jest-dynamodb', testEnvironment: 'node', restoreMocks: true, clearMocks: true, diff --git a/package-lock.json b/package-lock.json index f07ad29..31cae5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "devDependencies": { "@nestjs/cli": "^10.2.1", "@nestjs/testing": "^10.2.10", + "@shelf/jest-dynamodb": "^3.4.2", "@types/jest": "^29.5.10", "jest": "^29.7.0", "ts-jest": "^29.1.1" @@ -340,6 +341,184 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/client-sso-oidc": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.379.1.tgz", + "integrity": "sha512-B6hZ2ysPyvafCMf6gls1jHI/IUviVZ4+TURpNfUBqThg/hZ1IMxc4BLkXca6VlgzYR+bWU8GKiClS9fFH6mu0g==", + "dev": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/middleware-host-header": "3.379.1", + "@aws-sdk/middleware-logger": "3.378.0", + "@aws-sdk/middleware-recursion-detection": "3.378.0", + "@aws-sdk/middleware-user-agent": "3.379.1", + "@aws-sdk/types": "3.378.0", + "@aws-sdk/util-endpoints": "3.378.0", + "@aws-sdk/util-user-agent-browser": "3.378.0", + "@aws-sdk/util-user-agent-node": "3.378.0", + "@smithy/config-resolver": "^2.0.1", + "@smithy/fetch-http-handler": "^2.0.1", + "@smithy/hash-node": "^2.0.1", + "@smithy/invalid-dependency": "^2.0.1", + "@smithy/middleware-content-length": "^2.0.1", + "@smithy/middleware-endpoint": "^2.0.1", + "@smithy/middleware-retry": "^2.0.1", + "@smithy/middleware-serde": "^2.0.1", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.1", + "@smithy/node-http-handler": "^2.0.1", + "@smithy/protocol-http": "^2.0.1", + "@smithy/smithy-client": "^2.0.1", + "@smithy/types": "^2.0.2", + "@smithy/url-parser": "^2.0.1", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.0.0", + "@smithy/util-defaults-mode-browser": "^2.0.1", + "@smithy/util-defaults-mode-node": "^2.0.1", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/middleware-host-header": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.379.1.tgz", + "integrity": "sha512-LI4KpAFWNWVr2aH2vRVblr0Y8tvDz23lj8LOmbDmCrzd5M21nxuocI/8nEAQj55LiTIf9Zs+dHCdsyegnFXdrA==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/middleware-logger": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.378.0.tgz", + "integrity": "sha512-l1DyaDLm3KeBMNMuANI3scWh8Xvu248x+vw6Z7ExWOhGXFmQ1MW7YvASg/SdxWkhlF9HmkkTif1LdMB22x6QDA==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.378.0.tgz", + "integrity": "sha512-mUMfHAz0oGNIWiTZHTVJb+I515Hqs2zx1j36Le4MMiiaMkPW1SRUF1FIwGuc1wh6E8jB5q+XfEMriDjRi4TZRA==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.379.1.tgz", + "integrity": "sha512-4zIGeAIuutcRieAvovs82uBNhJBHuxfxaAUqrKiw49xUBG7xeNVUl+DYPSpbALbEIy4ujfwWCBOOWVCt6dyUZg==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@aws-sdk/util-endpoints": "3.378.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/types": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.378.0.tgz", + "integrity": "sha512-qP0CvR/ItgktmN8YXpGQglzzR/6s0nrsQ4zIfx3HMwpsBTwuouYahcCtF1Vr82P4NFcoDA412EJahJ2pIqEd+w==", + "dev": true, + "dependencies": { + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/util-endpoints": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.378.0.tgz", + "integrity": "sha512-NU5C2l2xAXxpyB5nT0fIhahLPlJoJdzHWw4uC53KH9b4PrjHtgvgCN8beIsD3QxyfgeoM4A5J9Auo6WurfRnLw==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.378.0.tgz", + "integrity": "sha512-FSCpagzftK1W+m7Ar6lpX7/Gr9y5P56nhFYz8U4EYQ4PkufS6czWX9YW+/FA5OYV0vlQ/SvPqMnzoHIPUNhZrQ==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/types": "^2.0.2", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.378.0.tgz", + "integrity": "sha512-IdwVJV0E96MkJeFte4dlWqvB+oiqCiZ5lOlheY3W9NynTuuX0GGYNC8Y9yIsV8Oava1+ujpJq0ww6qXdYxmO4A==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/node-config-provider": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/client-sso-oidc/node_modules/@smithy/protocol-http": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-2.0.5.tgz", + "integrity": "sha512-d2hhHj34mA2V86doiDfrsy2fNTnUOowGaf9hKb0hIPHqvcnShU4/OSc4Uf1FwHkAdYF3cFXTrj5VGUYbEuvMdw==", + "dev": true, + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/client-sts": { "version": "3.428.0", "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.428.0.tgz", @@ -501,6 +680,34 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/lib-dynamodb": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/lib-dynamodb/-/lib-dynamodb-3.379.1.tgz", + "integrity": "sha512-SdHuRk9Jo0G9icW5uh36w1+RQ2U1c+dBBBVJSH7a17DzWAEsmcYYDUJ96PaA61clUgC7DI1a3jwSmgZnOszPhg==", + "dev": true, + "dependencies": { + "@aws-sdk/util-dynamodb": "3.379.1", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-dynamodb": "^3.0.0" + } + }, + "node_modules/@aws-sdk/lib-dynamodb/node_modules/@aws-sdk/util-dynamodb": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.379.1.tgz", + "integrity": "sha512-789tTjt0yd8Uf8fBr4I56dYfLysncx3NlvuNhLqdLRWBpsGvfIixNZ9OSKxDpdJ0GASXMJklmyGadvGx/vXKZg==", + "dev": true, + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/middleware-endpoint-discovery": { "version": "3.428.0", "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-endpoint-discovery/-/middleware-endpoint-discovery-3.428.0.tgz", @@ -2177,6 +2384,484 @@ "node": ">=14" } }, + "node_modules/@shelf/jest-dynamodb": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/@shelf/jest-dynamodb/-/jest-dynamodb-3.4.2.tgz", + "integrity": "sha512-XfxbyXlI+dtP/1Lr2X6qjmUAzlQReVbqEykGUJp9eRmPLG2aZhkri2lys8K5d8pZ1WSv0ZgIQbxz94o2ugZVYw==", + "dev": true, + "dependencies": { + "@aws-sdk/client-dynamodb": "3.379.1", + "@aws-sdk/lib-dynamodb": "3.379.1", + "@aws-sdk/util-dynamodb": "3.379.1", + "cwd": "0.10.0", + "debug": "4.3.4", + "dynamodb-local": "0.0.32" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/client-dynamodb": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.379.1.tgz", + "integrity": "sha512-6a1nDXkWfMgXvjHNR4rqN+ujqJDKa2WRNC+8DBKfcumsRb/f8JLz8q+K7jOOEz3i0gsaXao1tyxe+lM5Y0NfeQ==", + "dev": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.379.1", + "@aws-sdk/credential-provider-node": "3.379.1", + "@aws-sdk/middleware-endpoint-discovery": "3.379.1", + "@aws-sdk/middleware-host-header": "3.379.1", + "@aws-sdk/middleware-logger": "3.378.0", + "@aws-sdk/middleware-recursion-detection": "3.378.0", + "@aws-sdk/middleware-signing": "3.379.1", + "@aws-sdk/middleware-user-agent": "3.379.1", + "@aws-sdk/types": "3.378.0", + "@aws-sdk/util-endpoints": "3.378.0", + "@aws-sdk/util-user-agent-browser": "3.378.0", + "@aws-sdk/util-user-agent-node": "3.378.0", + "@smithy/config-resolver": "^2.0.1", + "@smithy/fetch-http-handler": "^2.0.1", + "@smithy/hash-node": "^2.0.1", + "@smithy/invalid-dependency": "^2.0.1", + "@smithy/middleware-content-length": "^2.0.1", + "@smithy/middleware-endpoint": "^2.0.1", + "@smithy/middleware-retry": "^2.0.1", + "@smithy/middleware-serde": "^2.0.1", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.1", + "@smithy/node-http-handler": "^2.0.1", + "@smithy/protocol-http": "^2.0.1", + "@smithy/smithy-client": "^2.0.1", + "@smithy/types": "^2.0.2", + "@smithy/url-parser": "^2.0.1", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.0.0", + "@smithy/util-defaults-mode-browser": "^2.0.1", + "@smithy/util-defaults-mode-node": "^2.0.1", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "@smithy/util-waiter": "^2.0.1", + "tslib": "^2.5.0", + "uuid": "^8.3.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/client-sso": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.379.1.tgz", + "integrity": "sha512-2N16TPnRcq+seNP8VY/Zq7kfnrUOrJMbVNpyDZWGe5Qglua3n8v/FzxmXFNI87MiSODq8IHtiXhggWhefCd+TA==", + "dev": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/middleware-host-header": "3.379.1", + "@aws-sdk/middleware-logger": "3.378.0", + "@aws-sdk/middleware-recursion-detection": "3.378.0", + "@aws-sdk/middleware-user-agent": "3.379.1", + "@aws-sdk/types": "3.378.0", + "@aws-sdk/util-endpoints": "3.378.0", + "@aws-sdk/util-user-agent-browser": "3.378.0", + "@aws-sdk/util-user-agent-node": "3.378.0", + "@smithy/config-resolver": "^2.0.1", + "@smithy/fetch-http-handler": "^2.0.1", + "@smithy/hash-node": "^2.0.1", + "@smithy/invalid-dependency": "^2.0.1", + "@smithy/middleware-content-length": "^2.0.1", + "@smithy/middleware-endpoint": "^2.0.1", + "@smithy/middleware-retry": "^2.0.1", + "@smithy/middleware-serde": "^2.0.1", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.1", + "@smithy/node-http-handler": "^2.0.1", + "@smithy/protocol-http": "^2.0.1", + "@smithy/smithy-client": "^2.0.1", + "@smithy/types": "^2.0.2", + "@smithy/url-parser": "^2.0.1", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.0.0", + "@smithy/util-defaults-mode-browser": "^2.0.1", + "@smithy/util-defaults-mode-node": "^2.0.1", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/client-sts": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.379.1.tgz", + "integrity": "sha512-gEnKuk9bYjThvmxCgOgCn1qa+rRX8IgIRE2+xhbWhlpDanozhkDq9aMB5moX4tBNYQEmi1LtGD+JOvOoZRnToQ==", + "dev": true, + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/credential-provider-node": "3.379.1", + "@aws-sdk/middleware-host-header": "3.379.1", + "@aws-sdk/middleware-logger": "3.378.0", + "@aws-sdk/middleware-recursion-detection": "3.378.0", + "@aws-sdk/middleware-sdk-sts": "3.379.1", + "@aws-sdk/middleware-signing": "3.379.1", + "@aws-sdk/middleware-user-agent": "3.379.1", + "@aws-sdk/types": "3.378.0", + "@aws-sdk/util-endpoints": "3.378.0", + "@aws-sdk/util-user-agent-browser": "3.378.0", + "@aws-sdk/util-user-agent-node": "3.378.0", + "@smithy/config-resolver": "^2.0.1", + "@smithy/fetch-http-handler": "^2.0.1", + "@smithy/hash-node": "^2.0.1", + "@smithy/invalid-dependency": "^2.0.1", + "@smithy/middleware-content-length": "^2.0.1", + "@smithy/middleware-endpoint": "^2.0.1", + "@smithy/middleware-retry": "^2.0.1", + "@smithy/middleware-serde": "^2.0.1", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.1", + "@smithy/node-http-handler": "^2.0.1", + "@smithy/protocol-http": "^2.0.1", + "@smithy/smithy-client": "^2.0.1", + "@smithy/types": "^2.0.2", + "@smithy/url-parser": "^2.0.1", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.0.0", + "@smithy/util-defaults-mode-browser": "^2.0.1", + "@smithy/util-defaults-mode-node": "^2.0.1", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "fast-xml-parser": "4.2.5", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/credential-provider-env": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.378.0.tgz", + "integrity": "sha512-B2OVdO9kBClDwGgWTBLAQwFV8qYTYGyVujg++1FZFSFMt8ORFdZ5fNpErvJtiSjYiOOQMzyBeSNhKyYNXCiJjQ==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.379.1.tgz", + "integrity": "sha512-YhEsJIskzCFwIIKiMN9GSHQkgWwj/b7rq0ofhsXsCRimFtdVkmMlB9veE6vtFAuXpX/WOGWdlWek1az0V22uuw==", + "dev": true, + "dependencies": { + "@aws-sdk/credential-provider-env": "3.378.0", + "@aws-sdk/credential-provider-process": "3.378.0", + "@aws-sdk/credential-provider-sso": "3.379.1", + "@aws-sdk/credential-provider-web-identity": "3.378.0", + "@aws-sdk/types": "3.378.0", + "@smithy/credential-provider-imds": "^2.0.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/credential-provider-node": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.379.1.tgz", + "integrity": "sha512-39Y4OHKn6a8lY8YJhSLLw08aZytWxfvSjM4ObIEnE6hjLl8gsL9vROKKITsh3q6iGQ1EDSWMWZL50aOh3LJUIg==", + "dev": true, + "dependencies": { + "@aws-sdk/credential-provider-env": "3.378.0", + "@aws-sdk/credential-provider-ini": "3.379.1", + "@aws-sdk/credential-provider-process": "3.378.0", + "@aws-sdk/credential-provider-sso": "3.379.1", + "@aws-sdk/credential-provider-web-identity": "3.378.0", + "@aws-sdk/types": "3.378.0", + "@smithy/credential-provider-imds": "^2.0.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/credential-provider-process": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.378.0.tgz", + "integrity": "sha512-KFTIy7u+wXj3eDua4rgS0tODzMnXtXhAm1RxzCW9FL5JLBBrd82ymCj1Dp72217Sw5Do6NjCnDTTNkCHZMA77w==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.379.1.tgz", + "integrity": "sha512-PhGtu1+JbUntYP/5CSfazQhWsjUBiksEuhg9fLhYl5OAgZVjVygbgoNVUz/gM7gZJSEMsasTazkn7yZVzO/k7w==", + "dev": true, + "dependencies": { + "@aws-sdk/client-sso": "3.379.1", + "@aws-sdk/token-providers": "3.379.1", + "@aws-sdk/types": "3.378.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.378.0.tgz", + "integrity": "sha512-GWjydOszhc4xDF8xuPtBvboglXQr0gwCW1oHAvmLcOT38+Hd6qnKywnMSeoXYRPgoKfF9TkWQgW1jxplzCG0UA==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/middleware-endpoint-discovery": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-endpoint-discovery/-/middleware-endpoint-discovery-3.379.1.tgz", + "integrity": "sha512-HpFF3Nb9csmg/j/trs4OhrQvthKFVz9lKkarGzxwYzaMqZ/xqFyPScJlZ41VgIkP+iP48IZVxAzLL/rsmsi/jA==", + "dev": true, + "dependencies": { + "@aws-sdk/endpoint-cache": "3.310.0", + "@aws-sdk/types": "3.378.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/middleware-host-header": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.379.1.tgz", + "integrity": "sha512-LI4KpAFWNWVr2aH2vRVblr0Y8tvDz23lj8LOmbDmCrzd5M21nxuocI/8nEAQj55LiTIf9Zs+dHCdsyegnFXdrA==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/middleware-logger": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.378.0.tgz", + "integrity": "sha512-l1DyaDLm3KeBMNMuANI3scWh8Xvu248x+vw6Z7ExWOhGXFmQ1MW7YvASg/SdxWkhlF9HmkkTif1LdMB22x6QDA==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.378.0.tgz", + "integrity": "sha512-mUMfHAz0oGNIWiTZHTVJb+I515Hqs2zx1j36Le4MMiiaMkPW1SRUF1FIwGuc1wh6E8jB5q+XfEMriDjRi4TZRA==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/middleware-sdk-sts": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sts/-/middleware-sdk-sts-3.379.1.tgz", + "integrity": "sha512-SK3gSyT0XbLiY12+AjLFYL9YngxOXHnZF3Z33Cdd4a+AUYrVBV7JBEEGD1Nlwrcmko+3XgaKlmgUaR5s91MYvg==", + "dev": true, + "dependencies": { + "@aws-sdk/middleware-signing": "3.379.1", + "@aws-sdk/types": "3.378.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/middleware-signing": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.379.1.tgz", + "integrity": "sha512-kBk2ZUvR84EM4fICjr8K+Ykpf8SI1UzzPp2/UVYZ0X+4H/ZCjfSqohGRwHykMqeplne9qHSL7/rGJs1H3l3gPg==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/signature-v4": "^2.0.0", + "@smithy/types": "^2.0.2", + "@smithy/util-middleware": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.379.1.tgz", + "integrity": "sha512-4zIGeAIuutcRieAvovs82uBNhJBHuxfxaAUqrKiw49xUBG7xeNVUl+DYPSpbALbEIy4ujfwWCBOOWVCt6dyUZg==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@aws-sdk/util-endpoints": "3.378.0", + "@smithy/protocol-http": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/token-providers": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.379.1.tgz", + "integrity": "sha512-NlYPkArJ7A/txCrjqqkje+4hsv7pSOqm+Qdx3BUIOc7PRYrBVs/XwThxUkGceSntVXoNlO8g9DFL0NY53/wb8Q==", + "dev": true, + "dependencies": { + "@aws-sdk/client-sso-oidc": "3.379.1", + "@aws-sdk/types": "3.378.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/types": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.378.0.tgz", + "integrity": "sha512-qP0CvR/ItgktmN8YXpGQglzzR/6s0nrsQ4zIfx3HMwpsBTwuouYahcCtF1Vr82P4NFcoDA412EJahJ2pIqEd+w==", + "dev": true, + "dependencies": { + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/util-dynamodb": { + "version": "3.379.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.379.1.tgz", + "integrity": "sha512-789tTjt0yd8Uf8fBr4I56dYfLysncx3NlvuNhLqdLRWBpsGvfIixNZ9OSKxDpdJ0GASXMJklmyGadvGx/vXKZg==", + "dev": true, + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/util-endpoints": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.378.0.tgz", + "integrity": "sha512-NU5C2l2xAXxpyB5nT0fIhahLPlJoJdzHWw4uC53KH9b4PrjHtgvgCN8beIsD3QxyfgeoM4A5J9Auo6WurfRnLw==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.378.0.tgz", + "integrity": "sha512-FSCpagzftK1W+m7Ar6lpX7/Gr9y5P56nhFYz8U4EYQ4PkufS6czWX9YW+/FA5OYV0vlQ/SvPqMnzoHIPUNhZrQ==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/types": "^2.0.2", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.378.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.378.0.tgz", + "integrity": "sha512-IdwVJV0E96MkJeFte4dlWqvB+oiqCiZ5lOlheY3W9NynTuuX0GGYNC8Y9yIsV8Oava1+ujpJq0ww6qXdYxmO4A==", + "dev": true, + "dependencies": { + "@aws-sdk/types": "3.378.0", + "@smithy/node-config-provider": "^2.0.1", + "@smithy/types": "^2.0.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@shelf/jest-dynamodb/node_modules/@smithy/protocol-http": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-2.0.5.tgz", + "integrity": "sha512-d2hhHj34mA2V86doiDfrsy2fNTnUOowGaf9hKb0hIPHqvcnShU4/OSc4Uf1FwHkAdYF3cFXTrj5VGUYbEuvMdw==", + "dev": true, + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -3474,6 +4159,12 @@ "fsevents": "~2.3.2" } }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, "node_modules/chrome-trace-event": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", @@ -3760,6 +4451,19 @@ "@aws-sdk/util-dynamodb": "^3.405.0" } }, + "node_modules/cwd": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/cwd/-/cwd-0.10.0.tgz", + "integrity": "sha512-YGZxdTTL9lmLkCUTpg4j0zQ7IhRB5ZmqNBbGCl3Tg6MP/d5/6sY7L5mmTjzbc6JKgVZYiqTQTNhPFsbXNGlRaA==", + "dev": true, + "dependencies": { + "find-pkg": "^0.1.2", + "fs-exists-sync": "^0.1.0" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3830,6 +4534,31 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dynamodb-local": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/dynamodb-local/-/dynamodb-local-0.0.32.tgz", + "integrity": "sha512-JvZYSkOJ4S1DaXtFuvP1AonWCD6EAZ/ttmsOS+eQJBQ4yE0s1/kbHIghYeRVV+arJDCr202cUqhOYD6hTBfHXA==", + "dev": true, + "dependencies": { + "debug": "~4.1.0", + "mkdirp": "~0.5.0", + "q": "~1.4.1", + "tar": "^4.4.19" + }, + "engines": { + "node": ">= 0.10.33" + } + }, + "node_modules/dynamodb-local/node_modules/debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, "node_modules/dynamodb-onetable": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/dynamodb-onetable/-/dynamodb-onetable-2.7.1.tgz", @@ -4026,6 +4755,18 @@ "node": ">= 0.8.0" } }, + "node_modules/expand-tilde": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-1.2.2.tgz", + "integrity": "sha512-rtmc+cjLZqnu9dSYosX9EWmSJhTwpACgJQTfj4hgg2JjOD/6SIQalZrt4a3aQeh++oNxkazcaxrhPUj6+g5G/Q==", + "dev": true, + "dependencies": { + "os-homedir": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/expect": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", @@ -4130,6 +4871,31 @@ "node": ">=8" } }, + "node_modules/find-file-up": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/find-file-up/-/find-file-up-0.1.3.tgz", + "integrity": "sha512-mBxmNbVyjg1LQIIpgO8hN+ybWBgDQK8qjht+EbrTCGmmPV/sc7RF1i9stPTD6bpvXZywBdrwRYxhSdJv867L6A==", + "dev": true, + "dependencies": { + "fs-exists-sync": "^0.1.0", + "resolve-dir": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/find-pkg": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/find-pkg/-/find-pkg-0.1.2.tgz", + "integrity": "sha512-0rnQWcFwZr7eO0513HahrWafsc3CTFioEB7DRiEYCUM/70QXSY8f3mCST17HXLcPvEhzH/Ty/Bxd72ZZsr/yvw==", + "dev": true, + "dependencies": { + "find-file-up": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -4199,6 +4965,15 @@ "webpack": "^5.11.0" } }, + "node_modules/fs-exists-sync": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", + "integrity": "sha512-cR/vflFyPZtrN6b38ZyWxpWdhlXrzZEBawlpBQMq7033xVY7/kg0GDMBK5jg8lDYQckdJ5x/YC88lM3C7VMsLg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -4213,6 +4988,25 @@ "node": ">=12" } }, + "node_modules/fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "dev": true, + "dependencies": { + "minipass": "^2.6.0" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, "node_modules/fs-monkey": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.5.tgz", @@ -4322,6 +5116,46 @@ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dev": true }, + "node_modules/global-modules": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", + "integrity": "sha512-JeXuCbvYzYXcwE6acL9V2bAOeSIGl4dD+iwLY9iUx2VBJJ80R18HCn+JCwHM9Oegdfya3lEkGCdaRkSyc10hDA==", + "dev": true, + "dependencies": { + "global-prefix": "^0.1.4", + "is-windows": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", + "integrity": "sha512-gOPiyxcD9dJGCEArAhF4Hd0BAqvAe/JzERP7tYumE4yIkmIedPUVXcJFWbV3/p/ovIIvKjkrTk+f1UVkq7vvbw==", + "dev": true, + "dependencies": { + "homedir-polyfill": "^1.0.0", + "ini": "^1.3.4", + "is-windows": "^0.2.0", + "which": "^1.2.12" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -4366,6 +5200,18 @@ "node": ">=8" } }, + "node_modules/homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "dependencies": { + "parse-passwd": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -4473,6 +5319,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, "node_modules/inquirer": { "version": "8.2.6", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.6.tgz", @@ -4619,6 +5471,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha512-n67eJYmXbniZB7RF4I/FTjK1s6RPOCTxhYrVYLRaCt3lF0mpWZPKr3T2LSZAqyjQsxR2qMmGYXXzK0YWwcPM1Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -5609,6 +6470,37 @@ "node": ">=8" } }, + "node_modules/minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "dev": true, + "dependencies": { + "minipass": "^2.9.0" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, "node_modules/mnemonist": { "version": "0.38.3", "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.3.tgz", @@ -5760,6 +6652,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/os-name": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.1.tgz", @@ -5866,6 +6767,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -6069,6 +6979,16 @@ } ] }, + "node_modules/q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha512-/CdEdaw49VZVmyIDGUQKDDT53c7qBkO6g5CefWz91Ae+l4+cRtcDYwMTXh6me4O8TMldeGHG3N2Bl84V78Ywbg==", + "dev": true, + "engines": { + "node": ">=0.6.0", + "teleport": ">=0.2.0" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -6193,6 +7113,19 @@ "node": ">=8" } }, + "node_modules/resolve-dir": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", + "integrity": "sha512-QxMPqI6le2u0dCLyiGzgy92kjkkL6zO0XyvHzjdTNH3zM6e5Hz3BwG6+aEyNgiQ5Xz6PwTwgQEj3U50dByPKIA==", + "dev": true, + "dependencies": { + "expand-tilde": "^1.2.2", + "global-modules": "^0.2.3" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -6684,6 +7617,34 @@ "node": ">=6" } }, + "node_modules/tar": { + "version": "4.4.19", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", + "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", + "dev": true, + "dependencies": { + "chownr": "^1.1.4", + "fs-minipass": "^1.2.7", + "minipass": "^2.9.0", + "minizlib": "^1.3.3", + "mkdirp": "^0.5.5", + "safe-buffer": "^5.2.1", + "yallist": "^3.1.1" + }, + "engines": { + "node": ">=4.5" + } + }, + "node_modules/tar/node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, "node_modules/terser": { "version": "5.24.0", "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz", diff --git a/package.json b/package.json index 525f361..4e4a5a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nest-onetable", - "version": "0.0.4", + "version": "0.0.5", "private": false, "license": "MIT", "repository": { @@ -19,7 +19,7 @@ "scripts": { "build": "tsc --project tsconfig-build.json", "prebuild": "npx rimraf dist", - "prepublish": "npm run build", + "prepublishOnly": "npm run build", "lint": "eslint \"{src}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", @@ -37,6 +37,7 @@ "devDependencies": { "@nestjs/cli": "^10.2.1", "@nestjs/testing": "^10.2.10", + "@shelf/jest-dynamodb": "^3.4.2", "@types/jest": "^29.5.10", "jest": "^29.7.0", "ts-jest": "^29.1.1" diff --git a/src/decorators.ts b/src/decorators.ts index b920acb..593b7b9 100644 --- a/src/decorators.ts +++ b/src/decorators.ts @@ -7,12 +7,11 @@ export const tableSymbol = Symbol('OneTable:Table'); export const OneTable = () => Inject(tableSymbol); -export function OneModel(name: string, fields: T, timestamps?: boolean | string) { - class OneTableModel extends Model> { - public readonly fields: T; +export function OneModel>(name: string, fields: T, timestamps?: boolean | string) { + class OneTableModel extends Model { + public static readonly fields: T = fields; constructor(@OneTable() table: Table) { super(table, name, { fields, timestamps }); - this.fields = fields; } } diff --git a/src/onetable.spec.ts b/src/onetable.spec.ts index acc9a9d..e90ee54 100644 --- a/src/onetable.spec.ts +++ b/src/onetable.spec.ts @@ -1,29 +1,47 @@ import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { Injectable } from '@nestjs/common'; import { Test } from '@nestjs/testing'; +import { Entity } from 'dynamodb-onetable'; +import { EntityParametersForCreate } from 'dynamodb-onetable/dist/cjs/Model'; import { OneModel, OnetableModule } from './index'; @Injectable() export class OneModelX extends OneModel('OneModelX', { - pk: { type: String, value: '${id}', hidden: true }, - sk: { type: String, value: 'latest', hidden: true }, - id: { type: String, value: '${id}', required: true } + pk: { type: String, value: 'ModelX#', hidden: true }, + sk: { type: String, value: 'ModelX#${id}', hidden: true }, + id: { type: String, generate: 'ulid' }, + name: { type: String, required: true }, + description: { type: String, required: false } }) {} +type TypeOfModelX = typeof OneModelX.fields; +type ModelX = Entity + @Injectable() class Service { constructor(public readonly model: OneModelX) { } + + async create(props: EntityParametersForCreate): Promise { + return await this.model.create(props); + } } describe('OneTable', () => { - it('should instantiate custom models', async () => { - const module = await Test.createTestingModule({ + async function setup() { + return await Test.createTestingModule({ imports: [ OnetableModule.register({ global: false, - client: jest.mocked(DynamoDBClient), - name: 'test:table:name', + client: new DynamoDBClient({ + endpoint: 'http://localhost:5002', + region: 'local', + credentials: { + accessKeyId: 'fake', + secretAccessKey: 'fake' + } + }), + name: 'onetable', partial: true, schema: { format: 'onetable:1.1.0', @@ -39,8 +57,21 @@ describe('OneTable', () => { }) .compile() .then(app => app.init()); + } + + + it('should instantiate custom models', async () => { + const module = await setup(); + const service = module.get(Service); + expect(service.model).toBeDefined(); + }); + + it('should validate types', async () => { + const module = await setup(); + const service = module.get(Service); - const node = module.get(Service); - expect(node.model).toBeDefined(); + const result = await service.create({ name: 'one and only one table' }); + expect(result.id).toHaveLength(26); // ulid + expect(result.name).toBe('one and only one table'); }); -}); +}); \ No newline at end of file