From 9f0275c3931a773debcd2357fe56333493db8444 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:30:14 +0100 Subject: [PATCH 1/6] added slots interface, dialog states and confirmation statuses --- types/alexa-sdk/index.d.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 9f99b14995..3e8096ca15 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,12 +1,15 @@ // Type definitions for Alexa SDK for Node.js v1.0.3 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs -// Definitions by: Pete Beegle +// Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; +type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; +type ConfirmationStatuses = 'NONE' | 'DENIED' | 'CONFIRMED'; + interface AlexaObject { _event: any; _context: any; @@ -74,12 +77,22 @@ interface SessionUser { interface LaunchRequest extends IRequest { } interface IntentRequest extends IRequest { + dialogState: DialogStates; intent: Intent; } +interface ISlots { + [slot: string]: { + name: string, + value?: any, + confirmationStatus: ConfirmationStatuses; + } +} + interface Intent { + confirmationStatus: ConfirmationStatuses; name: string; - slots: any; + slots: ISlots; } interface SessionEndedRequest extends IRequest { @@ -127,5 +140,3 @@ interface Image { interface Reprompt { outputSpeech: OutputSpeech; } - - From ec6fd79ea1317583e014e01c7366fb92186d962d Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:32:11 +0100 Subject: [PATCH 2/6] alphabetised keys --- types/alexa-sdk/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 3e8096ca15..1243392569 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -7,8 +7,8 @@ export function handler(event: RequestBody, context: Context, callback?: Functio export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; -type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; type ConfirmationStatuses = 'NONE' | 'DENIED' | 'CONFIRMED'; +type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; interface AlexaObject { _event: any; @@ -83,9 +83,9 @@ interface IntentRequest extends IRequest { interface ISlots { [slot: string]: { + confirmationStatus: ConfirmationStatuses; name: string, value?: any, - confirmationStatus: ConfirmationStatuses; } } From cda924591dfe6541dbbcdf8951708840fc28a5b9 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:37:11 +0100 Subject: [PATCH 3/6] increased version number --- types/alexa-sdk/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 1243392569..b06855489a 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Alexa SDK for Node.js v1.0.3 +// Type definitions for Alexa SDK for Node.js v1.1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 940ace74aba9f1eeb1f4b344b6226c7e6a17bdca Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:48:58 +0100 Subject: [PATCH 4/6] linting errors --- types/alexa-sdk/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index b06855489a..fca31e45e4 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -7,8 +7,8 @@ export function handler(event: RequestBody, context: Context, callback?: Functio export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; -type ConfirmationStatuses = 'NONE' | 'DENIED' | 'CONFIRMED'; -type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; +type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; interface AlexaObject { _event: any; @@ -84,9 +84,9 @@ interface IntentRequest extends IRequest { interface ISlots { [slot: string]: { confirmationStatus: ConfirmationStatuses; - name: string, - value?: any, - } + name: string; + value?: any; + }; } interface Intent { From 0ef498c36a0d303e795a224aac72817757239bda Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Tue, 23 May 2017 19:09:07 +0100 Subject: [PATCH 5/6] addressed feedback --- types/alexa-sdk/index.d.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index fca31e45e4..141d41743e 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -81,18 +81,16 @@ interface IntentRequest extends IRequest { intent: Intent; } -interface ISlots { - [slot: string]: { - confirmationStatus: ConfirmationStatuses; - name: string; - value?: any; - }; +interface SlotValue { + confirmationStatus: ConfirmationStatuses; + name: string; + value?: any; } interface Intent { confirmationStatus: ConfirmationStatuses; name: string; - slots: ISlots; + slots: Record; } interface SessionEndedRequest extends IRequest { From 528a0c1e224f5ebf70092a19328fe498d834b116 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Tue, 23 May 2017 19:13:28 +0100 Subject: [PATCH 6/6] updated typescript version --- types/alexa-sdk/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 141d41743e..d051c44ccc 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; export function CreateStateHandler(state: string, obj: any): any;