diff --git a/alexa-sdk/alexa-sdk-tests.ts b/alexa-sdk/alexa-sdk-tests.ts index e161c5bf38..34eb88d5e2 100644 --- a/alexa-sdk/alexa-sdk-tests.ts +++ b/alexa-sdk/alexa-sdk-tests.ts @@ -1,5 +1,4 @@ -/// -/// +/// import * as Alexa from "alexa-sdk"; diff --git a/alexa-sdk/alexa-sdk.d.ts b/alexa-sdk/alexa-sdk.d.ts deleted file mode 100644 index 5866d8c4ee..0000000000 --- a/alexa-sdk/alexa-sdk.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -// 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: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module 'alexa-sdk' { - export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; - export function CreateStateHandler(state: string, obj: any): any; - export var StateString: string; - - interface AlexaObject { - _event: any; - _context: any; - _callback: any; - state: any; - appId: any; - response: any; - dynamoDBTableName: any; - saveBeforeResponse: boolean; - registerHandlers: (...handlers: Handlers[]) => any; - execute: () => void; - } - - interface Handlers { - [intent: string]: () => void; - } - - interface Handler { - on: any; - emit(event: string, ...args: any[]): boolean; - emitWithState: any; - state: any; - handler: any; - event: RequestBody; - attributes: any; - context: any; - name: any; - isOverriden: any; - } - - interface Context { - callbackWaitsForEmptyEventLoop: boolean; - logGroupName: string; - logStreamName: string; - functionName: string; - memoryLimitInMB: string; - functionVersion: string; - invokeid: string; - awsRequestId: string; - } - - interface RequestBody { - version: string; - session: Session; - request: LaunchRequest | IntentRequest | SessionEndedRequest; - } - - interface Session { - new: boolean; - sessionId: string; - attributes: any; - application: SessionApplication; - user: SessionUser; - } - - interface SessionApplication { - applicationId: string; - } - - interface SessionUser { - userId: string; - accessToken: string; - } - - interface LaunchRequest extends IRequest {} - - interface IntentRequest extends IRequest { - intent: Intent; - } - - interface Intent { - name: string; - slots: any; - } - - interface SessionEndedRequest extends IRequest{ - reason: string; - } - - interface IRequest { - type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; - requestId: string; - timeStamp: string; - } - - interface ResponseBody { - version: string; - sessionAttributes?: any; - response: Response; - } - - interface Response { - outputSpeech?: OutputSpeech; - card?: Card; - reprompt?: Reprompt; - shouldEndSession: boolean; - } - - interface OutputSpeech { - type: "PlainText" | "SSML"; - text?: string; - ssml?: string; - } - - interface Card { - type: "Simple" | "Standard" | "LinkAccount"; - title?: string; - content?: string; - text?: string; - image?: Image; - } - - interface Image { - smallImageUrl: string; - largeImageUrl: string; - } - - interface Reprompt { - outputSpeech: OutputSpeech; - } -} - diff --git a/alexa-sdk/index.d.ts b/alexa-sdk/index.d.ts new file mode 100644 index 0000000000..5c420ec1d3 --- /dev/null +++ b/alexa-sdk/index.d.ts @@ -0,0 +1,131 @@ +// 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: 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; + +interface AlexaObject { + _event: any; + _context: any; + _callback: any; + state: any; + appId: any; + response: any; + dynamoDBTableName: any; + saveBeforeResponse: boolean; + registerHandlers: (...handlers: Handlers[]) => any; + execute: () => void; +} + +interface Handlers { + [intent: string]: () => void; +} + +interface Handler { + on: any; + emit(event: string, ...args: any[]): boolean; + emitWithState: any; + state: any; + handler: any; + event: RequestBody; + attributes: any; + context: any; + name: any; + isOverriden: any; +} + +interface Context { + callbackWaitsForEmptyEventLoop: boolean; + logGroupName: string; + logStreamName: string; + functionName: string; + memoryLimitInMB: string; + functionVersion: string; + invokeid: string; + awsRequestId: string; +} + +interface RequestBody { + version: string; + session: Session; + request: LaunchRequest | IntentRequest | SessionEndedRequest; +} + +interface Session { + new: boolean; + sessionId: string; + attributes: any; + application: SessionApplication; + user: SessionUser; +} + +interface SessionApplication { + applicationId: string; +} + +interface SessionUser { + userId: string; + accessToken: string; +} + +interface LaunchRequest extends IRequest { } + +interface IntentRequest extends IRequest { + intent: Intent; +} + +interface Intent { + name: string; + slots: any; +} + +interface SessionEndedRequest extends IRequest { + reason: string; +} + +interface IRequest { + type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; + requestId: string; + timeStamp: string; +} + +interface ResponseBody { + version: string; + sessionAttributes?: any; + response: Response; +} + +interface Response { + outputSpeech?: OutputSpeech; + card?: Card; + reprompt?: Reprompt; + shouldEndSession: boolean; +} + +interface OutputSpeech { + type: "PlainText" | "SSML"; + text?: string; + ssml?: string; +} + +interface Card { + type: "Simple" | "Standard" | "LinkAccount"; + title?: string; + content?: string; + text?: string; + image?: Image; +} + +interface Image { + smallImageUrl: string; + largeImageUrl: string; +} + +interface Reprompt { + outputSpeech: OutputSpeech; +} + + diff --git a/alexa-sdk/tsconfig.json b/alexa-sdk/tsconfig.json new file mode 100644 index 0000000000..834836e163 --- /dev/null +++ b/alexa-sdk/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "alexa-sdk-tests.ts" + ] +} \ No newline at end of file