Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ask-sdk-runtime

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ask-sdk-runtime - npm Package Compare versions

Comparing version 2.8.0 to 2.10.0

dist/util/UserAgentManager.d.ts

22

CHANGELOG.md

@@ -6,2 +6,24 @@ # Change Log

# [2.10.0](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/compare/v2.9.0...v2.10.0) (2020-10-08)
### Bug Fixes
* Addded new line at end of tsconfig.json files ([d94a1c6](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/d94a1c656484ca067d82411269283e5d1370d535))
* fix the github action workflow and compilation making relative require fail issue ([#658](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/658)) ([895c88e](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/895c88e8bd875488a62966680a3d9d8eb2bcd9ea))
* update rootDir to point to the right root dir in tsconfig file in tst ([66ca284](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/66ca284e13ed1dc881a13d69a399035eb4725e28))
* Updated all packages .npmignore files ([de76a18](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/de76a18bcd21c6a411ddd72a09064e6d8b00c6ae))
* Updated all packages package.json ([#656](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/656)) ([c27c3e6](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/c27c3e6842834d0fea365613da7f3598955b558f))
### Features
* add UserAgentManager ([bc03b55](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/bc03b554e072f0ea1feffa90fa2486dcbdfcc9db))
* eslint migration and fixes, git workflows and updates on package.json for ask-sdk-runtime ([7265239](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/7265239581fe7aa0654f5b095f86482a60499b0a))
* Update root package.json to fix doc generation ([4bf482b](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/commit/4bf482bb889fc9b93ad8d0afe8725862c5690f24))
# [2.8.0](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/compare/v2.7.0...v2.8.0) (2020-04-01)

@@ -8,0 +30,0 @@

77

dist/dispatcher/error/mapper/GenericErrorMapper.js

@@ -14,74 +14,21 @@ "use strict";

*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenericErrorMapper = void 0;
/**
* Generic implementation of @{link ErrorMapper}
*/
var GenericErrorMapper = /** @class */ (function () {
function GenericErrorMapper(options) {
class GenericErrorMapper {
constructor(options) {
this.errorHandlers = options.errorHandlers;
}
GenericErrorMapper.prototype.getErrorHandler = function (handlerInput, error) {
return __awaiter(this, void 0, void 0, function () {
var _i, _a, errorHandler;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_i = 0, _a = this.errorHandlers;
_b.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
errorHandler = _a[_i];
return [4 /*yield*/, errorHandler.canHandle(handlerInput, error)];
case 2:
if (_b.sent()) {
return [2 /*return*/, errorHandler];
}
_b.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/, null];
}
});
});
};
return GenericErrorMapper;
}());
async getErrorHandler(handlerInput, error) {
for (const errorHandler of this.errorHandlers) {
if (await errorHandler.canHandle(handlerInput, error)) {
return errorHandler;
}
}
return null;
}
}
exports.GenericErrorMapper = GenericErrorMapper;
//# sourceMappingURL=GenericErrorMapper.js.map

@@ -14,40 +14,5 @@ "use strict";

*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var AskSdkUtils_1 = require("../util/AskSdkUtils");
exports.GenericRequestDispatcher = void 0;
const AskSdkUtils_1 = require("../util/AskSdkUtils");
/**

@@ -58,4 +23,4 @@ * Generic implementation of {@link RequestDispatcher}.

*/
var GenericRequestDispatcher = /** @class */ (function () {
function GenericRequestDispatcher(options) {
class GenericRequestDispatcher {
constructor(options) {
this.requestMappers = options.requestMappers;

@@ -72,51 +37,25 @@ this.handlerAdapters = options.handlerAdapters;

*/
GenericRequestDispatcher.prototype.dispatch = function (input) {
return __awaiter(this, void 0, void 0, function () {
var output, _i, _a, requestInterceptor, _b, _c, responseInterceptor, err_1;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_d.trys.push([0, 10, , 12]);
if (!this.requestInterceptors) return [3 /*break*/, 4];
_i = 0, _a = this.requestInterceptors;
_d.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
requestInterceptor = _a[_i];
return [4 /*yield*/, requestInterceptor.process(input)];
case 2:
_d.sent();
_d.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4: return [4 /*yield*/, this.dispatchRequest(input)];
case 5:
// Dispatch request to handler chain
output = _d.sent();
if (!this.responseInterceptors) return [3 /*break*/, 9];
_b = 0, _c = this.responseInterceptors;
_d.label = 6;
case 6:
if (!(_b < _c.length)) return [3 /*break*/, 9];
responseInterceptor = _c[_b];
return [4 /*yield*/, responseInterceptor.process(input, output)];
case 7:
_d.sent();
_d.label = 8;
case 8:
_b++;
return [3 /*break*/, 6];
case 9: return [3 /*break*/, 12];
case 10:
err_1 = _d.sent();
return [4 /*yield*/, this.dispatchError(input, err_1)];
case 11:
output = _d.sent();
return [3 /*break*/, 12];
case 12: return [2 /*return*/, output];
async dispatch(input) {
let output;
try {
// Execute global request interceptors
if (this.requestInterceptors) {
for (const requestInterceptor of this.requestInterceptors) {
await requestInterceptor.process(input);
}
});
});
};
}
// Dispatch request to handler chain
output = await this.dispatchRequest(input);
// Execute global response interceptors
if (this.responseInterceptors) {
for (const responseInterceptor of this.responseInterceptors) {
await responseInterceptor.process(input, output);
}
}
}
catch (err) {
output = await this.dispatchError(input, err);
}
return output;
}
/**

@@ -126,74 +65,44 @@ * Main logic for request dispatching.

*/
GenericRequestDispatcher.prototype.dispatchRequest = function (input) {
return __awaiter(this, void 0, void 0, function () {
var handlerChain, _i, _a, requestMapper, handler, requestInterceptors, responseInterceptors, adapter, _b, _c, handlerAdapter, _d, requestInterceptors_1, requestInterceptor, output, _e, responseInterceptors_1, responseInterceptor;
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
_i = 0, _a = this.requestMappers;
_f.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
requestMapper = _a[_i];
return [4 /*yield*/, requestMapper.getRequestHandlerChain(input)];
case 2:
handlerChain = _f.sent();
if (handlerChain) {
return [3 /*break*/, 4];
}
_f.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4:
if (!handlerChain) {
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, "Unable to find a suitable request handler.");
}
handler = handlerChain.getRequestHandler();
requestInterceptors = handlerChain.getRequestInterceptors();
responseInterceptors = handlerChain.getResponseInterceptors();
for (_b = 0, _c = this.handlerAdapters; _b < _c.length; _b++) {
handlerAdapter = _c[_b];
if (handlerAdapter.supports(handler)) {
adapter = handlerAdapter;
break;
}
}
if (!adapter) {
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, "Unable to find a suitable handler adapter.");
}
if (!requestInterceptors) return [3 /*break*/, 8];
_d = 0, requestInterceptors_1 = requestInterceptors;
_f.label = 5;
case 5:
if (!(_d < requestInterceptors_1.length)) return [3 /*break*/, 8];
requestInterceptor = requestInterceptors_1[_d];
return [4 /*yield*/, requestInterceptor.process(input)];
case 6:
_f.sent();
_f.label = 7;
case 7:
_d++;
return [3 /*break*/, 5];
case 8: return [4 /*yield*/, adapter.execute(input, handler)];
case 9:
output = _f.sent();
if (!responseInterceptors) return [3 /*break*/, 13];
_e = 0, responseInterceptors_1 = responseInterceptors;
_f.label = 10;
case 10:
if (!(_e < responseInterceptors_1.length)) return [3 /*break*/, 13];
responseInterceptor = responseInterceptors_1[_e];
return [4 /*yield*/, responseInterceptor.process(input, output)];
case 11:
_f.sent();
_f.label = 12;
case 12:
_e++;
return [3 /*break*/, 10];
case 13: return [2 /*return*/, output];
}
});
});
};
async dispatchRequest(input) {
// Get the request handler chain that can handle the request
let handlerChain;
for (const requestMapper of this.requestMappers) {
handlerChain = await requestMapper.getRequestHandlerChain(input);
if (handlerChain) {
break;
}
}
if (!handlerChain) {
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, `Unable to find a suitable request handler.`);
}
// Extract the handler and interceptors from the handler chain
const handler = handlerChain.getRequestHandler();
const requestInterceptors = handlerChain.getRequestInterceptors();
const responseInterceptors = handlerChain.getResponseInterceptors();
let adapter;
for (const handlerAdapter of this.handlerAdapters) {
if (handlerAdapter.supports(handler)) {
adapter = handlerAdapter;
break;
}
}
if (!adapter) {
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, `Unable to find a suitable handler adapter.`);
}
// Execute request interceptors that are local to the handler chain
if (requestInterceptors) {
for (const requestInterceptor of requestInterceptors) {
await requestInterceptor.process(input);
}
}
// Invoke the request handler
const output = await adapter.execute(input, handler);
// Execute response interceptors that are local to the handler chain
if (responseInterceptors) {
for (const responseInterceptor of responseInterceptors) {
await responseInterceptor.process(input, output);
}
}
return output;
}
/**

@@ -204,24 +113,13 @@ * Main logic for error dispatching.

*/
GenericRequestDispatcher.prototype.dispatchError = function (input, error) {
return __awaiter(this, void 0, void 0, function () {
var handler;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.errorMapper) return [3 /*break*/, 2];
return [4 /*yield*/, this.errorMapper.getErrorHandler(input, error)];
case 1:
handler = _a.sent();
if (handler) {
return [2 /*return*/, handler.handle(input, error)];
}
_a.label = 2;
case 2: throw error;
}
});
});
};
return GenericRequestDispatcher;
}());
async dispatchError(input, error) {
if (this.errorMapper) {
const handler = await this.errorMapper.getErrorHandler(input, error);
if (handler) {
return handler.handle(input, error);
}
}
throw error;
}
}
exports.GenericRequestDispatcher = GenericRequestDispatcher;
//# sourceMappingURL=GenericRequestDispatcher.js.map

