diff --git a/ask-sdk-core/package.json b/ask-sdk-core/package.json index 23e06713..6a314d48 100644 --- a/ask-sdk-core/package.json +++ b/ask-sdk-core/package.json @@ -37,7 +37,7 @@ "devDependencies": { "@types/chai": "^4.1.2", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@types/sinon": "^7.0.13", "@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/parser": "^3.9.0", diff --git a/ask-sdk-dynamodb-persistence-adapter/lib/attributes/persistence/DynamoDbPersistenceAdapter.ts b/ask-sdk-dynamodb-persistence-adapter/lib/attributes/persistence/DynamoDbPersistenceAdapter.ts index fa3735c1..1b3cebee 100644 --- a/ask-sdk-dynamodb-persistence-adapter/lib/attributes/persistence/DynamoDbPersistenceAdapter.ts +++ b/ask-sdk-dynamodb-persistence-adapter/lib/attributes/persistence/DynamoDbPersistenceAdapter.ts @@ -16,7 +16,8 @@ import { PersistenceAdapter } from 'ask-sdk-core'; import { RequestEnvelope } from 'ask-sdk-model'; -import { DynamoDB } from 'aws-sdk'; +import { DeleteCommand, DeleteCommandInput, DynamoDBDocumentClient, GetCommand, GetCommandInput, GetCommandOutput, PutCommand, PutCommandInput } from '@aws-sdk/lib-dynamodb'; +import { CreateTableInput, DynamoDB } from '@aws-sdk/client-dynamodb'; import { PartitionKeyGenerator, PartitionKeyGenerators @@ -32,7 +33,7 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { protected createTable: boolean; protected dynamoDBClient: DynamoDB; protected partitionKeyGenerator: PartitionKeyGenerator; - protected dynamoDBDocumentClient: DynamoDB.DocumentClient; + protected dynamoDBDocumentClient: DynamoDBDocumentClient; constructor(config: { tableName: string, @@ -48,13 +49,15 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { this.createTable = config.createTable === true; this.dynamoDBClient = config.dynamoDBClient ? config.dynamoDBClient : new DynamoDB({apiVersion : 'latest'}); this.partitionKeyGenerator = config.partitionKeyGenerator ? config.partitionKeyGenerator : PartitionKeyGenerators.userId; - this.dynamoDBDocumentClient = new DynamoDB.DocumentClient({ - convertEmptyValues : true, - service : this.dynamoDBClient, + + this.dynamoDBDocumentClient = DynamoDBDocumentClient.from(this.dynamoDBClient, { + marshallOptions: { + convertEmptyValues : true, + }, }); // Create table when createTable is set to true and table does not exist if (this.createTable) { - const createTableParams: DynamoDB.CreateTableInput = { + const createTableParams: CreateTableInput = { AttributeDefinitions: [{ AttributeName: this.partitionKeyName, AttributeType: 'S', @@ -89,7 +92,7 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { public async getAttributes(requestEnvelope: RequestEnvelope): Promise<{[key: string]: any}> { const attributesId = this.partitionKeyGenerator(requestEnvelope); - const getParams: DynamoDB.DocumentClient.GetItemInput = { + const getParams: GetCommandInput = { Key : { [this.partitionKeyName] : attributesId, }, @@ -97,9 +100,9 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { ConsistentRead : true, }; - let data: DynamoDB.DocumentClient.GetItemOutput; + let data: GetCommandOutput; try { - data = await this.dynamoDBDocumentClient.get(getParams).promise(); + data = await this.dynamoDBDocumentClient.send(new GetCommand(getParams)); } catch (err) { throw createAskSdkError( this.constructor.name, @@ -123,7 +126,7 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { public async saveAttributes(requestEnvelope: RequestEnvelope, attributes: {[key: string]: any}): Promise { const attributesId = this.partitionKeyGenerator(requestEnvelope); - const putParams: DynamoDB.DocumentClient.PutItemInput = { + const putParams: PutCommandInput = { Item: { [this.partitionKeyName] : attributesId, [this.attributesName] : attributes, @@ -132,7 +135,7 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { }; try { - await this.dynamoDBDocumentClient.put(putParams).promise(); + await this.dynamoDBDocumentClient.send(new PutCommand(putParams)); } catch (err) { throw createAskSdkError( this.constructor.name, @@ -149,7 +152,7 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { public async deleteAttributes(requestEnvelope: RequestEnvelope): Promise { const attributesId = this.partitionKeyGenerator(requestEnvelope); - const deleteParams: DynamoDB.DocumentClient.DeleteItemInput = { + const deleteParams: DeleteCommandInput = { Key : { [this.partitionKeyName] : attributesId, }, @@ -157,7 +160,7 @@ export class DynamoDbPersistenceAdapter implements PersistenceAdapter { }; try { - await this.dynamoDBDocumentClient.delete(deleteParams).promise(); + await this.dynamoDBDocumentClient.send(new DeleteCommand(deleteParams)); } catch (err) { throw createAskSdkError( this.constructor.name, diff --git a/ask-sdk-dynamodb-persistence-adapter/package.json b/ask-sdk-dynamodb-persistence-adapter/package.json index e65140db..1d8964bf 100644 --- a/ask-sdk-dynamodb-persistence-adapter/package.json +++ b/ask-sdk-dynamodb-persistence-adapter/package.json @@ -1,6 +1,6 @@ { "name": "ask-sdk-dynamodb-persistence-adapter", - "version": "2.11.0", + "version": "3.0.0", "description": "DynamoDB based implementation package of PersistenceAdapter interface in ASK SDK v2 for Node.js", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -29,7 +29,8 @@ "SDK" ], "dependencies": { - "aws-sdk": "^2.163.0" + "@aws-sdk/client-dynamodb": "^3.38.0", + "@aws-sdk/lib-dynamodb": "^3.38.0" }, "peerDependencies": { "ask-sdk-core": "^2.0.0" @@ -37,7 +38,7 @@ "devDependencies": { "@types/chai": "^4.1.2", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/parser": "^3.9.0", "ask-sdk-core": "^2.11.0", diff --git a/ask-sdk-dynamodb-persistence-adapter/tsconfig.json b/ask-sdk-dynamodb-persistence-adapter/tsconfig.json index 26d9e4b1..7760b4a3 100644 --- a/ask-sdk-dynamodb-persistence-adapter/tsconfig.json +++ b/ask-sdk-dynamodb-persistence-adapter/tsconfig.json @@ -8,9 +8,15 @@ "sourceMap" : true, "alwaysStrict" : true, "declaration" : true, - "lib": [] + "lib": [ + // required for compiling @aws-sdk/* + "dom" + ] }, "include": [ "lib" + ], + "exclude": [ + "node_modules" ] } diff --git a/ask-sdk-express-adapter/package.json b/ask-sdk-express-adapter/package.json index 51b31ee5..ffbd9bc7 100644 --- a/ask-sdk-express-adapter/package.json +++ b/ask-sdk-express-adapter/package.json @@ -39,7 +39,7 @@ "@types/chai": "^4.1.2", "@types/express": "^4.16.1", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@types/node-forge": "^0.8.0", "@types/semver": "^7.3.4", "@types/sinon": "^7.0.13", diff --git a/ask-sdk-runtime/package.json b/ask-sdk-runtime/package.json index 117861fd..38323f73 100644 --- a/ask-sdk-runtime/package.json +++ b/ask-sdk-runtime/package.json @@ -27,7 +27,7 @@ "devDependencies": { "@types/chai": "^4.1.2", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@types/sinon": "^7.0.13", "@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/parser": "^3.9.0", diff --git a/ask-sdk-s3-persistence-adapter/lib/attributes/persistence/S3PersistenceAdapter.ts b/ask-sdk-s3-persistence-adapter/lib/attributes/persistence/S3PersistenceAdapter.ts index 516b1e9d..862070ea 100644 --- a/ask-sdk-s3-persistence-adapter/lib/attributes/persistence/S3PersistenceAdapter.ts +++ b/ask-sdk-s3-persistence-adapter/lib/attributes/persistence/S3PersistenceAdapter.ts @@ -16,7 +16,7 @@ import { PersistenceAdapter } from 'ask-sdk-core'; import { RequestEnvelope } from 'ask-sdk-model'; -import { S3 } from 'aws-sdk'; +import { DeleteObjectCommand, DeleteObjectCommandInput, GetObjectCommand, GetObjectCommandInput, GetObjectCommandOutput, PutObjectCommand, PutObjectCommandInput, S3 } from '@aws-sdk/client-s3'; import * as path from 'path'; import { ObjectKeyGenerator, @@ -52,15 +52,15 @@ export class S3PersistenceAdapter implements PersistenceAdapter { public async getAttributes(requestEnvelope: RequestEnvelope): Promise<{[key: string]: string}> { const objectId = path.join(this.pathPrefix, this.objectKeyGenerator(requestEnvelope)); - const getParams: S3.GetObjectRequest = { + const getParams: GetObjectCommandInput = { Bucket : this.bucketName, Key : objectId, }; - let data: S3.GetObjectOutput; + let data: GetObjectCommandOutput; try { - data = await this.s3Client.getObject(getParams).promise(); + data = await this.s3Client.send(new GetObjectCommand(getParams)); } catch (err) { if (err.code === 'NoSuchKey') { return {}; @@ -94,14 +94,14 @@ export class S3PersistenceAdapter implements PersistenceAdapter { public async saveAttributes(requestEnvelope: RequestEnvelope, attributes: {[key: string]: string}): Promise { const objectId = path.join(this.pathPrefix, this.objectKeyGenerator(requestEnvelope)); - const putParams: S3.PutObjectRequest = { + const putParams: PutObjectCommandInput = { Bucket : this.bucketName, Key : objectId, Body : JSON.stringify(attributes), }; try { - await this.s3Client.putObject(putParams).promise(); + await this.s3Client.send(new PutObjectCommand(putParams)); } catch (err) { throw createAskSdkError( this.constructor.name, @@ -113,13 +113,13 @@ export class S3PersistenceAdapter implements PersistenceAdapter { public async deleteAttributes(requestEnvelope: RequestEnvelope): Promise { const objectId = path.join(this.pathPrefix, this.objectKeyGenerator(requestEnvelope)); - const deleteParams: S3.DeleteObjectRequest = { + const deleteParams: DeleteObjectCommandInput = { Bucket : this.bucketName, Key : objectId, }; try { - await this.s3Client.deleteObject(deleteParams).promise(); + await this.s3Client.send(new DeleteObjectCommand(deleteParams)); } catch (err) { throw createAskSdkError( this.constructor.name, diff --git a/ask-sdk-s3-persistence-adapter/package.json b/ask-sdk-s3-persistence-adapter/package.json index 5878aa41..91fb3d54 100644 --- a/ask-sdk-s3-persistence-adapter/package.json +++ b/ask-sdk-s3-persistence-adapter/package.json @@ -1,6 +1,6 @@ { "name": "ask-sdk-s3-persistence-adapter", - "version": "2.11.0", + "version": "3.0.0", "description": "S3 based implementation package of PersistenceAdapter interface in ASK SDK v2 for Node.js", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -25,7 +25,7 @@ "SDK" ], "dependencies": { - "aws-sdk": "^2.163.0" + "@aws-sdk/client-s3": "^3.38.0" }, "peerDependencies": { "ask-sdk-core": "^2.0.0" @@ -33,7 +33,7 @@ "devDependencies": { "@types/chai": "^4.1.2", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/parser": "^3.9.0", "ask-sdk-core": "^2.11.0", diff --git a/ask-sdk-s3-persistence-adapter/tsconfig.json b/ask-sdk-s3-persistence-adapter/tsconfig.json index 26d9e4b1..87401f73 100644 --- a/ask-sdk-s3-persistence-adapter/tsconfig.json +++ b/ask-sdk-s3-persistence-adapter/tsconfig.json @@ -8,9 +8,10 @@ "sourceMap" : true, "alwaysStrict" : true, "declaration" : true, - "lib": [] + "lib": ["dom"] }, "include": [ "lib" - ] + ], + "exclude": ["node_modules"] } diff --git a/ask-sdk-v1adapter/package.json b/ask-sdk-v1adapter/package.json index 65227a64..5cf88a7e 100644 --- a/ask-sdk-v1adapter/package.json +++ b/ask-sdk-v1adapter/package.json @@ -39,7 +39,7 @@ "devDependencies": { "@types/chai": "^4.1.2", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@types/sinon": "^7.0.13", "@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/parser": "^3.9.0", diff --git a/ask-sdk/package.json b/ask-sdk/package.json index 64b4d888..100f9756 100644 --- a/ask-sdk/package.json +++ b/ask-sdk/package.json @@ -36,7 +36,7 @@ "devDependencies": { "@types/chai": "^4.1.2", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/parser": "^3.9.0", "chai": "^4.1.2", diff --git a/ask-smapi-sdk/package.json b/ask-smapi-sdk/package.json index 48f716f2..2b30a258 100644 --- a/ask-smapi-sdk/package.json +++ b/ask-smapi-sdk/package.json @@ -27,7 +27,7 @@ "@types/chai": "^4.1.2", "@types/jsonpath": "^0.2.0", "@types/mocha": "^5.0.0", - "@types/node": "^9.6.1", + "@types/node": "^12.0.0", "@types/sinon": "^4.3.0", "@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/parser": "^3.9.0", diff --git a/package.json b/package.json index a7bafcab..128fc866 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "private": true, "scripts": { + "postinstall": "lerna bootstrap", "lerna": "./node_modules/.bin/lerna", "setup": "lerna exec npm install", "bootstrap": "lerna bootstrap --force-local --hoist --nohoist=ts-node",