Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
Bump version to MINOR release 2.7.1-preview.1
Browse files Browse the repository at this point in the history
Sync version to 2.7.1

Change-Id: If0e3c8b85cc4d25babcecf389a19196f4b886bf2
  • Loading branch information
Canain committed Jun 6, 2019
2 parents a4e37a3 + 1d1f545 commit 95c397c
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 4,537 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist
package
package-lock.json
docs
yarn.lock
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ script
package
.nycrc.json
typedoc.json
package-lock.json
yarn.lock
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Actions on Google Client Library for Node.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"version": "2.7.0-preview.2",
"version": "2.7.1-preview.1",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
Expand All @@ -16,7 +16,7 @@
"build": "tsc",
"build:watch": "tsc -w",
"build:clean": "yarn clean:pack && yarn clean && yarn build",
"package": "yarn build:clean && yarn pack",
"package": "yarn build:clean && npm pack",
"test": "yarn build:clean && yarn lint && nyc ava --fail-fast",
"test:watch": "yarn build:clean && concurrently -rk \"yarn build:watch\" \"ava -w --fail-fast\"",
"test:ci": "yarn audit && yarn test",
Expand All @@ -43,6 +43,7 @@
"client library"
],
"devDependencies": {
"@gerrit0/typedoc": "^0.15.0",
"@types/sinon": "^4.3.3",
"ava": "^1.4.1",
"concurrently": "^3.5.1",
Expand All @@ -51,18 +52,16 @@
"sinon": "^6.0.0",
"tslint": "^5.9.1",
"tslint-eslint-rules": "^5.1.0",
"typedoc": "^0.14.2",
"typedoc-neo-theme": "^1.0.0",
"typedoc-plugin-external-module-map": "^0.1.0",
"typescript": "^3.2.0"
"typedoc-neo-theme": "^1.0.1",
"typescript": "~3.5.1"
},
"dependencies": {
"@types/aws-lambda": "^0.0.33",
"@types/debug": "^0.0.30",
"@types/express": "^4.11.1",
"@types/node": "^9.4.6",
"debug": "^3.1.0",
"google-auth-library": "^1.3.2",
"google-auth-library": "^1.6.1",
"googleapis": "^27.0.0"
}
}
2 changes: 1 addition & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ debug.log = info
export const deprecate = (feature: string, alternative: string) =>
info(`${feature} is *DEPRECATED*: ${alternative}`)