@@ -14,59 +14,17 @@ "use strict";

*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenericHandlerAdapter = void 0;
/**
* Generic implementation of {@link HandlerAdapter that supports the {@link RequestHandler}}}
*/
var GenericHandlerAdapter = /** @class */ (function () {
function GenericHandlerAdapter() {
}
GenericHandlerAdapter.prototype.supports = function (handler) {
class GenericHandlerAdapter {
supports(handler) {
return typeof handler.canHandle === 'function'
&& typeof handler.handle === 'function';
};
GenericHandlerAdapter.prototype.execute = function (input, handler) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, handler.handle(input)];
});
});
};
return GenericHandlerAdapter;
}());
}
async execute(input, handler) {
return handler.handle(input);
}
}
exports.GenericHandlerAdapter = GenericHandlerAdapter;
//# sourceMappingURL=GenericHandlerAdapter.js.map

@@ -15,7 +15,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.GenericRequestHandlerChain = void 0;
/**
* Generic implementation of {@link RequestHandlerChain}.
*/
var GenericRequestHandlerChain = /** @class */ (function () {
function GenericRequestHandlerChain(options) {
class GenericRequestHandlerChain {
constructor(options) {
this.requestHandler = options.requestHandler;

@@ -25,14 +26,13 @@ this.requestInterceptors = options.requestInterceptors;

}
GenericRequestHandlerChain.prototype.getRequestHandler = function () {
getRequestHandler() {
return this.requestHandler;
};
GenericRequestHandlerChain.prototype.getRequestInterceptors = function () {
}
getRequestInterceptors() {
return this.requestInterceptors;
};
GenericRequestHandlerChain.prototype.getResponseInterceptors = function () {
}
getResponseInterceptors() {
return this.responseInterceptors;
};
return GenericRequestHandlerChain;
}());
}
}
exports.GenericRequestHandlerChain = GenericRequestHandlerChain;
//# sourceMappingURL=GenericRequestHandlerChain.js.map

@@ -14,75 +14,22 @@ "use strict";

*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenericRequestMapper = void 0;
/**
* Generic implementation for {@link RequestMapper}.
*/
var GenericRequestMapper = /** @class */ (function () {
function GenericRequestMapper(options) {
class GenericRequestMapper {
constructor(options) {
this.requestHandlerChains = options.requestHandlerChains;
}
GenericRequestMapper.prototype.getRequestHandlerChain = function (input) {
return __awaiter(this, void 0, void 0, function () {
var _i, _a, requestHandlerChain, requestHandler;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_i = 0, _a = this.requestHandlerChains;
_b.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
requestHandlerChain = _a[_i];
requestHandler = requestHandlerChain.getRequestHandler();
return [4 /*yield*/, requestHandler.canHandle(input)];
case 2:
if (_b.sent()) {
return [2 /*return*/, requestHandlerChain];
}
_b.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/, null];
}
});
});
};
return GenericRequestMapper;
}());
async getRequestHandlerChain(input) {
for (const requestHandlerChain of this.requestHandlerChains) {
const requestHandler = requestHandlerChain.getRequestHandler();
if (await requestHandler.canHandle(input)) {
return requestHandlerChain;
}
}
return null;
}
}
exports.GenericRequestMapper = GenericRequestMapper;
//# sourceMappingURL=GenericRequestMapper.js.map

