UNPKG

ask-cli-x

Version:

Alexa Skills Kit (ASK) Command Line Interfaces

53 lines (52 loc) 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ImportStatus = void 0; const ramda_1 = require("ramda"); /** * Class to abstract a single resource object from the GetImportStatus SMAPI API response JSON * { * name:<InteractionModel.Locale>, * status: <InteractionModel Build Status> * } */ class ImportStatusResource { constructor(locale, status) { this.locale = locale; this.status = status; } } /** * Class to abstract the skillId and resources from the SMAPI getSkillStatus API response JSON * { * body: { * skill: { * skillId: <SkillId of the skill in question>, * resources: [ * { * action: <InteractionModel Action Type>, * name:<InteractionModel.Locale>, * status: <InteractionModel Build Status> * }, * ... * ] * } * } * } */ class ImportStatus { constructor(pollImportStatusResponse) { this.skillId = (0, ramda_1.view)((0, ramda_1.lensPath)(["body", "skill", "skillId"]), pollImportStatusResponse); this.warnings = (0, ramda_1.view)((0, ramda_1.lensPath)(["body", "warnings"]), pollImportStatusResponse) || []; this.resources = new Array(); const resources = (0, ramda_1.view)((0, ramda_1.lensPath)(["body", "skill", "resources"]), pollImportStatusResponse) || []; resources.forEach((res) => { const name = (0, ramda_1.view)((0, ramda_1.lensPath)(["name"]), res); const status = (0, ramda_1.view)((0, ramda_1.lensPath)(["status"]), res); this.resources.push(new ImportStatusResource(this._getLocaleFromInteractionModel(name), status)); }); } _getLocaleFromInteractionModel(interactionModelName) { return interactionModelName ? interactionModelName.replace("InteractionModel.", "") : ""; } } exports.ImportStatus = ImportStatus;