/** @hidden */
/** @public */
export interface JsonObject {
// tslint:disable-next-line:no-any JSON value can be anything
[key: string]: any
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,5 @@ export {
} from './service/smarthome'

export * from './service/smarthome/api/v1'

export { JsonObject } from './common'
23 changes: 11 additions & 12 deletions src/service/actionssdk/_test/actionssdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
ActionsSdkMiddleware,
ActionsSdkIntentHandler,
} from '../actionssdk'
import { Conversation, ActionsSdkConversation, Argument } from '..'
import { ActionsSdkConversation, Argument } from '..'
import * as Api from '../api/v2'
import { OAuth2Client } from 'google-auth-library'
import { clone } from '../../../common'
Expand Down Expand Up @@ -89,11 +89,10 @@ test('intent handler is invoked', (t) => {
const app = actionssdk()
let invoked = false

const intentHandler = (conv: Conversation<{}>) => {
app.intent('intent.foo', (conv) => {
invoked = true
return conv.ask('hello')
}
app.intent('intent.foo', intentHandler)
})

const promise = app.handler(buildRequest('NEW', 'intent.foo'), {})

Expand All @@ -108,18 +107,18 @@ test('fallback handler is invoked', t => {
let intentInvoked = false
let fallbackInvoked = false

const intentHandler = (conv: Conversation<{}>) => {
app.intent('intent.foo', (conv) => {
intentInvoked = true
return conv.ask('hello')
}
const fallbackHandler = (conv: Conversation<{}>) => {
})
app.intent('intent.bar', (conv) => {
intentInvoked = true
return conv.ask('hello')
})
app.fallback((conv) => {
fallbackInvoked = true
return conv.ask('fallback')
}

app.intent('intent.foo', intentHandler)
app.intent('intent.bar', intentHandler)
app.fallback(fallbackHandler)
})

const promise = app.handler(buildRequest('NEW', 'some.other.intent'), {})

Expand Down
5 changes: 3 additions & 2 deletions src/service/actionssdk/conv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import * as Api from './api/v2'
import { JsonObject } from '../../common'
import { Conversation, ConversationBaseOptions, ConversationOptionsInit } from './conversation'

/** @public */
Expand All @@ -41,8 +42,8 @@ const deserializeData = <TConvData>(

/** @public */
export class ActionsSdkConversation<
TConvData = {},
TUserStorage = {}
TConvData = JsonObject,
TUserStorage = JsonObject
> extends Conversation<TUserStorage> {
/** @public */
body: Api.GoogleActionsV2AppRequest
Expand Down
24 changes: 14 additions & 10 deletions src/service/dialogflow/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,24 @@ export class ContextValues<TContexts extends Contexts> {
const parameters = context.parameters!
if (isV1(context)) {
const lifespan = context.lifespan!
this.input[name] = {
name,
lifespan,
parameters,
}
Object.assign(this.input, {
[name]: {
name,
lifespan,
parameters,
},
})
continue
}
const lifespanCount = context.lifespanCount!
const find = /([^/]+)?$/.exec(name)
this.input[find ? find[0] : name] = {
name,
lifespan: lifespanCount!,
parameters,
}
Object.assign(this.input, {
[find ? find[0] : name]: {
name,
lifespan: lifespanCount!,
parameters,
},
})
}
this.output = {}
}
Expand Down
4 changes: 2 additions & 2 deletions src/service/dialogflow/conv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ const deserializeData = <TContexts extends Contexts, TConvData>(

/** @public */
export class DialogflowConversation<
TConvData = {},
TUserStorage = {},
TConvData = JsonObject,
TUserStorage = JsonObject,
TContexts extends Contexts = Contexts,
> extends Conversation<TUserStorage> {
/** @public */
Expand Down
29 changes: 8 additions & 21 deletions src/service/dialogflow/dialogflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@ export interface DialogflowIntentHandler<

/** @hidden */
export interface DialogflowIntentHandlers {
[event: string]: DialogflowIntentHandler<
Contexts,
{},
{},
DialogflowConversation<{}, {}>,
Parameters,
Argument
> | string | undefined
[event: string]: Function | string | undefined
}

/** @hidden */
Expand All @@ -81,29 +74,22 @@ export interface DialogflowHandlers<
> {
intents: DialogflowIntentHandlers
catcher: ExceptionHandler<TUserStorage, TConversation>
fallback?: DialogflowIntentHandler<
Contexts,
{},
{},
DialogflowConversation<{}, {}>,
Parameters,
Argument
> | string
fallback?: Function | string
}

/** @public */
export interface DialogflowMiddleware<
TConversationPlugin extends DialogflowConversation<{}, {}, Contexts>
TConversationPlugin extends DialogflowConversation
> {
(
/** @public */
conv: DialogflowConversation<{}, {}, Contexts>,
conv: DialogflowConversation,

/** @public */
framework: BuiltinFrameworkMetadata,
): (DialogflowConversation<{}, {}, Contexts> & TConversationPlugin) |
): (DialogflowConversation & TConversationPlugin) |
void |
Promise<DialogflowConversation<{}, {}, Contexts> & TConversationPlugin> |
Promise<DialogflowConversation & TConversationPlugin> |
Promise<void>
}

Expand Down Expand Up @@ -499,7 +485,8 @@ export const dialogflow: Dialogflow = <
await conv.user._verifyProfile(this._client!, this.auth!.client.id)
}
for (const middleware of this._middlewares) {
const result = middleware(conv, metadata)
// tslint:disable-next-line:no-any genericize Conversation type
const result = middleware(conv as any, metadata)
conv = (result instanceof DialogflowConversation ? result : ((await result) || conv)) as (
DialogflowConversation<TConvData, TUserStorage, TContexts>
)
Expand Down
Loading

0 comments on commit 95c397c

Please sign in to comment.