@@ -18,2 +18,3 @@ export { ErrorHandler } from './dispatcher/error/handler/ErrorHandler';

export { Skill } from './skill/Skill';
export { createAskSdkError, createAskSdkUserAgent, } from './util/AskSdkUtils';
export { createAskSdkError, createAskSdkUserAgent } from './util/AskSdkUtils';
export { UserAgentManager } from './util/UserAgentManager';

@@ -16,16 +16,18 @@ "use strict";

var GenericErrorMapper_1 = require("./dispatcher/error/mapper/GenericErrorMapper");
exports.GenericErrorMapper = GenericErrorMapper_1.GenericErrorMapper;
Object.defineProperty(exports, "GenericErrorMapper", { enumerable: true, get: function () { return GenericErrorMapper_1.GenericErrorMapper; } });
var GenericHandlerAdapter_1 = require("./dispatcher/request/handler/GenericHandlerAdapter");
exports.GenericHandlerAdapter = GenericHandlerAdapter_1.GenericHandlerAdapter;
Object.defineProperty(exports, "GenericHandlerAdapter", { enumerable: true, get: function () { return GenericHandlerAdapter_1.GenericHandlerAdapter; } });
var GenericRequestHandlerChain_1 = require("./dispatcher/request/handler/GenericRequestHandlerChain");
exports.GenericRequestHandlerChain = GenericRequestHandlerChain_1.GenericRequestHandlerChain;
Object.defineProperty(exports, "GenericRequestHandlerChain", { enumerable: true, get: function () { return GenericRequestHandlerChain_1.GenericRequestHandlerChain; } });
var GenericRequestMapper_1 = require("./dispatcher/request/mapper/GenericRequestMapper");
exports.GenericRequestMapper = GenericRequestMapper_1.GenericRequestMapper;
Object.defineProperty(exports, "GenericRequestMapper", { enumerable: true, get: function () { return GenericRequestMapper_1.GenericRequestMapper; } });
var RuntimeConfigurationBuilder_1 = require("./skill/RuntimeConfigurationBuilder");
exports.RuntimeConfigurationBuilder = RuntimeConfigurationBuilder_1.RuntimeConfigurationBuilder;
Object.defineProperty(exports, "RuntimeConfigurationBuilder", { enumerable: true, get: function () { return RuntimeConfigurationBuilder_1.RuntimeConfigurationBuilder; } });
var GenericRequestDispatcher_1 = require("./dispatcher/GenericRequestDispatcher");
exports.GenericRequestDispatcher = GenericRequestDispatcher_1.GenericRequestDispatcher;
Object.defineProperty(exports, "GenericRequestDispatcher", { enumerable: true, get: function () { return GenericRequestDispatcher_1.GenericRequestDispatcher; } });
var AskSdkUtils_1 = require("./util/AskSdkUtils");
exports.createAskSdkError = AskSdkUtils_1.createAskSdkError;
exports.createAskSdkUserAgent = AskSdkUtils_1.createAskSdkUserAgent;
Object.defineProperty(exports, "createAskSdkError", { enumerable: true, get: function () { return AskSdkUtils_1.createAskSdkError; } });
Object.defineProperty(exports, "createAskSdkUserAgent", { enumerable: true, get: function () { return AskSdkUtils_1.createAskSdkUserAgent; } });
var UserAgentManager_1 = require("./util/UserAgentManager");
Object.defineProperty(exports, "UserAgentManager", { enumerable: true, get: function () { return UserAgentManager_1.UserAgentManager; } });
//# sourceMappingURL=index.js.map

