mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge remote-tracking branch 'upstream/master' into reactstrap-exportProps
# Conflicts: # types/reactstrap/index.d.ts # types/reactstrap/lib/PopoverBody.d.ts # types/reactstrap/lib/PopoverHeader.d.ts
This commit is contained in:
commit
3369d2b9d2
13
types/actions-on-google/NOTICE
Normal file
13
types/actions-on-google/NOTICE
Normal file
@ -0,0 +1,13 @@
|
||||
License Notices:
|
||||
|
||||
The API definitions are from Actions on Google reference site [1] and actions-on-google library [2].
|
||||
The actions-on-google library is licensed under the Apache 2.0 License [3].
|
||||
|
||||
The code documentation is reproduced from work created and shared by Google [4]
|
||||
and used according to terms described in the Creative Commons 3.0 Attribution License [5].
|
||||
|
||||
[1] https://developers.google.com/actions/
|
||||
[2] https://github.com/actions-on-google/actions-on-google-nodejs
|
||||
[3] http://www.apache.org/licenses/LICENSE-2.0
|
||||
[4] https://developers.google.com/readme/policies/
|
||||
[5] http://creativecommons.org/licenses/by/3.0/
|
||||
33
types/actions-on-google/actions-on-google-tests.ts
Normal file
33
types/actions-on-google/actions-on-google-tests.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { ActionsSdkApp, ActionsSdkAppOptions, DialogflowApp, DialogflowAppOptions, AssistantApp,
|
||||
Responses, Transactions } from 'actions-on-google';
|
||||
import * as express from 'express';
|
||||
|
||||
function testActionsSdk(request: express.Request, response: express.Response) {
|
||||
const app = new ActionsSdkApp({request, response});
|
||||
const actionMap = new Map();
|
||||
actionMap.set(app.StandardIntents.MAIN, () => {
|
||||
const richResponse: Responses.RichResponse = app.buildRichResponse()
|
||||
.addSimpleResponse('Hello world')
|
||||
.addSuggestions(['foo', 'bar']);
|
||||
app.ask(richResponse);
|
||||
});
|
||||
app.handleRequest(actionMap);
|
||||
}
|
||||
|
||||
function testDialogflow(request: express.Request, response: express.Response) {
|
||||
const app = new DialogflowApp({request, response});
|
||||
const actionMap = new Map();
|
||||
actionMap.set(app.StandardIntents.MAIN, () => {
|
||||
const order: Transactions.Order = app.buildOrder('foo');
|
||||
app.askForTransactionDecision(order, {
|
||||
type: app.Transactions.PaymentType.PAYMENT_CARD,
|
||||
displayName: 'VISA-1234',
|
||||
deliveryAddressRequired: true
|
||||
});
|
||||
});
|
||||
app.handleRequest(actionMap);
|
||||
}
|
||||
|
||||
const expressApp = express();
|
||||
expressApp.get('/actionssdk', testActionsSdk);
|
||||
expressApp.get('/dialogflow', testDialogflow);
|
||||
390
types/actions-on-google/actions-sdk-app.d.ts
vendored
Normal file
390
types/actions-on-google/actions-sdk-app.d.ts
vendored
Normal file
@ -0,0 +1,390 @@
|
||||
import * as express from 'express';
|
||||
|
||||
import { AssistantApp } from './assistant-app';
|
||||
import { Carousel, List, RichResponse, SimpleResponse } from './response-builder';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Actions SDK support
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface ActionsSdkAppOptions {
|
||||
/** Express HTTP request object. */
|
||||
request: express.Request;
|
||||
/** Express HTTP response object. */
|
||||
response: express.Response;
|
||||
/** Function callback when session starts. */
|
||||
sessionStarted?(): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the class that handles the conversation API directly from Assistant,
|
||||
* providing implementation for all the methods available in the API.
|
||||
*/
|
||||
export class ActionsSdkApp extends AssistantApp {
|
||||
/**
|
||||
* Constructor for ActionsSdkApp object.
|
||||
* To be used in the Actions SDK HTTP endpoint logic.
|
||||
*
|
||||
* @example
|
||||
* const ActionsSdkApp = require('actions-on-google').ActionsSdkApp;
|
||||
* const app = new ActionsSdkApp({request: request, response: response,
|
||||
* sessionStarted:sessionStarted});
|
||||
*
|
||||
* @actionssdk
|
||||
*/
|
||||
constructor(options: ActionsSdkAppOptions);
|
||||
|
||||
/**
|
||||
* Validates whether request is from Assistant through signature verification.
|
||||
* Uses Google-Auth-Library to verify authorization token against given
|
||||
* Google Cloud Project ID. Auth token is given in request header with key,
|
||||
* "Authorization".
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request, response});
|
||||
* app.isRequestFromAssistant('nodejs-cloud-test-project-1234')
|
||||
* .then(() => {
|
||||
* app.ask('Hey there, thanks for stopping by!');
|
||||
* })
|
||||
* .catch(err => {
|
||||
* response.status(400).send();
|
||||
* });
|
||||
*
|
||||
* @param projectId Google Cloud Project ID for the Assistant app.
|
||||
* @return Promise resolving with google-auth-library LoginTicket
|
||||
* if request is from a valid source, otherwise rejects with the error reason
|
||||
* for an invalid token.
|
||||
* @actionssdk
|
||||
*/
|
||||
isRequestFromAssistant(projectId: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Gets the request Conversation API version.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
* const apiVersion = app.getApiVersion();
|
||||
*
|
||||
* @return Version value or null if no value.
|
||||
* @actionssdk
|
||||
*/
|
||||
getApiVersion(): string;
|
||||
|
||||
/**
|
||||
* Gets the user's raw input query.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
* app.tell('You said ' + app.getRawInput());
|
||||
*
|
||||
* @return User's raw query or null if no value.
|
||||
* @actionssdk
|
||||
*/
|
||||
getRawInput(): string;
|
||||
|
||||
/**
|
||||
* Gets previous JSON dialog state that the app sent to Assistant.
|
||||
* Alternatively, use the app.data field to store JSON values between requests.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
* const dialogState = app.getDialogState();
|
||||
*
|
||||
* @return JSON object provided to the Assistant in the previous
|
||||
* user turn or {} if no value.
|
||||
* @actionssdk
|
||||
*/
|
||||
getDialogState(): any;
|
||||
|
||||
/**
|
||||
* Gets the "versionLabel" specified inside the Action Package.
|
||||
* Used by app to do version control.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
* const actionVersionLabel = app.getActionVersionLabel();
|
||||
*
|
||||
* @return The specified version label or null if unspecified.
|
||||
* @actionssdk
|
||||
*/
|
||||
getActionVersionLabel(): string;
|
||||
|
||||
/**
|
||||
* Gets the unique conversation ID. It's a new ID for the initial query,
|
||||
* and stays the same until the end of the conversation.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
* const conversationId = app.getConversationId();
|
||||
*
|
||||
* @return Conversation ID or null if no value.
|
||||
* @actionssdk
|
||||
*/
|
||||
getConversationId(): string;
|
||||
|
||||
/**
|
||||
* Get the current intent. Alternatively, using a handler Map with
|
||||
* {@link AssistantApp#handleRequest|handleRequest}, the client library will
|
||||
* automatically handle the incoming intents.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
*
|
||||
* function responseHandler (app) {
|
||||
* const intent = app.getIntent();
|
||||
* switch (intent) {
|
||||
* case app.StandardIntents.MAIN:
|
||||
* const inputPrompt = app.buildInputPrompt(false, 'Welcome to action snippets! Say anything.');
|
||||
* app.ask(inputPrompt);
|
||||
* break;
|
||||
*
|
||||
* case app.StandardIntents.TEXT:
|
||||
* app.tell('You said ' + app.getRawInput());
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* app.handleRequest(responseHandler);
|
||||
*
|
||||
* @return Intent id or null if no value.
|
||||
* @actionssdk
|
||||
*/
|
||||
getIntent(): string;
|
||||
|
||||
/**
|
||||
* Get the argument value by name from the current intent. If the argument
|
||||
* is not a text argument, the entire argument object is returned.
|
||||
*
|
||||
* Note: If incoming request is using an API version under 2 (e.g. 'v1'),
|
||||
* the argument object will be in Proto2 format (snake_case, etc).
|
||||
*
|
||||
* @param argName Name of the argument.
|
||||
* @return Argument value matching argName
|
||||
* or null if no matching argument.
|
||||
* @actionssdk
|
||||
*/
|
||||
getArgument(argName: string): string;
|
||||
|
||||
/**
|
||||
* Returns the option key user chose from options response.
|
||||
*
|
||||
* @example
|
||||
* const app = new App({request: req, response: res});
|
||||
*
|
||||
* function pickOption (app) {
|
||||
* if (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {
|
||||
* app.askWithCarousel('Which of these looks good?',
|
||||
* app.buildCarousel().addItems(
|
||||
* app.buildOptionItem('another_choice', ['Another choice']).
|
||||
* setTitle('Another choice').setDescription('Choose me!')));
|
||||
* } else {
|
||||
* app.ask('What would you like?');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* function optionPicked (app) {
|
||||
* app.ask('You picked ' + app.getSelectedOption());
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(app.StandardIntents.TEXT, pickOption);
|
||||
* actionMap.set(app.StandardIntents.OPTION, optionPicked);
|
||||
*
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @return Option key of selected item. Null if no option selected or
|
||||
* if current intent is not OPTION intent.
|
||||
* @actionssdk
|
||||
*/
|
||||
getSelectedOption(): string;
|
||||
|
||||
/**
|
||||
* Asks to collect user's input; all user's queries need to be sent to
|
||||
* the app.
|
||||
* {@link https://developers.google.com/actions/policies/general-policies#user_experience|The guidelines when prompting the user for a response must be followed at all times}.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
*
|
||||
* function mainIntent (app) {
|
||||
* const inputPrompt = app.buildInputPrompt(true, '<speak>Hi! <break time="1"/> ' +
|
||||
* 'I can read out an ordinal like ' +
|
||||
* '<say-as interpret-as="ordinal">123</say-as>. Say a number.</speak>',
|
||||
* ['I didn\'t hear a number', 'If you\'re still there, what\'s the number?', 'What is the number?']);
|
||||
* app.ask(inputPrompt);
|
||||
* }
|
||||
*
|
||||
* function rawInput (app) {
|
||||
* if (app.getRawInput() === 'bye') {
|
||||
* app.tell('Goodbye!');
|
||||
* } else {
|
||||
* const inputPrompt = app.buildInputPrompt(true, '<speak>You said, <say-as interpret-as="ordinal">' +
|
||||
* app.getRawInput() + '</say-as></speak>',
|
||||
* ['I didn\'t hear a number', 'If you\'re still there, what\'s the number?', 'What is the number?']);
|
||||
* app.ask(inputPrompt);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(app.StandardIntents.MAIN, mainIntent);
|
||||
* actionMap.set(app.StandardIntents.TEXT, rawInput);
|
||||
*
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param inputPrompt Holding initial and
|
||||
* no-input prompts.
|
||||
* @param dialogState JSON object the app uses to hold dialog state that
|
||||
* will be circulated back by App.
|
||||
* @return The response that is sent to Assistant to ask user to provide input.
|
||||
* @actionssdk
|
||||
*/
|
||||
ask(inputPrompt: object | SimpleResponse | RichResponse, dialogState?: object): express.Response | null;
|
||||
|
||||
/**
|
||||
* Asks to collect user's input with a list.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request, response});
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.askWithlist('Which of these looks good?',
|
||||
* app.buildList('List title')
|
||||
* .addItems([
|
||||
* app.buildOptionItem(SELECTION_KEY_ONE,
|
||||
* ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
|
||||
* .setTitle('Number one'),
|
||||
* app.buildOptionItem(SELECTION_KEY_TWO,
|
||||
* ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
|
||||
* .setTitle('Number two'),
|
||||
* ]));
|
||||
* }
|
||||
*
|
||||
* function optionIntent (app) {
|
||||
* if (app.getSelectedOption() === SELECTION_KEY_ONE) {
|
||||
* app.tell('Number one is a great choice!');
|
||||
* } else {
|
||||
* app.tell('Number two is a great choice!');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(app.StandardIntents.TEXT, welcomeIntent);
|
||||
* actionMap.set(app.StandardIntents.OPTION, optionIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param inputPrompt Holding initial and
|
||||
* no-input prompts. Cannot contain basic card.
|
||||
* @param list List built with {@link AssistantApp#buildList|buildList}.
|
||||
* @param dialogState JSON object the app uses to hold dialog state that
|
||||
* will be circulated back by Assistant.
|
||||
* @return The response that is sent to Assistant to ask user to provide input.
|
||||
* @actionssdk
|
||||
*/
|
||||
askWithList(inputPrompt: object | SimpleResponse | RichResponse, list: List, dialogState?: object): express.Response | null;
|
||||
|
||||
/**
|
||||
* Asks to collect user's input with a carousel.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request, response});
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.askWithCarousel('Which of these looks good?',
|
||||
* app.buildCarousel()
|
||||
* .addItems([
|
||||
* app.buildOptionItem(SELECTION_KEY_ONE,
|
||||
* ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
|
||||
* .setTitle('Number one'),
|
||||
* app.buildOptionItem(SELECTION_KEY_TWO,
|
||||
* ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
|
||||
* .setTitle('Number two'),
|
||||
* ]));
|
||||
* }
|
||||
*
|
||||
* function optionIntent (app) {
|
||||
* if (app.getSelectedOption() === SELECTION_KEY_ONE) {
|
||||
* app.tell('Number one is a great choice!');
|
||||
* } else {
|
||||
* app.tell('Number two is a great choice!');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(app.StandardIntents.TEXT, welcomeIntent);
|
||||
* actionMap.set(app.StandardIntents.OPTION, optionIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param inputPrompt Holding initial and
|
||||
* no-input prompts. Cannot contain basic card.
|
||||
* @param carousel Carousel built with
|
||||
* {@link AssistantApp#buildCarousel|buildCarousel}.
|
||||
* @param dialogState JSON object the app uses to hold dialog state that
|
||||
* will be circulated back by Assistant.
|
||||
* @return The response that is sent to Assistant to ask user to provide input.
|
||||
* @actionssdk
|
||||
*/
|
||||
askWithCarousel(inputPrompt: object | SimpleResponse | RichResponse, carousel: Carousel, dialogState?: object): express.Response | null;
|
||||
|
||||
/**
|
||||
* Tells Assistant to render the speech response and close the mic.
|
||||
*
|
||||
* @example
|
||||
* const app = new ActionsSdkApp({request: request, response: response});
|
||||
*
|
||||
* function mainIntent (app) {
|
||||
* const inputPrompt = app.buildInputPrompt(true, '<speak>Hi! <break time="1"/> ' +
|
||||
* 'I can read out an ordinal like ' +
|
||||
* '<say-as interpret-as="ordinal">123</say-as>. Say a number.</speak>',
|
||||
* ['I didn\'t hear a number', 'If you\'re still there, what\'s the number?', 'What is the number?']);
|
||||
* app.ask(inputPrompt);
|
||||
* }
|
||||
*
|
||||
* function rawInput (app) {
|
||||
* if (app.getRawInput() === 'bye') {
|
||||
* app.tell('Goodbye!');
|
||||
* } else {
|
||||
* const inputPrompt = app.buildInputPrompt(true, '<speak>You said, <say-as interpret-as="ordinal">' +
|
||||
* app.getRawInput() + '</say-as></speak>',
|
||||
* ['I didn\'t hear a number', 'If you\'re still there, what\'s the number?', 'What is the number?']);
|
||||
* app.ask(inputPrompt);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(app.StandardIntents.MAIN, mainIntent);
|
||||
* actionMap.set(app.StandardIntents.TEXT, rawInput);
|
||||
*
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param textToSpeech Final response.
|
||||
* Spoken response can be SSML.
|
||||
* @return The HTTP response that is sent back to Assistant.
|
||||
* @actionssdk
|
||||
*/
|
||||
tell(textToSpeech: string | SimpleResponse | RichResponse): express.Response | null;
|
||||
|
||||
/**
|
||||
* Builds the {@link https://developers.google.com/actions/reference/conversation#InputPrompt|InputPrompt object}
|
||||
* from initial prompt and no-input prompts.
|
||||
*
|
||||
* The App needs one initial prompt to start the conversation. If there is no user response,
|
||||
* the App re-opens the mic and renders the no-input prompts three times
|
||||
* (one for each no-input prompt that was configured) to help the user
|
||||
* provide the right response.
|
||||
*
|
||||
* Note: we highly recommend app to provide all the prompts required here in order to ensure a
|
||||
* good user experience.
|
||||
*
|
||||
* @example
|
||||
* const inputPrompt = app.buildInputPrompt(false, 'Welcome to action snippets! Say a number.',
|
||||
* ['Say any number', 'Pick a number', 'What is the number?']);
|
||||
* app.ask(inputPrompt);
|
||||
*
|
||||
* @param isSsml Indicates whether the text to speech is SSML or not.
|
||||
* @param initialPrompt The initial prompt the App asks the user.
|
||||
* @param noInputs Array of re-prompts when the user does not respond (max 3).
|
||||
* @return.
|
||||
* @actionssdk
|
||||
*/
|
||||
buildInputPrompt(isSsml: boolean, initialPrompt: string, noInputs?: string[]): object;
|
||||
}
|
||||
1316
types/actions-on-google/assistant-app.d.ts
vendored
Normal file
1316
types/actions-on-google/assistant-app.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
571
types/actions-on-google/dialogflow-app.d.ts
vendored
Normal file
571
types/actions-on-google/dialogflow-app.d.ts
vendored
Normal file
@ -0,0 +1,571 @@
|
||||
import * as express from 'express';
|
||||
|
||||
import { AssistantApp } from './assistant-app';
|
||||
import { Carousel, List, RichResponse, SimpleResponse } from './response-builder';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Dialogflow support
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Dialogflow {@link https://dialogflow.com/docs/concept-contexts|Context}.
|
||||
*/
|
||||
export interface Context {
|
||||
/** Full name of the context. */
|
||||
name: string;
|
||||
/**
|
||||
* Parameters carried within this context.
|
||||
* See {@link https://dialogflow.com/docs/concept-actions#section-extracting-values-from-contexts|here}.
|
||||
*/
|
||||
parameters: object;
|
||||
/** Remaining number of intents */
|
||||
lifespan: number;
|
||||
}
|
||||
|
||||
export interface DialogflowAppOptions {
|
||||
/** Express HTTP request object. */
|
||||
request: express.Request;
|
||||
/** Express HTTP response object. */
|
||||
response: express.Response;
|
||||
/**
|
||||
* Function callback when session starts.
|
||||
* Only called if webhook is enabled for welcome/triggering intents, and
|
||||
* called from Web Simulator or Google Home device (i.e., not Dialogflow simulator).
|
||||
*/
|
||||
sessionStarted?(): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the class that handles the communication with Dialogflow's fulfillment API.
|
||||
*/
|
||||
export class DialogflowApp extends AssistantApp {
|
||||
/**
|
||||
* Constructor for DialogflowApp object.
|
||||
* To be used in the Dialogflow fulfillment webhook logic.
|
||||
*
|
||||
* @example
|
||||
* const DialogflowApp = require('actions-on-google').DialogflowApp;
|
||||
* const app = new DialogflowApp({request: request, response: response,
|
||||
* sessionStarted:sessionStarted});
|
||||
*
|
||||
* @dialogflow
|
||||
*/
|
||||
constructor(options: DialogflowAppOptions);
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Verifies whether the request comes from Dialogflow.
|
||||
*
|
||||
* @param key The header key specified by the developer in the
|
||||
* Dialogflow Fulfillment settings of the app.
|
||||
* @param value The private value specified by the developer inside the
|
||||
* fulfillment header.
|
||||
* @return True if the request comes from Dialogflow.
|
||||
* @dialogflow
|
||||
*/
|
||||
isRequestFromApiAi(key: string, value: string): boolean;
|
||||
|
||||
/**
|
||||
* Verifies whether the request comes from Dialogflow.
|
||||
*
|
||||
* @param key The header key specified by the developer in the
|
||||
* Dialogflow Fulfillment settings of the app.
|
||||
* @param value The private value specified by the developer inside the
|
||||
* fulfillment header.
|
||||
* @return True if the request comes from Dialogflow.
|
||||
* @dialogflow
|
||||
*/
|
||||
isRequestFromDialogflow(key: string, value: string): boolean;
|
||||
|
||||
/**
|
||||
* Get the current intent. Alternatively, using a handler Map with
|
||||
* {@link AssistantApp#handleRequest|handleRequest},
|
||||
* the client library will automatically handle the incoming intents.
|
||||
* 'Intent' in the Dialogflow context translates into the current action.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
*
|
||||
* function responseHandler (app) {
|
||||
* const intent = app.getIntent();
|
||||
* switch (intent) {
|
||||
* case WELCOME_INTENT:
|
||||
* app.ask('Welcome to action snippets! Say a number.');
|
||||
* break;
|
||||
*
|
||||
* case NUMBER_INTENT:
|
||||
* const number = app.getArgument(NUMBER_ARGUMENT);
|
||||
* app.tell('You said ' + number);
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* app.handleRequest(responseHandler);
|
||||
*
|
||||
* @return Intent id or null if no value (action name).
|
||||
* @dialogflow
|
||||
*/
|
||||
getIntent(): string;
|
||||
|
||||
/**
|
||||
* Get the argument value by name from the current intent. If the argument
|
||||
* is included in originalRequest, and is not a text argument, the entire
|
||||
* argument object is returned.
|
||||
*
|
||||
* Note: If incoming request is using an API version under 2 (e.g. 'v1'),
|
||||
* the argument object will be in Proto2 format (snake_case, etc).
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* const WELCOME_INTENT = 'input.welcome';
|
||||
* const NUMBER_INTENT = 'input.number';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.ask('Welcome to action snippets! Say a number.');
|
||||
* }
|
||||
*
|
||||
* function numberIntent (app) {
|
||||
* const number = app.getArgument(NUMBER_ARGUMENT);
|
||||
* app.tell('You said ' + number);
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(NUMBER_INTENT, numberIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param argName Name of the argument.
|
||||
* @return Argument value matching argName
|
||||
* or null if no matching argument.
|
||||
* @dialogflow
|
||||
*/
|
||||
getArgument(argName: string): object;
|
||||
|
||||
/**
|
||||
* Get the context argument value by name from the current intent. Context
|
||||
* arguments include parameters collected in previous intents during the
|
||||
* lifespan of the given context. If the context argument has an original
|
||||
* value, usually representing the underlying entity value, that will be given
|
||||
* as part of the return object.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* const WELCOME_INTENT = 'input.welcome';
|
||||
* const NUMBER_INTENT = 'input.number';
|
||||
* const OUT_CONTEXT = 'output_context';
|
||||
* const NUMBER_ARG = 'myNumberArg';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* const parameters = {};
|
||||
* parameters[NUMBER_ARG] = '42';
|
||||
* app.setContext(OUT_CONTEXT, 1, parameters);
|
||||
* app.ask('Welcome to action snippets! Ask me for your number.');
|
||||
* }
|
||||
*
|
||||
* function numberIntent (app) {
|
||||
* const number = app.getContextArgument(OUT_CONTEXT, NUMBER_ARG);
|
||||
* // number === { value: 42 }
|
||||
* app.tell('Your number is ' + number.value);
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(NUMBER_INTENT, numberIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param contextName Name of the context.
|
||||
* @param argName Name of the argument.
|
||||
* @return Object containing value property and optional original
|
||||
* property matching context argument. Null if no matching argument.
|
||||
* @dialogflow
|
||||
*/
|
||||
getContextArgument(contextName: string, argName: string): object;
|
||||
|
||||
/**
|
||||
* Returns the RichResponse constructed in Dialogflow response builder.
|
||||
*
|
||||
* @example
|
||||
* const app = new App({request: req, response: res});
|
||||
*
|
||||
* function tellFact (app) {
|
||||
* let fact = 'Google was founded in 1998';
|
||||
*
|
||||
* if (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {
|
||||
* app.ask(app.getIncomingRichResponse().addSimpleResponse('Here\'s a ' +
|
||||
* 'fact for you. ' + fact + ' Which one do you want to hear about ' +
|
||||
* 'next, Google\'s history or headquarters?'));
|
||||
* } else {
|
||||
* app.ask('Here\'s a fact for you. ' + fact + ' Which one ' +
|
||||
* 'do you want to hear about next, Google\'s history or headquarters?');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set('tell.fact', tellFact);
|
||||
*
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @return RichResponse created in Dialogflow. If no RichResponse was
|
||||
* created, an empty RichResponse is returned.
|
||||
* @dialogflow
|
||||
*/
|
||||
getIncomingRichResponse(): RichResponse;
|
||||
|
||||
/**
|
||||
* Returns the List constructed in Dialogflow response builder.
|
||||
*
|
||||
* @example
|
||||
* const app = new App({request: req, response: res});
|
||||
*
|
||||
* function pickOption (app) {
|
||||
* if (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {
|
||||
* app.askWithList('Which of these looks good?',
|
||||
* app.getIncomingList().addItems(
|
||||
* app.buildOptionItem('another_choice', ['Another choice']).
|
||||
* setTitle('Another choice')));
|
||||
* } else {
|
||||
* app.ask('What would you like?');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set('pick.option', pickOption);
|
||||
*
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @return List created in Dialogflow. If no List was created, an empty
|
||||
* List is returned.
|
||||
* @dialogflow
|
||||
*/
|
||||
getIncomingList(): List;
|
||||
|
||||
/**
|
||||
* Returns the Carousel constructed in Dialogflow response builder.
|
||||
*
|
||||
* @example
|
||||
* const app = new App({request: req, response: res});
|
||||
*
|
||||
* function pickOption (app) {
|
||||
* if (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {
|
||||
* app.askWithCarousel('Which of these looks good?',
|
||||
* app.getIncomingCarousel().addItems(
|
||||
* app.buildOptionItem('another_choice', ['Another choice']).
|
||||
* setTitle('Another choice').setDescription('Choose me!')));
|
||||
* } else {
|
||||
* app.ask('What would you like?');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set('pick.option', pickOption);
|
||||
*
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @return Carousel created in Dialogflow. If no Carousel was created,
|
||||
* an empty Carousel is returned.
|
||||
* @dialogflow
|
||||
*/
|
||||
getIncomingCarousel(): Carousel;
|
||||
|
||||
/**
|
||||
* Returns the option key user chose from options response.
|
||||
*
|
||||
* @example
|
||||
* const app = new App({request: req, response: res});
|
||||
*
|
||||
* function pickOption (app) {
|
||||
* if (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {
|
||||
* app.askWithCarousel('Which of these looks good?',
|
||||
* app.getIncomingCarousel().addItems(
|
||||
* app.buildOptionItem('another_choice', ['Another choice']).
|
||||
* setTitle('Another choice').setDescription('Choose me!')));
|
||||
* } else {
|
||||
* app.ask('What would you like?');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* function optionPicked (app) {
|
||||
* app.ask('You picked ' + app.getSelectedOption());
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set('pick.option', pickOption);
|
||||
* actionMap.set('option.picked', optionPicked);
|
||||
*
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @return Option key of selected item. Null if no option selected or
|
||||
* if current intent is not OPTION intent.
|
||||
* @dialogflow
|
||||
*/
|
||||
getSelectedOption(): string;
|
||||
|
||||
/**
|
||||
* Asks to collect the user's input.
|
||||
* {@link https://developers.google.com/actions/policies/general-policies#user_experience|The guidelines when prompting the user for a response must be followed at all times}.
|
||||
*
|
||||
* NOTE: Due to a bug, if you specify the no-input prompts,
|
||||
* the mic is closed after the 3rd prompt, so you should use the 3rd prompt
|
||||
* for a bye message until the bug is fixed.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* const WELCOME_INTENT = 'input.welcome';
|
||||
* const NUMBER_INTENT = 'input.number';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.ask('Welcome to action snippets! Say a number.',
|
||||
* ['Say any number', 'Pick a number', 'We can stop here. See you soon.']);
|
||||
* }
|
||||
*
|
||||
* function numberIntent (app) {
|
||||
* const number = app.getArgument(NUMBER_ARGUMENT);
|
||||
* app.tell('You said ' + number);
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(NUMBER_INTENT, numberIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param inputPrompt The input prompt
|
||||
* response.
|
||||
* @param noInputs Array of re-prompts when the user does not respond (max 3).
|
||||
* @return HTTP response.
|
||||
* @dialogflow
|
||||
*/
|
||||
ask(inputPrompt: string | SimpleResponse | RichResponse, noInputs?: string[]): express.Response | null;
|
||||
|
||||
/**
|
||||
* Asks to collect the user's input with a list.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request, response});
|
||||
* const WELCOME_INTENT = 'input.welcome';
|
||||
* const OPTION_INTENT = 'option.select';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.askWithList('Which of these looks good?',
|
||||
* app.buildList('List title')
|
||||
* .addItems([
|
||||
* app.buildOptionItem(SELECTION_KEY_ONE,
|
||||
* ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
|
||||
* .setTitle('Title of First List Item'),
|
||||
* app.buildOptionItem(SELECTION_KEY_TWO,
|
||||
* ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
|
||||
* .setTitle('Title of Second List Item'),
|
||||
* ]));
|
||||
* }
|
||||
*
|
||||
* function optionIntent (app) {
|
||||
* if (app.getSelectedOption() === SELECTION_KEY_ONE) {
|
||||
* app.tell('Number one is a great choice!');
|
||||
* } else {
|
||||
* app.tell('Number two is a great choice!');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(OPTION_INTENT, optionIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param inputPrompt The input prompt
|
||||
* response.
|
||||
* @param.list List built with {@link AssistantApp#buildList|buildList}
|
||||
* @return HTTP response.
|
||||
* @dialogflow
|
||||
*/
|
||||
askWithList(inputPrompt: string | RichResponse | SimpleResponse, list: List): express.Response | null;
|
||||
|
||||
/**
|
||||
* Asks to collect the user's input with a carousel.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request, response});
|
||||
* const WELCOME_INTENT = 'input.welcome';
|
||||
* const OPTION_INTENT = 'option.select';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.askWithCarousel('Which of these looks good?',
|
||||
* app.buildCarousel()
|
||||
* .addItems([
|
||||
* app.buildOptionItem(SELECTION_KEY_ONE,
|
||||
* ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
|
||||
* .setTitle('Number one'),
|
||||
* app.buildOptionItem(SELECTION_KEY_TWO,
|
||||
* ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
|
||||
* .setTitle('Number two'),
|
||||
* ]));
|
||||
* }
|
||||
*
|
||||
* function optionIntent (app) {
|
||||
* if (app.getSelectedOption() === SELECTION_KEY_ONE) {
|
||||
* app.tell('Number one is a great choice!');
|
||||
* } else {
|
||||
* app.tell('Number two is a great choice!');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(OPTION_INTENT, optionIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param inputPrompt The input prompt
|
||||
* response.
|
||||
* @param carousel Carousel built with
|
||||
* {@link AssistantApp#buildCarousel|buildCarousel}.
|
||||
* @return HTTP response.
|
||||
* @dialogflow
|
||||
*/
|
||||
askWithCarousel(inputPrompt: string | RichResponse | SimpleResponse, carousel: Carousel): express.Response | null;
|
||||
|
||||
/**
|
||||
* Tells the Assistant to render the speech response and close the mic.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* const WELCOME_INTENT = 'input.welcome';
|
||||
* const NUMBER_INTENT = 'input.number';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.ask('Welcome to action snippets! Say a number.');
|
||||
* }
|
||||
*
|
||||
* function numberIntent (app) {
|
||||
* const number = app.getArgument(NUMBER_ARGUMENT);
|
||||
* app.tell('You said ' + number);
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(NUMBER_INTENT, numberIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param speechResponse Final response.
|
||||
* Spoken response can be SSML.
|
||||
* @return The response that is sent back to Assistant.
|
||||
* @dialogflow
|
||||
*/
|
||||
tell(speechResponse: string | SimpleResponse | RichResponse): express.Response | null;
|
||||
|
||||
/**
|
||||
* Set a new context for the current intent.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* const CONTEXT_NUMBER = 'number';
|
||||
* const NUMBER_ARGUMENT = 'myNumber';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.setContext(CONTEXT_NUMBER);
|
||||
* app.ask('Welcome to action snippets! Say a number.');
|
||||
* }
|
||||
*
|
||||
* function numberIntent (app) {
|
||||
* const number = app.getArgument(NUMBER_ARGUMENT);
|
||||
* app.tell('You said ' + number);
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(NUMBER_INTENT, numberIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param name Name of the context. Dialogflow converts to lowercase.
|
||||
* @param [lifespan=1] Context lifespan.
|
||||
* @param parameters Context JSON parameters.
|
||||
* @return Null if the context name is not defined.
|
||||
* @dialogflow
|
||||
*/
|
||||
setContext(name: string, lifespan?: number, parameters?: any): null | undefined;
|
||||
|
||||
/**
|
||||
* Returns the incoming contexts for this intent.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* const CONTEXT_NUMBER = 'number';
|
||||
* const NUMBER_ARGUMENT = 'myNumber';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.setContext(CONTEXT_NUMBER);
|
||||
* app.ask('Welcome to action snippets! Say a number.');
|
||||
* }
|
||||
*
|
||||
* function numberIntent (app) {
|
||||
* let contexts = app.getContexts();
|
||||
* // contexts === [{
|
||||
* // name: 'number',
|
||||
* // lifespan: 0,
|
||||
* // parameters: {
|
||||
* // myNumber: '23',
|
||||
* // myNumber.original: '23'
|
||||
* // }
|
||||
* // }]
|
||||
* const number = app.getArgument(NUMBER_ARGUMENT);
|
||||
* app.tell('You said ' + number);
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(NUMBER_INTENT, numberIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @return Empty if no active contexts.
|
||||
* @dialogflow
|
||||
*/
|
||||
getContexts(): Context[];
|
||||
|
||||
/**
|
||||
* Returns the incoming context by name for this intent.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* const CONTEXT_NUMBER = 'number';
|
||||
* const NUMBER_ARGUMENT = 'myNumber';
|
||||
*
|
||||
* function welcomeIntent (app) {
|
||||
* app.setContext(CONTEXT_NUMBER);
|
||||
* app.ask('Welcome to action snippets! Say a number.');
|
||||
* }
|
||||
*
|
||||
* function numberIntent (app) {
|
||||
* let context = app.getContext(CONTEXT_NUMBER);
|
||||
* // context === {
|
||||
* // name: 'number',
|
||||
* // lifespan: 0,
|
||||
* // parameters: {
|
||||
* // myNumber: '23',
|
||||
* // myNumber.original: '23'
|
||||
* // }
|
||||
* // }
|
||||
* const number = app.getArgument(NUMBER_ARGUMENT);
|
||||
* app.tell('You said ' + number);
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_INTENT, welcomeIntent);
|
||||
* actionMap.set(NUMBER_INTENT, numberIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param name The name of the Context to retrieve.
|
||||
* @return Context value matching name
|
||||
* or null if no matching context.
|
||||
* @dialogflow
|
||||
*/
|
||||
getContext(name: string): object;
|
||||
|
||||
/**
|
||||
* Gets the user's raw input query.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
* app.tell('You said ' + app.getRawInput());
|
||||
*
|
||||
* @return User's raw query or null if no value.
|
||||
* @dialogflow
|
||||
*/
|
||||
getRawInput(): string;
|
||||
}
|
||||
24
types/actions-on-google/index.d.ts
vendored
Normal file
24
types/actions-on-google/index.d.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// Type definitions for actions-on-google 1.5
|
||||
// Project: https://github.com/actions-on-google/actions-on-google-nodejs
|
||||
// Definitions by: Joel Hegg <https://github.com/joelhegg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/**
|
||||
* The Actions on Google client library.
|
||||
* https://developers.google.com/actions/
|
||||
*/
|
||||
|
||||
import * as Transactions from './transactions';
|
||||
import * as Responses from './response-builder';
|
||||
|
||||
export { AssistantApp } from './assistant-app';
|
||||
export { ActionsSdkApp, ActionsSdkAppOptions } from './actions-sdk-app';
|
||||
export { DialogflowApp, DialogflowAppOptions } from './dialogflow-app';
|
||||
export { Transactions };
|
||||
export { Responses };
|
||||
// Backwards compatibility
|
||||
export { AssistantApp as Assistant } from './assistant-app';
|
||||
export { ActionsSdkApp as ActionsSdkAssistant } from './actions-sdk-app';
|
||||
export { DialogflowApp as ApiAiAssistant } from './dialogflow-app';
|
||||
export { DialogflowApp as ApiAiApp } from './dialogflow-app';
|
||||
386
types/actions-on-google/response-builder.d.ts
vendored
Normal file
386
types/actions-on-google/response-builder.d.ts
vendored
Normal file
@ -0,0 +1,386 @@
|
||||
/**
|
||||
* A collection of response builders.
|
||||
*/
|
||||
|
||||
import { OrderUpdate } from './transactions';
|
||||
|
||||
/**
|
||||
* Simple Response type.
|
||||
*/
|
||||
export interface SimpleResponse {
|
||||
/** Speech to be spoken to user. SSML allowed. */
|
||||
speech: string;
|
||||
/** Optional text to be shown to user */
|
||||
displayText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suggestions to show with response.
|
||||
*/
|
||||
export interface Suggestion {
|
||||
/** Text of the suggestion. */
|
||||
title: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link Out Suggestion. Used in rich response as a suggestion chip which, when
|
||||
* selected, links out to external URL.
|
||||
*/
|
||||
export interface LinkOutSuggestion {
|
||||
/** Text shown on the suggestion chip. */
|
||||
title: string;
|
||||
/** String URL to open. */
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Image type shown on visual elements.
|
||||
*/
|
||||
export interface Image {
|
||||
/** Image source URL. */
|
||||
url: string;
|
||||
/** Text to replace for image for accessibility. */
|
||||
accessibilityText: string;
|
||||
/** Width of the image. */
|
||||
width: number;
|
||||
/** Height of the image. */
|
||||
height: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic Card Button. Shown below basic cards. Open a URL when selected.
|
||||
*/
|
||||
export interface Button {
|
||||
/** Text shown on the button. */
|
||||
title: string;
|
||||
/** Action to take when selected. */
|
||||
openUrlAction: {
|
||||
/** String URL to open. */
|
||||
url: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Option info. Provides unique identifier for a given OptionItem.
|
||||
*/
|
||||
export interface OptionInfo {
|
||||
/** Unique string ID for this option. */
|
||||
key: string;
|
||||
/** Synonyms that can be used by the user to indicate this option if they do not use the key. */
|
||||
synonyms: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing Rich Responses with chainable interface.
|
||||
*/
|
||||
export class RichResponse {
|
||||
/**
|
||||
* Constructor for RichResponse. Accepts optional RichResponse to clone.
|
||||
*
|
||||
* @param richResponse Optional RichResponse to clone.
|
||||
*/
|
||||
constructor(richResponse?: RichResponse);
|
||||
|
||||
/**
|
||||
* Ordered list of either SimpleResponse objects or BasicCard objects.
|
||||
* First item must be SimpleResponse. There can be at most one card.
|
||||
*/
|
||||
items: Array<SimpleResponse | BasicCard>;
|
||||
|
||||
/**
|
||||
* Ordered list of text suggestions to display. Optional.
|
||||
*/
|
||||
suggestions: Suggestion[];
|
||||
|
||||
/**
|
||||
* Link Out Suggestion chip for this rich response. Optional.
|
||||
*/
|
||||
linkOutSuggestion?: LinkOutSuggestion;
|
||||
|
||||
/**
|
||||
* Adds a SimpleResponse to list of items.
|
||||
*
|
||||
* @param simpleResponse Simple response to present to
|
||||
* user. If just a string, display text will not be set.
|
||||
* @return Returns current constructed RichResponse.
|
||||
*/
|
||||
addSimpleResponse(simpleResponse: string | SimpleResponse): RichResponse;
|
||||
|
||||
/**
|
||||
* Adds a BasicCard to list of items.
|
||||
*
|
||||
* @param basicCard Basic card to include in response.
|
||||
* @return Returns current constructed RichResponse.
|
||||
*/
|
||||
addBasicCard(basicCard: BasicCard): RichResponse;
|
||||
|
||||
/**
|
||||
* Adds a single suggestion or list of suggestions to list of items.
|
||||
*
|
||||
* @param suggestions Either a single string suggestion
|
||||
* or list of suggestions to add.
|
||||
* @return Returns current constructed RichResponse.
|
||||
*/
|
||||
addSuggestions(suggestions: string | string[]): RichResponse;
|
||||
|
||||
/**
|
||||
* Returns true if the given suggestion text is valid to be added to the suggestion list. A valid
|
||||
* text string is not longer than 25 characters.
|
||||
* @param suggestionText Text to validate as suggestion.
|
||||
* @return True if the text is valid, false otherwise.s
|
||||
*/
|
||||
isValidSuggestionText(suggestionText: string): boolean;
|
||||
|
||||
/**
|
||||
* Sets the suggestion link for this rich response.
|
||||
*
|
||||
* @param destinationName Name of the link out destination.
|
||||
* @param suggestionUrl - String URL to open when suggestion is used.
|
||||
* @return Returns current constructed RichResponse.
|
||||
*/
|
||||
addSuggestionLink(destinationName: string, suggestionUrl: string): RichResponse;
|
||||
|
||||
/**
|
||||
* Adds an order update to this response. Use after a successful transaction
|
||||
* decision to confirm the order.
|
||||
*
|
||||
* @param orderUpdate OrderUpdate object to add.
|
||||
* @return Returns current constructed RichResponse.
|
||||
*/
|
||||
addOrderUpdate(orderUpdate: OrderUpdate): RichResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing Basic Cards with chainable interface.
|
||||
*/
|
||||
export class BasicCard {
|
||||
/**
|
||||
* Constructor for BasicCard. Accepts optional BasicCard to clone.
|
||||
*
|
||||
* @param basicCard Optional BasicCard to clone.
|
||||
*/
|
||||
constructor(basicCard?: BasicCard);
|
||||
|
||||
/**
|
||||
* Title of the card. Optional.
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Body text to show on the card. Required, unless image is present.
|
||||
*/
|
||||
formattedText: string;
|
||||
|
||||
/**
|
||||
* Subtitle of the card. Optional.
|
||||
*/
|
||||
subtitle?: string;
|
||||
|
||||
/**
|
||||
* Image to show on the card. Optional.
|
||||
*/
|
||||
image?: Image;
|
||||
|
||||
/**
|
||||
* Ordered list of buttons to show below card. Optional.
|
||||
*/
|
||||
buttons: Button[];
|
||||
|
||||
/**
|
||||
* Sets the title for this Basic Card.
|
||||
*
|
||||
* @param title Title to show on card.
|
||||
* @return Returns current constructed BasicCard.
|
||||
*/
|
||||
setTitle(title: string): BasicCard;
|
||||
|
||||
/**
|
||||
* Sets the subtitle for this Basic Card.
|
||||
*
|
||||
* @param subtitle Subtitle to show on card.
|
||||
* @return Returns current constructed BasicCard.
|
||||
*/
|
||||
setSubtitle(subtitle: string): BasicCard;
|
||||
|
||||
/**
|
||||
* Sets the body text for this Basic Card.
|
||||
*
|
||||
* @param bodyText Body text to show on card.
|
||||
* @return Returns current constructed BasicCard.
|
||||
*/
|
||||
setBodyText(bodyText: string): BasicCard;
|
||||
|
||||
/**
|
||||
* Sets the image for this Basic Card.
|
||||
*
|
||||
* @param url Image source URL.
|
||||
* @param accessibilityText Text to replace for image for
|
||||
* accessibility.
|
||||
* @param width Width of the image.
|
||||
* @param height Height of the image.
|
||||
* @return Returns current constructed BasicCard.
|
||||
*/
|
||||
setImage(url: string, accessibilityText: string, width?: number, height?: number): BasicCard;
|
||||
|
||||
/**
|
||||
* Adds a button below card.
|
||||
*
|
||||
* @param text Text to show on button.
|
||||
* @param url URL to open when button is selected.
|
||||
* @return Returns current constructed BasicCard.
|
||||
*/
|
||||
addButton(text: string, url: string): BasicCard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing Lists with chainable interface.
|
||||
*/
|
||||
export class List {
|
||||
/**
|
||||
* Constructor for List. Accepts optional List to clone, string title, or
|
||||
* list of items to copy.
|
||||
*
|
||||
* @param list Either a list to clone, a title
|
||||
* to set for a new List, or an array of OptionItem to initialize a new
|
||||
* list.
|
||||
*/
|
||||
constructor(list?: List | string | OptionItem[]);
|
||||
|
||||
/**
|
||||
* Title of the list. Optional.
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* List of 2-20 items to show in this list. Required.
|
||||
*/
|
||||
items: OptionItem[];
|
||||
|
||||
/**
|
||||
* Sets the title for this List.
|
||||
*
|
||||
* @param title Title to show on list.
|
||||
* @return Returns current constructed List.
|
||||
*/
|
||||
setTitle(title: string): List;
|
||||
|
||||
/**
|
||||
* Adds a single item or list of items to the list.
|
||||
*
|
||||
* @param optionItems OptionItems to add.
|
||||
* @return Returns current constructed List.
|
||||
*/
|
||||
addItems(optionItems: OptionItem | OptionItem[]): List;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing Carousel with chainable interface.
|
||||
*/
|
||||
export class Carousel {
|
||||
/**
|
||||
* Constructor for Carousel. Accepts optional Carousel to clone or list of
|
||||
* items to copy.
|
||||
*
|
||||
* @param carousel Either a carousel to clone
|
||||
* or an array of OptionItem to initialize a new carousel
|
||||
*/
|
||||
constructor(carousel?: Carousel | OptionItem[]);
|
||||
|
||||
/**
|
||||
* List of 2-20 items to show in this carousel. Required.
|
||||
*/
|
||||
items: OptionItem[];
|
||||
|
||||
/**
|
||||
* Adds a single item or list of items to the carousel.
|
||||
*
|
||||
* @param optionItems OptionItems to add.
|
||||
* @return Returns current constructed Carousel.
|
||||
*/
|
||||
addItems(optionItems: OptionItem | OptionItem[]): Carousel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing Option Items with chainable interface.
|
||||
*/
|
||||
export class OptionItem {
|
||||
/**
|
||||
* Constructor for OptionItem. Accepts optional OptionItem to clone.
|
||||
*
|
||||
* @param optionItem Optional OptionItem to clone.
|
||||
*/
|
||||
constructor(optionItem?: OptionItem);
|
||||
|
||||
/**
|
||||
* Option info of the option item. Required.
|
||||
*/
|
||||
optionInfo: OptionInfo;
|
||||
|
||||
/**
|
||||
* Title of the option item. Required.
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Description text of the item. Optional.
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Image to show on item. Optional.
|
||||
*/
|
||||
image?: Image;
|
||||
|
||||
/**
|
||||
* Sets the title for this Option Item.
|
||||
*
|
||||
* @param title Title to show on item.
|
||||
* @return Returns current constructed OptionItem.
|
||||
*/
|
||||
setTitle(title: string): OptionItem;
|
||||
|
||||
/**
|
||||
* Sets the description for this Option Item.
|
||||
*
|
||||
* @param description Description to show on item.
|
||||
* @return Returns current constructed OptionItem.
|
||||
*/
|
||||
setDescription(description: string): OptionItem;
|
||||
|
||||
/**
|
||||
* Sets the image for this Option Item.
|
||||
*
|
||||
* @param url Image source URL.
|
||||
* @param accessibilityText Text to replace for image for
|
||||
* accessibility.
|
||||
* @param width Width of the image.
|
||||
* @param height Height of the image.
|
||||
* @return Returns current constructed OptionItem.
|
||||
*/
|
||||
setImage(url: string, accessibilityText: string, width?: number, height?: number): OptionItem;
|
||||
|
||||
/**
|
||||
* Sets the key for the OptionInfo of this Option Item. This will be returned
|
||||
* as an argument in the resulting actions.intent.OPTION intent.
|
||||
*
|
||||
* @param key Key to uniquely identify this item.
|
||||
* @return Returns current constructed OptionItem.
|
||||
*/
|
||||
setKey(key: string): OptionItem;
|
||||
|
||||
/**
|
||||
* Adds a single synonym or list of synonyms to item.
|
||||
*
|
||||
* @param synonyms Either a single string synonyms
|
||||
* or list of synonyms to add.
|
||||
* @return Returns current constructed OptionItem.
|
||||
*/
|
||||
addSynonyms(synonyms: string | string[]): OptionItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given text contains SSML.
|
||||
* @param text Text to check.
|
||||
* @return True if text contains SSML, false otherwise.
|
||||
*/
|
||||
export function isSsml(text: string): boolean;
|
||||
1023
types/actions-on-google/transactions.d.ts
vendored
Normal file
1023
types/actions-on-google/transactions.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
types/actions-on-google/tsconfig.json
Normal file
28
types/actions-on-google/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"assistant-app.d.ts",
|
||||
"actions-sdk-app.d.ts",
|
||||
"dialogflow-app.d.ts",
|
||||
"response-builder.d.ts",
|
||||
"transactions.d.ts",
|
||||
"actions-on-google-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/actions-on-google/tslint.json
Normal file
1
types/actions-on-google/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
28
types/atom/index.d.ts
vendored
28
types/atom/index.d.ts
vendored
@ -137,11 +137,11 @@ export interface AtomEnvironment {
|
||||
|
||||
// Managing the Atom Window
|
||||
/** Open a new Atom window using the given options. */
|
||||
open(params: {
|
||||
open(params?: {
|
||||
pathsToOpen: ReadonlyArray<string>,
|
||||
newWindow: boolean,
|
||||
devMode: boolean,
|
||||
safeMode: boolean,
|
||||
newWindow?: boolean,
|
||||
devMode?: boolean,
|
||||
safeMode?: boolean,
|
||||
}): void;
|
||||
|
||||
/** Close the current window. */
|
||||
@ -270,15 +270,18 @@ export interface CommandRegistry {
|
||||
}): CompositeDisposable;
|
||||
|
||||
/** Find all registered commands matching a query. */
|
||||
findCommands(params: { target: Node }): Array<{
|
||||
findCommands(params: { target: string|Node }): Array<{
|
||||
name: string,
|
||||
displayName: string,
|
||||
description?: string,
|
||||
tags?: string[],
|
||||
}>;
|
||||
|
||||
/** Simulate the dispatch of a command on a DOM node. */
|
||||
dispatch(target: Node, commandName: string): void;
|
||||
/**
|
||||
* Simulate the dispatch of a command on a DOM node.
|
||||
* @return Whether or not there was a matching command for the target.
|
||||
*/
|
||||
dispatch(target: Node, commandName: string): boolean;
|
||||
|
||||
/** Invoke the given callback before dispatching a command event. */
|
||||
onWillDispatch(callback: (event: CommandEvent) => void): Disposable;
|
||||
@ -1092,10 +1095,10 @@ export class Point {
|
||||
export class Range {
|
||||
// Properties
|
||||
/** A Point representing the start of the Range. */
|
||||
start: PointLike;
|
||||
start: Point;
|
||||
|
||||
/** A Point representing the end of the Range. */
|
||||
end: PointLike;
|
||||
end: Point;
|
||||
|
||||
// Construction
|
||||
/** Convert any range-compatible object to a Range. */
|
||||
@ -1114,7 +1117,7 @@ export class Range {
|
||||
negate(): Range;
|
||||
|
||||
// Serialization and Deserialization
|
||||
/** Returns a plain javascript object representation of the range. */
|
||||
/** Returns a plain javascript object representation of the Range. */
|
||||
serialize(): number[][];
|
||||
|
||||
// Range Details
|
||||
@ -4710,7 +4713,7 @@ export class TextBuffer {
|
||||
destroyed: boolean;
|
||||
|
||||
/** Create a new buffer backed by the given file path. */
|
||||
static load(source: string, params?: BufferLoadOptions): Promise<TextBuffer>;
|
||||
static load(filePath: string, params?: BufferLoadOptions): Promise<TextBuffer>;
|
||||
|
||||
/**
|
||||
* Create a new buffer backed by the given file path. For better performance,
|
||||
@ -4737,6 +4740,9 @@ export class TextBuffer {
|
||||
shouldDestroyOnFileDelete?(): boolean
|
||||
});
|
||||
|
||||
/** Returns a plain javascript object representation of the TextBuffer. */
|
||||
serialize(options?: { markerLayers?: boolean, history?: boolean }): object;
|
||||
|
||||
/** Returns the unique identifier for this buffer. */
|
||||
getId(): string;
|
||||
|
||||
|
||||
10
types/babel-webpack-plugin/babel-webpack-plugin-tests.ts
Normal file
10
types/babel-webpack-plugin/babel-webpack-plugin-tests.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import BabelWebpackPlugin = require('babel-webpack-plugin');
|
||||
|
||||
new BabelWebpackPlugin();
|
||||
new BabelWebpackPlugin({});
|
||||
new BabelWebpackPlugin({
|
||||
test: /\.js$/,
|
||||
presets: ['es2015'],
|
||||
sourceMaps: false,
|
||||
compact: false
|
||||
});
|
||||
23
types/babel-webpack-plugin/index.d.ts
vendored
Normal file
23
types/babel-webpack-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// Type definitions for babel-webpack-plugin 0.1
|
||||
// Project: https://github.com/simlrh/babel-webpack-plugin
|
||||
// Definitions by: Jed Fox <https://github.com/j-f1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
import { TransformOptions } from 'babel-core';
|
||||
|
||||
export = BabelWebpackPlugin;
|
||||
|
||||
declare class BabelWebpackPlugin extends Plugin {
|
||||
constructor(options?: BabelWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace BabelWebpackPlugin {
|
||||
type Matcher = RegExp | string | Array<RegExp | string>;
|
||||
interface Options extends TransformOptions {
|
||||
test?: Matcher;
|
||||
include?: Matcher;
|
||||
exclude?: Matcher;
|
||||
}
|
||||
}
|
||||
23
types/babel-webpack-plugin/tsconfig.json
Normal file
23
types/babel-webpack-plugin/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"babel-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/babel-webpack-plugin/tslint.json
Normal file
1
types/babel-webpack-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
2
types/chart.js/index.d.ts
vendored
2
types/chart.js/index.d.ts
vendored
@ -78,7 +78,7 @@ interface Size {
|
||||
}
|
||||
|
||||
declare namespace Chart {
|
||||
type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble';
|
||||
type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
|
||||
type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
||||
|
||||
|
||||
17
types/clean-webpack-plugin/clean-webpack-plugin-tests.ts
Normal file
17
types/clean-webpack-plugin/clean-webpack-plugin-tests.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
|
||||
const paths = [
|
||||
'path',
|
||||
'glob/**/*.js',
|
||||
];
|
||||
|
||||
new CleanWebpackPlugin(paths);
|
||||
new CleanWebpackPlugin(paths, 'root-directory');
|
||||
new CleanWebpackPlugin(paths, {});
|
||||
new CleanWebpackPlugin(paths, {
|
||||
root: 'root-directory',
|
||||
verbose: true,
|
||||
dry: true,
|
||||
watch: true,
|
||||
exclude: ['a, b'],
|
||||
});
|
||||
47
types/clean-webpack-plugin/index.d.ts
vendored
Normal file
47
types/clean-webpack-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
// Type definitions for clean-webpack-plugin 0.1
|
||||
// Project: https://github.com/johnagan/clean-webpack-plugin
|
||||
// Definitions by: Jed Fox <https://github.com/j-f1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
export = CleanWebpackPlugin;
|
||||
|
||||
declare class CleanWebpackPlugin extends Plugin {
|
||||
/**
|
||||
* @param paths A glob or array of globs to delete
|
||||
*/
|
||||
constructor(paths: string | ReadonlyArray<string>, options?: string | CleanWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace CleanWebpackPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* Absolute path to your webpack root folder (paths appended to this)
|
||||
* Default: root of your package
|
||||
*/
|
||||
root?: string;
|
||||
/**
|
||||
* Write logs to the console.
|
||||
*/
|
||||
verbose?: boolean;
|
||||
/**
|
||||
* Set to `true` to emulate deletion without actually removing any files.
|
||||
*/
|
||||
dry?: boolean;
|
||||
/**
|
||||
* If true, remove files on recompile.
|
||||
*/
|
||||
watch?: boolean;
|
||||
/**
|
||||
* Instead of removing whole path recursively,
|
||||
* remove all path's content with exclusion of provided immediate children.
|
||||
* Good for not removing shared files from build directories.
|
||||
*/
|
||||
exclude?: ReadonlyArray<string>;
|
||||
/**
|
||||
* Allow the plugin to clean folders outside of the webpack root
|
||||
*/
|
||||
allowExternal?: boolean;
|
||||
}
|
||||
}
|
||||
23
types/clean-webpack-plugin/tsconfig.json
Normal file
23
types/clean-webpack-plugin/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clean-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/clean-webpack-plugin/tslint.json
Normal file
1
types/clean-webpack-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@ -2,7 +2,7 @@
|
||||
import express = require('express');
|
||||
import cors = require('cors');
|
||||
|
||||
var app = express();
|
||||
const app = express();
|
||||
app.use(cors());
|
||||
app.use(cors({
|
||||
maxAge: 100,
|
||||
@ -28,6 +28,9 @@ app.use(cors({
|
||||
app.use(cors({
|
||||
origin: /example\.com$/
|
||||
}));
|
||||
app.use(cors({
|
||||
origin: [/example\.com$/, 'http://example.com']
|
||||
}));
|
||||
app.use(cors({
|
||||
origin: ['http://example.com', 'http://fakeurl.com']
|
||||
}));
|
||||
@ -37,7 +40,7 @@ app.use(cors({
|
||||
app.use(cors({
|
||||
origin: (requestOrigin, cb) => {
|
||||
try {
|
||||
var allow = requestOrigin.indexOf('.edu') !== -1;
|
||||
const allow = requestOrigin.indexOf('.edu') !== -1;
|
||||
cb(null, allow);
|
||||
} catch (err) {
|
||||
cb(err);
|
||||
|
||||
2
types/cors/index.d.ts
vendored
2
types/cors/index.d.ts
vendored
@ -16,7 +16,7 @@ type CustomOrigin = (
|
||||
|
||||
declare namespace e {
|
||||
interface CorsOptions {
|
||||
origin?: boolean | string | RegExp | string[] | RegExp[] | CustomOrigin;
|
||||
origin?: boolean | string | RegExp | (string | RegExp)[] | CustomOrigin;
|
||||
methods?: string | string[];
|
||||
allowedHeaders?: string | string[];
|
||||
exposedHeaders?: string | string[];
|
||||
|
||||
@ -13,7 +13,7 @@ console.log('cson.createJSONString => %s', data);
|
||||
data = cson.createCSONString({hello: 'world'});
|
||||
console.log('cson.createCSONString => %s', data);
|
||||
|
||||
var obj: Object = cson.parse(data);
|
||||
var obj = cson.parse(data);
|
||||
console.log('cson.parse => %s', JSON.stringify(obj));
|
||||
|
||||
obj = cson.parseCSONString(data);
|
||||
|
||||
36
types/cson/index.d.ts
vendored
36
types/cson/index.d.ts
vendored
@ -5,27 +5,27 @@
|
||||
|
||||
|
||||
// Create Strings
|
||||
export declare function stringify(data: Object, opts?: Object, indent?: any): string;
|
||||
export declare function createCSONString(data: Object, opts?: Object, next?: any): string;
|
||||
export declare function createJSONString(data: Object, opts?: Object, next?: any): string;
|
||||
export declare function createString(data: Object, opts?: Object, next?: any): string;
|
||||
export declare function stringify(data: any, opts?: Object, indent?: any): string;
|
||||
export declare function createCSONString(data: any, opts?: Object, next?: any): string;
|
||||
export declare function createJSONString(data: any, opts?: Object, next?: any): string;
|
||||
export declare function createString(data: any, opts?: Object, next?: any): string;
|
||||
|
||||
// Parse Strings
|
||||
export declare function parse(data: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseCSONString(data: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseJSONString(data: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseCSString(data: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseJSString(data: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseString(data: string, opts?: Object, next?: any): Object;
|
||||
export declare function parse(data: string, opts?: Object, next?: any): any;
|
||||
export declare function parseCSONString(data: string, opts?: Object, next?: any): any;
|
||||
export declare function parseJSONString(data: string, opts?: Object, next?: any): any;
|
||||
export declare function parseCSString(data: string, opts?: Object, next?: any): any;
|
||||
export declare function parseJSString(data: string, opts?: Object, next?: any): any;
|
||||
export declare function parseString(data: string, opts?: Object, next?: any): any;
|
||||
|
||||
// Parse Files
|
||||
export declare function load(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseCSONFile(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseJSONFile(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseCSFile(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function parseJSFile(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function load(filePath: string, opts?: Object, next?: any): any;
|
||||
export declare function parseCSONFile(filePath: string, opts?: Object, next?: any): any;
|
||||
export declare function parseJSONFile(filePath: string, opts?: Object, next?: any): any;
|
||||
export declare function parseCSFile(filePath: string, opts?: Object, next?: any): any;
|
||||
export declare function parseJSFile(filePath: string, opts?: Object, next?: any): any;
|
||||
|
||||
// Require Files
|
||||
export declare function requireCSFile(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function requireJSFile(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function requireFile(filePath: string, opts?: Object, next?: any): Object;
|
||||
export declare function requireCSFile(filePath: string, opts?: Object, next?: any): any;
|
||||
export declare function requireJSFile(filePath: string, opts?: Object, next?: any): any;
|
||||
export declare function requireFile(filePath: string, opts?: Object, next?: any): any;
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
// Examples from https://github.com/googlesamples/apps-script-oauth2
|
||||
|
||||
/**
|
||||
* Create the OAuth2 service.
|
||||
*/
|
||||
function getDriveService() {
|
||||
return OAuth2.createService('drive')
|
||||
.setAuthorizationBaseUrl('https://accounts.google.com/o/oauth2/auth')
|
||||
.setTokenUrl('https://accounts.google.com/o/oauth2/token')
|
||||
.setClientId('xxx')
|
||||
.setClientSecret('yyy')
|
||||
.setCallbackFunction('authCallback')
|
||||
.setPropertyStore(PropertiesService.getUserProperties())
|
||||
.setScope('https://www.googleapis.com/auth/drive')
|
||||
.setParam('login_hint', Session.getActiveUser().getEmail())
|
||||
.setParam('access_type', 'offline')
|
||||
.setParam('approval_prompt', 'force')
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the callback.
|
||||
*/
|
||||
function authCallback(request: any) {
|
||||
const driveService = getDriveService();
|
||||
const isAuthorized = driveService.handleCallback(request);
|
||||
if (isAuthorized) {
|
||||
Logger.log('success');
|
||||
} else {
|
||||
Logger.log('denied');
|
||||
}
|
||||
}
|
||||
197
types/google-apps-script-oauth2/index.d.ts
vendored
Normal file
197
types/google-apps-script-oauth2/index.d.ts
vendored
Normal file
@ -0,0 +1,197 @@
|
||||
// Type definitions for google-apps-script-oauth2 24.0
|
||||
// Project: https://github.com/googlesamples/apps-script-oauth2
|
||||
// Definitions by: dhayab <https://github.com/dhayab>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="google-apps-script" />
|
||||
|
||||
declare namespace GoogleAppsScriptOAuth2 {
|
||||
interface OAuth2 {
|
||||
/**
|
||||
* The supported locations for passing the state parameter.
|
||||
*/
|
||||
STATE_PARAMETER_LOCATION: typeof StateParameterLocation;
|
||||
/**
|
||||
* The supported formats for the returned OAuth2 token.
|
||||
*/
|
||||
TOKEN_FORMAT: typeof TokenFormat;
|
||||
/**
|
||||
* Creates a new OAuth2 service with the name specified.
|
||||
* It's usually best to create and configure your service once at the start of your script,
|
||||
* and then reference them during the different phases of the authorization flow.
|
||||
*/
|
||||
createService(serviceName: string): OAuth2Service;
|
||||
/**
|
||||
* Returns the redirect URI that will be used for a given script.
|
||||
* Often this URI needs to be entered into a configuration screen of your OAuth provider.
|
||||
*/
|
||||
getRedirectUri(scriptId: string): string;
|
||||
}
|
||||
|
||||
interface OAuth2Service {
|
||||
/**
|
||||
* Gets an access token for this service.
|
||||
* This token can be used in HTTP requests to the service's endpoint.
|
||||
* This method will throw an error if the user's access was not granted or has expired.
|
||||
*/
|
||||
getAccessToken(): string;
|
||||
/**
|
||||
* Gets the authorization URL.
|
||||
* The first step in getting an OAuth2 token is to have the user visit this URL
|
||||
* and approve the authorization request. The user will then be redirected back to your
|
||||
* application using callback function name specified, so that the flow may continue.
|
||||
*/
|
||||
getAuthorizationUrl(): string;
|
||||
/**
|
||||
* Gets the last error that occurred this execution when trying to
|
||||
* automatically refresh or generate an access token.
|
||||
*/
|
||||
getLastError(): any;
|
||||
/**
|
||||
* Returns the redirect URI that will be used for this service.
|
||||
* Often this URI needs to be entered into a configuration screen of your OAuth provider.
|
||||
*/
|
||||
getRedirectUri(): string;
|
||||
/**
|
||||
* Gets the token from the service's property store or cache.
|
||||
*/
|
||||
getToken(): object | null;
|
||||
/**
|
||||
* Completes the OAuth2 flow using the request data passed in to the callback function.
|
||||
*/
|
||||
handleCallback(callbackRequest: object): boolean;
|
||||
/**
|
||||
* Determines if the service has access (has been authorized and hasn't expired).
|
||||
* If offline access was granted and the previous token has expired this method attempts
|
||||
* to generate a new token.
|
||||
*/
|
||||
hasAccess(): boolean;
|
||||
/**
|
||||
* Refreshes a token that has expired.
|
||||
* This is only possible if offline access was requested when the token was authorized.
|
||||
*/
|
||||
refresh(): void;
|
||||
/**
|
||||
* Resets the service, removing access and requiring the service to be re-authorized.
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* Sets the service's authorization base URL (required).
|
||||
* For Google services this URL should be `https://accounts.google.com/o/oauth2/auth`.
|
||||
*/
|
||||
setAuthorizationBaseUrl(authorizationBaseUrl: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the cache to use when persisting credentials (optional).
|
||||
* Using a cache will reduce the need to read from the property store and may increase
|
||||
* performance. In most cases this should be a private cache, but a public cache may be
|
||||
* appropriate if you want to share access across users.
|
||||
*/
|
||||
setCache(cache: GoogleAppsScript.Cache.Cache): OAuth2Service;
|
||||
/**
|
||||
* Sets the name of the authorization callback function (required).
|
||||
* This is the function that will be called when the user completes the authorization flow
|
||||
* on the service provider's website. The callback accepts a request parameter, which
|
||||
* should be passed to this service's `handleCallback()` method to complete the process.
|
||||
*/
|
||||
setCallbackFunction(callbackFunctionName: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the client ID to use for the OAuth flow (required).
|
||||
* You can create client IDs in the "Credentials" section of a Google Developers Console
|
||||
* project. Although you can use any project with this library, it may be convinient to use
|
||||
* the project that was created for your script. These projects are not visible if you
|
||||
* visit the console directly, but you can access it by click on the menu item
|
||||
* "Resources > Advanced Google services" in the Script Editor, and then click on the link
|
||||
* "Google Developers Console" in the resulting dialog.
|
||||
*/
|
||||
setClientId(clientId: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the client secret to use for the OAuth flow (required).
|
||||
* See the documentation for `setClientId()` for more information on how to create client IDs and secrets.
|
||||
*/
|
||||
setClientSecret(clientSecret: string): OAuth2Service;
|
||||
/**
|
||||
* Sets number of minutes that a token obtained through Service Account authorization should be valid. Default: 60 minutes.
|
||||
*/
|
||||
setExpirationMinutes(expirationMinutes: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the issuer (iss) value to use for Service Account authorization.
|
||||
* If not set the client ID will be used instead.
|
||||
*/
|
||||
setIssuer(issuer: string): OAuth2Service;
|
||||
/**
|
||||
* Sets an additional parameter to use when constructing the authorization URL (optional).
|
||||
* See the documentation for your service provider for information on what parameter values they support.
|
||||
*/
|
||||
setParam(name: string, value: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the private key to use for Service Account authorization.
|
||||
*/
|
||||
setPrivateKey(privateKey: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the property store to use when persisting credentials (required).
|
||||
* In most cases this should be user properties, but document or script properties may be appropriate
|
||||
* if you want to share access across users.
|
||||
*/
|
||||
setPropertyStore(propertyStore: GoogleAppsScript.Properties.Properties): OAuth2Service;
|
||||
/**
|
||||
* Sets the scope or scopes to request during the authorization flow (optional).
|
||||
* If the scope value is an array it will be joined using the separator before being sent to the server,
|
||||
* which is is a space character by default.
|
||||
*/
|
||||
setScope(scope: string | string[], separator?: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the subject (sub) value to use for Service Account authorization.
|
||||
*/
|
||||
setSubject(subject: string): OAuth2Service;
|
||||
/**
|
||||
* Sets the format of the returned token. Default: `OAuth2.TOKEN_FORMAT.JSON`.
|
||||
*/
|
||||
setTokenFormat(tokenFormat: TokenFormat): OAuth2Service;
|
||||
/**
|
||||
* Sets the additional HTTP headers that should be sent when retrieving or refreshing the access token.
|
||||
*/
|
||||
setTokenHeaders(tokenHeaders: { [key: string]: string }): OAuth2Service;
|
||||
/**
|
||||
* Sets an additional function to invoke on the payload of the access token request.
|
||||
*/
|
||||
setTokenPayloadHandler(tokenHandler: (tokenPayload: TokenPayload) => object): OAuth2Service;
|
||||
/**
|
||||
* Sets the service's token URL (required).
|
||||
* For Google services this URL should be `https://accounts.google.com/o/oauth2/token`.
|
||||
*/
|
||||
setTokenUrl(tokenUrl: string): OAuth2Service;
|
||||
}
|
||||
|
||||
enum StateParameterLocation {
|
||||
/**
|
||||
* Pass the state parameter in the authorization URL.
|
||||
*/
|
||||
AUTHORIZATION_URL,
|
||||
/**
|
||||
* Pass the state token in the redirect URL, as a workaround for APIs that don't support the state parameter.
|
||||
*/
|
||||
REDIRECT_URL,
|
||||
}
|
||||
|
||||
enum TokenFormat {
|
||||
/**
|
||||
* JSON format, for example `{"access_token": "..."}`.
|
||||
*/
|
||||
JSON,
|
||||
/**
|
||||
* Form URL-encoded, for example `access_token=...`.
|
||||
*/
|
||||
FORM_URL_ENCODED,
|
||||
}
|
||||
|
||||
interface TokenPayload {
|
||||
code: string;
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
redirect_uri: string;
|
||||
grant_type: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var OAuth2: GoogleAppsScriptOAuth2.OAuth2;
|
||||
23
types/google-apps-script-oauth2/tsconfig.json
Normal file
23
types/google-apps-script-oauth2/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"google-apps-script-oauth2-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/google-apps-script-oauth2/tslint.json
Normal file
1
types/google-apps-script-oauth2/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
3
types/google.picker/index.d.ts
vendored
3
types/google.picker/index.d.ts
vendored
@ -146,6 +146,9 @@ declare namespace google {
|
||||
|
||||
// For photo uploads, controls whether per-photo selection (as opposed to per-album) selection is enabled.
|
||||
SIMPLE_UPLOAD_ENABLED: string;
|
||||
|
||||
// Whether Team Drive items should be included in results.
|
||||
SUPPORT_TEAM_DRIVES: string;
|
||||
};
|
||||
|
||||
export var ViewId:{
|
||||
|
||||
10
types/highlight.js/index.d.ts
vendored
10
types/highlight.js/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for highlight.js v9.1.0
|
||||
// Type definitions for highlight.js v9.12
|
||||
// Project: https://github.com/isagalaev/highlight.js
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>, Jeremy Hull <https://github.com/sourrust>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -9,7 +9,7 @@ declare namespace hljs
|
||||
name: string,
|
||||
value: string,
|
||||
ignore_illegals?: boolean,
|
||||
continuation?: boolean) : IHighlightResult;
|
||||
continuation?: ICompiledMode) : IHighlightResult;
|
||||
export function highlightAuto(
|
||||
value: string,
|
||||
languageSubset?: string[]) : IAutoHighlightResult;
|
||||
@ -154,6 +154,6 @@ declare namespace hljs
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'highlight.js' {
|
||||
export = hljs;
|
||||
}
|
||||
|
||||
export = hljs;
|
||||
export as namespace hljs;
|
||||
|
||||
3
types/jest/index.d.ts
vendored
3
types/jest/index.d.ts
vendored
@ -8,6 +8,7 @@
|
||||
// Allan Lukwago <https://github.com/epicallan>
|
||||
// Ika <https://github.com/ikatyang>
|
||||
// Waseem Dahman <https://github.com/wsmd>
|
||||
// Jamie Mason <https://github.com/JamieMason>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@ -240,7 +241,7 @@ declare namespace jest {
|
||||
}
|
||||
|
||||
interface ExpectExtendMap {
|
||||
[key: string]: (this: MatcherUtils, received: any, actual: any) => { message(): string, pass: boolean };
|
||||
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean };
|
||||
}
|
||||
|
||||
interface SnapshotSerializerOptions {
|
||||
|
||||
@ -259,6 +259,12 @@ describe('Extending extend', () => {
|
||||
() => `expected ${received} ${pass ? 'not ' : ''} to be ${actual}`;
|
||||
return { message, pass };
|
||||
},
|
||||
toBeVariadicMatcher(received: any, floor: number, ceiling: number) {
|
||||
const pass = received >= floor && received <= ceiling;
|
||||
const message =
|
||||
() => `expected ${received} ${pass ? 'not ' : ''} to be within range ${floor}-${ceiling}`;
|
||||
return { message, pass };
|
||||
},
|
||||
toBeTest(received: any, actual: any) {
|
||||
this.utils.ensureNoExpected(received);
|
||||
this.utils.ensureActualIsNumber(received);
|
||||
|
||||
182
types/joi/index.d.ts
vendored
182
types/joi/index.d.ts
vendored
@ -1,6 +1,13 @@
|
||||
// Type definitions for joi v10.4.2
|
||||
// Type definitions for joi v13.0.1
|
||||
// Project: https://github.com/hapijs/joi
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Laurence Dougal Myers <https://github.com/laurence-myers>, Christopher Glantschnig <https://github.com/cglantschnig>, David Broder-Rodgers <https://github.com/DavidBR-SW>, Gael Magnan de Bornier <https://github.com/GaelMagnan>, Rytis Alekna <https://github.com/ralekna>, Pavel Ivanov <https://github.com/schfkt>, Youngrok Kim <https://github.com/rokoroku>
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Laurence Dougal Myers <https://github.com/laurence-myers>
|
||||
// Christopher Glantschnig <https://github.com/cglantschnig>
|
||||
// David Broder-Rodgers <https://github.com/DavidBR-SW>
|
||||
// Gael Magnan de Bornier <https://github.com/GaelMagnan>
|
||||
// Rytis Alekna <https://github.com/ralekna>
|
||||
// Pavel Ivanov <https://github.com/schfkt>
|
||||
// Youngrok Kim <https://github.com/rokoroku>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@ -88,7 +95,7 @@ export interface EmailOptions {
|
||||
/**
|
||||
* Specifies a list of acceptable TLDs.
|
||||
*/
|
||||
tldWhitelist?: string[] | Object;
|
||||
tldWhitelist?: string[] | object;
|
||||
/**
|
||||
* Number of atoms required for the domain. Be careful since some domains, such as io, directly allow email.
|
||||
*/
|
||||
@ -161,7 +168,7 @@ export interface ValidationError extends Error, JoiObject {
|
||||
export interface ValidationErrorItem {
|
||||
message: string;
|
||||
type: string;
|
||||
path: string;
|
||||
path: string[];
|
||||
options?: ValidationOptions;
|
||||
context?: Context;
|
||||
}
|
||||
@ -195,6 +202,8 @@ export type Schema = AnySchema
|
||||
|
||||
export interface AnySchema extends JoiObject {
|
||||
|
||||
schemaType?: Types | string;
|
||||
|
||||
/**
|
||||
* Validates a value using the schema and options.
|
||||
*/
|
||||
@ -270,7 +279,7 @@ export interface AnySchema extends JoiObject {
|
||||
/**
|
||||
* Attaches metadata to the key.
|
||||
*/
|
||||
meta(meta: Object): this;
|
||||
meta(meta: object): this;
|
||||
|
||||
/**
|
||||
* Annotates the key with an example value, must be valid.
|
||||
@ -346,7 +355,7 @@ export interface AnySchema extends JoiObject {
|
||||
* an instance of `Error` - the override error.
|
||||
* a `function(errors)`, taking an array of errors as argument, where it must either:
|
||||
* return a `string` - substitutes the error message with this text
|
||||
* return a single `object` or an `Array` of it, where:
|
||||
* return a single ` object` or an `Array` of it, where:
|
||||
* `type` - optional parameter providing the type of the error (eg. `number.min`).
|
||||
* `message` - optional parameter if `template` is provided, containing the text of the error.
|
||||
* `template` - optional parameter if `message` is provided, containing a template string, using the same format as usual joi language errors.
|
||||
@ -384,6 +393,8 @@ export interface Description {
|
||||
|
||||
export interface Context {
|
||||
[key: string]: any;
|
||||
key?: string;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
export interface State {
|
||||
@ -455,7 +466,7 @@ export interface NumberSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Specifies the maximum number of decimal places where:
|
||||
* limit - the maximum number of decimal places allowed.
|
||||
* @param limit - the maximum number of decimal places allowed.
|
||||
*/
|
||||
precision(limit: number): this;
|
||||
|
||||
@ -497,6 +508,18 @@ export interface StringSchema extends AnySchema {
|
||||
max(limit: number, encoding?: string): this;
|
||||
max(limit: Reference, encoding?: string): this;
|
||||
|
||||
/**
|
||||
* Specifies whether the string.max() limit should be used as a truncation.
|
||||
* @param enabled - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value.
|
||||
*/
|
||||
truncate(enabled?: boolean): this;
|
||||
|
||||
/**
|
||||
* Requires the string value to be in a unicode normalized form. If the validation convert option is on (enabled by default), the string will be normalized.
|
||||
* @param form - The unicode normalization form to use. Valid values: NFC [default], NFD, NFKC, NFKD
|
||||
*/
|
||||
normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this;
|
||||
|
||||
/**
|
||||
* Requires the number to be a credit card number (Using Lunh Algorithm).
|
||||
*/
|
||||
@ -554,7 +577,7 @@ export interface StringSchema extends AnySchema {
|
||||
* Requires the string value to be a valid GUID.
|
||||
*/
|
||||
guid(options?: GuidOptions): this;
|
||||
|
||||
|
||||
/**
|
||||
* Alias for `guid` -- Requires the string value to be a valid GUID
|
||||
*/
|
||||
@ -651,6 +674,7 @@ export interface ArraySchema extends AnySchema {
|
||||
}
|
||||
|
||||
export interface ObjectSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Sets the allowed object keys.
|
||||
*/
|
||||
@ -888,7 +912,7 @@ export type ExtensionBoundSchema = Schema & {
|
||||
|
||||
export interface Rules<P extends object = any> {
|
||||
name: string;
|
||||
params?: ObjectSchema | { [key in keyof P]: SchemaLike; };
|
||||
params?: ObjectSchema | {[key in keyof P]: SchemaLike; };
|
||||
setup?(this: ExtensionBoundSchema, params: P): Schema | void;
|
||||
validate?<R = any>(this: ExtensionBoundSchema, params: P, value: any, state: State, options: ValidationOptions): Err | R;
|
||||
description?: string | ((params: P) => string);
|
||||
@ -965,10 +989,15 @@ export function string(): StringSchema;
|
||||
/**
|
||||
* Generates a type that will match one of the provided alternative schemas
|
||||
*/
|
||||
export function alternatives(): AlternativesSchema;
|
||||
export function alternatives(types: SchemaLike[]): AlternativesSchema;
|
||||
export function alternatives(...types: SchemaLike[]): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Alias for `alternatives`
|
||||
*/
|
||||
export function alt(types: SchemaLike[]): AlternativesSchema;
|
||||
export function alt(...types: SchemaLike[]): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Generates a placeholder schema for a schema that you would provide with the fn.
|
||||
* Supports the same methods of the any() type.
|
||||
@ -1030,7 +1059,140 @@ export function reach<T extends Schema>(schema: ObjectSchema, path: string): T;
|
||||
*/
|
||||
export function extend(extention: Extension): any;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
import * as Module from 'joi';
|
||||
export type Root = typeof Module;
|
||||
export type DefaultsFunction = (root: Schema) => Schema;
|
||||
|
||||
/**
|
||||
* Creates a new Joi instance that will apply defaults onto newly created schemas
|
||||
* through the use of the fn function that takes exactly one argument, the schema being created.
|
||||
*
|
||||
* @param fn - The function must always return a schema, even if untransformed.
|
||||
*/
|
||||
export function defaults(fn: DefaultsFunction): Root;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
// Below are undocumented APIs. use at your own risk
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
/**
|
||||
* Returns a plain object representing the schema's rules and properties
|
||||
*/
|
||||
export function describe(schema: Schema): Description;
|
||||
|
||||
/**
|
||||
* Whitelists a value
|
||||
*/
|
||||
export function allow(value: any, ...values: any[]): Schema;
|
||||
export function allow(values: any[]): Schema;
|
||||
|
||||
/**
|
||||
* Adds the provided values into the allowed whitelist and marks them as the only valid values allowed.
|
||||
*/
|
||||
export function valid(value: any, ...values: any[]): Schema;
|
||||
export function valid(values: any[]): Schema;
|
||||
export function only(value: any, ...values: any[]): Schema;
|
||||
export function only(values: any[]): Schema;
|
||||
export function equal(value: any, ...values: any[]): Schema;
|
||||
export function equal(values: any[]): Schema;
|
||||
|
||||
/**
|
||||
* Blacklists a value
|
||||
*/
|
||||
export function invalid(value: any, ...values: any[]): Schema;
|
||||
export function invalid(values: any[]): Schema;
|
||||
export function disallow(value: any, ...values: any[]): Schema;
|
||||
export function disallow(values: any[]): Schema;
|
||||
export function not(value: any, ...values: any[]): Schema;
|
||||
export function not(values: any[]): Schema;
|
||||
|
||||
/**
|
||||
* Marks a key as required which will not allow undefined as value. All keys are optional by default.
|
||||
*/
|
||||
export function required(): Schema;
|
||||
|
||||
/**
|
||||
* Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default.
|
||||
*/
|
||||
export function optional(): Schema;
|
||||
|
||||
/**
|
||||
* Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys.
|
||||
*/
|
||||
export function forbidden(): Schema;
|
||||
|
||||
/**
|
||||
* Marks a key to be removed from a resulting object or array after validation. Used to sanitize output.
|
||||
*/
|
||||
export function strip(): Schema;
|
||||
|
||||
/**
|
||||
* Annotates the key
|
||||
*/
|
||||
export function description(desc: string): Schema;
|
||||
|
||||
/**
|
||||
* Annotates the key
|
||||
*/
|
||||
export function notes(notes: string): Schema;
|
||||
export function notes(notes: string[]): Schema;
|
||||
|
||||
/**
|
||||
* Annotates the key
|
||||
*/
|
||||
export function tags(notes: string): Schema;
|
||||
export function tags(notes: string[]): Schema;
|
||||
|
||||
/**
|
||||
* Attaches metadata to the key.
|
||||
*/
|
||||
export function meta(meta: object): Schema;
|
||||
|
||||
/**
|
||||
* Annotates the key with an example value, must be valid.
|
||||
*/
|
||||
export function example(value: any): Schema;
|
||||
|
||||
/**
|
||||
* Annotates the key with an unit name.
|
||||
*/
|
||||
export function unit(name: string): Schema;
|
||||
|
||||
/**
|
||||
* Overrides the global validate() options for the current key and any sub-key.
|
||||
*/
|
||||
export function options(options: ValidationOptions): Schema;
|
||||
|
||||
/**
|
||||
* Sets the options.convert options to false which prevent type casting for the current key and any child keys.
|
||||
*/
|
||||
export function strict(isStrict?: boolean): Schema;
|
||||
|
||||
/**
|
||||
* Returns a new type that is the result of adding the rules of one type to another.
|
||||
*/
|
||||
export function concat<T>(schema: T): T;
|
||||
|
||||
/**
|
||||
* Converts the type into an alternatives type where the conditions are merged into the type definition where:
|
||||
*/
|
||||
export function when(ref: string, options: WhenOptions): AlternativesSchema;
|
||||
export function when(ref: Reference, options: WhenOptions): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Overrides the key name in error messages.
|
||||
*/
|
||||
export function label(name: string): Schema;
|
||||
|
||||
/**
|
||||
* Outputs the original untouched value instead of the casted value.
|
||||
*/
|
||||
export function raw(isRaw?: boolean): Schema;
|
||||
|
||||
/**
|
||||
* Considers anything that matches the schema to be empty (undefined).
|
||||
* @param schema - any object or joi schema to match. An undefined schema unsets that rule.
|
||||
*/
|
||||
export function empty(schema?: any): Schema;
|
||||
|
||||
@ -136,13 +136,13 @@ var validErrFunc: Joi.ValidationErrorFunction;
|
||||
validErrItem = {
|
||||
message: str,
|
||||
type: str,
|
||||
path: str
|
||||
path: [str]
|
||||
};
|
||||
|
||||
validErrItem = {
|
||||
message: str,
|
||||
type: str,
|
||||
path: str,
|
||||
path: [str],
|
||||
options: validOpts,
|
||||
context: obj
|
||||
};
|
||||
@ -773,6 +773,10 @@ strSchema = strSchema.isoDate();
|
||||
strSchema = strSchema.lowercase();
|
||||
strSchema = strSchema.uppercase();
|
||||
strSchema = strSchema.trim();
|
||||
strSchema = strSchema.truncate();
|
||||
strSchema = strSchema.truncate(false);
|
||||
strSchema = strSchema.normalize();
|
||||
strSchema = strSchema.normalize('NFKC');
|
||||
|
||||
namespace common {
|
||||
strSchema = strSchema.allow(x);
|
||||
@ -830,6 +834,13 @@ schema = Joi.alternatives().try(schema, schema);
|
||||
schema = Joi.alternatives(schemaArr);
|
||||
schema = Joi.alternatives(schema, anySchema, boolSchema);
|
||||
|
||||
schema = Joi.alt();
|
||||
schema = Joi.alt().try(schemaArr);
|
||||
schema = Joi.alt().try(schema, schema);
|
||||
|
||||
schema = Joi.alt(schemaArr);
|
||||
schema = Joi.alt(schema, anySchema, boolSchema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.lazy(() => schema)
|
||||
@ -844,14 +855,14 @@ namespace validate_tests {
|
||||
Joi.validate(value, schema, validOpts, (err, value) => {
|
||||
x = value;
|
||||
str = err.message;
|
||||
str = err.details[0].path;
|
||||
str = err.details[0].path[0];
|
||||
str = err.details[0].message;
|
||||
str = err.details[0].type;
|
||||
});
|
||||
Joi.validate(value, schema, (err, value) => {
|
||||
x = value;
|
||||
str = err.message;
|
||||
str = err.details[0].path;
|
||||
str = err.details[0].path.join('.');
|
||||
str = err.details[0].message;
|
||||
str = err.details[0].type;
|
||||
});
|
||||
@ -950,3 +961,120 @@ const Joi3 = Joi.extend({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
const defaultsJoi = Joi.defaults((schema) => {
|
||||
switch (schema.schemaType) {
|
||||
case 'string':
|
||||
return schema.allow('');
|
||||
case 'object':
|
||||
return (schema as Joi.ObjectSchema).min(1);
|
||||
default:
|
||||
return schema;
|
||||
}
|
||||
});
|
||||
|
||||
schema = Joi.allow(x, x);
|
||||
schema = Joi.allow([x, x, x]);
|
||||
schema = Joi.valid(x);
|
||||
schema = Joi.valid(x, x);
|
||||
schema = Joi.valid([x, x, x]);
|
||||
schema = Joi.only(x);
|
||||
schema = Joi.only(x, x);
|
||||
schema = Joi.only([x, x, x]);
|
||||
schema = Joi.equal(x);
|
||||
schema = Joi.equal(x, x);
|
||||
schema = Joi.equal([x, x, x]);
|
||||
schema = Joi.invalid(x);
|
||||
schema = Joi.invalid(x, x);
|
||||
schema = Joi.invalid([x, x, x]);
|
||||
schema = Joi.disallow(x);
|
||||
schema = Joi.disallow(x, x);
|
||||
schema = Joi.disallow([x, x, x]);
|
||||
schema = Joi.not(x);
|
||||
schema = Joi.not(x, x);
|
||||
schema = Joi.not([x, x, x]);
|
||||
|
||||
schema = Joi.required();
|
||||
schema = Joi.optional();
|
||||
schema = Joi.forbidden();
|
||||
schema = Joi.strip();
|
||||
|
||||
schema = Joi.description(str);
|
||||
schema = Joi.notes(str);
|
||||
schema = Joi.notes(strArr);
|
||||
schema = Joi.tags(str);
|
||||
schema = Joi.tags(strArr);
|
||||
|
||||
schema = Joi.meta(obj);
|
||||
schema = Joi.example(obj);
|
||||
schema = Joi.unit(str);
|
||||
|
||||
schema = Joi.options(validOpts);
|
||||
schema = Joi.strict();
|
||||
schema = Joi.strict(bool);
|
||||
schema = Joi.concat(x);
|
||||
|
||||
schema = Joi.when(str, whenOpts);
|
||||
schema = Joi.when(ref, whenOpts);
|
||||
|
||||
schema = Joi.label(str);
|
||||
schema = Joi.raw();
|
||||
schema = Joi.raw(bool);
|
||||
schema = Joi.empty();
|
||||
schema = Joi.empty(str);
|
||||
schema = Joi.empty(anySchema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.allow(x, x);
|
||||
schema = Joi.allow([x, x, x]);
|
||||
schema = Joi.valid(x);
|
||||
schema = Joi.valid(x, x);
|
||||
schema = Joi.valid([x, x, x]);
|
||||
schema = Joi.only(x);
|
||||
schema = Joi.only(x, x);
|
||||
schema = Joi.only([x, x, x]);
|
||||
schema = Joi.equal(x);
|
||||
schema = Joi.equal(x, x);
|
||||
schema = Joi.equal([x, x, x]);
|
||||
schema = Joi.invalid(x);
|
||||
schema = Joi.invalid(x, x);
|
||||
schema = Joi.invalid([x, x, x]);
|
||||
schema = Joi.disallow(x);
|
||||
schema = Joi.disallow(x, x);
|
||||
schema = Joi.disallow([x, x, x]);
|
||||
schema = Joi.not(x);
|
||||
schema = Joi.not(x, x);
|
||||
schema = Joi.not([x, x, x]);
|
||||
|
||||
schema = Joi.required();
|
||||
schema = Joi.optional();
|
||||
schema = Joi.forbidden();
|
||||
schema = Joi.strip();
|
||||
|
||||
schema = Joi.description(str);
|
||||
schema = Joi.notes(str);
|
||||
schema = Joi.notes(strArr);
|
||||
schema = Joi.tags(str);
|
||||
schema = Joi.tags(strArr);
|
||||
|
||||
schema = Joi.meta(obj);
|
||||
schema = Joi.example(obj);
|
||||
schema = Joi.unit(str);
|
||||
|
||||
schema = Joi.options(validOpts);
|
||||
schema = Joi.strict();
|
||||
schema = Joi.strict(bool);
|
||||
schema = Joi.concat(x);
|
||||
|
||||
schema = Joi.when(str, whenOpts);
|
||||
schema = Joi.when(ref, whenOpts);
|
||||
|
||||
schema = Joi.label(str);
|
||||
schema = Joi.raw();
|
||||
schema = Joi.raw(bool);
|
||||
schema = Joi.empty();
|
||||
schema = Joi.empty(str);
|
||||
schema = Joi.empty(anySchema);
|
||||
|
||||
@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"joi-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
1178
types/joi/v10/index.d.ts
vendored
Normal file
1178
types/joi/v10/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1016
types/joi/v10/joi-tests.ts
Normal file
1016
types/joi/v10/joi-tests.ts
Normal file
File diff suppressed because it is too large
Load Diff
28
types/joi/v10/tsconfig.json
Normal file
28
types/joi/v10/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": false,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"joi": [
|
||||
"joi/v10"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"joi-tests.ts"
|
||||
]
|
||||
}
|
||||
42
types/leaflet.polylinemeasure/index.d.ts
vendored
Normal file
42
types/leaflet.polylinemeasure/index.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Type definitions for leaflet.polylinemeasure 1.0
|
||||
// Project: https://github.com/ppete2/Leaflet.PolylineMeasure#readme
|
||||
// Definitions by: Rinat Sultanov <https://github.com/RiON69>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare module 'leaflet' {
|
||||
namespace Control {
|
||||
interface PolylineMeasure extends Control {
|
||||
new (options?: PolylineMeasureOptions): any;
|
||||
}
|
||||
|
||||
interface PolylineMeasureOptions {
|
||||
position?: string;
|
||||
unit?: string;
|
||||
measureControlTitleOn?: string;
|
||||
measureControlTitleOff?: string;
|
||||
measureControlLabel?: string;
|
||||
measureControlClasses?: any[];
|
||||
backgroundColor?: string;
|
||||
cursor?: string;
|
||||
clearMeasurementsOnStop?: boolean;
|
||||
showMeasurementsClearControl?: boolean;
|
||||
clearControlTitle?: string;
|
||||
clearControlLabel?: string;
|
||||
clearControlClasses?: any[];
|
||||
showUnitControl?: boolean;
|
||||
tempLine?: any;
|
||||
fixedLine?: any;
|
||||
startCircle?: any;
|
||||
intermedCircle?: any;
|
||||
currentCircle?: any;
|
||||
endCircle?: any;
|
||||
}
|
||||
}
|
||||
|
||||
namespace control {
|
||||
function polylineMeasure(options?: Control.PolylineMeasureOptions): Control.PolylineMeasure;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet.polylinemeasure';
|
||||
|
||||
const map = L.map('map', {center: L.latLng(43.24209, 76.87743), zoom: 15});
|
||||
|
||||
L.tileLayer("http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", {
|
||||
subdomains: ['a', 'b', 'c'],
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
|
||||
L.control.polylineMeasure().addTo(map);
|
||||
24
types/leaflet.polylinemeasure/tsconfig.json
Normal file
24
types/leaflet.polylinemeasure/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"DOM"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"leaflet.polylinemeasure-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/leaflet.polylinemeasure/tslint.json
Normal file
1
types/leaflet.polylinemeasure/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
18
types/notyf/index.d.ts
vendored
Normal file
18
types/notyf/index.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Type definitions for notyf 2.0
|
||||
// Project: https://github.com/caroso1222/notyf
|
||||
// Definitions by: Pavel Gurov <https://github.com/gurov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Options {
|
||||
delay?: number;
|
||||
alertIcon?: string;
|
||||
confirmIcon?: string;
|
||||
}
|
||||
|
||||
declare class Notyf {
|
||||
constructor(options?: Options);
|
||||
|
||||
alert(text: string): void;
|
||||
confirm(text: string): void;
|
||||
}
|
||||
export = Notyf;
|
||||
11
types/notyf/notyf-tests.ts
Normal file
11
types/notyf/notyf-tests.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import Notyf = require("notyf");
|
||||
|
||||
const options = {
|
||||
delay: 1000,
|
||||
alertIcon: 'fa fa-bell',
|
||||
confirmIcon: 'fa fa-exclamation'
|
||||
};
|
||||
|
||||
const notyf = new Notyf(options);
|
||||
notyf.alert('Danger!');
|
||||
notyf.confirm('Success!');
|
||||
23
types/notyf/tsconfig.json
Normal file
23
types/notyf/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"notyf-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/notyf/tslint.json
Normal file
1
types/notyf/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
183
types/pubnub/index.d.ts
vendored
Normal file
183
types/pubnub/index.d.ts
vendored
Normal file
@ -0,0 +1,183 @@
|
||||
// Type definitions for pubnub 4.0
|
||||
// Project: https://github.com/pubnub/javascript
|
||||
// Definitions by: bitbankinc <https://github.com/bitbankinc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// @see https://www.pubnub.com/docs/web-javascript/api-reference-configuration
|
||||
|
||||
declare class Pubnub {
|
||||
constructor(config: Pubnub.PubnubConfig);
|
||||
|
||||
setAuthKey(authKey: string): void;
|
||||
|
||||
setFilterExpression(filterExpression: string): void;
|
||||
|
||||
getFilterExpression(): string;
|
||||
|
||||
publish(
|
||||
params: Pubnub.PublishParameters,
|
||||
callback: (status: any, response: Pubnub.PublishResponse) => void
|
||||
): void;
|
||||
|
||||
publish(
|
||||
params: Pubnub.PublishParameters
|
||||
): Promise<Pubnub.PublishResponse>;
|
||||
|
||||
fire(
|
||||
params: Pubnub.FireParameters,
|
||||
callback: (status: any, response: Pubnub.PublishResponse) => void
|
||||
): void;
|
||||
|
||||
fire(
|
||||
params: Pubnub.FireParameters
|
||||
): Promise<Pubnub.PublishResponse>;
|
||||
|
||||
subscribe(params: Pubnub.SubscribeParameters): void;
|
||||
|
||||
unsubscribe(params: Pubnub.UnsubscribeParameters): void;
|
||||
|
||||
unsubscribeAll(): void;
|
||||
|
||||
addListener(params: Pubnub.ListenerParameters): void;
|
||||
|
||||
removeListener(params: Pubnub.ListenerParameters): void;
|
||||
|
||||
hereNow(
|
||||
params: Pubnub.HereNowParameters,
|
||||
callback: (status: any, response: Pubnub.HereNowResponse) => void
|
||||
): void;
|
||||
|
||||
hereNow(
|
||||
params: Pubnub.HereNowParameters
|
||||
): Promise<Pubnub.HereNowResponse>;
|
||||
|
||||
whereNow(
|
||||
params: {uuid: string},
|
||||
callback: (status: Pubnub.WhereNowStatus, response: Pubnub.WhereNowResponse) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
declare namespace Pubnub {
|
||||
interface PubnubConfig {
|
||||
subscribeKey: string;
|
||||
publishKey?: string;
|
||||
cipherKey?: string;
|
||||
authKey?: string;
|
||||
logVerbosity?: boolean;
|
||||
uuid?: string;
|
||||
ssl?: boolean;
|
||||
origin?: string;
|
||||
presenceTimeout?: number;
|
||||
heartbeatInterval?: number;
|
||||
restore?: boolean;
|
||||
keepAlive?: boolean;
|
||||
keepAliveSettings?: {
|
||||
keepAliveMsecs?: number;
|
||||
freeSocketKeepAliveTimeout?: number;
|
||||
timeout?: number;
|
||||
maxSockets?: number;
|
||||
maxFreeSockets?: number;
|
||||
};
|
||||
suppressLeaveEvents?: boolean;
|
||||
secretKey?: string;
|
||||
}
|
||||
|
||||
interface PubnubData {
|
||||
actualChannel: string;
|
||||
channel: string;
|
||||
message: any;
|
||||
}
|
||||
|
||||
interface StatusEvent {
|
||||
category: string;
|
||||
operation: string;
|
||||
affectedChannels: string[];
|
||||
subscribedChannels: string[];
|
||||
affectedChannelGroups: string[];
|
||||
lastTimetoken: number | string;
|
||||
currentTimetoken: number | string;
|
||||
}
|
||||
|
||||
// publish
|
||||
interface PublishParameters {
|
||||
message: any;
|
||||
channel: string;
|
||||
storeInHistory?: boolean;
|
||||
sendByPost?: boolean;
|
||||
meta?: any;
|
||||
ttl?: number;
|
||||
}
|
||||
|
||||
interface PublishResponse {
|
||||
timetoken: number;
|
||||
}
|
||||
|
||||
// fire
|
||||
interface FireParameters {
|
||||
message: any;
|
||||
channel: string;
|
||||
sendByPost?: boolean;
|
||||
meta?: any;
|
||||
}
|
||||
|
||||
// subscribe
|
||||
interface SubscribeParameters {
|
||||
channels?: string[];
|
||||
channelGroups?: string[];
|
||||
withPresence?: boolean;
|
||||
timetoken?: number;
|
||||
}
|
||||
|
||||
// unsubscribe
|
||||
interface UnsubscribeParameters {
|
||||
channels?: string[];
|
||||
channelGroups?: string[];
|
||||
}
|
||||
|
||||
// addListener
|
||||
interface ListenerParameters {
|
||||
status?: (statusEvent: StatusEvent) => void;
|
||||
message?: (data: PubnubData) => void;
|
||||
presence?: (presenceEvent: any) => void;
|
||||
}
|
||||
|
||||
// hereNow
|
||||
interface HereNowParameters {
|
||||
channels?: string[];
|
||||
channelGroups?: string[];
|
||||
includeUUIDs?: boolean;
|
||||
includeState?: boolean;
|
||||
}
|
||||
|
||||
interface HereNowResponse {
|
||||
totalChannels: number;
|
||||
totalOccupancy: number;
|
||||
channels: {[channel: string]: any};
|
||||
}
|
||||
|
||||
// whereNow
|
||||
interface WhereNowStatus {
|
||||
error: boolean;
|
||||
operation: string;
|
||||
statusCode: number;
|
||||
}
|
||||
|
||||
interface WhereNowResponse {
|
||||
channels: string[];
|
||||
}
|
||||
|
||||
// setState
|
||||
interface SetStateParameters {
|
||||
channels?: string[];
|
||||
channelGroups?: string[];
|
||||
state?: any;
|
||||
}
|
||||
|
||||
// getState
|
||||
interface GetStateParameters {
|
||||
uuid?: string;
|
||||
channels?: string[];
|
||||
channelGroups?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
export default Pubnub;
|
||||
51
types/pubnub/pubnub-tests.ts
Normal file
51
types/pubnub/pubnub-tests.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import Pubnub from 'pubnub';
|
||||
|
||||
const console = {
|
||||
log: (params: any) => {}
|
||||
};
|
||||
|
||||
const config: Pubnub.PubnubConfig = {
|
||||
subscribeKey: '',
|
||||
publishKey: '',
|
||||
secretKey: '',
|
||||
ssl: true,
|
||||
authKey: ''
|
||||
};
|
||||
|
||||
const pubnub = new Pubnub(config);
|
||||
|
||||
pubnub.setAuthKey('myAuthenKey');
|
||||
|
||||
// publish with callback
|
||||
pubnub.publish({channel: 'channel-1', message: {data: 1}}, (status, response) => {
|
||||
/*
|
||||
* Do something
|
||||
*/
|
||||
console.log(response.timetoken);
|
||||
});
|
||||
|
||||
// publish promise
|
||||
pubnub.publish({channel: 'channel-1', message: {data: 1}}).then((response) => {
|
||||
/*
|
||||
* Do something
|
||||
*/
|
||||
console.log(response.timetoken);
|
||||
});
|
||||
|
||||
pubnub.subscribe({channels: ['channel-1']});
|
||||
|
||||
pubnub.addListener({
|
||||
status: statusEvent => {
|
||||
if (statusEvent.category === "PNConnectedCategory") {
|
||||
console.log(statusEvent.category);
|
||||
}
|
||||
},
|
||||
message: message => {
|
||||
// handle message
|
||||
},
|
||||
presence: presenceEvent => {
|
||||
// handle presence
|
||||
}
|
||||
});
|
||||
|
||||
pubnub.unsubscribe({channels: ['channel-1']});
|
||||
23
types/pubnub/tsconfig.json
Normal file
23
types/pubnub/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"pubnub-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/pubnub/tslint.json
Normal file
1
types/pubnub/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
31
types/puppeteer/index.d.ts
vendored
31
types/puppeteer/index.d.ts
vendored
@ -96,6 +96,25 @@ export interface Cookie {
|
||||
sameSite: "Strict" | "Lax";
|
||||
}
|
||||
|
||||
export interface DeleteCookie {
|
||||
name: string;
|
||||
url?: string;
|
||||
domain?: string;
|
||||
path?: string;
|
||||
secure?: boolean;
|
||||
}
|
||||
|
||||
export interface SetCookie {
|
||||
name: string;
|
||||
value: string;
|
||||
domain?: string;
|
||||
path?: string;
|
||||
expires?: number;
|
||||
httpOnly?: boolean;
|
||||
secure?: boolean;
|
||||
sameSite?: "Strict" | "Lax";
|
||||
}
|
||||
|
||||
export interface Viewport {
|
||||
width: number;
|
||||
height: number;
|
||||
@ -359,15 +378,7 @@ export interface Page extends FrameBase {
|
||||
close(): Promise<void>;
|
||||
content(): Promise<string>;
|
||||
cookies(...urls: string[]): Promise<Cookie[]>;
|
||||
deleteCookie(
|
||||
...cookies: Array<{
|
||||
name: string;
|
||||
url?: string;
|
||||
domain?: string;
|
||||
path?: string;
|
||||
secure?: boolean;
|
||||
}>
|
||||
): Promise<void>;
|
||||
deleteCookie(...cookies: DeleteCookie[]): Promise<void>;
|
||||
emulate(options: Partial<EmulateOptions>): Promise<void>;
|
||||
emulateMedia(mediaType: 'screen' | 'print' | null): Promise<void>;
|
||||
evaluateHandle(
|
||||
@ -398,7 +409,7 @@ export interface Page extends FrameBase {
|
||||
screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
||||
select(selector: string, ...values: string[]): Promise<void>;
|
||||
setContent(html: string): Promise<void>;
|
||||
setCookie(...cookies: Cookie[]): Promise<void>;
|
||||
setCookie(...cookies: SetCookie[]): Promise<void>;
|
||||
setExtraHTTPHeaders(headers: Headers): Promise<void>;
|
||||
setJavaScriptEnabled(enabled: boolean): Promise<void>;
|
||||
setRequestInterceptionEnabled(value: boolean): Promise<void>;
|
||||
|
||||
20
types/qlik-engineapi/index.d.ts
vendored
20
types/qlik-engineapi/index.d.ts
vendored
@ -4060,7 +4060,7 @@ declare namespace EngineAPI {
|
||||
/**
|
||||
* Identifier and type of the dimension.
|
||||
*/
|
||||
qDim: INxLibraryMeasureDef;
|
||||
qDim: INxLibraryDimensionDef;
|
||||
|
||||
/**
|
||||
* Cardinal and tags related to the dimension.
|
||||
@ -4106,7 +4106,7 @@ declare namespace EngineAPI {
|
||||
*
|
||||
* @returns - A promise GenericDimension.
|
||||
*/
|
||||
getDimension(): Promise<IGenericDimension>;
|
||||
getDimension(): Promise<IGenericDimensionProperties>;
|
||||
|
||||
/**
|
||||
* Returns the type and identifier of the object.
|
||||
@ -6087,7 +6087,7 @@ declare namespace EngineAPI {
|
||||
* @returns - Information about the measure.
|
||||
* >> This parameter is mandatory.
|
||||
*/
|
||||
getMeasure(): Promise<INxLibraryMeasureDef>;
|
||||
getMeasure(): Promise<IGenericMeasureProperties>;
|
||||
|
||||
/**
|
||||
* Shows the properties of an object.
|
||||
@ -6879,12 +6879,6 @@ declare namespace EngineAPI {
|
||||
qSignature: string;
|
||||
}
|
||||
|
||||
interface IQOptions {
|
||||
qBookmarkId: string;
|
||||
|
||||
qExpires: number;
|
||||
}
|
||||
|
||||
interface IQDownloadInfo {
|
||||
/**
|
||||
* URL of the generated QVF
|
||||
@ -7104,14 +7098,6 @@ declare namespace EngineAPI {
|
||||
*/
|
||||
exportApp(qTargetPath: string, qSrcAppId: string, qIds: string[]): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Reduce an app in the memory to the current selection of a specified bookmark
|
||||
* and make it as http download available.
|
||||
* @params - optional qOptions
|
||||
* @returns - A Promise of qDownloadInfo
|
||||
*/
|
||||
exportReducedData(qOptions?: IQOptions): Promise<IQDownloadInfo>;
|
||||
|
||||
/**
|
||||
* Returns the handle of the current app.
|
||||
*
|
||||
|
||||
30
types/react-calendar-heatmap/index.d.ts
vendored
Normal file
30
types/react-calendar-heatmap/index.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Type definitions for react-calendar-heatmap 1.6
|
||||
// Project: https://github.com/patientslikeme/react-calendar-heatmap
|
||||
// Definitions by: Keisuke Kan <https://github.com/9renpoto>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export interface Props {
|
||||
classForValue?: (value: any) => any;
|
||||
endDate?: string | number | Date;
|
||||
gutterSize?: number;
|
||||
horizontal?: boolean;
|
||||
monthLabels?: string[];
|
||||
numDays?: number;
|
||||
onClick?: (value: any) => void;
|
||||
onMouseLeave?: (e: any, value: any) => void;
|
||||
onMouseOver?: (e: any, value: any) => void;
|
||||
showMonthLabels?: boolean;
|
||||
showOutOfRangeDays?: boolean;
|
||||
showWeekdayLabels?: boolean;
|
||||
startDate?: string | number | Date;
|
||||
titleForValue?: (value: any) => any;
|
||||
tooltipDataAttrs?: object;
|
||||
transformDayElement?: (rect: any, value: any, index: number) => any;
|
||||
values: any[];
|
||||
weekdayLabels?: string[];
|
||||
}
|
||||
|
||||
export default class ReactCalendarHeatmap extends React.Component<Props> {}
|
||||
@ -0,0 +1,16 @@
|
||||
import * as React from 'react';
|
||||
import CalendarHeatmap from 'react-calendar-heatmap';
|
||||
|
||||
export default function() {
|
||||
return (
|
||||
<CalendarHeatmap
|
||||
endDate={new Date('2016-04-01')}
|
||||
numDays={100}
|
||||
values={[
|
||||
{date: '2016-01-01'},
|
||||
{date: '2016-01-22'},
|
||||
{date: '2016-01-30'}
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
25
types/react-calendar-heatmap/tsconfig.json
Normal file
25
types/react-calendar-heatmap/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-calendar-heatmap-tests.tsx"
|
||||
]
|
||||
}
|
||||
3
types/react-calendar-heatmap/tslint.json
Normal file
3
types/react-calendar-heatmap/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
2
types/react-ga/index.d.ts
vendored
2
types/react-ga/index.d.ts
vendored
@ -25,6 +25,8 @@ export interface GaOptions {
|
||||
legacyHistoryImport?: boolean;
|
||||
allowLinker?: boolean;
|
||||
userId?: string;
|
||||
language?: string;
|
||||
hostName?: string;
|
||||
}
|
||||
|
||||
export interface InitializeOptions {
|
||||
|
||||
4
types/reactstrap/index.d.ts
vendored
4
types/reactstrap/index.d.ts
vendored
@ -68,8 +68,8 @@ export { Pagination, PaginationProps } from '
|
||||
export { PaginationItem, PaginationItemProps } from './lib/PaginationItem';
|
||||
export { PaginationLink, PaginationLinkProps } from './lib/PaginationLink';
|
||||
export { Popover, PopoverProps } from './lib/Popover';
|
||||
export { PopoverContent, PopoverContentProps } from './lib/PopoverContent';
|
||||
export { PopoverTitle, PopoverTitleProps } from './lib/PopoverTitle';
|
||||
export { PopoverBody, PopoverBodyProps } from './lib/PopoverBody';
|
||||
export { PopoverHeader, PopoverHeaderProps } from './lib/PopoverHeader';
|
||||
export { Progress, ProgressProps } from './lib/Progress';
|
||||
export { Row, RowProps } from './lib/Row';
|
||||
export { TabContent, TabContentProps } from './lib/TabContent';
|
||||
|
||||
10
types/reactstrap/lib/PopoverBody.d.ts
vendored
Normal file
10
types/reactstrap/lib/PopoverBody.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { CSSModule } from '../index';
|
||||
|
||||
export interface PopoverBodyProps {
|
||||
tag?: React.ReactType;
|
||||
className?: string;
|
||||
cssModule?: CSSModule;
|
||||
}
|
||||
|
||||
export const PopoverBody: React.StatelessComponent<PopoverBodyProps>;
|
||||
export default PopoverBody;
|
||||
10
types/reactstrap/lib/PopoverContent.d.ts
vendored
10
types/reactstrap/lib/PopoverContent.d.ts
vendored
@ -1,10 +0,0 @@
|
||||
import { CSSModule } from '../index';
|
||||
|
||||
export interface PopoverContentProps {
|
||||
tag?: React.ReactType;
|
||||
className?: string;
|
||||
cssModule?: CSSModule;
|
||||
}
|
||||
|
||||
export const PopoverContent: React.StatelessComponent<PopoverContentProps>;
|
||||
export default PopoverContent;
|
||||
10
types/reactstrap/lib/PopoverHeader.d.ts
vendored
Normal file
10
types/reactstrap/lib/PopoverHeader.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { CSSModule } from '../index';
|
||||
|
||||
export interface PopoverHeaderProps {
|
||||
tag?: React.ReactType;
|
||||
className?: string;
|
||||
cssModule?: CSSModule;
|
||||
}
|
||||
|
||||
export const PopoverHeader: React.StatelessComponent<PopoverHeaderProps>;
|
||||
export default PopoverHeader;
|
||||
10
types/reactstrap/lib/PopoverTitle.d.ts
vendored
10
types/reactstrap/lib/PopoverTitle.d.ts
vendored
@ -1,10 +0,0 @@
|
||||
import { CSSModule } from '../index';
|
||||
|
||||
export interface PopoverTitleProps {
|
||||
tag?: React.ReactType;
|
||||
className?: string;
|
||||
cssModule?: CSSModule;
|
||||
}
|
||||
|
||||
export const PopoverTitle: React.StatelessComponent<PopoverTitleProps>;
|
||||
export default PopoverTitle;
|
||||
@ -62,8 +62,8 @@ import {
|
||||
PaginationItem,
|
||||
PaginationLink,
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTitle,
|
||||
PopoverBody,
|
||||
PopoverHeader,
|
||||
Progress,
|
||||
TabPane,
|
||||
UncontrolledButtonDropdown,
|
||||
@ -2480,8 +2480,8 @@ class Example85 extends React.Component<any, any> {
|
||||
Launch Popover
|
||||
</Button>
|
||||
<Popover placement="bottom" isOpen={this.state.popoverOpen} target="Popover1" toggle={this.toggle}>
|
||||
<PopoverTitle>Popover Title</PopoverTitle>
|
||||
<PopoverContent>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</PopoverContent>
|
||||
<PopoverHeader>Popover Title</PopoverHeader>
|
||||
<PopoverBody>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</PopoverBody>
|
||||
</Popover>
|
||||
</div>
|
||||
);
|
||||
@ -2511,8 +2511,8 @@ class PopoverItem extends React.Component<any, any> {
|
||||
{this.props.item.text}
|
||||
</Button>
|
||||
<Popover placement={this.props.item.placement} isOpen={this.state.popoverOpen} target={'Popover-' + this.props.id} toggle={this.toggle}>
|
||||
<PopoverTitle>Popover Title</PopoverTitle>
|
||||
<PopoverContent>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</PopoverContent>
|
||||
<PopoverHeader>Popover Title</PopoverHeader>
|
||||
<PopoverBody>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</PopoverBody>
|
||||
</Popover>
|
||||
</span>
|
||||
);
|
||||
|
||||
106
types/resourcejs/index.d.ts
vendored
Normal file
106
types/resourcejs/index.d.ts
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
// Type definitions for resourcejs 1.9
|
||||
// Project: https://github.com/travist/resourcejs
|
||||
// Definitions by: Shaun Luttin <https://github.com/shaunluttin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import express = require("express");
|
||||
import mongoose = require("mongoose");
|
||||
|
||||
export = resourcejs;
|
||||
|
||||
declare function resourcejs(
|
||||
app: express.Application,
|
||||
route: string,
|
||||
modelName: string,
|
||||
model: mongoose.Model<mongoose.Document>): resourcejs.ResourceEndpoint;
|
||||
|
||||
declare namespace resourcejs {
|
||||
type HttpHandler = (req: Request, res: Response, next: express.NextFunction) => void;
|
||||
|
||||
type MethodBuild<T> = (options?: T) => ResourceEndpoint;
|
||||
|
||||
interface RestOptions extends HttpMethodOptions {
|
||||
beforePut?: HttpHandler;
|
||||
beforePatch?: HttpHandler;
|
||||
beforePost?: HttpHandler;
|
||||
beforeIndex?: HttpHandler;
|
||||
beforeGet?: HttpHandler;
|
||||
afterPut?: HttpHandler;
|
||||
afterPatch?: HttpHandler;
|
||||
afterPost?: HttpHandler;
|
||||
afterIndex?: HttpHandler;
|
||||
afterGet?: HttpHandler;
|
||||
}
|
||||
|
||||
interface VirtualOptions extends HttpMethodOptions {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
interface HttpMethodOptions {
|
||||
before?: HttpHandler;
|
||||
after?: HttpHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* We manually generated this interface by looking an resource like this:
|
||||
* const resource = Resource(app, route, name, model);
|
||||
* console.log(resource);
|
||||
*/
|
||||
interface ResourceEndpoint {
|
||||
model: mongoose.Model<mongoose.Document>;
|
||||
modelName: string;
|
||||
name: string;
|
||||
route: string;
|
||||
methods: string[];
|
||||
__swagger: any;
|
||||
register: (
|
||||
app: express.Application,
|
||||
method: string,
|
||||
path: string,
|
||||
callback: (...args: any[]) => any,
|
||||
last: (...args: any[]) => any,
|
||||
options: object) => any;
|
||||
|
||||
respond: HttpHandler;
|
||||
setResponse: HttpHandler;
|
||||
getMethodOptions: (method: string, options: object) => object;
|
||||
rest: MethodBuild<RestOptions>;
|
||||
getParamQuery: (req: Request, name: string) => any;
|
||||
getFindQuery: (req: Request) => object;
|
||||
index: MethodBuild<HttpMethodOptions>;
|
||||
get: MethodBuild<HttpMethodOptions>;
|
||||
virtual: MethodBuild<VirtualOptions>;
|
||||
post: MethodBuild<HttpMethodOptions>;
|
||||
put: MethodBuild<HttpMethodOptions>;
|
||||
patch: MethodBuild<HttpMethodOptions>;
|
||||
delete: MethodBuild<HttpMethodOptions>;
|
||||
swagger: MethodBuild<HttpMethodOptions>;
|
||||
}
|
||||
|
||||
interface Request extends express.Request {
|
||||
skipResource: boolean;
|
||||
noResponse: boolean;
|
||||
query: any;
|
||||
countQuery: any;
|
||||
modelQuery: any;
|
||||
skipDelete: boolean;
|
||||
}
|
||||
|
||||
interface Response extends express.Response {
|
||||
resource: Resource;
|
||||
}
|
||||
|
||||
interface Resource {
|
||||
status: number;
|
||||
error: Error;
|
||||
item: mongoose.Document | mongoose.Document[];
|
||||
}
|
||||
|
||||
interface Error {
|
||||
message: string;
|
||||
path: string;
|
||||
name: string;
|
||||
errors: Error[];
|
||||
}
|
||||
}
|
||||
19
types/resourcejs/resourcejs-tests.ts
Normal file
19
types/resourcejs/resourcejs-tests.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import express = require("express");
|
||||
import resourcejs = require("resourcejs");
|
||||
import mongoose = require("mongoose");
|
||||
|
||||
const app = express();
|
||||
const route = "the-route";
|
||||
const resourceName = "the-resource-name";
|
||||
|
||||
const schema = new mongoose.Schema({});
|
||||
const model = mongoose.model(resourceName, schema);
|
||||
|
||||
resourcejs(app, route, resourceName, model)
|
||||
.get()
|
||||
.post()
|
||||
.delete()
|
||||
.put()
|
||||
.patch()
|
||||
.index()
|
||||
.rest();
|
||||
23
types/resourcejs/tsconfig.json
Normal file
23
types/resourcejs/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"resourcejs-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/resourcejs/tslint.json
Normal file
3
types/resourcejs/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
24
types/swig-email-templates/index.d.ts
vendored
24
types/swig-email-templates/index.d.ts
vendored
@ -1,20 +1,30 @@
|
||||
// Type definitions for swig-email-templates
|
||||
// Type definitions for swig-email-templates 5.0
|
||||
// Project: https://github.com/andrewrk/swig-email-templates
|
||||
// Definitions by: Adam Babcock <https://github.com/mrhen>
|
||||
// Satana Charuwichitratana <https://github.com/micksatana>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="swig" />
|
||||
/// <reference types="jquery" />
|
||||
|
||||
import swig = require('swig');
|
||||
|
||||
interface SwigRender<T> {
|
||||
(file: string, context: T, callback: (err: any, html: string, text: string) => any): any;
|
||||
}
|
||||
type SwigRender<T> = (file: string, context: T, callback: (err: any, html: string, text: string) => any) => any;
|
||||
|
||||
interface SwigEmailTemplatesOptions extends swig.SwigOptions {
|
||||
root?: string;
|
||||
juice?: any;
|
||||
rewriteUrl?: (href: string) => string;
|
||||
rewrite?: ($: JQueryStatic) => void;
|
||||
}
|
||||
|
||||
declare function init<T>(options: SwigEmailTemplatesOptions, cb: (err: any, render: SwigRender<T>) => any): any;
|
||||
export = init;
|
||||
declare class EmailTemplates {
|
||||
constructor(options?: SwigEmailTemplatesOptions);
|
||||
|
||||
generateText(templatePath: string, context: any, html: string, cb: (error: any, text: string | null) => void): void;
|
||||
generateSubject(templatePath: string, context: any, cb: (error: any, text: string | null) => void): void;
|
||||
rewriteUrls($: JQueryStatic, rewrite: (href: string) => void): void;
|
||||
render(templatePath: string, context: any, cb: (error: any, inlinedHTML?: string, text?: string, subject?: string) => void): void;
|
||||
}
|
||||
|
||||
export = EmailTemplates;
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import EmailTemplates = require('swig-email-templates');
|
||||
import jQuery = require('jquery');
|
||||
|
||||
import emailTemplates = require('swig-email-templates');
|
||||
const templates = new EmailTemplates();
|
||||
const withOptions = new EmailTemplates({ root: '' });
|
||||
|
||||
var options = {
|
||||
root: "root"
|
||||
};
|
||||
templates.generateText('templatePath', {}, 'html', () => {});
|
||||
templates.generateSubject('templatePath', {}, () => {});
|
||||
templates.rewriteUrls(jQuery, () => {});
|
||||
templates.render('templatePath', {}, () => {});
|
||||
|
||||
emailTemplates(options, function(err, render) {
|
||||
var context = {
|
||||
meatballCount: 9001,
|
||||
};
|
||||
render('meatball-sandwich.html', context, function(err, html, text) {
|
||||
// send html/text email
|
||||
});
|
||||
});
|
||||
withOptions.generateText('templatePath', {}, 'html', () => {});
|
||||
withOptions.generateSubject('templatePath', {}, () => { });
|
||||
withOptions.rewriteUrls(jQuery, () => {});
|
||||
withOptions.render('templatePath', {}, () => {});
|
||||
|
||||
@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"swig-email-templates-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,79 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
89
types/vuex-i18n/index.d.ts
vendored
Normal file
89
types/vuex-i18n/index.d.ts
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
// Type definitions for vuex-i18n 1.7
|
||||
// Project: https://github.com/dkfbasel/vuex-i18n
|
||||
// Definitions by: Cedric Kemp <https://github.com/jaeggerr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import _Vue, { PluginObject } from "vue";
|
||||
|
||||
declare module "vue/types/vue" {
|
||||
interface Vue {
|
||||
$i18n: Ii18n;
|
||||
}
|
||||
|
||||
interface VueConstructor<V extends Vue = Vue> {
|
||||
i18n: Ii18n;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Translations {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export interface Ii18n {
|
||||
/** get the current locale */
|
||||
locale(): string;
|
||||
|
||||
/** set the current locale (i.e. 'de', 'en') */
|
||||
set(locale: string): void;
|
||||
|
||||
/**
|
||||
* add locale translation to the storage. this will extend existing information
|
||||
* (i.e. 'de', {'message': 'Eine Nachricht'})
|
||||
*/
|
||||
add(locale: string, translations: Translations): void;
|
||||
|
||||
/**
|
||||
* replace locale translations in the storage. this will remove all previous
|
||||
* locale information for the specified locale
|
||||
*/
|
||||
replace(locale: string, translations: Translations): void;
|
||||
|
||||
/**
|
||||
* remove the given locale from the store
|
||||
*/
|
||||
remove(locale: string): void;
|
||||
|
||||
/**
|
||||
* set a fallback locale if translation for current locale does not exist
|
||||
*/
|
||||
fallback(locale: string): void;
|
||||
|
||||
/**
|
||||
* get localized string from store. note that we pass the arguments passed
|
||||
* to the function directly to the translateInLanguage function
|
||||
*/
|
||||
translate(key: string, options: any, pluralization?: number): string | undefined;
|
||||
|
||||
/**
|
||||
* get localized string from store. note that we pass the arguments passed
|
||||
* to the function directly to the translateInLanguage function
|
||||
*/
|
||||
translate(key: string, defaultValue: string, options: any, pluralization?: number): string | undefined;
|
||||
|
||||
/**
|
||||
* get localized string from store in a given language if available.
|
||||
*/
|
||||
translateIn(locale: string, key: string, options: any, pluralization?: number): string | undefined;
|
||||
|
||||
/**
|
||||
* get localized string from store in a given language if available.
|
||||
*/
|
||||
translateIn(locale: string, key: string, defaultValue: string, options: any, pluralization?: number): string | undefined;
|
||||
|
||||
/**
|
||||
* check if the given locale translations are present in the store
|
||||
*/
|
||||
localeExists(locale: string): boolean;
|
||||
|
||||
/**
|
||||
* check if the given key is available in the current or fallback locale
|
||||
*/
|
||||
keyExists(key: string): boolean;
|
||||
}
|
||||
|
||||
declare const _default: {
|
||||
plugin: PluginObject<Ii18n>;
|
||||
};
|
||||
|
||||
export default _default;
|
||||
7
types/vuex-i18n/package.json
Normal file
7
types/vuex-i18n/package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"vue": ">=2.0.0",
|
||||
"vuex": ">=2.0.0"
|
||||
}
|
||||
}
|
||||
25
types/vuex-i18n/tsconfig.json
Normal file
25
types/vuex-i18n/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"types": [],
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"vuex-i18n-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/vuex-i18n/tslint.json
Normal file
3
types/vuex-i18n/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
41
types/vuex-i18n/vuex-i18n-tests.ts
Normal file
41
types/vuex-i18n/vuex-i18n-tests.ts
Normal file
@ -0,0 +1,41 @@
|
||||
// load vue and vuex instance
|
||||
import Vue from "vue";
|
||||
import { Store } from "vuex";
|
||||
|
||||
// load vuex i18n module
|
||||
import vuexI18n from "vuex-i18n";
|
||||
|
||||
// initialize the vuex store using the vuex module. note that you can change the
|
||||
// name of the module if you wish
|
||||
const store = new Store({});
|
||||
|
||||
// initialize the internationalization plugin on the vue instance. note that
|
||||
// the store must be passed to the plugin. the plugin will then generate some
|
||||
// helper functions for components (i.e. this.$i18n.set, this.$t) and on the vue
|
||||
// instance (i.e. Vue.i18n.set).
|
||||
Vue.use(vuexI18n.plugin, store);
|
||||
|
||||
// please note that you must specify the name of the vuex module if it is
|
||||
// different from i18n. i.e. Vue.use(vuexI18n.plugin, store, "myName")
|
||||
|
||||
// add some translations (could also be loaded from a separate file)
|
||||
// note that it is possible to use placeholders. translations can also be
|
||||
// structured as object trees and will automatically be flattened by the the
|
||||
// plugin
|
||||
const translationsEn = {
|
||||
content: "This is some {type} content"
|
||||
};
|
||||
|
||||
// translations can be kept in separate files for each language
|
||||
// i.e. resources/i18n/de.json.
|
||||
const translationsDe = {
|
||||
"My nice title": "Ein schöner Titel",
|
||||
content: "Dies ist ein toller Inhalt"
|
||||
};
|
||||
|
||||
// add translations directly to the application
|
||||
Vue.i18n.add("en", translationsEn);
|
||||
Vue.i18n.add("de", translationsDe);
|
||||
|
||||
// set the start locale to use
|
||||
Vue.i18n.set("en");
|
||||
7
types/wtfnode/index.d.ts
vendored
Normal file
7
types/wtfnode/index.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// Type definitions for wtfnode 0.5
|
||||
// Project: https://github.com/myndzi/wtfnode
|
||||
// Definitions by: Piotr Roszatycki <https://github.com/dex4er>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function dump(): void;
|
||||
export function init(): void;
|
||||
23
types/wtfnode/tsconfig.json
Normal file
23
types/wtfnode/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"wtfnode-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/wtfnode/tslint.json
Normal file
1
types/wtfnode/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
4
types/wtfnode/wtfnode-tests.ts
Normal file
4
types/wtfnode/wtfnode-tests.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import * as wtf from 'wtfnode';
|
||||
|
||||
wtf.init();
|
||||
wtf.dump();
|
||||
Loading…
Reference in New Issue
Block a user