UNPKG

@jargon/platform-alexa-skill-kit

Version:

Jargon Platform SDK adapter for the Alexa Skills Kit

51 lines 2.32 kB
"use strict"; /* * 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. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.JargonSkillBuilder = exports.DefaultSkillBuilderOptions = void 0; const platform_sdk_core_1 = require("@jargon/platform-sdk-core"); const requestInterceptor_1 = require("../requestInterceptor"); const responseBuilder_1 = require("../responseBuilder"); exports.DefaultSkillBuilderOptions = Object.assign(Object.assign({}, platform_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) */ class JargonSkillBuilder { /** * Constructs a new JargonSkillBuilder * @param opts Options for the skill builder; defaults to an empty object */ constructor(opts = {}) { this._options = Object.assign({}, exports.DefaultSkillBuilderOptions, opts); this._rmf = this._options.resourceManagerFactory || new platform_sdk_core_1.DefaultResourceManagerFactory(this._options); } /** * Installs onto a base ASK skill builder * @param base The base ASK skill builder */ installOnto(base) { base.addRequestInterceptors(new requestInterceptor_1.JargonRequestInterceptor(this._rmf, this._options)); return base; } /** * @deprecated Use installOnto instead * @param base The base ASK skill builder */ wrap(base) { return this.installOnto(base); } } exports.JargonSkillBuilder = JargonSkillBuilder; //# sourceMappingURL=index.js.map