Skip to content

Commit

Permalink
chore(release): initial commit for 2.x_public-beta branch
Browse files Browse the repository at this point in the history
This commit contains the following changes:
- Update README.md to contain instructions for beta ASK SDK v2 for Node.js packages
- Add support for name-free interaction of custom Alexa skills
- Update version numbers with beta qualifiers
  • Loading branch information
Zhang committed May 30, 2018
1 parent 721c46e commit e49578c
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 164 deletions.
78 changes: 0 additions & 78 deletions README.ja.md

This file was deleted.

88 changes: 29 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,48 @@
# ASK SDK for Node.js [![Build Status](https://travis-ci.org/alexa/alexa-skills-kit-sdk-for-nodejs.svg?branch=2.0.x)](https://travis-ci.org/alexa/alexa-skills-kit-sdk-for-nodejs)
This guide describes how to use the ASK SDK v2 for Node.js (public beta) in your project.

*[English](README.md) | [日本語](README.ja.md)*
## Disclaimer

| Package | NPM |
| ------------- | ------------- |
|[ask-sdk](./ask-sdk)| [![npm](https://img.shields.io/npm/v/ask-sdk.svg)](https://www.npmjs.com/package/ask-sdk) [![npm](https://img.shields.io/npm/dt/ask-sdk.svg)](https://www.npmjs.com/package/ask-sdk)|
|[ask-sdk-core](./ask-sdk-core)| [![npm](https://img.shields.io/npm/v/ask-sdk-core.svg)](https://www.npmjs.com/package/ask-sdk-core) [![npm](https://img.shields.io/npm/dt/ask-sdk-core.svg)](https://www.npmjs.com/package/ask-sdk-core)|
|[ask-sdk-dynamodb-persistence-adapter](./ask-sdk-dynamodb-persistence-adapter)| [![npm](https://img.shields.io/npm/v/ask-sdk-dynamodb-persistence-adapter.svg)](https://www.npmjs.com/package/ask-sdk-dynamodb-persistence-adapter) [![npm](https://img.shields.io/npm/dt/ask-sdk-dynamodb-persistence-adapter.svg)](https://www.npmjs.com/package/ask-sdk-dynamodb-persistence-adapter)|
|[ask-sdk-v1adapter](./ask-sdk-v1adapter)|[![npm](https://img.shields.io/npm/v/ask-sdk-v1adapter.svg)](https://www.npmjs.com/package/ask-sdk-v1adapter) [![npm](https://img.shields.io/npm/dt/ask-sdk-v1adapter.svg)](https://www.npmjs.com/package/ask-sdk-v1adapter)|
This repo contains public beta versions of the ASK SDK v2 for Node.js, which may contain one or more Alexa features that are currently available in public beta. These features may contain unexpected bugs or be subject to future breaking changes. Production skills should use non-beta versions of the ASK SDK.

The ASK SDK v2 for Node.js makes it easier for you to build highly engaging skills by allowing you to spend more time on implementing features and less writing boiler-plate code.
## Prerequisites

To help you get started more quickly with the SDK, see the following resources.
* An [NPM](https://www.npmjs.com/) project.
* A suitable Node.js development environment. The ASK SDK v2 for Node.js requires Node 4.3.2 or above.

## Technical Documentation
## Adding the ASK SDK to Your Project

### [Setting Up The ASK SDK](../../wiki/Setting-Up-The-ASK-SDK)
Shows how to install the SDK as a dependency in your NPM project.
To use the ASK SDK v2 for Node.js (public beta) in your project, install it as a NPM module. You can choose to install the standard SDK distribution or the core SDK module with selective add-on packages. The standard SDK distribution is the easiest way to quickly get up and running with the SDK. It includes the core SDK module, the model package, and the module for the Amazon DynamoDB persistence adapter that enables storing skill attributes in DynamoDB.

### [Developing Your First Skill](../../wiki/Developing-Your-First-Skill)
Walks through step-by-step instructions for building the Hello World sample.
### Installing Standard ASK SDK Distribution

### [ASK SDK Migration Guide](../../wiki/ASK-SDK-Migration-Guide)
Provides instructions for migrating an Alexa skill from the SDK v1 to the SDK v2.
From within your NPM project, run the following commands to install the standard ASK SDK v2 for Node.js (public beta) distribution:

### [Request Processing](../../wiki/Request-Processing)
Covers how to build request handlers, exception handlers, and request and response interceptors.
```
npm install --save ask-sdk@beta
```

### [Skill Attributes](../../wiki/Skill-Attributes)
Covers how to use skill attributes to store and retrieve skill data
### Installing Core SDK Module Only

### [Response Building](../../wiki/Response-Building)
Covers how to use the ResponseBuilder to compose multiple elements like text, cards, and audio into a single response.
If you do not need everything in the `ask-sdk` module, you can install the core modules and expand with individual add-on packages later. From within your NPM project, run the following commands to install the core ASK SDK v2 for Node.js distribution:

### [Alexa Service Clients](../../wiki/Alexa-Service-Clients)
Covers how to use service clients in your skill to access Alexa APIs.
**Model (required as peer dependency of **`ask-sdk-core`**)**

### [Skill Builders](../../wiki/Skill-Builders)
Covers how to configure and construct a skill instance.
```
npm install --save ask-sdk-model@beta
```

### [Managing In-Skill Purchases](../../wiki/Managing-In-Skill-Purchases)
Covers how to manage in-skill products and the purchase experience in your skills.
**Core SDK**

## Samples
```
npm install --save ask-sdk-core@beta
```

### [Hello World](https://github.com/alexa/skill-sample-nodejs-hello-world)
Sample that familiarizes you with the Alexa Skills Kit and AWS Lambda by allowing you to hear a response from Alexa when you trigger the sample.
### Installing Add-on ASK SDK Modules

### [Fact](https://github.com/alexa/skill-sample-nodejs-fact)
Template for a basic fact skill. You’ll provide a list of interesting facts about a topic, Alexa will select a fact at random and tell it to the user when the skill is invoked.
Add-on packages implement SDK functionality such as `PersistenceAdapter`. You can selectively install modules on top of the core SDK module to expand the capability of your skill.

### [How To](https://github.com/alexa/skill-sample-nodejs-howto)
Template for a parameter-based skill called 'Minecraft Helper'. When the user asks how to craft an item in the game Minecraft, the skill provides instructions.
**Amazon DynamoDB Persistence Adapter**

### [Trivia](https://github.com/alexa/skill-sample-nodejs-trivia)
Template for a trivia-style game with score keeping. Alexa asks the user multiple-choice questions and seeks a response. Correct and incorrect answers to questions are recorded.

### [Quiz Game](https://github.com/alexa/skill-sample-nodejs-quiz-game)
Template for a basic quiz game skill. Alexa quizzes the user with facts from a list you provide.

### [City Guide](https://github.com/alexa/skill-sample-nodejs-city-guide)
Template for a local recommendations skill. Alexa uses the data that you provide to offer recommendations according to the user's stated preferences.

### [Pet Match](https://github.com/alexa/skill-sample-nodejs-petmatch)
Sample skill that matches the user with a pet. Alexa prompts the user for the information it needs to determine a match. Once all of the required information is collected, the skill sends the data to an external web service that processes the data and returns the match.

### [High Low Game](https://github.com/alexa/skill-sample-nodejs-highlowgame)
Template for a basic high-low game skill. When the user guesses a number, Alexa tells the user whether the number she has in mind is higher or lower.

### [Decision Tree](https://github.com/alexa/skill-sample-nodejs-decision-tree)
Template for a basic decision tree skill. Alexa asks the user a series of questions to get to a career suggestion.

### [Device Address API](https://github.com/alexa/skill-sample-node-device-address-api)
Sample skill that shows how to request and access the configured address in the user’s device settings.

## Got Feedback?
Request and vote for Alexa features [here](https://alexa.uservoice.com/forums/906892-alexa-skills-developer-voice-and-vote)!
```
npm install --save ask-sdk-dynamodb-persistence-adapter@beta
```
6 changes: 3 additions & 3 deletions ask-sdk-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Core SDK package contains basic components and default implementations of ASK SD
The ASK SDK v2 for Node.js is an open-source Alexa Skill Development Kit. ASK SDK v2 for Node.js makes it easier for you to build highly engaging skills, by allowing you to spend more time on implementing features and less on writing boiler-plate code.

## Installing
To use the Core SDK package, you need to install two modules: core SDK and model(peer dependency of core SDK) within your NPM project. Run the following commands in the terminal to install them:
To use the Core SDK package (public beta), you need to install two modules: core SDK and model(peer dependency of core SDK) within your NPM project. Run the following commands in the terminal to install them:

```
npm install --save ask-sdk-core
npm install --save ask-sdk-core@beta
```

```
npm install --save ask-sdk-model
npm install --save ask-sdk-model@beta
```

## Usage and Getting Started
Expand Down
8 changes: 8 additions & 0 deletions ask-sdk-core/lib/response/ResponseBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
'use strict';

import {
canfulfill,
Directive,
Intent,
interfaces,
Response,
} from 'ask-sdk-model';
import AudioItemMetadata = interfaces.audioplayer.AudioItemMetadata;
import CanFulfillIntent = canfulfill.CanFulfillIntent;

/**
* An interface which helps building a response.
Expand Down Expand Up @@ -161,6 +163,12 @@ export interface ResponseBuilder {
* @returns {ResponseBuilder}
*/
addVideoAppLaunchDirective(source : string, title? : string, subtitle? : string) : this;
/**
* Adds canFulfillIntent to response.
* @param {canfulfill.CanFulfillIntent} canFulfillIntent
* @return {ResponseBuilder}
*/
withCanFulfillIntent(canFulfillIntent : CanFulfillIntent) : this;
/**
* Sets shouldEndSession value to null/false/true
* @param {boolean} val
Expand Down
7 changes: 7 additions & 0 deletions ask-sdk-core/lib/response/ResponseFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'use strict';

import {
canfulfill,
dialog,
Directive,
Intent,
Expand All @@ -38,6 +39,7 @@ import ElicitSlotDirective = dialog.ElicitSlotDirective;
import ConfirmSlotDirective = dialog.ConfirmSlotDirective;
import ConfirmIntentDirective = dialog.ConfirmIntentDirective;
import AudioItemMetadata = interfaces.audioplayer.AudioItemMetadata;
import CanFulfillIntent = canfulfill.CanFulfillIntent;

/**
* Responsible for building JSON responses using ask-sdk-model as per the Alexa skills kit interface
Expand Down Expand Up @@ -308,6 +310,11 @@ export class ResponseFactory {

return this;
},
withCanFulfillIntent(canFulfillIntent : CanFulfillIntent) : ResponseBuilder {
response.canFulfillIntent = canFulfillIntent;

return this;
},
withShouldEndSession(val : boolean) : ResponseBuilder {
if (!isVideoAppLaunchDirectivePresent()) {
response.shouldEndSession = val;
Expand Down
6 changes: 3 additions & 3 deletions ask-sdk-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ask-sdk-core",
"version": "2.0.5",
"version": "2.1.0-beta.1",
"description": "Core package for Alexa Skills Kit SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -24,14 +24,14 @@
"SDK"
],
"peerDependencies": {
"ask-sdk-model": "^1.0.0"
"ask-sdk-model": "^1.4.0-beta.1"
},
"devDependencies": {
"@types/chai": "^4.1.2",
"@types/mocha": "^5.0.0",
"@types/node": "^9.6.1",
"@types/sinon": "^4.3.0",
"ask-sdk-model": "^1.0.0",
"ask-sdk-model": "^1.4.0-beta.1",
"chai": "^4.1.2",
"del": "^3.0.0",
"gulp": "^4.0.0",
Expand Down
24 changes: 23 additions & 1 deletion ask-sdk-core/tst/response/ResponseFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

'use strict';

import { interfaces } from 'ask-sdk-model';
import {
canfulfill,
interfaces,
} from 'ask-sdk-model';
import { expect } from 'chai';
import { ImageHelper } from '../../lib/response/ImageHelper';
import { ResponseBuilder } from '../../lib/response/ResponseBuilder';
Expand All @@ -24,6 +27,7 @@ import PlayBehavior = interfaces.audioplayer.PlayBehavior;
import ClearBehavior = interfaces.audioplayer.ClearBehavior;
import Image = interfaces.display.Image;
import BodyTemplate1 = interfaces.display.BodyTemplate1;
import CanFulfillIntent = canfulfill.CanFulfillIntent;

describe('ResponseFactory', () => {

Expand Down Expand Up @@ -649,6 +653,24 @@ describe('ResponseFactory', () => {
.to.deep.equals(expectResponse2);
});

it('should build response with canFulfillIntent', () => {
const responseBuilder : ResponseBuilder = ResponseFactory.init();
const canFulfillIntent : CanFulfillIntent = {
canFulfill : 'YES',
slots : {
foo : {
canUnderstand : 'MAYBE',
canFulfill : 'YES',
},
},
};
const expectedResponse = {
canFulfillIntent,
};

expect(responseBuilder.withCanFulfillIntent(canFulfillIntent).getResponse()).to.deep.equals(expectedResponse);
});

it('should build response with shouldEndSession value', () => {
const responseBuilder : ResponseBuilder = ResponseFactory.init();
const expectResponse = {
Expand Down
Loading

0 comments on commit e49578c

Please sign in to comment.