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

@jargon/alexa-skill-sdk

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jargon/alexa-skill-sdk - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

CHANGELOG.md

1

dist/resourceManager/i18next.d.ts

@@ -10,2 +10,3 @@ import * as i18n from 'i18next';

render(item: RenderItem): Promise<string>;
renderObject<T>(item: RenderItem): Promise<T>;
protected selectKey(keys: string[], opts?: RenderOptions): string;

@@ -12,0 +13,0 @@ }

@@ -34,6 +34,18 @@ "use strict";

var key = this.selectKey(Object.keys(s), item.options);
return Promise.resolve(s[key]);
var v = s[key];
if (typeof v !== 'string') {
return Promise.reject(new Error("Unexpected type " + typeof v + " for item key " + item.key + "." + key));
}
return Promise.resolve(v);
}
return Promise.reject("Unexpected type " + typeof s + " returned from translator");
return Promise.reject(new Error("Unexpected type " + typeof s + " for item key " + item.key));
};
I18NextResourceManager.prototype.renderObject = function (item) {
var obj = this._translator.t(item.key, item.params);
var t = typeof obj;
if (t === 'object' || t === 'string' || t === 'boolean' || t === 'number') {
return Promise.resolve(obj);
}
return Promise.reject(new Error("Unexpected type " + t + " for item key " + item.key));
};
I18NextResourceManager.prototype.selectKey = function (keys, opts) {

@@ -40,0 +52,0 @@ var rv = this._rv;

@@ -68,2 +68,5 @@ "use strict";

}
else if (typeof res === 'boolean' || typeof res === 'number') {
return res;
}
var hadSuccessfulLookup = info && info.resolved && info.resolved.res;

@@ -70,0 +73,0 @@ var fc;

@@ -33,4 +33,11 @@ export interface ResourceManagerOptions {

* @param {RenderItem} item The item to render
* @returns {Promise<string>} A promise to the rendered string
*/
render(item: RenderItem): Promise<string>;
/** Renders an object in the current locale. This also supports returning
* strings, numbers, or booleans
* @param {RenderItem} item The item to render
* @returns {Promise<T>} A promise to the rendered object
*/
renderObject<T>(item: RenderItem): Promise<T>;
/** The locale the resource manager uses */

@@ -37,0 +44,0 @@ readonly locale: string;

2

package.json
{
"name": "@jargon/alexa-skill-sdk",
"version": "1.0.0",
"version": "1.0.1",
"description": "The Jargon Alexa Skill SDK makes it easy to manage the content of your custom Alexa skill",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -119,2 +119,31 @@ # Jargon SDK for Amazon Alexa (nodejs)

### ResourceManager
Internally `JargonResponseBuilder` uses a `ResourceManager` to render strings and objects. You
can directly access the resource manager if desired, for use cases such as:
* obtaining locale-specific values that are used as parameters for later rendering operations
* incrementally or conditionally constructing complex content
* response directives that internally have locale-specific content (such as an upsell directive)
```typescript
export interface ResourceManager {
/** Renders a string in the current locale
* @param {RenderItem} item The item to render
* @returns {Promise<string>} A promise to the rendered string
*/
render (item: RenderItem): Promise<string>
/** Renders an object in the current locale. This also supports returning
* strings, numbers, or booleans
* @param {RenderItem} item The item to render
* @returns {Promise<T>} A promise to the rendered object
*/
renderObject<T> (item: RenderItem): Promise<T>
/** The locale the resource manager uses */
readonly locale: string
}
```
Note that the render routines return `Promise`s to the rendered content, not the content directly.
## Adding to an existing skill

@@ -121,0 +150,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

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