Skip to content

Commit

Permalink
Merge "Add @hidden tag to internals"
Browse files Browse the repository at this point in the history
  • Loading branch information
Canain authored and Gerrit Code Review committed Apr 25, 2018
2 parents fbf9dba + 7da5316 commit 9e878f5
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface AppOptions {
debug?: boolean
}

/** @hidden */
export interface ServiceBaseApp {
/** @public */
handler: StandardHandler
Expand All @@ -51,6 +52,7 @@ export interface BaseApp extends ServiceBaseApp {
debug: boolean
}

/** @hidden */
const create = (options?: AppOptions): BaseApp => ({
frameworks: Object.assign({}, builtin),
handler: () => Promise.reject(new Error('StandardHandler not set')),
Expand All @@ -60,6 +62,7 @@ const create = (options?: AppOptions): BaseApp => ({
debug: !!(options && options.debug),
})

/** @hidden */
export const attach = <TService>(
service: TService,
options?: AppOptions,
Expand Down
13 changes: 13 additions & 0 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,44 @@ import * as Debug from 'debug'

const name = 'actions-on-google'

/** @hidden */
export const debug = Debug(`${name}:debug`)

/** @hidden */
export const warn = Debug(`${name}:warn`)

/** @hidden */
export const error = console.error.bind(console) as typeof console.error

/** @hidden */
export const info = console.log.bind(console) as typeof console.log

warn.log = error
debug.log = info

/** @hidden */
export interface JsonObject {
// tslint:disable-next-line:no-any JSON value can be anything
[key: string]: any
}

/** @hidden */
export const values = <T>(o: { [key: string]: T }) => Object.keys(o).map(k => o[k])

/** @hidden */
export const clone = <T>(o: T): T => JSON.parse(JSON.stringify(o))

/** @hidden */
export const stringify =
(o: {}, override?: {}) => JSON.stringify(Object.assign(clone(o), override), null, 2)

/** @hidden */
export type ProtoAny<TType, TSpec> = { '@type': TType } & TSpec

/** @hidden */
export const toArray = <T>(a: T | T[]) => Array.isArray(a) ? a : [a]

/** @hidden */
export interface ApiClientObjectMap<TValue> {
[key: string]: TValue
}
2 changes: 2 additions & 0 deletions src/framework/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface ExpressHandler {
(request: Request, response: Response): void
}

/** @hidden */
export class Express implements Framework<ExpressHandler> {
handle(standard: StandardHandler) {
return (request: Request, response: Response) => {
Expand All @@ -51,4 +52,5 @@ export class Express implements Framework<ExpressHandler> {
}
}

/** @hidden */
export const express = new Express()
1 change: 1 addition & 0 deletions src/framework/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface BuiltinFrameworks extends Frameworks {
lambda: Lambda
}

/** @hidden */
export const builtin: BuiltinFrameworks = {
express,
lambda,
Expand Down
2 changes: 2 additions & 0 deletions src/framework/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface LambdaHandler {
(event: JsonObject, context: Context, callback: Callback): Promise<void>
}

/** @hidden */
export class Lambda implements Framework<LambdaHandler> {
handle(standard: StandardHandler) {
return async (event: JsonObject, context: Context, callback: Callback) => {
Expand Down Expand Up @@ -58,4 +59,5 @@ export class Lambda implements Framework<LambdaHandler> {
}
}

/** @hidden */
export const lambda = new Lambda()
2 changes: 2 additions & 0 deletions src/service/actionssdk/actionssdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface ActionsSdkIntentHandler<
): Promise<any> | any
}

/** @hidden */
export interface ActionSdkIntentHandlers {
[intent: string]: ActionsSdkIntentHandler<
{},
Expand All @@ -60,6 +61,7 @@ export interface ActionSdkIntentHandlers {
> | string | undefined
}

/** @hidden */
export interface ActionsSdkHandlers<
TConvData,
TUserStorage,
Expand Down
1 change: 1 addition & 0 deletions src/service/actionssdk/conversation/argument/argument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export interface ArgumentsParsed extends ArgumentsNamed {
[name: string]: Argument | undefined
}

/** @hidden */
export interface ArgumentsIndexable {
[key: string]: Argument
}
Expand Down
4 changes: 4 additions & 0 deletions src/service/actionssdk/conversation/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,20 @@ export type Response =
MediaObject |
Question<Intent, JsonObject>

/** @hidden */
export interface ConversationResponse {
richResponse: Api.GoogleActionsV2RichResponse
expectUserResponse: boolean
userStorage: string
expectedIntent?: Api.GoogleActionsV2ExpectedIntent
}

/** @hidden */
export interface ConversationOptionsInit<TUserStorage> {
storage?: TUserStorage
}

/** @hidden */
export interface ConversationOptions<TUserStorage> {
request: Api.GoogleActionsV2AppRequest
headers: Headers
Expand Down Expand Up @@ -376,6 +379,7 @@ export interface ExceptionHandler<
(conv: TConversation, error: Error): Promise<any> | any
}

/** @hidden */
export interface Traversed {
[key: string]: boolean
}
2 changes: 2 additions & 0 deletions src/service/actionssdk/conversation/question/option/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ export interface OptionItem {
image?: Api.GoogleActionsV2UiElementsImage
}

/** @hidden */
export interface ApiOptionItem extends Api.GoogleActionsV2UiElementsCarouselSelectCarouselItem { }

/** @hidden */
export const convert = (items: OptionItems) => Object.keys(items).map(key => {
const value = items[key]
if (typeof value === 'string') {
Expand Down
3 changes: 3 additions & 0 deletions src/service/dialogflow/conv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ import { Incoming } from './incoming'
const APP_DATA_CONTEXT = '_actions_on_google'
const APP_DATA_CONTEXT_LIFESPAN = 99

/** @hidden */
export interface SystemIntent {
intent: string
data: ProtoAny<string, JsonObject>
}

/** @hidden */
export interface GoogleAssistantResponse {
expectUserResponse: boolean
noInputPrompts?: ActionsApi.GoogleActionsV2SimpleResponse[]
Expand All @@ -40,6 +42,7 @@ export interface GoogleAssistantResponse {
userStorage?: string
}

/** @hidden */
export interface PayloadGoogle {
google: GoogleAssistantResponse
}
Expand Down
2 changes: 2 additions & 0 deletions src/service/dialogflow/dialogflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface DialogflowIntentHandler<
): Promise<any> | any
}

/** @hidden */
export interface DialogflowIntentHandlers {
[event: string]: DialogflowIntentHandler<
Contexts,
Expand All @@ -61,6 +62,7 @@ export interface DialogflowIntentHandlers {
> | string | undefined
}

/** @hidden */
export interface DialogflowHandlers<
TConvData,
TUserStorage,
Expand Down
3 changes: 2 additions & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"out": "docs",
"exclude": [
"**/_test/**/*.*",
"**/index.ts"
"**/index.ts",
"**/common.ts"
],
"ignoreCompilerErrors": true,
"disableOutputCheck": true,
Expand Down

0 comments on commit 9e878f5

Please sign in to comment.