ask-sdk-local-debug
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -22,3 +22,6 @@ module.exports = { | ||
// --------------------------------------------------------- | ||
"class-methods-use-this": ["error", { "exceptMethods": ["errorEvent", "connectedEvent"] }], | ||
"class-methods-use-this": [ | ||
"error", | ||
{ exceptMethods: ["errorEvent", "connectedEvent"] }, | ||
], | ||
"no-unused-vars": "off", // because it flags types that are imported for type declarations (but otherwise unused). | ||
@@ -50,10 +53,11 @@ "no-undef": "off", // because if flags lack of import for Set. // TODO: fix the issues and remove this override. | ||
{ | ||
"js": "never", | ||
"jsx": "never", | ||
"ts": "never", | ||
"tsx": "never" | ||
} | ||
js: "never", | ||
jsx: "never", | ||
ts: "never", | ||
tsx: "never", | ||
}, | ||
], | ||
"import/no-cycle": "off", | ||
"import/no-default-export": "error", | ||
"import/no-dynamic-require": "off", | ||
"import/no-extraneous-dependencies": ["off", { devDependencies: false }], | ||
@@ -66,2 +70,3 @@ "import/prefer-default-export": "off", | ||
"no-caller": "error", | ||
"no-console": "off", | ||
"no-duplicate-imports": "error", | ||
@@ -76,5 +81,9 @@ "no-eval": "error", | ||
"no-undef-init": "error", | ||
"no-underscore-dangle": ["error", { | ||
"allowAfterThis": true | ||
}], | ||
"no-underscore-dangle": [ | ||
"error", | ||
{ | ||
allowAfterThis: true, | ||
}, | ||
], | ||
"global-require": 0, | ||
"no-var": "error", | ||
@@ -133,2 +142,3 @@ "object-shorthand": "error", | ||
"@typescript-eslint/no-unused-expressions": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
@@ -135,0 +145,0 @@ "@typescript-eslint/no-var-requires": "error", |
# Change Log | ||
# 1.1.0 (2020-11-10) | ||
This release contains the following changes : | ||
- Adding support for EU and FE. | ||
# 1.0.0 (2020-07-21) | ||
@@ -4,0 +10,0 @@ |
@@ -34,2 +34,6 @@ "use strict"; | ||
} | ||
withRegion(region) { | ||
this._region = region; | ||
return this; | ||
} | ||
get skillEntryFile() { | ||
@@ -47,2 +51,5 @@ return this._skillEntryFile; | ||
} | ||
get region() { | ||
return this._region; | ||
} | ||
build() { | ||
@@ -49,0 +56,0 @@ return new ClientConfig_1.ClientConfig(this); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WebSocketClientConfigBuilder = void 0; | ||
/* | ||
@@ -14,10 +16,13 @@ * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WebSocketClientConfigBuilder = void 0; | ||
const WebSocketClientConfig_1 = require("../config/WebSocketClientConfig"); | ||
const Constants_1 = require("../constants/Constants"); | ||
class WebSocketClientConfigBuilder { | ||
withSkillId(skillId) { | ||
this._webSocketServerUri = `wss://bob-dispatch-prod-na.amazon.com/v1/skills/${skillId}/stages/development/connectCustomDebugEndpoint`; | ||
this._skillId = skillId; | ||
return this; | ||
} | ||
withRegion(region) { | ||
this._region = region; | ||
return this; | ||
} | ||
withAccessToken(accessToken) { | ||
@@ -28,3 +33,4 @@ this._headers = { authorization: accessToken }; | ||
get webSocketServerUri() { | ||
return this._webSocketServerUri; | ||
console.log(`Region chosen: ${this._region}`); | ||
return `wss://${Constants_1.RegionEndpointMapping.get(this._region)}/v1/skills/${this._skillId}/stages/development/connectCustomDebugEndpoint`; | ||
} | ||
@@ -31,0 +37,0 @@ get headers() { |
@@ -44,4 +44,3 @@ "use strict"; | ||
connectedEvent() { | ||
console.log('*****Starting Skill Debug Session in NA region*****', '\n'); | ||
console.log('*****NOTE: Skill debugging is currently only available for invocations from customer in North America region (https://developer.amazon.com/en-US/docs/alexa/custom-skills/develop-skills-in-multiple-languages.html#h2-multiple-endpoints)*****', '\n'); | ||
console.log('*****Starting Skill Debug Session*****', '\n'); | ||
console.log('*****Session will last for 1 hour*****', '\n'); | ||
@@ -48,0 +47,0 @@ } |
@@ -22,2 +22,3 @@ "use strict"; | ||
this._skillId = clientConfigBuilder.skillId; | ||
this._region = clientConfigBuilder.region; | ||
} | ||
@@ -36,4 +37,7 @@ get skillEntryFile() { | ||
} | ||
get region() { | ||
return this._region; | ||
} | ||
} | ||
exports.ClientConfig = ClientConfig; | ||
//# sourceMappingURL=ClientConfig.js.map |
@@ -30,6 +30,6 @@ "use strict"; | ||
.withSkillId(argv.skillId) | ||
.withRegion(argv.region) | ||
.build(); | ||
const skillInvokerConfig = new SkillInvokerConfigBuilder_1.SkillInvokerConfigBuilder() | ||
// eslint-disable-next-line import/no-dynamic-require | ||
.withHandler(require(clientConfig.skillEntryFile)[clientConfig.handlerName]) | ||
.withHandler(ArgsParserUtils_1.getHandlerFunction(clientConfig.skillEntryFile, clientConfig.handlerName)) | ||
.build(); | ||
@@ -39,2 +39,3 @@ const webSocketClientConfig = new WebSocketClientConfigBuilder_1.WebSocketClientConfigBuilder() | ||
.withAccessToken(clientConfig.accessToken) | ||
.withRegion(clientConfig.region) | ||
.build(); | ||
@@ -41,0 +42,0 @@ const webSocketClient = new ws_1.default(webSocketClientConfig.webSocketServerUri, { |
@@ -15,5 +15,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.argsParser = void 0; | ||
exports.getHandlerFunction = exports.argsParser = void 0; | ||
const yargs_1 = require("yargs"); | ||
const fs_1 = require("fs"); | ||
const ask_sdk_core_1 = require("ask-sdk-core"); | ||
const Constants_1 = require("../constants/Constants"); | ||
function argsParser() { | ||
@@ -23,3 +25,3 @@ return yargs_1.option({ | ||
type: 'string', | ||
description: 'Access Token', | ||
description: 'Access Token of the profile being used to debug skill.', | ||
demandOption: true, | ||
@@ -30,3 +32,3 @@ requiresArg: true, | ||
type: 'string', | ||
description: 'Skill id', | ||
description: 'Skill id of the skill being debugged.', | ||
demandOption: true, | ||
@@ -37,3 +39,3 @@ requiresArg: true, | ||
type: 'string', | ||
description: 'Handler method to invoke in your skillEntryFile', | ||
description: 'Name of the handler function that will be invoked to run the skill code.', | ||
demandOption: true, | ||
@@ -44,6 +46,10 @@ requiresArg: true, | ||
type: 'string', | ||
description: 'Skill entry file', | ||
description: 'Path of the file in the skill code package where the handler function is located.', | ||
demandOption: true, | ||
requiresArg: true, | ||
}, | ||
region: { | ||
type: 'string', | ||
description: 'Region of the developer account. TODO:: dev documentation link.', | ||
}, | ||
}) | ||
@@ -81,5 +87,23 @@ .check((argv) => { | ||
return true; | ||
}); | ||
}) | ||
.check((argv) => { | ||
if (argv.region != null && !Constants_1.RegionEndpointMapping.has(argv.region)) { | ||
const errorMessage = `Invalid region - ${argv.region}. Please ensure that the region value is one of - ${Constants_1.RegionEndpointMapping.keySeq().toArray()}`; | ||
console.error(errorMessage); | ||
return false; | ||
} | ||
return true; | ||
}) | ||
.default('region', Constants_1.DefaultRegion, 'The region will default to NA(North America).'); | ||
} | ||
exports.argsParser = argsParser; | ||
function getHandlerFunction(skillEntryFile, handlerName) { | ||
const handlerFunction = require(skillEntryFile)[handlerName]; | ||
if (typeof handlerFunction !== 'function') { | ||
const errorMessage = `Handler function does not exist. Make sure that the skill entry file path:${skillEntryFile} and the handler name:${handlerName} are correct.`; | ||
throw ask_sdk_core_1.createAskSdkError('LocalDebug.ArgsParse', errorMessage); | ||
} | ||
return handlerFunction; | ||
} | ||
exports.getHandlerFunction = getHandlerFunction; | ||
//# sourceMappingURL=ArgsParserUtils.js.map |
{ | ||
"name": "ask-sdk-local-debug", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Local debug package for Alexa Skills Kit SDK", | ||
@@ -11,10 +11,4 @@ "main": "dist/client/WebSocketClient.js", | ||
"compile": "tsc", | ||
"mkdir": "mkdir -p build/lib/commonjs/ask-sdk-local-debug", | ||
"copy-pkg": "cp package.json build/lib/commonjs/ask-sdk-local-debug/", | ||
"copy-dist": "cp -r dist build/lib/commonjs/ask-sdk-local-debug/", | ||
"copy-src": "cp -r lib build/lib/commonjs/ask-sdk-local-debug/", | ||
"copy-tst": "cp -r tst build/lib/commonjs/ask-sdk-local-debug/", | ||
"copy": "npm run mkdir && npm run copy-pkg && npm run copy-src && npm run copy-dist", | ||
"cleanup": "rm -rf dist", | ||
"start": "npm run lint && npm run cleanup && npm run compile && npm run copy", | ||
"start": "npm run lint && npm run cleanup && npm run compile", | ||
"release": "npm run start", | ||
@@ -31,4 +25,2 @@ "pack": "npm run release && npm pack" | ||
"@typescript-eslint/parser": "^2.34.0", | ||
"ask-sdk-model": "^1.28.1", | ||
"ask-sdk-core": "^2.8.0", | ||
"eslint-config-airbnb": "^18.2.0", | ||
@@ -51,4 +43,7 @@ "eslint-import-resolver-typescript": "^2.0.0", | ||
"ws": "^7.3.0", | ||
"yargs": "^15.3.1" | ||
"yargs": "^15.3.1", | ||
"immutable": "^4.0.0-rc.11", | ||
"ask-sdk-model": "^1.29.0", | ||
"ask-sdk-core": "^2.8.0" | ||
} | ||
} |
@@ -13,5 +13,4 @@ # ASK SDK Local Debug (Node.js) | ||
``` | ||
`npm install --save ask-sdk-model@^1.29.0 | ||
``npm install --save-dev ask-sdk-local-debug | ||
` | ||
npm install --save ask-sdk-model@^1.29.0 | ||
npm install --save-dev ask-sdk-local-debug | ||
``` | ||
@@ -34,5 +33,6 @@ | ||
--accessToken <ACCESS_TOKEN> | ||
--skillID <SKILL_ID> | ||
--skillId <SKILL_ID> | ||
--skillEntryFile <FILE_NAME> | ||
--handlerName <HANDLER_NAME> | ||
--region <REGION> # Optional argument. Region defaults to NA. | ||
``` | ||
@@ -47,3 +47,4 @@ 1. ACCESS_TOKEN: | ||
3. FILE_NAME: The path to your skill code's main file (typically `index.js`). This file or module contains the skill's handler function. | ||
4. HANDLER_NAME: The exported handler method (typically `handler`). For example, please see the [Hello world example](https://github.com/alexa/skill-sample-nodejs-hello-world/blob/master/lambda/custom/index.js#L159). | ||
4. HANDLER_NAME: The exported handler method (typically `handler`). For example, please see the [Hello world example](https://github.com/alexa/skill-sample-nodejs-hello-world/blob/master/lambda/custom/index.js#L159). | ||
5. REGION: The region of the developer account. The accepted values are NA(North America), FE(Far East), EU(Europe). Defaults to NA. Instructions on finding out your region can be found [here](https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/vs-code-testing-simulator.html#test). | ||
3. Configure your preferred IDE or other debugging tool to attach to the above process or execute directly from your preferred IDE. For example, in VS Code, this would be included in the `launch.json`: | ||
@@ -60,3 +61,4 @@ ``` | ||
"--skillEntryFile", "<FILE_NAME>", | ||
"--handlerName" , "<HANDLER_NAME>" | ||
"--handlerName" , "<HANDLER_NAME>", | ||
"--region", "<REGION>" # Optional argument. Region defaults to NA. | ||
] | ||
@@ -63,0 +65,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
57222
19
33
713
78
5
+ Addedask-sdk-core@^2.8.0
+ Addedask-sdk-model@^1.29.0
+ Addedimmutable@^4.0.0-rc.11
+ Addedask-sdk-core@2.14.0(transitive)
+ Addedask-sdk-model@1.86.0(transitive)
+ Addedask-sdk-runtime@2.14.0(transitive)
+ Addedimmutable@4.3.7(transitive)