@jargon/alexa-skill-sdk
Version:
The Jargon Alexa Skill SDK makes it easy to manage the content of your custom Alexa skill
63 lines • 2.73 kB
JavaScript
;
/*
* Copyright 2018 Jargon, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var sdk_core_1 = require("@jargon/sdk-core");
var requestInterceptor_1 = require("../requestInterceptor");
var responseBuilder_1 = require("../responseBuilder");
exports.DefaultSkillBuilderOptions = __assign({}, sdk_core_1.DefaultResourceManagerOptions, responseBuilder_1.DefaultJargonResponseBuilderOptions);
/**
* JargonSkillBuilder installs itself onto an ASK SkillBuilder. Under the covers it creates
* a Jargon ResourceManager, and installs interceptors on the base skill builder that handle
* augmenting the ASK request objects with Jargon's additions (such as JargonResponseBuilder)
*/
var JargonSkillBuilder = /** @class */ (function () {
/**
* Constructs a new JargonSkillBuilder
* @param opts Options for the skill builder; defaults to an empty object
*/
function JargonSkillBuilder(opts) {
if (opts === void 0) { opts = {}; }
this._options = Object.assign({}, exports.DefaultSkillBuilderOptions, opts);
this._rmf = new sdk_core_1.DefaultResourceManagerFactory(this._options);
}
/**
* Installs onto a base ASK skill builder
* @param base The base ASK skill builder
*/
JargonSkillBuilder.prototype.installOnto = function (base) {
base.addRequestInterceptors(new requestInterceptor_1.JargonRequestInterceptor(this._rmf, this._options));
return base;
};
/**
* @deprecated Use installOnto instead
* @param base The base ASK skill builder
*/
JargonSkillBuilder.prototype.wrap = function (base) {
return this.installOnto(base);
};
return JargonSkillBuilder;
}());
exports.JargonSkillBuilder = JargonSkillBuilder;
//# sourceMappingURL=index.js.map