@@ -15,9 +15,10 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var GenericErrorMapper_1 = require("../dispatcher/error/mapper/GenericErrorMapper");
var GenericHandlerAdapter_1 = require("../dispatcher/request/handler/GenericHandlerAdapter");
var GenericRequestHandlerChain_1 = require("../dispatcher/request/handler/GenericRequestHandlerChain");
var GenericRequestMapper_1 = require("../dispatcher/request/mapper/GenericRequestMapper");
var AskSdkUtils_1 = require("../util/AskSdkUtils");
var RuntimeConfigurationBuilder = /** @class */ (function () {
function RuntimeConfigurationBuilder() {
exports.RuntimeConfigurationBuilder = void 0;
const GenericErrorMapper_1 = require("../dispatcher/error/mapper/GenericErrorMapper");
const GenericHandlerAdapter_1 = require("../dispatcher/request/handler/GenericHandlerAdapter");
const GenericRequestHandlerChain_1 = require("../dispatcher/request/handler/GenericRequestHandlerChain");
const GenericRequestMapper_1 = require("../dispatcher/request/mapper/GenericRequestMapper");
const AskSdkUtils_1 = require("../util/AskSdkUtils");
class RuntimeConfigurationBuilder {
constructor() {
this.requestHandlerChains = [];

@@ -28,5 +29,5 @@ this.requestInterceptors = [];

}
RuntimeConfigurationBuilder.prototype.addRequestHandler = function (matcher, executor) {
addRequestHandler(matcher, executor) {
if (typeof matcher !== 'function' || typeof executor !== 'function') {
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, "Incompatible matcher type: " + typeof matcher);
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, `Incompatible matcher type: ${typeof matcher}`);
}

@@ -40,23 +41,13 @@ this.requestHandlerChains.push(new GenericRequestHandlerChain_1.GenericRequestHandlerChain({

return this;
};
RuntimeConfigurationBuilder.prototype.addRequestHandlers = function () {
var requestHandlers = [];
for (var _i = 0; _i < arguments.length; _i++) {
requestHandlers[_i] = arguments[_i];
}
for (var _a = 0, requestHandlers_1 = requestHandlers; _a < requestHandlers_1.length; _a++) {
var requestHandler = requestHandlers_1[_a];
}
addRequestHandlers(...requestHandlers) {
for (const requestHandler of requestHandlers) {
this.requestHandlerChains.push(new GenericRequestHandlerChain_1.GenericRequestHandlerChain({
requestHandler: requestHandler,
requestHandler,
}));
}
return this;
};
RuntimeConfigurationBuilder.prototype.addRequestInterceptors = function () {
var executors = [];
for (var _i = 0; _i < arguments.length; _i++) {
executors[_i] = arguments[_i];
}
for (var _a = 0, executors_1 = executors; _a < executors_1.length; _a++) {
var executor = executors_1[_a];
}
addRequestInterceptors(...executors) {
for (const executor of executors) {
switch (typeof executor) {

@@ -74,3 +65,3 @@ case 'object': {

default: {
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, "Incompatible executor type: " + typeof executor);
throw AskSdkUtils_1.createAskSdkError(this.constructor.name, `Incompatible executor type: ${typeof executor}`);
}

@@ -80,10 +71,5 @@ }

return this;
};
RuntimeConfigurationBuilder.prototype.addResponseInterceptors = function () {
var executors = [];
for (var _i = 0; _i < arguments.length; _i++) {
executors[_i] = arguments[_i];
}
for (var _a = 0, executors_2 = executors; _a < executors_2.length; _a++) {
var executor = executors_2[_a];
}
addResponseInterceptors(...executors) {
for (const executor of executors) {
switch (typeof executor) {

@@ -101,3 +87,3 @@ case 'object': {

default: {
throw AskSdkUtils_1.createAskSdkError('SkillBuilderError', "Incompatible executor type: " + typeof executor);
throw AskSdkUtils_1.createAskSdkError('SkillBuilderError', `Incompatible executor type: ${typeof executor}`);
}

@@ -107,4 +93,4 @@ }

return this;
};
RuntimeConfigurationBuilder.prototype.addErrorHandler = function (matcher, executor) {
}
addErrorHandler(matcher, executor) {
this.errorHandlers.push({

@@ -115,17 +101,12 @@ canHandle: matcher,

return this;
};
RuntimeConfigurationBuilder.prototype.addErrorHandlers = function () {
var _a;
var errorHandlers = [];
for (var _i = 0; _i < arguments.length; _i++) {
errorHandlers[_i] = arguments[_i];
}
(_a = this.errorHandlers).push.apply(_a, errorHandlers);
}
addErrorHandlers(...errorHandlers) {
this.errorHandlers.push(...errorHandlers);
return this;
};
RuntimeConfigurationBuilder.prototype.getRuntimeConfiguration = function () {
var requestMapper = new GenericRequestMapper_1.GenericRequestMapper({
}
getRuntimeConfiguration() {
const requestMapper = new GenericRequestMapper_1.GenericRequestMapper({
requestHandlerChains: this.requestHandlerChains,
});
var errorMapper = this.errorHandlers.length
const errorMapper = this.errorHandlers.length
? new GenericErrorMapper_1.GenericErrorMapper({

@@ -138,10 +119,9 @@ errorHandlers: this.errorHandlers,

handlerAdapters: [new GenericHandlerAdapter_1.GenericHandlerAdapter()],
errorMapper: errorMapper,
errorMapper,
requestInterceptors: this.requestInterceptors,
responseInterceptors: this.responseInterceptors,
};
};
return RuntimeConfigurationBuilder;
}());
}
}
exports.RuntimeConfigurationBuilder = RuntimeConfigurationBuilder;
//# sourceMappingURL=RuntimeConfigurationBuilder.js.map

@@ -13,2 +13,2 @@ /**

*/
export declare function createAskSdkUserAgent(packageVersion: string, customUserAgent: string): string;
export declare function createAskSdkUserAgent(packageVersion: string, customUserAgent?: string): string;

@@ -15,2 +15,3 @@ /*

Object.defineProperty(exports, "__esModule", { value: true });
exports.createAskSdkUserAgent = exports.createAskSdkError = void 0;
/**

@@ -23,4 +24,4 @@ * function creating an AskSdk error.

function createAskSdkError(errorScope, errorMessage) {
var error = new Error(errorMessage);
error.name = "AskSdk." + errorScope + " Error";
const error = new Error(errorMessage);
error.name = `AskSdk.${errorScope} Error`;
return error;

@@ -35,6 +36,6 @@ }

function createAskSdkUserAgent(packageVersion, customUserAgent) {
var customUserAgentString = customUserAgent ? (' ' + customUserAgent) : '';
return "ask-node/" + packageVersion + " Node/" + process.version + customUserAgentString;
const customUserAgentString = customUserAgent ? (` ${customUserAgent}`) : '';
return `ask-node/${packageVersion} Node/${process.version}${customUserAgentString}`;
}
exports.createAskSdkUserAgent = createAskSdkUserAgent;
//# sourceMappingURL=AskSdkUtils.js.map
{
"name": "ask-sdk-runtime",
"version": "2.8.0",
"version": "2.10.0",
"description": "Base runtime package for Alexa Skills Kit SDK",

@@ -8,3 +8,8 @@ "main": "dist/index.js",

"scripts": {
"gulp": "./node_modules/.bin/gulp"
"build": "tsc && npm run lint",
"compile": "tsc",
"test": "cross-env TS_NODE_FILES=true mocha -r ts-node/register \"./tst/**/*.spec.ts\"",
"lint": "eslint \"lib/**/*.{ts,tsx}\" \"tst/**/*.{ts,tsx}\"",
"clean": "rm -rf ./dist",
"reinstall": "rm -rf ./node_modules && npm install"
},

@@ -28,5 +33,8 @@ "author": "Amazon.com",

"@types/sinon": "^7.0.13",
"@typescript-eslint/eslint-plugin": "^3.9.0",
"@typescript-eslint/parser": "^3.9.0",
"chai": "^4.1.2",
"del": "^3.0.0",
"gulp": "^4.0.0",
"cross-env": "^7.0.2",
"eslint": "^7.6.0",
"eslint-plugin-tsdoc": "^0.2.6",
"mocha": "^5.0.5",

@@ -37,3 +45,2 @@ "nock": "^9.2.3",

"ts-node": "^6.0.1",
"tslint": "^5.9.1",
"typescript": "^3.5.3"

@@ -44,3 +51,3 @@ },

"homepage": "https://github.com/alexa/alexa-skill-sdk-for-nodejs#readme",
"gitHead": "90f9500a5b0738889e8907a33acec74e4704aac0"
"gitHead": "c1d833ebae31ae822d30eef733afb6581d47453d"
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc