Merge branch 'master' into fix-elasticsearch

# Conflicts:
#	types/elasticsearch/index.d.ts
This commit is contained in:
daphnes
2017-12-01 13:52:29 +01:00
1502 changed files with 76736 additions and 26992 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- node
- 8
sudo: false
+1 -1
View File
@@ -38,7 +38,7 @@ or just look for any ".d.ts" files in the package and manually include them with
These can be used by TypeScript 1.0.
* [Typings](https://github.com/typings/typings)
* ~~[NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)~~ (use preferred alternatives, nuget DT type publishing has been turned off)
* ~~[NuGet](http://nuget.org/packages?q=DefinitelyTyped)~~ (use preferred alternatives, nuget DT type publishing has been turned off)
* Manually download from the `master` branch of this repository
You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
+12
View File
@@ -186,6 +186,12 @@
"sourceRepoURL": "https://github.com/loopline-systems/electron-builder",
"asOfVersion": "2.8.0"
},
{
"libraryName": "error-stack-parser",
"typingsPackageName": "error-stack-parser",
"sourceRepoURL": "https://github.com/stacktracejs/error-stack-parser",
"asOfVersion": "2.0.0"
},
{
"libraryName": "eventemitter2",
"typingsPackageName": "eventemitter2",
@@ -330,6 +336,12 @@
"sourceRepoURL": "https://github.com/tdegrunt/jsonschema",
"asOfVersion": "1.1.1"
},
{
"libraryName": "jsplumb",
"typingsPackageName": "jsplumb",
"sourceRepoURL": "https://github.com/jsplumb/jsPlumb",
"asOfVersion": "2.5.7"
},
{
"libraryName": "knockout-paging",
"typingsPackageName": "knockout-paging",
+51 -15
View File
@@ -345,18 +345,47 @@ declare namespace AceAjax {
insert(position: Position, text: string): any;
/**
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
* @param row The index of the row to insert at
* @param lines An array of strings
**/
* @deprecated Use the insertFullLines method instead.
*/
insertLines(row: number, lines: string[]): any;
/**
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
* @param position The position to insert at
**/
* Inserts the elements in `lines` into the document as full lines (does not merge with existing line), starting at the row index given by `row`. This method also triggers the `"change"` event.
* @param {Number} row The index of the row to insert at
* @param {Array} lines An array of strings
* @returns {Object} Contains the final row and column, like this:
* ```
* {row: endRow, column: 0}
* ```
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
* ```
* {row: row, column: 0}
* ```
*
**/
insertFullLines(row: number, lines: string[]): any;
/**
* @deprecated Use insertMergedLines(position, ['', '']) instead.
*/
insertNewLine(position: Position): any;
/**
* Inserts the elements in `lines` into the document, starting at the position index given by `row`. This method also triggers the `"change"` event.
* @param {Number} row The index of the row to insert at
* @param {Array} lines An array of strings
* @returns {Object} Contains the final row and column, like this:
* ```
* {row: endRow, column: 0}
* ```
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
* ```
* {row: row, column: 0}
* ```
*
**/
insertMergedLines(row: number, lines: string[]): any;
/**
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
* @param position The position to insert at
@@ -379,12 +408,19 @@ declare namespace AceAjax {
removeInLine(row: number, startColumn: number, endColumn: number): any;
/**
* Removes a range of full lines. This method also triggers the `'change'` event.
* @param firstRow The first row to be removed
* @param lastRow The last row to be removed
**/
* @deprecated Use the removeFullLines method instead.
*/
removeLines(firstRow: number, lastRow: number): string[];
/**
* Removes a range of full lines. This method also triggers the `"change"` event.
* @param {Number} firstRow The first row to be removed
* @param {Number} lastRow The last row to be removed
* @returns {[String]} Returns all the removed lines.
*
**/
removeFullLines(firstRow: number, lastRow: number): string[];
/**
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
* @param row The row to check
@@ -474,9 +510,9 @@ declare namespace AceAjax {
removeFold(arg: any): void;
expandFold(arg: any): void;
foldAll(startRow?: number, endRow?: number, depth?: number): void
unfold(arg1: any, arg2: boolean): void;
screenToDocumentColumn(row: number, column: number): void;
@@ -2659,9 +2695,9 @@ declare namespace AceAjax {
characterWidth: number;
lineHeight: number;
setScrollMargin(top:number, bottom:number, left: number, right: number): void;
screenToTextCoordinates(left: number, top: number): void;
/**
+12 -17
View File
@@ -1,13 +1,13 @@
import acorn = require('acorn');
import * as ESTree from 'estree';
declare var token: acorn.Token;
declare var tokens: acorn.Token[];
declare var comment: acorn.Comment;
declare var comments: acorn.Comment[];
declare var program: ESTree.Program;
var any: any;
var string: string;
declare let token: acorn.Token;
declare let tokens: acorn.Token[];
declare let comment: acorn.Comment;
declare let comments: acorn.Comment[];
declare let program: ESTree.Program;
let any: any;
let string: string;
// acorn
string = acorn.version;
@@ -32,16 +32,12 @@ const parser = new acorn.Parser({}, 'export default ""', 0);
const node = new acorn.Node(parser, 1, 1);
class LooseParser {
constructor(input: string, options = {}) {
}
constructor(input: string, options = {}) {}
// this means you can extend LooseParser
test() {
}
test() {}
}
acorn.addLooseExports(function () {
acorn.addLooseExports(() => {
return {
type: 'Program',
sourceType: 'script',
@@ -50,7 +46,7 @@ acorn.addLooseExports(function () {
type: 'EmptyStatement'
}
]
}
};
}, LooseParser, {});
acorn.parseExpressionAt('string', 2);
@@ -63,8 +59,7 @@ acorn.isIdentifierChar(56);
acorn.getLineInfo('string', 56);
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
}
acorn.plugins['test'] = (p: acorn.Parser, config: any) => {};
acorn.tokenizer('console.log("hello world)', {locations: true}).getToken();
acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next();
+9 -14
View File
@@ -1,10 +1,8 @@
// Type definitions for Acorn v4.0.3
// Type definitions for Acorn 4.0
// Project: https://github.com/marijnh/acorn
// Definitions by: RReverser <https://github.com/RReverser>, e-cloud <https://github.com/e-cloud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="estree" />
export as namespace acorn;
export = acorn;
import * as ESTree from 'estree';
@@ -181,7 +179,7 @@ declare namespace acorn {
_typeof: TokenType;
_void: TokenType;
_delete: TokenType;
}
};
class TokContext {
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override: (p: Parser) => void);
@@ -230,19 +228,18 @@ declare namespace acorn {
const version: string;
interface IParse {
(input: string, options?: Options): ESTree.Program;
}
// TODO: rename type.
type IParse = (input: string, options?: Options) => ESTree.Program;
const parse: IParse;
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
interface ITokenizer {
getToken() : Token,
[Symbol.iterator](): Iterator<Token>
getToken(): Token;
[Symbol.iterator](): Iterator<Token>;
}
function tokenizer(input: string, options: Options): ITokenizer;
let parse_dammit: IParse | undefined;
@@ -250,12 +247,10 @@ declare namespace acorn {
let pluginsLoose: PluginsObject | undefined;
interface ILooseParserClass {
new (input: string, options?: Options): ILooseParser
new (input: string, options?: Options): ILooseParser;
}
interface ILooseParser {
}
interface ILooseParser {}
function addLooseExports(parse: IParse, parser: ILooseParserClass, plugins: PluginsObject): void;
}
+1 -71
View File
@@ -1,79 +1,9 @@
{
"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
"no-unnecessary-class": false
}
}
+13
View 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/
@@ -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);
+415
View File
@@ -0,0 +1,415 @@
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);
/**
* @deprecated
* 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>;
/**
* Validates whether request is from Google 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.isRequestFromGoogle('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
*/
isRequestFromGoogle(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;
}
File diff suppressed because it is too large Load Diff
+571
View 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
View File
@@ -0,0 +1,24 @@
// Type definitions for actions-on-google 1.6
// 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';
+404
View File
@@ -0,0 +1,404 @@
/**
* 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[];
}
export interface StructuredResponse {
orderUpdate: OrderUpdate;
}
export interface RichResponseItemBasicCard {
basicCard: BasicCard;
}
export interface RichResponseItemSimpleResponse {
simpleResponse: SimpleResponse;
}
export interface RichResponseItemStructuredResponse {
structuredResponse: StructuredResponse;
}
export type RichResponseItem = RichResponseItemBasicCard | RichResponseItemSimpleResponse | RichResponseItemStructuredResponse;
/**
* 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: RichResponseItem[];
/**
* 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;
File diff suppressed because it is too large Load Diff
+28
View 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
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
-3
View File
@@ -731,9 +731,6 @@ declare namespace adone {
*/
creationData(): DatetimeCreationData;
/**
*
*/
parsingFlags(): DatetimeParsingFlags;
/**
+10 -2
View File
@@ -1,5 +1,4 @@
// Global
const threeCamera = new AFRAME.THREE.Camera();
AFRAME.TWEEN.Easing;
@@ -42,9 +41,18 @@ entity.addEventListener('child-detached', (event) => {
const Component = AFRAME.registerComponent('test', {});
// Scene
const scene = document.querySelector('a-scene');
scene.hasLoaded;
// System
const system = scene.systems['systemName'];
// Register Custom Geometry
AFRAME.registerGeometry('a-test-geometry', {
schema: {
groupIndex: { default: 0 }
},
init(data) {
this.geometry = new THREE.Geometry();
}
});
+9 -4
View File
@@ -1,6 +1,7 @@
// Type definitions for AFRAME 0.5
// Type definitions for AFRAME 0.7
// Project: https://aframe.io/
// Definitions by: Paul Shannon <https://github.com/devpaul>
// Roberto Ritger <https://github.com/bertoritger>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -40,7 +41,7 @@ declare namespace AFrame {
primitives: { [ key: string ]: Entity };
registerComponent(name: string, component: ComponentDefinition): ComponentConstructor;
registerElement(name: string, element: ANode): void;
registerGeometry(name: string, geometery: THREE.Geometry): Geometry;
registerGeometry(name: string, geometry: GeometryDefinition): Geometry;
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
registerShader(name: string, shader: any): void;
registerSystem(name: string, definition: SystemDefinition): void;
@@ -101,7 +102,7 @@ declare namespace AFrame {
name: string;
schema: Schema;
init(): void;
init(data?: any): void;
pause(): void;
play(): void;
remove(): void;
@@ -124,7 +125,7 @@ declare namespace AFrame {
multiple?: boolean;
schema?: Schema;
init?(): void;
init?(data?: any): void;
pause?(): void;
play?(): void;
remove?(): void;
@@ -222,6 +223,10 @@ declare namespace AFrame {
[ key: string ]: any;
}
interface GeometryDefinition extends ComponentDefinition {
geometry?: THREE.Geometry;
}
interface GeometryDescriptor {
Geometry: Geometry;
schema: Schema;
+255 -12
View File
@@ -1,4 +1,4 @@
// Type definitions for algoliasearch-client-js 3.24.5
// Type definitions for algoliasearch-client-js 3.24.6
// Project: https://github.com/algolia/algoliasearch-client-js
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
// Haroen Viaene <https://github.com/haroenv>
@@ -95,6 +95,18 @@ declare namespace algoliasearch {
* https://github.com/algolia/algoliasearch-client-js#keep-alive
*/
destroy(): void;
/**
* Add a header to be sent with all upcoming requests
*/
setExtraHeader(name: string, value: string): void;
/**
* Get the value of an extra header
*/
getExtraHeader(name: string): string;
/**
* remove an extra header for all upcoming requests
*/
unsetExtraHeader(name: string): void;
/**
* List all your indices along with their associated information (number of entries, disk size, etc.)
* @param cb(err, res)
@@ -533,6 +545,65 @@ declare namespace algoliasearch {
options: SearchSynonymOptions,
cb: (err: Error, res: any) => void
): void;
/**
* Save a rule object
* @param rule
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#save-rule---saverule
*/
saveRule(
rule: AlgoliaRule,
options: RuleOption,
cb: (err: Error, res: any) => void
): void;
/**
* Save a rule object
* @param rules
* @param options
* @param cb(err, res)
*/
batchRules(
rules: AlgoliaRule[],
options: RuleOption,
cb: (err: Error, res: any) => void
): void;
/**
* Delete a specific rule
* @param identifier
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#batch-rules---batchrules
*/
deleteRule(
identifier: string,
options: RuleOption,
cb: (err: Error, res: any) => void
): void;
/**
* Clear all rules of an index
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#clear-all-rules---clearrules
*/
clearRules(options: RuleOption, cb: (err: Error, res: any) => void): void;
/**
* Get a specific rule
* @param identifier
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#get-rule---getrule
*/
getRule(identifier: string, cb: (err: Error, res: any) => void): void;
/**
* Search a rules
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#search-rules---searchrules
*/
searchRules(
options: SearchRuleOptions,
cb: (err: Error, res: any) => void
): void;
/**
* List index user keys
* @param cb(err, res)
@@ -738,8 +809,8 @@ declare namespace algoliasearch {
}: {
facetName: string;
facetQuery: string;
qp: AlgoliaQueryParameters;
}): Promise<any>;
} & AlgoliaQueryParameters
): Promise<any>;
/**
* Search in an index
* @param params query parameter
@@ -755,8 +826,7 @@ declare namespace algoliasearch {
}: {
facetName: string;
facetQuery: string;
qp: AlgoliaQueryParameters;
},
} & AlgoliaQueryParameters,
cb: (err: Error, res: any) => void
): void;
/**
@@ -846,6 +916,50 @@ declare namespace algoliasearch {
* https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms
*/
searchSynonyms(options: SearchSynonymOptions): Promise<any>;
/**
* Save a rule object
* @param rule
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#save-rule---saverule
*/
saveRule(rule: AlgoliaRule, options: RuleOption): Promise<any>;
/**
* Save a rule object
* @param rules
* @param options
* return {Promise}
*/
batchRules(rules: AlgoliaRule[], options: RuleOption): Promise<any>;
/**
* Delete a specific rule
* @param identifier
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#batch-rules---batchrules
*/
deleteRule(identifier: string, options: RuleOption): Promise<any>;
/**
* Clear all query rules of an index
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#clear-all-rules---clearrules
*/
clearRules(options: RuleOption): Promise<any>;
/**
* Get a specific query rule
* @param identifier
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#get-rule---getrule
*/
getRule(identifier: string): Promise<any>;
/**
* Search for query rules
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#search-rules---searchrules
*/
searchRules(options: SearchRuleOptions): Promise<any>;
/**
* List index user keys
* return {Promise}
@@ -1024,8 +1138,8 @@ Interface describing options available for gettings the logs
description?: string;
}
/**
* Describes option used when making operation on synonyms
*/
* Describes option used when making operation on synonyms
*/
interface SynonymOption {
/**
* You can forward all settings updates to the replicas of an index
@@ -1039,8 +1153,8 @@ Interface describing options available for gettings the logs
replaceExistingSynonyms?: boolean;
}
/**
* Describes options used when searching for synonyms
*/
* Describes options used when searching for synonyms
*/
interface SearchSynonymOptions {
/**
* The actual search query to find synonyms
@@ -1049,7 +1163,7 @@ Interface describing options available for gettings the logs
query?: string;
/**
* The page to fetch when browsing through several pages of results
* default: 100
* default: 0
* https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms
*/
page?: number;
@@ -1066,6 +1180,49 @@ Interface describing options available for gettings the logs
*/
hitsPerPage?: number;
}
/**
* Describes option used when making operation on query rules
*/
interface RuleOption {
/**
* You can forward all settings updates to the replicas of an index
* https://github.com/algolia/algoliasearch-client-js#replica-settings
*/
forwardToReplicas?: boolean;
/**
* Replace all existing query rules on the index with the content of the batch
*/
clearExistingRules?: boolean;
}
/**
* Describes options used when searching for query rules
*/
interface SearchRuleOptions {
/**
* The actual search query to find synonyms
*/
query?: string;
/**
* When specified, restricts matches to rules with a specific anchoring type.
* When omitted, all anchoring types may match.
*/
anchoring?: string;
/**
* When specified, restricts matches to contextual rules with a specific context (exact match).
* When omitted, any generic or contextual rule (with any context) may match.
*/
context?: string;
/**
* Requested page (zero-based)
* default: 0
*/
page?: number;
/**
* Number of hits per page
* default: 20
*/
hitsPerPage?: number;
}
interface AlgoliaBrowseResponse {
cursor?: string;
hits: any[];
@@ -1094,8 +1251,94 @@ Interface describing options available for gettings the logs
synonyms: string[];
}
/**
* Describes the options used when generating new api keys
*/
* Describes a query rule object
*/
interface AlgoliaRule {
/**
* ObjectID of the synonym
* https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym
*/
objectID: string;
/**
* Condition of the rule
*/
condition: {
/**
* Query pattern
* syntax: https://www.algolia.com/doc/rest-api/query-rules/?language=php#query-pattern-syntax
*/
pattern: string;
/**
* Whether the pattern must match the beginning or the end of the query string, or both, or none.
*/
anchoring: 'is' | 'startsWith' | 'endsWith' | 'contains';
/**
* Rule context (format: [A-Za-z0-9_-]+).
* When specified, the rule is contextual and applies only when the same context is specified
* at query time (using the ruleContexts parameter).
* When absent, the rule is generic and always applies
* (provided that its other conditions are met, of course).
*/
context?: string;
};
/**
* Consequence of the rule. At least one of the following must be used:
*/
consequence: {
params?: {
/**
* When a string, it replaces the entire query string.
* When an object, describes incremental edits to be made to the query string.
*/
query?:
| string
| {
/**
* Tokens (literals or placeholders) from the query pattern
* that should be removed from the query string.
*/
remove: string[];
};
/**
* Names of facets to which automatic filtering must be applied;
* they must match the facet name of a facet value placeholder in the query pattern.
*/
automaticFacetFilters?: string[];
/**
* Same as automaticFacetFilters, but for optionalFacetFilters.
* The same syntax as query parameters can be used to specify a score: facetName<score=1>.
*/
automaticOptionalFacetFilters?: string[];
};
/**
* Objects to promote as hits. Each object must contain the following fields
*/
promote?: {
/**
* Unique identifier of the object to promote
*/
objectID: string;
/**
* Promoted rank for the object (zero-based)
*/
position: number;
}[];
/**
* Custom JSON object that will be appended to the userData array in the response.
* This object is not interpreted by the API. It is limited to 1kB of minified JSON.
*/
userData?: {};
};
/**
* This field is intended for rule management purposes,
* in particular to ease searching for rules and presenting them to human readers.
* It is not interpreted by the API.
*/
description?: string;
}
/**
* Describes the options used when generating new api keys
*/
interface AlgoliaSecuredApiOptions {
/**
* Filter the query with numeric, facet or/and tag filters
+15 -22
View File
@@ -1,23 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"algoliasearch-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "algoliasearch-tests.ts"]
}
+77 -77
View File
@@ -1,79 +1,79 @@
{
"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",
"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
}
}
+208 -45
View File
@@ -2191,27 +2191,45 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
chart.addGraph(graph);
*/
class AmGraph {
/** Text which screen readers will read if user rolls-over the bullet/column or sets focus using tab key (this is possible only if tabIndex property of AmGraph is set to some number). Text is added as aria-label tag. Note - not all screen readers and browsers support this.
@default "[[title]] [[category]] [[value]]"
*/
accessibleLabel: string;
/** Name of the alpha field in your dataProvider. */
alphaField: string;
/** If you set this to true before chart is drawn, the animation of this graph won't be played.
@default false
*/
animationPlayed: boolean;
/** Allows customizing graphs balloons individually (only when ChartCursor is used). Note: the balloon object is not created automatically, you should create it before setting properties */
balloon: AmBalloon;
/** Value balloon color. Will use graph or data item color if not set. */
balloonColor: string;
/** If you set some function, the graph will call it and pass GraphDataItem and AmGraph object to it. This function should return a string which will be displayed in a balloon. */
/** If you set some function, the graph will call it and pass GraphDataItem and AmGraph objects to it. This function should return a string which will be displayed in a balloon. */
balloonFunction(graphDataItem: GraphDataItem, amGraph: AmGraph): string;
/** Balloon text. You can use tags like [[value]], [[description]], [[percents]], [[open]], [[category]] [[value]] */
/** Balloon text. You can use tags like [[value]], [[description]], [[percents]], [[open]], [[category]] or any other field name from your data provider. HTML tags can also be used.
@default [[value]]
*/
balloonText: string;
/** Specifies if the line graph should be placed behind column graphs */
/** Specifies if the line graph should be placed behind column graphs
@default false
*/
behindColumns: boolean;
/** Type of the bullets. Possible values are: "none", "round", "square", "triangleUp", "triangleDown", "bubble", "custom". none */
/** Type of the bullets. Possible values are: "none", "round", "square", "triangleUp", "triangleDown", "triangleLeft", "triangleRight", "bubble", "diamond", "xError", "yError" and "custom".
@default "none"
*/
bullet: string;
/** Opacity of bullets. Value range is 0 - 1.
@default 1
*/
bulletAlpha: number;
/** bulletAxis value is used when you are building error chart. Error chart is a regular serial or XY chart with bullet type set to "xError" or "yError". The graph should know which axis should be used to determine the size of this bullet - that's when bulletAxis should be set. Besides that, you should also set graph.errorField. You can also use other bullet types with this feature too. For example, if you set bulletAxis for XY chart, the size of a bullet will change as you zoom the chart. */
bulletAxis: ValueAxis;
/** Bullet border opacity.
@default 1
@default 0
*/
bulletBorderAlpha: number;
/** Bullet border color. Will use lineColor if not set. */
/** Bullet border color. Will use lineColor if not set. */
bulletBorderColor: string;
/** Bullet border thickness.
@default 2
@@ -2221,7 +2239,11 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
bulletColor: string;
/** Name of the bullet field in your dataProvider. */
bulletField: string;
/** Bullet offset. Distance from the actual data point to the bullet. Can be used to place custom bullets above the columns. */
/** Useful for touch devices - if you set it to 20 or so, the bullets of a graph will have invisible circle around the actual bullet (bullets should still be enabled), which will be easier to touch (bullets usually are smaller and hard to hit). */
bulletHitAreaSize: number;
/** Bullet offset. Distance from the actual data point to the bullet. Can be used to place custom bullets above the columns.
@default 0
*/
bulletOffset: number;
/** Bullet size.
@default 8
@@ -2229,17 +2251,31 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
bulletSize: number;
/** Name of the bullet size field in your dataProvider. */
bulletSizeField: string;
/** If this field is set and addClassNames is enabled, the chart will look for a class name string in data using this setting and apply additional class names to elements of the particular data points, such as bullets. */
classNameField: string;
/** Name of the close field (used by candlesticks and ohlc) in your dataProvider. */
closeField: string;
/** In case you want to place this graph's columns in front of other columns, set this to false. In case "true", the columns will be clustered next to each other.
NOTE: clustering works only for graphs of type "column".
@default true
*/
clustered: boolean;
/** Color of value labels. Will use chart's color if not set. */
color: string;
/** Name of the color field in your dataProvider. */
colorField: string;
/** Specifies whether to connect data points if data is missing. The default value is true.
/** You can use this property with non-stacked column graphs and specify order of columns of each category (starting from 0). Important: this feature does not work in stacked columns scenarios as well as with graph toggling enabled in legend. */
columnIndexField: string;
/** You can specify custom column width for each graph individually. Value range is 0 - 1 (we set relative width, not pixel width here). */
columnWidth: number;
/** Specifies whether to connect data points if data is missing. The default value is true. This feature does not work with XY chart.
@default true
*/
connect: boolean;
/** Corner radius of column. It can be set both in pixels or in percents. The chart's depth and angle styles must be set to 0. The default value is 0. Note, cornerRadiusTop will be applied for all corners of the column, JavaScript charts do not have a possibility to set separate corner radius for top and bottom. As we want all the property names to be the same both on JS and Flex, we didn't change this too. */
/** Corner radius of column. It can be set both in pixels or in percents. The chart's depth and angle styles must be set to 0. The default value is 0. Note, cornerRadiusTop will be applied for all corners of the column, JavaScript charts do not have a possibility to set separate corner radius for top and bottom. As we want all the property names to be the same both on JS and Flex, we didn't change this too.
@default 0
*/
cornerRadiusTop: number;
/** If bulletsEnabled of ChartCurosor is true, a bullet on each graph follows the cursor. You can set opacity of each graphs bullet. In case you want to disable these bullets for a certain graph, set opacity to 0.
@default 1
@@ -2249,55 +2285,108 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
customBullet: string;
/** Name of the custom bullet field in your dataProvider. */
customBulletField: string;
/** Dash length. If you set it to a value greater than 0, the graph line will be dashed. */
/** Path to the image for legend marker. */
customMarker: string;
/** Dash length. If you set it to a value greater than 0, the graph line (or columns border) will be dashed.
@default 0
*/
dashLength: number;
/** Name of the dash length field in your dataProvider. This property adds a possibility to change graphs line from solid to dashed on any data point. You can also make columns border dashed using this setting. Note, this won't work with smoothedLineGraph. */
dashLengthField: string;
/** Used to format balloons if value axis is date-based.
@default "MMM DD, YYYY"
*/
dateFormat: string;
/** Name of the description field in your dataProvider. */
descriptionField: string;
/** Opacity of fill. Plural form is used to keep the same property names as our Flex charts'. Flex charts can accept array of numbers to generate gradients. Although you can set array here, only first value of this array will be used. */
/** Name of error value field in your data provider. */
errorField: string;
/** Opacity of fill. Plural form is used to keep the same property names as our Flex charts'. Flex charts can accept array of numbers to generate gradients. Although you can set array here, only first value of this array will be used.
@default 0
*/
fillAlphas: number;
/** Fill color. Will use lineColor if not set. */
fillColors: any;
/** Name of the fill colors field in your dataProvider. */
/** Fill color. Will use lineColor if not set. You can also set array of colors here. */
fillColors: string;
/** Name of the fill colors field in your dataProvider. This property adds a possibility to change line graphs fill color on any data point to create highlighted sections of the graph. Works only with AmSerialChart. */
fillColorsField: string;
/** You can set another graph here and if fillAlpha is >0, the area from this graph to fillToGraph will be filled (instead of filling the area to the X axis). */
/** XY chart only. If you set this property to id or reference of your X or Y axis, and the fillAlphas is > 0, the area between graph and axis will be filled with color, like in this demo. */
fillToAxis: ValueAxis;
/** You can set another graph here and if fillAlpha is >0, the area from this graph to fillToGraph will be filled (instead of filling the area to the X axis). This feature is not supported by smoothedLine graphs and Radar chart. */
fillToGraph: AmGraph;
/** Column width in pixels. If you set this property, columns will be of a fixed width and won't adjust to the available space. */
fixedColumnWidth: number;
/** Size of value labels text. Will use chart's fontSize if not set. */
fontSize: string;
/** Orientation of the gradient fills (only for "column" graph type). Possible values are "vertical" and "horizontal". vertical */
fontSize: number;
/** If this is set `true`, the graph will always break the line if the distance in time between two adjacent data points is bigger than `gapPeriod x minPeriod`, even if `connect` is set to `true`.
@default false
*/
forceGap: boolean;
/** Name of the gap field in your dataProvider. You can force graph to show gap at a desired data point using this feature. This feature does not work with XY chart. */
gapField: string;
/** Using this property you can specify when graph should display gap - if the time difference between data points is bigger than duration of minPeriod * gapPeriod, and connect property of a graph is set to false, graph will display gap.
@default 1.1
*/
gapPeriod: number;
/** Orientation of the gradient fills (only for "column" graph type). Possible values are "vertical" and "horizontal".
@default "vertical"
*/
gradientOrientation: string;
/** Specifies whether the graph is hidden. Do not use this to show/hide the graph, use hideGraph(graph) and showGraph(graph) methods instead. */
/** Specifies whether the graph is hidden. Do not use this to show/hide the graph, use hideGraph(graph) and showGraph(graph) methods instead.
@default false
*/
hidden: boolean;
/** If there are more data points than hideBulletsCount, the bullets will not be shown. 0 means the bullets will always be visible. */
/** If there are more data points than hideBulletsCount, the bullets will not be shown. 0 means the bullets will always be visible.
@default 0
*/
hideBulletsCount: number;
/** Name of the high field (used by candlesticks and ohlc) in your dataProvider. */
highField: string;
/** Unique id of a graph. It is not required to set one, unless you want to use this graph for as your scrollbar's graph and need to indicate which graph should be used.*/
id?: string;
/** Unique id of a graph. It is not required to set one, unless you want to use this graph for as your scrollbar's graph and need to indicate which graph should be used. */
id: string;
/** Whether to include this graph when calculating min and max value of the axis.
@default true
*/
includeInMinMax: boolean;
/** Data label text anchor.
@default "auto"
*/
labelAnchor: string;
/** Name of label color field in data provider. */
labelColorField: string;
/** Position of value label. Possible values are: "bottom", "top", "right", "left", "inside", "middle". Sometimes position is changed by the chart, depending on a graph type, rotation, etc. top */
/** You can use it to format labels of data items in any way you want. Graph will call this function and pass reference to GraphDataItem and formatted text as attributes. This function should return string which will be displayed as label. */
labelFunction(value: number, valueText: string, valueAxis: ValueAxis): string;
labelFunction(valueText: string, data: Date, valueAxis: ValueAxis): string;
/** Offset of data label.
@default 0
*/
labelOffset: number;
/** Position of value label. Possible values are: "bottom", "top", "right", "left", "inside", "middle". Sometimes position is changed by the chart, depending on a graph type, rotation, etc.
@default "top"
*/
labelPosition: string;
/** Rotation of a data label.
@default 0
*/
labelRotation: number;
/** Value label text. You can use tags like [[value]], [[description]], [[percents]], [[open]], [[category]]. */
labelText: string;
/** Legend marker opacity. Will use lineAlpha if not set. Value range is 0 - 1. */
legendAlpha: number;
/** Legend marker color. Will use lineColor if not set. */
legendColor: string;
/** It is called and the following attributes are passed: dataItem, formattedText, periodValues, periodPercentValues. It should return hex color code which will be used for legend marker. */
legendColorFunction: Object;
/** The text which will be displayed in the value portion of the legend when user is not hovering above any data point. The tags should be made out of two parts - the name of a field (value / open / close / high / low) and the value of the period you want to be show - open / close / high / low / sum / average / count. For example: [[value.sum]] means that sum of all data points of value field in the selected period will be displayed. */
legendPeriodValueText: string;
/** Legend value text. You can use tags like [[value]], [[description]], [[percents]], [[open]], [[category]] You can also use custom fields from your dataProvider. If not set, uses Legend's valueText. */
legendValueText: string;
/** Opacity of the line (or column border). Value range is 0 - 1.
@default 1
*/
lineAlpha: number;
/** Color of the line (or column border). If you do not set any, the color from [[AmCoordinateChart */
/** Color of the line (or column border). If you do not set any, the color from AmCoordinateChart.colors array will be used for each subsequent graph. */
lineColor: string;
/** Name of the line color field (used by columns and candlesticks only) in your dataProvider. */
/** Name of the line color field in your dataProvider. This property adds a possibility to change graphs line color on any data point to create highlighted sections of the graph. Works only with AmSerialChart. */
lineColorField: string;
/** Specifies thickness of the graph line (or column border).
@default 1
@@ -2305,55 +2394,125 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
lineThickness: number;
/** Name of the low field (used by candlesticks and ohlc) in your dataProvider. */
lowField: string;
/** Legend marker type. You can set legend marker (key) type for individual graphs. Possible values are: "square", "circle", "line", "dashedLine", "triangleUp", "triangleDown", "bubble". */
/** Legend marker type. You can set legend marker (key) type for individual graphs. Possible values are: square, circle, diamond, triangleUp, triangleDown, triangleLeft, triangleDown, bubble, line, none. */
markerType: string;
/** Specifies size of the bullet which value is the biggest (XY chart).
@default 50
*/
maxBulletSize: number;
/** Specifies minimum size of the bullet (XY chart). */
/** Specifies minimum size of the bullet (XY chart).
@default 4
*/
minBulletSize: number;
/** If you use different colors for your negative values, a graph below zero line is filled with negativeColor. With this property you can define a different base value at which colors should be changed to negative colors. */
/** It is useful if you have really lots of data points. Based on this property the graph will omit some of the lines (if the distance between points is less that minDistance, in pixels). This will not affect the bullets or indicator in anyway, so the user will not see any difference (unless you set minValue to a bigger value, let say 5), but will increase performance as less lines will be drawn. By setting value to a bigger number you can also make your lines look less jagged.
@default 1
*/
minDistance: number;
/** If you use different colors for your negative values, a graph below zero line is filled with negativeColor. With this property you can define a different base value at which colors should be changed to negative colors.
@default 0
*/
negativeBase: number;
/** Fill opacity of negative part of the graph. Will use fillAlphas if not set. */
negativeFillAlphas: number;
/** Fill color of negative part of the graph. Will use fillColors if not set. */
negativeFillColors: any; //String /Array;
negativeFillColors: string;
/** Opacity of the negative portion of the line (or column border). Value range is 0 - 1.
@default 1
*/
negativeLineAlpha: number;
/** Color of the line (or column) when the values are negative. In case the graph type is candlestick or ohlc, negativeLineColor is used when close value is less then open value. */
negativeLineColor: string;
/** Example: {precision:-1, decimalSeparator:'.', thousandsSeparator:','}. The graph uses this object's values to format the numbers. Uses chart's numberFormatter if not defined. */
numberFormatter: Object;
/** If you set it to true, column chart will begin new stack. This allows having Clustered and Stacked column/bar chart. */
newStack: boolean;
/** Name of the open field (used by floating columns, candlesticks and ohlc) in your dataProvider.
@default 50
/** If you set it to true, column chart will begin new stack. This allows having Clustered and Stacked column/bar chart.
@default false
*/
newStack: boolean;
/** In case you want to have a step line graph without risers, you should set this to true.
@default false
*/
noStepRisers: boolean;
/** Name of the open field (used by floating columns, candlesticks and ohlc) in your dataProvider. */
openField: string;
/**Precision of values. Will use chart's precision if not set any.*/
precision: number;
/** Specifies where data points should be placed - on the beginning of the period (day, hour, etc) or in the middle (only when parseDates property of categoryAxis is set to true). This setting affects Serial chart only. Possible values are "start" and "middle". middle */
/** Value of pattern should be object with url, width, height of an image, optionally it might have x, y, randomX and randomY values. For example: {"url":"../amcharts/patterns/black/pattern1.png", "width":4, "height":4}. If you want to have individual patterns for each column, define patterns in data provider and set graph.patternField property. Check amcharts/patterns folder for some patterns. You can create your own patterns and use them. Note, x, y, randomX and randomY properties won't work with IE8 and older. 3D bar/Pie charts won't work properly with patterns. */
pattern: Object;
/** Field name in your data provider which holds pattern information. Value of pattern should be object with url, width, height of an image, optionally it might have x, y, randomX and randomY values. For example: {"url":"../amcharts/patterns/black/pattern1.png", "width":4, "height":4}. Check amcharts/patterns folder for some patterns. You can create your own patterns and use them. Note, x, y, randomX and randomY properties won't work with IE8 and older. 3D bar/Pie charts won't work properly with patterns. */
patternField: string;
/** This property can be used by step graphs - you can set how many periods one horizontal line should span.
@default 1
*/
periodSpan: number;
/** Specifies where data points should be placed - on the beginning of the period (day, hour, etc) or in the middle (only when parseDates property of categoryAxis is set to true). This setting affects Serial chart only. Possible values are "start", "middle" and "end"
@default "middle"
*/
pointPosition: string;
/** If graph's type is column and labelText is set, graph hides labels which do not fit into the column's space. If you don't want these labels to be hidden, set this to true. */
/** Precision of values. Will use chart's precision if not set any. */
precision: number;
/** If this is set to true, candlesticks will be colored in a different manner - if current close is less than current open, the candlestick will be empty, otherwise - filled with color. If previous close is less than current close, the candlestick will use positive color, otherwise - negative color.
@default false
*/
proCandlesticks: boolean;
/** Gantt chart only. Contains unmodified segment object from data provider. */
segmentData: Object;
/** If graph's type is column and labelText is set, graph hides labels which do not fit into the column's space or go outside plot area. If you don't want these labels to be hidden, set this to true.
@default false
*/
showAllValueLabels: boolean;
/** Specifies whether the value balloon of this graph is shown when mouse is over data item or chart's indicator is over some series.
@default true
*/
showBalloon: boolean;
/** Specifies graphs value at which cursor is showed. This is only important for candlestick and ohlc charts, also if column chart has "open" value. Possible values are: "open", "close", "high", "low". close */
/** Specifies graphs value at which cursor is showed. This is only important for candlestick and ohlc charts, also if column chart has "open" value. Possible values are: "open", "close", "high", "low". "top" and "bottom" values will glue the balloon to top/bottom of the plot area.
@default "close"
*/
showBalloonAt: string;
/** Works with candlestick graph type, you can set it to open, close, high, low. If you set it to high, the events will be shown at the tip of the high line.
@default "close"
*/
showBulletsAt: string;
/** If you want mouse pointer to change to hand when hovering the graph, set this property to true.
@default false
*/
showHandOnHover: boolean;
/** It can only be used together with topRadius (when columns look like cylinders). If you set it to true, the cylinder will be lowered down so that the center of it's bottom circle would be right on category axis.
@default false
*/
showOnAxis: boolean;
/** If the value axis of this graph has stack types like "regular" or "100%" You can exclude this graph from stacking.
@default true
*/
stackable: boolean;
/** Step graph only. Specifies to which direction step should be drawn.
@default "right"
*/
stepDirection: string;
/** If you set it to false, the graph will not be hidden when user clicks on legend entry.
@default true
*/
switchable: boolean;
/** In case you set it to some number, the chart will set focus on bullet/column (starting from first) when user clicks tab key. When a focus is set, screen readers like NVDA Screen reader will read label which is set using accessibleLabel property of AmGraph. Note, not all browsers and readers support this. */
tabIndex: number;
/** Graph title. */
title: string;
/** Type of the graph. Possible values are: "line", "column", "step", "smoothedLine", "candlestick", "ohlc". XY and Radar charts can only display "line" type graphs. line */
/** If you set this to 1, columns will become cylinders (must set depth3D and angle properties of a chart to >0 values in order this to be visible). you can make columns look like cones (set topRadius to 0) or even like some glasses (set to bigger than 1). We strongly recommend setting grid opacity to 0 in order this to look good. */
topRadius: number;
/** Type of the graph. Possible values are: "line", "column", "step", "smoothedLine", "candlestick", "ohlc". XY and Radar charts can only display "line" type graphs.
@default "line"
*/
type: string;
/** Name of the url field in your dataProvider. */
urlField: string;
/** Target to open URLs in, i.e. _blank, _top, etc. */
urlTarget: string;
/** Specifies which value axis the graph will use. Will use the first value axis if not set. */
/** If set to true, the bullet border will take the same color as graph line.
@default false
*/
useLineColorForBulletBorder: boolean;
/** If negativeLineColor and/or negativeFillColors are set and useNegativeColorIfDown is set to true (default is false), the line, step and column graphs will use these colors for lines, bullets or columns if previous value is bigger than current value. In case you set openField for the graph, the graph will compare current value with openField value instead of comparing to previous value. Here is a demo.
@default false
*/
useNegativeColorIfDown: boolean;
/** Specifies which value axis the graph will use. Will use the first value axis if not set. You can use reference to the real ValueAxis object or set value axis id.
@default ValueAxis
*/
valueAxis: ValueAxis;
/** Name of the value field in your dataProvider. */
valueField: string;
@@ -2361,11 +2520,15 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
@default true
*/
visibleInLegend: boolean;
/** XY chart only. A horizontal value axis object to attach graph to. */
/** XY chart only. A horizontal value axis object to attach graph to.
@default ValueAxis
*/
xAxis: ValueAxis;
/** XY chart only. Name of the x field in your dataProvider. */
xField: string;
/** XY chart only. A vertical value axis object to attach graph to. */
/** XY chart only. A vertical value axis object to attach graph to.
@default ValueAxis
*/
yAxis: ValueAxis;
/** XY chart only. Name of the y field in your dataProvider. */
yField: string;
+1 -1
View File
@@ -63,4 +63,4 @@ export interface ConfirmChannel extends Channel {
waitForConfirms(): Promise<void>;
}
export function connect(url: string, socketOptions?: any): Promise<Connection>;
export function connect(url: string | Options.Connect, socketOptions?: any): Promise<Connection>;
+59 -1
View File
@@ -21,6 +21,64 @@ export namespace Replies {
}
export namespace Options {
interface Connect {
/**
* The to be used protocol
*
* Default value: 'amqp'
*/
protocol?: string;
/**
* Hostname used for connecting to the server.
*
* Default value: 'localhost'
*/
hostname?: string;
/**
* Port used for connecting to the server.
*
* Default value: 5672
*/
port?: number;
/**
* Username used for authenticating against the server.
*
* Default value: 'guest'
*/
username?: string;
/**
* Password used for authenticating against the server.
*
* Default value: 'guest'
*/
password?: string;
/**
* The desired locale for error messages. RabbitMQ only ever uses en_US
*
* Default value: 'en_US'
*/
locale?: string;
/**
* The size in bytes of the maximum frame allowed over the connection. 0 means
* no limit (but since frames have a size field which is an unsigned 32 bit integer, its perforce 2^32 - 1).
*
* Default value: 0x1000 (4kb) - That's the allowed minimum, it will fit many purposes
*/
frameMax?: number;
/**
* The period of the connection heartbeat in seconds.
*
* Default value: 0
*/
heartbeat?: number;
/**
* What VHost shall be used.
*
* Default value: '/'
*/
vhost?: string;
}
interface AssertQueue {
exclusive?: boolean;
durable?: boolean;
@@ -85,4 +143,4 @@ export interface Message {
content: Buffer;
fields: any;
properties: any;
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: http://angularjs.org
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>, Raphael Schweizer <https://github.com/rasch>, Cody Schaaf <https://github.com/codyschaaf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3
declare var _: string;
export = _;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/nervgh/angular-file-upload
// Definitions by: Cyril Gandon <https://github.com/cyrilgandon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
import * as angular from 'angular';
-55
View File
@@ -1,55 +0,0 @@
## What is it?
This is a typescript interface to be used with [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys/).
## What are declaration files?
See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
## How do I get them?
### npm
This is the preferred method. This is only available for TypeScript 2.0+ users. For these typings:
```sh
npm install --save-dev @types/angular-hotkeys
```
The types should then be automatically included by the compiler.
See more in the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
### Other methods
These can be used by TypeScript 1.0.
* [Typings](https://github.com/typings/typings)
* ~~[NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)~~ (use preferred alternatives, nuget DT type publishing has been turned off)
* Manually download from the `master` branch of this repository
You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
## How to use
After installing a package you can import the definition file and begin using it as so:
```ts
import * as hotkeys from '../../node_modules/@types/angular-hotkeys'
class FooController {
static $inject = [
'hotkeys'
];
constructor(
private hotkeys: ng.hotkeys.HotkeysProvider
) { }
}
```
for a detailed explanation of the behavior of angular-hotkeys please refer to [its documentation](https://github.com/chieffancypants/angular-hotkeys/)
+64 -27
View File
@@ -1,30 +1,67 @@
var scope: ng.IScope;
var hotkeyProvider: ng.hotkeys.HotkeysProvider;
var hotkeyObj: ng.hotkeys.Hotkey;
import { HotkeysProvider, Hotkey } from 'angular-hotkeys';
import { module } from 'angular';
hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
hotkeyProvider.add(["mod+s"], "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
hotkeyProvider.add(hotkeyObj);
hotkeyProvider.bindTo(scope);
hotkeyProvider.del("mod+s");
hotkeyProvider.del(["mod+s"]);
hotkeyProvider.get("mod+s");
hotkeyProvider.get(["mod+s"]);
hotkeyProvider.toggleCheatSheet();
hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description ,hotkeyObj.callback);
hotkeyProvider.bindTo(scope)
.add(hotkeyObj)
.add(hotkeyObj)
.add({
combo: 'w',
description: 'blah blah',
callback: function() {}
})
.add({
combo: ['w', 'mod+w'],
description: 'blah blah',
callback: function() {}
module('myApp', ['cfp.hotkeys'])
.config((hotkeysProvider: HotkeysProvider) => {
hotkeysProvider.includeCheatSheet = false;
const somehotKeyObj: Hotkey = {
combo: '',
callback: () => { }
};
});
function someInjectionService(
scope: ng.IScope,
hotkeyProvider: ng.hotkeys.HotkeysProvider,
hotkeyObj: ng.hotkeys.Hotkey
) {
hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => { });
hotkeyProvider.add(["mod+s"], "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => { });
hotkeyProvider.add(hotkeyObj);
hotkeyProvider.bindTo(scope);
hotkeyProvider.del("mod+s");
hotkeyProvider.del(["mod+s"]);
hotkeyProvider.get("mod+s");
hotkeyProvider.get(["mod+s"]);
hotkeyProvider.toggleCheatSheet();
hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description, hotkeyObj.callback);
hotkeyProvider.bindTo(scope)
.add(hotkeyObj)
.add(hotkeyObj)
.add({
combo: 'w',
description: 'blah blah',
callback: () => { }
})
.add({
combo: ['w', 'mod+w'],
description: 'blah blah',
callback: () => { }
});
hotkeyProvider.add({
combo: 'ctrl+w',
description: 'Description goes here',
callback: (event, hotkey) => {
event.preventDefault();
}
});
hotkeyProvider.add({
combo: 'ctrl+x',
callback: (event, hotkey) => {
//
}
});
hotkeyProvider.add({
combo: 'ctrl+w',
description: 'Description goes here',
allowIn: ['INPUT', 'SELECT', 'TEXTAREA'],
callback(event, hotkey) {
event.preventDefault();
}
});
}
+99 -24
View File
@@ -1,12 +1,10 @@
// Type definitions for angular-hotkeys
// Type definitions for angular-hotkeys 1.7
// Project: https://github.com/chieffancypants/angular-hotkeys
// Definitions by: Jason Zhao <https://github.com/jlz27>, Stefan Steinhart <https://github.com/reppners>
// Definitions by: Jason Zhao <https://github.com/jlz27>
// Stefan Steinhart <https://github.com/reppners>
// Cyril Gandon <https://github.com/cyrilgandon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
//readme written by David Valentine <https://github.com/dvalenti314>
/// <reference types="angular" />
import * as ng from 'angular';
@@ -15,46 +13,123 @@ export type HotkeysProviderChained = ng.hotkeys.HotkeysProviderChained;
export type Hotkey = ng.hotkeys.Hotkey;
declare module 'angular' {
export namespace hotkeys {
namespace hotkeys {
interface HotkeysProvider {
template: string;
templateTitle: string;
/**
* Configurable setting to disable the cheatsheet entirely.
* @default true
*/
includeCheatSheet: boolean;
/**
* Configurable setting to disable ngRoute hooks.
*/
useNgRoute: boolean;
/**
* Configurable setting for the cheat sheet title
* @default 'Keyboard Shortcuts'
*/
templateTitle: string;
/**
* Configurable settings for the cheat sheet header in HTML.
* This overrides the normal title if specified.
* @default null
*/
templateHeader: string | null;
/**
* Configurable settings for the cheat sheet footer in HTML.
* @default null
*/
templateFooter: string | null;
/**
* Cheat sheet template in the event you want to totally customize it.
*/
template: string;
/**
* Configurable setting for the cheat sheet hotkey.
* @default '?'
*/
cheatSheetHotkey: string;
/**
* Configurable setting for the cheat sheet description.
* @default 'Show / hide this help menu'
*/
cheatSheetDescription: string;
add(combo: string | string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
/**
* Creates a new Hotkey and creates the Mousetrap binding.
*/
add(combo: string | string[], description?: string, callback?: (event: Event, hotkey: Hotkey) => void, action?: string, allowIn?: string[], persistent?: boolean): Hotkey;
add(combo: string | string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
/**
* Creates a new Hotkey and creates the Mousetrap binding.
*/
add(hotkeyObj: Hotkey): Hotkey;
add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey;
/**
* Binds the hotkey to a particular scope.
* Useful if the scope is destroyed, we can automatically destroy the hotkey binding.
* @param scope The scope to bind to
*/
bindTo(scope: IScope): HotkeysProviderChained;
bindTo(scope: ng.IScope): ng.hotkeys.HotkeysProviderChained;
/**
* Removes and unbinds a hotkey
* @param combo The keyboard combo (shortcut) or the HotKey object
*/
del(combo: string | string[] | Hotkey): void;
del(combo: string | string[]): void;
del(hotkeyObj: ng.hotkeys.Hotkey): void;
get(combo: string | string[]): ng.hotkeys.Hotkey;
/**
* Returns the Hotkey object
* @param combo The keyboard combo (shortcut)
*/
get(combo: string | string[]): Hotkey;
/**
* Toggles the help menu element's visiblity
*/
toggleCheatSheet(): void;
/**
* Purges all non-persistent hotkeys (such as those defined in routes)
*
* Without this, the same hotkey would get recreated everytime
* the route is accessed.
*/
purgeHotkeys(): void;
}
interface HotkeysProviderChained {
add(combo: string | string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;
add(combo: string | string[], description: string, callback: (event: Event, hotkeys: Hotkey) => void): HotkeysProviderChained;
add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained;
add(hotkeyObj: Hotkey): HotkeysProviderChained;
}
interface Hotkey {
/**
* They keyboard combo (shortcut) you want to bind to.
*/
combo: string | string[];
/**
* The description for what the combo does and is only used for the Cheat Sheet.
* If it is not supplied, it will not show up, and in effect, allows you to have unlisted hotkeys.
*/
description?: string;
callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void;
/**
* The function to execute when the key(s) are pressed. Passes along two arguments, event and hotkey
*/
callback(event: Event, hotkey: Hotkey): void;
/**
* The type of event to listen for, such as keypress, keydown or keyup.
* Usage of this parameter is discouraged as the underlying library will pick the most suitable option automatically.
* This should only be necessary in advanced situations.
*/
action?: string;
allowIn?: Array<string>;
/**
* An array of tag names to allow this combo in ('INPUT', 'SELECT', and/or 'TEXTAREA')
*/
allowIn?: Array<'INPUT' | 'SELECT' | 'TEXTAREA'>;
/**
* Whether the hotkey persists navigation events
*/
persistent?: boolean;
}
}
+2 -2
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -21,4 +21,4 @@
"index.d.ts",
"angular-hotkeys-tests.ts"
]
}
}
+1 -79
View File
@@ -1,79 +1 @@
{
"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" }
@@ -5,6 +5,7 @@ interface TestScope extends ng.IScope {
}
myApp.config((
$mdAriaProvider: ng.material.IAriaProvider,
$mdThemingProvider: ng.material.IThemingProvider,
$mdIconProvider: ng.material.IIconProvider,
$mdProgressCircularProvider: ng.material.IProgressCircularProvider) => {
@@ -52,6 +53,9 @@ myApp.config((
return c * Math.pow(2, (t / d - 1) * 10) + b;
}
});
// Globally disables all ARIA warnings.
$mdAriaProvider.disableWarnings();
});
myApp.controller('BottomSheetController', ($scope: TestScope, $mdBottomSheet: ng.material.IBottomSheetService, $q: ng.IQService) => {
@@ -136,6 +140,9 @@ myApp.controller('DialogController', ($scope: TestScope, $mdDialog: ng.material.
$scope['promptDialog'] = () => {
$mdDialog.show($mdDialog.prompt().initialValue('Buddy'));
};
$scope['promptDialog'] = () => {
$mdDialog.show($mdDialog.prompt().required(true));
};
$scope['prerenderedDialog'] = () => {
$mdDialog.show({
template: '<md-dialog>Hello!</md-dialog>',
+6 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for angular-material 1.1
// Project: https://github.com/angular/material
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>, Geert Jansen <https://github.com/geertjansen>
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>, Geert Jansen <https://github.com/geertjansen>, Edward Knowles <https://github.com/eknowles>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -11,6 +11,10 @@ export = _;
declare module 'angular' {
namespace material {
interface IAriaProvider {
disableWarnings(): void;
}
interface ResolveObject {
[name: string]: Injectable<(...args: any[]) => PromiseLike<any>>;
}
@@ -76,6 +80,7 @@ declare module 'angular' {
interface IPromptDialog extends IPresetDialog<IPromptDialog> {
cancel(cancel: string): IPromptDialog;
required(required: boolean): IPromptDialog; // default: false
placeholder(placeholder: string): IPromptDialog;
initialValue(initialValue: string): IPromptDialog;
}
+6 -2
View File
@@ -45,9 +45,9 @@ function withContainerAsString() {
});
}
// With container as jQuery element
// With container as jQuery/JQLite element
function withContainerAsJquery() {
var container: JQuery = $('body');
var container: JQuery = angular.element('body');
btfModal({
template: '<div></div>',
container: container
@@ -94,6 +94,10 @@ function callingValues() {
template: '<div></div>'
});
modal.activate().then(() => {}, () => {});
// activating with random locals
modal.activate({name: 'TestName'}).then(() => {}, () => {});
// activating with genericly typed locals
modal.activate<{name: string}>({name: 'TestName'}).then(() => {}, () => {});
modal.deactivate().then(() => {}, () => {});
var isActive: boolean = modal.active();
}
+2 -2
View File
@@ -5,7 +5,6 @@
// TypeScript Version: 2.3
/// <reference types="angular" />
/// <reference types="jquery" />
declare namespace angularModal {
@@ -28,7 +27,8 @@ declare namespace angularModal {
}
export interface AngularModal {
activate(): angular.IPromise<void>;
activate(locals?: {}): angular.IPromise<void>;
activate<T>(locals: T): angular.IPromise<void>;
deactivate(): angular.IPromise<void>;
active(): boolean;
}
@@ -4,5 +4,6 @@ declare var $sanitizeService: ng.sanitize.ISanitizeService;
shouldBeString = $sanitizeService(shouldBeString);
declare var $linky: ng.sanitize.filter.ILinky;
shouldBeString = $linky(shouldBeString);
shouldBeString = $linky(shouldBeString, "target");
shouldBeString = $linky(shouldBeString, shouldBeString);
+1 -1
View File
@@ -36,7 +36,7 @@ declare module 'angular' {
* see https://docs.angularjs.org/api/ngSanitize/filter/linky
*/
interface ILinky {
(text: string, target: string, attributes?: { [attribute: string]: string } | ((url: string) => { [attribute: string]: string })): string;
(text: string, target?: string, attributes?: { [attribute: string]: string } | ((url: string) => { [attribute: string]: string })): string;
}
}
+4 -1
View File
@@ -6,10 +6,13 @@
/// <reference types="angular" />
declare var _: string;
export = _;
import * as angular from 'angular';
declare module 'angular' {
export namespace a0.storage {
namespace a0.storage {
interface IStoreService extends INamespacedStoreService {
/**
* Returns a namespaced store
+1
View File
@@ -2,6 +2,7 @@
// Project: http://720kb.github.io/angular-tooltips
// Definitions by: Leonard Thieu <https://github.com/leonard-thieu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare const AngularTooltips: '720kb.tooltips';
export = AngularTooltips;
+53 -6
View File
@@ -644,6 +644,9 @@ isolateScope = element.find('div').isolateScope();
isolateScope = element.children().isolateScope();
let element2 = angular.element(element);
let elementArray = angular.element(document.querySelectorAll('div'));
let elementReadyFn = angular.element(() => {
console.log('ready');
});
// $timeout signature tests
namespace TestTimeout {
@@ -704,7 +707,7 @@ class SampleDirective implements ng.IDirective {
restrict = 'A';
name = 'doh';
compile(templateElement: ng.IAugmentedJQuery) {
compile(templateElement: JQLite) {
return {
post: this.link
};
@@ -720,7 +723,7 @@ class SampleDirective implements ng.IDirective {
class SampleDirective2 implements ng.IDirective {
restrict = 'EAC';
compile(templateElement: ng.IAugmentedJQuery) {
compile(templateElement: JQLite) {
return {
pre: this.link
};
@@ -738,7 +741,7 @@ angular.module('SameplDirective', []).directive('sampleDirective', SampleDirecti
angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpolate', '$q', ($interpolate: ng.IInterpolateService, $q: ng.IQService) => {
return {
restrict: 'A',
link: (scope: ng.IScope, el: ng.IAugmentedJQuery, attr: ng.IAttributes) => {
link: (scope: ng.IScope, el: JQLite, attr: ng.IAttributes) => {
$interpolate(attr['test'])(scope);
$interpolate('', true)(scope);
$interpolate('', true, 'html')(scope);
@@ -866,7 +869,7 @@ angular.module('docsTimeDirective', [])
}])
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
return {
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
link(scope: ng.IScope, element: JQLite, attrs: ng.IAttributes) {
let format: any;
let timeoutId: any;
@@ -913,7 +916,7 @@ angular.module('docsTransclusionExample', [])
transclude: true,
scope: {},
templateUrl: 'my-dialog.html',
link(scope: ng.IScope, element: ng.IAugmentedJQuery) {
link(scope: ng.IScope, element: JQLite) {
scope['name'] = 'Jeff';
}
};
@@ -1014,7 +1017,7 @@ angular.module('docsTabsExample', [])
scope: {
title: '@'
},
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) {
link(scope: ng.IScope, element: JQLite, attrs: ng.IAttributes, tabsCtrl: any) {
tabsCtrl.addPane(scope);
},
templateUrl: 'my-pane.html'
@@ -1095,6 +1098,18 @@ angular.module('copyExample', [])
$scope.reset();
}]);
// Extending IScope for a directive, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/21160
interface IMyScope extends angular.IScope {
myScopeProperty: boolean;
}
angular.module('aaa').directive('directive', () => ({
link(scope: IMyScope) {
console.log(scope.myScopeProperty);
return;
}
}));
namespace locationTests {
const $location: ng.ILocationService = null;
@@ -1309,3 +1324,35 @@ function toPromise<T>(val: T): ng.IPromise<T> {
const p: ng.IPromise<T> = null;
return p;
}
const directiveCompileFn: ng.IDirectiveCompileFn = (
templateElement: JQLite,
templateAttributes: ng.IAttributes,
transclude: ng.ITranscludeFunction
): ng.IDirectiveLinkFn => {
return (
scope: ng.IScope,
instanceElement: JQLite,
instanceAttributes: ng.IAttributes
) => {
return null;
};
};
interface MyScope extends ng.IScope {
foo: string;
}
const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn<MyScope> = (
templateElement: JQLite,
templateAttributes: ng.IAttributes,
transclude: ng.ITranscludeFunction
): ng.IDirectiveLinkFn<MyScope> => {
return (
scope: MyScope,
instanceElement: JQLite,
instanceAttributes: ng.IAttributes
) => {
return null;
};
};
+28 -22
View File
@@ -9,9 +9,6 @@
/// <reference path="jqlite.d.ts" />
// NOTE: @types/angular technically doesn't require TypeScript 2.3, only TypeScript 2.1.
// It has a TypeScript 2.3 header so that merging tests with @types/jquery v3 will work.
declare var angular: angular.IAngularStatic;
// Support for painless dependency injection
@@ -232,8 +229,8 @@ declare namespace angular {
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
* @param directiveFactory An injectable directive factory function.
*/
directive(name: string, directiveFactory: Injectable<IDirectiveFactory>): IModule;
directive(object: {[directiveName: string]: Injectable<IDirectiveFactory>}): IModule;
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): IModule;
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): IModule;
/**
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
*
@@ -1252,8 +1249,8 @@ declare namespace angular {
}
interface ICompileProvider extends IServiceProvider {
directive(name: string, directiveFactory: Injectable<IDirectiveFactory>): ICompileProvider;
directive(object: {[directiveName: string]: Injectable<IDirectiveFactory>}): ICompileProvider;
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): ICompileProvider;
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
component(name: string, options: IComponentOptions): ICompileProvider;
@@ -1302,6 +1299,17 @@ declare namespace angular {
*/
cssClassDirectivesEnabled(): boolean;
cssClassDirectivesEnabled(enabled: boolean): ICompileProvider;
/**
* Call this method to enable/disable strict component bindings check.
* If enabled, the compiler will enforce that for all bindings of a
* component that are not set as optional with ?, an attribute needs
* to be provided on the component's HTML tag.
* Defaults to false.
* See: https://docs.angularjs.org/api/ng/provider/$compileProvider#strictComponentBindingsEnabled
*/
strictComponentBindingsEnabled(): boolean;
strictComponentBindingsEnabled(enabled: boolean): ICompileProvider;
}
interface ICloneAttachFunction {
@@ -1961,13 +1969,13 @@ declare namespace angular {
// and http://docs.angularjs.org/guide/directive
///////////////////////////////////////////////////////////////////////////
interface IDirectiveFactory {
(...args: any[]): IDirective | IDirectiveLinkFn;
interface IDirectiveFactory<TScope extends IScope = IScope> {
(...args: any[]): IDirective<TScope> | IDirectiveLinkFn<TScope>;
}
interface IDirectiveLinkFn {
interface IDirectiveLinkFn<TScope extends IScope = IScope> {
(
scope: IScope,
scope: TScope,
instanceElement: JQLite,
instanceAttributes: IAttributes,
controller?: IController | IController[] | {[key: string]: IController},
@@ -1975,12 +1983,12 @@ declare namespace angular {
): void;
}
interface IDirectivePrePost {
pre?: IDirectiveLinkFn;
post?: IDirectiveLinkFn;
interface IDirectivePrePost<TScope extends IScope = IScope> {
pre?: IDirectiveLinkFn<TScope>;
post?: IDirectiveLinkFn<TScope>;
}
interface IDirectiveCompileFn {
interface IDirectiveCompileFn<TScope extends IScope = IScope> {
(
templateElement: JQLite,
templateAttributes: IAttributes,
@@ -1991,11 +1999,11 @@ declare namespace angular {
* that is passed to the link function instead.
*/
transclude: ITranscludeFunction
): void | IDirectiveLinkFn | IDirectivePrePost;
): void | IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
}
interface IDirective {
compile?: IDirectiveCompileFn;
interface IDirective<TScope extends IScope = IScope> {
compile?: IDirectiveCompileFn<TScope>;
controller?: string | Injectable<IControllerConstructor>;
controllerAs?: string;
/**
@@ -2004,7 +2012,7 @@ declare namespace angular {
* relies upon bindings inside a $onInit method on the controller, instead.
*/
bindToController?: boolean | {[boundProperty: string]: string};
link?: IDirectiveLinkFn | IDirectivePrePost;
link?: IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
multiElement?: boolean;
priority?: number;
/**
@@ -2077,9 +2085,7 @@ declare namespace angular {
get<T>(name: '$xhrFactory'): IXhrFactory<T>;
has(name: string): boolean;
instantiate<T>(typeConstructor: {new(...args: any[]): T}, locals?: any): T;
invoke(inlineAnnotatedFunction: any[], context?: any, locals?: any): any;
invoke<T>(func: (...args: any[]) => T, context?: any, locals?: any): T;
invoke(func: Function, context?: any, locals?: any): any;
invoke<T = any>(func: Injectable<Function | ((...args: any[]) => T)>, context?: any, locals?: any): T;
strictDi: boolean;
}
+1 -1
View File
@@ -684,7 +684,7 @@ interface JQuery {
}
interface JQueryStatic {
(element: string | Element | Document | JQuery | ArrayLike<Element>): JQLite;
(element: string | Element | Document | JQuery | ArrayLike<Element> | (() => void)): JQLite;
}
/**
+2 -2
View File
@@ -16,7 +16,7 @@
"noImplicitAny": false,
"noImplicitThis": false,
"strictNullChecks": false,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -25,4 +25,4 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
import * as angular from 'angular';
import { angulartics } from 'angulartics';
import * as angulartics from 'angulartics';
namespace Analytics {
angular.module("angulartics.app", ["angulartics"])
+39 -11
View File
@@ -1,11 +1,13 @@
// Type definitions for Angulartics 1.3
// Type definitions for Angulartics 1.4
// Project: http://luisfarzati.github.io/angulartics/
// Definitions by: Steven Fan <https://github.com/stevenfan>
// Definitions by: Bateast2 <https://github.com/bateast2>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as angular from 'angular';
export = angulartics;//AMD/Require module support
export as namespace angulartics;//UMD module support
declare namespace angulartics {
interface IAngularticsStatic {
@@ -13,41 +15,67 @@ declare namespace angulartics {
}
interface IAnalyticsService {
eventTrack(eventName: string, properties?: any): any;
getOptOut(): boolean;
pageTrack(path: string, location?: angular.ILocationService): any;
eventTrack(eventName: string, properties?: any): any;
exceptionTrack(error: any, cause: string): any;
transactionTrack: any;
setAlias(alias: string): any;
setOptOut(value: boolean): void;
setUsername(username: string): any;
setUserProperties(properties: any): any;
setSuperProperties(properties: any): any;
setUserProperties(userProperties: any): any;
setUserPropertiesOnce(userProperties: any): any;
setSuperProperties(superProperties: any): any;
setSuperPropertiesOnce(superProperties: any): any;
incrementProperty(property: string, value?: any): any;
userTimings(properties: any): any;
clearCookies: any;
getOptOut(): boolean;
setOptOut(value: boolean): void;
}
interface IAnalyticsServiceProvider extends angular.IServiceProvider {
virtualPageviews(value: boolean): void;
trackStates(value: boolean): void;
trackRoutes(value: boolean): void;
excludeRoutes(value: string[]): void;
queryKeysWhitelist(keys: string[]): void
queryKeysBlacklist(keys: string[]): void
firstPageview(value: boolean): void;
withBase(value: boolean): void;
withAutoBase(value: boolean): void;
developerMode(value: boolean): void;
trackExceptions(value: boolean): void;
trackRoutes(value: boolean): void;
trackStates(value: boolean): void;
developerMode(value: boolean): void;
registerPageTrack(callback: (path: string, location?: angular.ILocationService) => any): void;
registerEventTrack(callback: (eventName: string, properties?: any) => any): void;
registerTransactionTrack(callback: any): void;
registerSetAlias(callback: (alias: string) => any): void;
registerSetUsername(callback: (username: string) => any): void;
registerSetUserProperties(callback: (userProperties: any) => any): void;
registerSetUserPropertiesOnce(callback: (userProperties: any) => any): void;
registerSetSuperProperties(callback: (superProperties: any) => any): void;
registerSetSuperPropertiesOnce(callback: (superProperties: any) => any): void;
registerIncrementProperty(callback: (property: string, value?: any) => any): void;
registerUserTimings(callback: (properties: any) => any): void;
registerClearCookies(callback: any): void;
settings: {
pageTracking: {
autoTrackingVirtualPages: boolean,
autoTrackingFirstPage: boolean,
trackRelativePath: boolean,
trackRoutes: boolean,
trackStates: boolean,
autoBasePath: boolean,
basePath: string,
autoBasePath: boolean
excludedRoutes: string[],
queryKeysWhitelisted: string[],
queryKeysBlacklisted: string[]
},
eventTracking: {},
bufferFlushDelay: number,
trackExceptions: boolean,
optOut: boolean,
developerMode: boolean
};
}
+13
View File
@@ -0,0 +1,13 @@
import ansiRegex = require("ansi-regex");
ansiRegex(); // $ExpectType RegExp
// From the ansi-regex README.md
ansiRegex().test('\u001B[4mcake\u001B[0m'); // $ExpectType boolean
// => true
ansiRegex().test('cake'); // $ExpectType boolean
// => false
'\u001B[4mcake\u001B[0m'.match(ansiRegex()); // $ExpectType RegExpMatchArray | null
// => ['\u001B[4m', '\u001B[0m']
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for ansi-regex 3.0
// Project: https://github.com/chalk/ansi-regex#readme
// Definitions by: Manish Vachharajani <https://github.com/mvachhar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function r(): RegExp;
export = r;
+23
View 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",
"ansi-regex-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/apex/node-apex
// Definitions by: Yoriki Yamaguchi <https://github.com/y13i>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="aws-lambda" />
@@ -1,4 +1,3 @@
import * as errorHandler from 'api-error-handler';
import * as express from 'express';
+1 -3
View File
@@ -2,9 +2,7 @@
// Project: https://github.com/expressjs/api-error-handler
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as express from 'express';
+1 -1
View File
@@ -777,7 +777,7 @@ declare module Microsoft.ApplicationInsights {
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
*/
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie?: boolean): any;
/**
* Clears the authenticated user id and the account id from the user context.
*/
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/Esri/arcgis-to-geojson-utils
// Definitions by: Jeff Jacobson <https://github.com/JeffJacobson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="geojson" />
+67
View File
@@ -0,0 +1,67 @@
import * as args from "args";
args
.option("opt1", "desc")
.option("opt2", "desc", false, (value: any): any => value)
.options([
{
name: 'opt3',
description: 'desc',
defaultValue: 1,
init: (value: any) => { },
},
{
name: 'opt4',
description: 'desc',
},
])
.command("cm1", "desc")
.command("cm2", "desc", (value: any): void => { }, ['a'])
.example("ex1", "desc")
.examples([
{
usage: "ex2",
description: "desc",
},
]);
args.parse(['~/bin/node', '~/dir', 'arg', '--param'], {
help: true,
name: "name",
version: true,
usageFilter: (a: any): any => a,
value: "value",
mri: {
args: ['a'],
alias: {
a: "b",
c: ['d'],
},
boolean: ['wat'],
default: {
foo: 'bar',
},
string: ['zulu'],
unknown: (param: string): boolean => true,
},
minimist: {
string: ['string'],
boolean: ['string'],
alias: {
bar: 'foo',
foo: ['bar1', 'bar2'],
},
default: {
foo: 'bar',
},
stopEarly: true,
"--": false,
unknown: (param: string): boolean => true,
},
mainColor: "yellow",
subColor: "dim"
});
args.showHelp();
const x: string = args.sub[0];
+72
View File
@@ -0,0 +1,72 @@
// Type definitions for args 3.0
// Project: https://github.com/leo/args#readme
// Definitions by: Slessi <https://github.com/Slessi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const c: args;
export = c;
interface args {
sub: string[];
option(name: string | [string, string], description: string, defaultValue?: any, init?: OptionInitFunction): args;
options(list: Option[]): args;
command(name: string, description: string, init?: (name: string, sub: string[], options: ConfigurationOptions) => void, aliases?: string[]): args;
example(usage: string, description: string): args;
examples(list: Example[]): args;
parse(argv: string[], options?: ConfigurationOptions): { [key: string]: any };
showHelp(): void;
}
type OptionInitFunction = (value: any) => any;
interface MriOptions {
args?: string[];
alias?: {
[key: string]: string | string[]
};
boolean?: string | string[];
default?: {
[key: string]: any
};
string?: string | string[];
unknown?: (param: string) => boolean;
}
interface MinimistOptions {
string?: string | string[];
boolean?: boolean | string | string[];
alias?: {
[key: string]: string | string[]
};
default?: {
[key: string]: any
};
stopEarly?: boolean;
"--"?: boolean;
unknown?: (param: string) => boolean;
}
interface ConfigurationOptions {
help?: boolean;
name?: string;
version?: boolean;
usageFilter?: (output: any) => any;
value?: string;
mri: MriOptions;
minimist?: MinimistOptions;
mainColor: string | string[];
subColor: string | string[];
}
interface Option {
name: string | [string, string];
description: string;
init?: OptionInitFunction;
defaultValue?: any;
}
interface Example {
usage: string;
description: string;
}
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"error-stack-parser-tests.ts"
"args-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+7
View File
@@ -0,0 +1,7 @@
import union = require('arr-union');
// $ExpectType string[]
union(['a'], ['b', 'c'], ['d', 'e', 'f']);
// $ExpectType number[]
union([1, 1], [2, 3]);
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for arr-union 3.1
// Project: https://github.com/jonschlinkert/arr-union
// Definitions by: mrmlnc <https://github.com/mrmlnc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function union<T>(...arrays: Array<ArrayLike<T>>): T[];
export = union;
+23
View 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",
"arr-union-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/shoreditch-ops/artillery#readme
// Definitions by: Kira McCoan <https://github.com/kmccoan-allocadia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
import * as request from 'request';
import * as events from 'events';
+3 -2
View File
@@ -15,6 +15,7 @@ export interface AsyncResultArrayCallback<T, E> { (err?: E, results?: (T | undef
export interface AsyncResultObjectCallback<T, E> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
export interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
export interface AsyncFunctionEx<T, E> { (callback: (err?: E, ...results: T[]) => void): void; }
export interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
export interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
export interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
@@ -174,9 +175,9 @@ export function parallel<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?
export function parallelLimit<T, E>(tasks: Array<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultArrayCallback<T, E>): void;
export function parallelLimit<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultObjectCallback<T, E>): void;
export function whilst<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doWhilst<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
export function doWhilst<T, E>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
export function until<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doUntil<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
export function doUntil<T, E>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
export function during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
export function forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
+4 -4
View File
@@ -47,13 +47,13 @@ interface NumberCallback { (err?: Error, result?: number): void; }
interface AsyncNumberGetter { (callback: NumberCallback): void; }
var taskDict: Lookup<AsyncNumberGetter> = {
one: function(callback){
setTimeout(function(){
one: function(callback) {
setTimeout(function() {
callback(undefined, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
two: function(callback) {
setTimeout(function() {
callback(undefined, 2);
}, 100);
}
+4 -4
View File
@@ -239,16 +239,16 @@ async.parallelLimit({
function whileFn(callback: any) {
count++;
setTimeout(callback, 1000);
setTimeout(() => callback(null, ++count), 1000);
}
function whileTest() { return count < 5; }
function doWhileTest(count: number) { return count < 5; }
var count = 0;
async.whilst(whileTest, whileFn, function (err) { });
async.until(whileTest, whileFn, function (err) { });
async.doWhilst(whileFn, whileTest, function (err) { });
async.doUntil(whileFn, whileTest, function (err) { });
async.doWhilst(whileFn, doWhileTest, function (err) { });
async.doUntil(whileFn, doWhileTest, function (err) { });
async.during(function (testCallback) { testCallback(new Error(), false); }, function (callback) { callback() }, function (error) { console.log(error) });
async.doDuring(function (callback) { callback() }, function (testCallback) { testCallback(new Error(), false); }, function (error) { console.log(error) });
+135
View File
@@ -0,0 +1,135 @@
import { ArrayIterator, AsyncIterator, BufferedIterator, ClonedIterator, EmptyIterator, IntegerIterator,
MultiTransformIterator, SingletonIterator, SimpleTransformIterator, TransformIterator } from "asynciterator";
function test_asynciterator() {
// We can't instantiate an abstract class.
const it1: AsyncIterator<number> = <any> {};
const read1: number = it1.read();
it1.each((data: number) => console.log(data));
it1.each((data: number) => console.log(data), {});
it1.close();
const it2: AsyncIterator<string> = <any> {};
const read2: string = it2.read();
it2.each((data: string) => console.log(data));
it2.each((data: string) => console.log(data), {});
it2.close();
const it3: AsyncIterator<AsyncIterator<string>> = <any> {};
const read3: AsyncIterator<string> = it3.read();
it3.each((data: AsyncIterator<string>) => data.each((data: string) => console.log(data)));
it3.each((data: AsyncIterator<string>) => data.each((data: string) => console.log(data), {}), {});
it3.close();
const readable2: boolean = it1.readable;
const closed2: boolean = it1.closed;
const ended2: boolean = it1.ended;
it1.setProperty('name1', 123);
it2.setProperty('name2', 'someValue');
const p1: number = it1.getProperty('name1');
const p2: string = it1.getProperty('name2');
it1.getProperty('name1', (value: number) => console.log(value));
it1.getProperty('name2', (value: string) => console.log(value));
const ps1: {[id: string]: any} = it1.getProperties();
it1.setProperties({ name1: 1234, name2: 'someOtherValue' });
it1.copyProperties(it2, [ 'name1', 'name2' ]);
const str: string = it1.toString();
const stit1: SimpleTransformIterator<number, string> = it1.transform();
const stit2: SimpleTransformIterator<number, string> = it1.map((number: number) => 'i' + number);
const stit3: AsyncIterator<string> = it1.map((number: number) => 'i' + number);
const stit4: AsyncIterator<number> = it2.map(parseInt);
const stit5: AsyncIterator<number> = it1.map((number: number) => number + 1);
const stit6: AsyncIterator<number> = it1.filter((number: number) => number < 10);
const stit7: AsyncIterator<number> = it1.prepend([0, 1, 2]);
const stit8: AsyncIterator<number> = it1.append([0, 1, 2]);
const stit9: AsyncIterator<number> = it1.surround([0, 1, 2], [0, 1, 2]);
const stit10: AsyncIterator<number> = it1.skip(2);
const stit11: AsyncIterator<number> = it1.take(2);
const stit12: AsyncIterator<number> = it1.range(2, 20);
const stit13: AsyncIterator<number> = it1.clone();
const intit1: IntegerIterator = AsyncIterator.range(10, 100, 1);
const intit2: IntegerIterator = AsyncIterator.range(10, 100);
const intit3: IntegerIterator = AsyncIterator.range(10);
const intit4: IntegerIterator = AsyncIterator.range();
}
function test_emptyiterator() {
const it1: AsyncIterator<number> = new EmptyIterator();
const it2: AsyncIterator<string> = new EmptyIterator();
}
function test_singletoniterator() {
const it1: AsyncIterator<number> = new SingletonIterator(3);
const it2: AsyncIterator<string> = new SingletonIterator('a');
}
function test_arrayiterator() {
const it1: AsyncIterator<number> = new ArrayIterator([1, 2, 3]);
const it2: AsyncIterator<string> = new ArrayIterator(['a', 'b', 'c']);
}
function test_integeriterator() {
const it1: IntegerIterator = new IntegerIterator();
const it2: AsyncIterator<number> = new IntegerIterator({});
const it3: AsyncIterator<number> = new IntegerIterator({ start: 0 });
const it4: AsyncIterator<number> = new IntegerIterator({ end: 100 });
const it5: AsyncIterator<number> = new IntegerIterator({ step: 10 });
}
function test_bufferediterator() {
const it1: BufferedIterator<number> = new BufferedIterator();
const it2: AsyncIterator<number> = new BufferedIterator({});
const it3: AsyncIterator<number> = new BufferedIterator({ maxBufferSize: 10 });
const it4: AsyncIterator<number> = new BufferedIterator({ autoStart: true });
}
function test_transformiterator() {
const it1: TransformIterator<number, string> = new TransformIterator<number, string>();
const it2: AsyncIterator<string> = new TransformIterator<number, string>();
const it3: AsyncIterator<number> = new TransformIterator<string, number>(it1);
const it4: AsyncIterator<number> = new TransformIterator<string, number>(it1, {});
const it5: AsyncIterator<number> = new TransformIterator<string, number>(it1, { optional: true });
const it6: AsyncIterator<number> = new TransformIterator<string, number>({ source: it1 });
const source: AsyncIterator<number> = it1.source;
}
function test_simpletransformiterator() {
const it1: SimpleTransformIterator<number, string> = new SimpleTransformIterator<number, string>();
const it2: TransformIterator<number, string> = new SimpleTransformIterator<number, string>();
const it3: AsyncIterator<string> = new SimpleTransformIterator<number, string>();
const it4: AsyncIterator<number> = new SimpleTransformIterator<string, number>(it1);
const it5: AsyncIterator<number> = new SimpleTransformIterator<string, number>(it1, {});
const it6: AsyncIterator<number> = new SimpleTransformIterator<string, number>({});
const it7: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ optional: true });
const it8: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ source: it1 });
const it9: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ offset: 2 });
const it10: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ limit: 2 });
const it11: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ prepend: [0, 1, 2] });
const it12: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ append: [0, 1, 2] });
const it13: AsyncIterator<number> = new SimpleTransformIterator<number, number>(
{ filter: (val: number) => val > 10 });
const it14: AsyncIterator<number> = new SimpleTransformIterator<number, number>({ map: (val: number) => val + 1 });
const it15: AsyncIterator<number> = new SimpleTransformIterator<number, number>(
{ transform: (val: number, cb: (result: number) => void) => cb(val + 1) });
}
function test_multitransformiterator() {
const it1: MultiTransformIterator<number, string> = new MultiTransformIterator<number, string>();
const it2: TransformIterator<number, string> = new MultiTransformIterator<number, string>();
const it3: AsyncIterator<string> = new MultiTransformIterator<number, string>();
const it4: AsyncIterator<number> = new MultiTransformIterator<string, number>(it1);
const it5: AsyncIterator<number> = new MultiTransformIterator<string, number>(it1, {});
const it6: AsyncIterator<number> = new MultiTransformIterator<string, number>({});
const it7: AsyncIterator<number> = new MultiTransformIterator<string, number>({ optional: true });
const it8: AsyncIterator<number> = new MultiTransformIterator<string, number>({ source: it1 });
}
function test_clonediterator() {
const it1: ClonedIterator<number> = new ClonedIterator<number>();
const it2: ClonedIterator<number> = new ClonedIterator<number>(it1);
}
+164
View File
@@ -0,0 +1,164 @@
// Type definitions for asynciterator 1.1
// Project: https://github.com/rubenverborgh/AsyncIterator#readme
// Definitions by: Ruben Taelman <https://github.com/rubensworks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
import { EventEmitter } from "events";
export abstract class AsyncIterator<T> extends NodeJS.EventEmitter {
protected static STATES: ['INIT', 'OPEN', 'CLOSING', 'CLOSED', 'ENDED'];
protected static INIT: 0;
protected static OPEN: 1;
protected static CLOSING: 2;
protected static CLOSED: 3;
protected static ENDED: 4;
protected _state: number;
protected _readable: boolean;
protected _destination?: AsyncIterator<any>;
readable: boolean;
closed: boolean;
ended: boolean;
constructor();
read(): T;
each(callback: (data: T) => void, self?: any): void;
close(): void;
protected _changeState(newState: number, eventAsync?: boolean): void;
private _hasListeners(eventName: string | symbol): boolean;
// tslint:disable-next-line ban-types
private _addSingleListener(eventName: string | symbol, listener: Function): void;
protected _end(): void;
getProperty(propertyName: string, callback?: (value: any) => void): any;
setProperty(propertyName: string, value: any): void;
getProperties(): {[id: string]: any};
setProperties(properties: {[id: string]: any}): void;
copyProperties(source: AsyncIterator<any>, propertyNames: string[]): void;
toString(): string;
protected _toStringDetails(): string;
transform<T2>(options?: SimpleTransformIteratorOptions<T, T2>): SimpleTransformIterator<T, T2>;
map<T2>(mapper: (item: T) => T2, self?: object): SimpleTransformIterator<T, T2>;
filter(filter: (item: T) => boolean, self?: object): SimpleTransformIterator<T, T>;
prepend(items: T[]): SimpleTransformIterator<T, T>;
append<T>(items: T[]): SimpleTransformIterator<T, T>;
surround<T>(prepend: T[], append: T[]): SimpleTransformIterator<T, T>;
skip<T>(offset: number): SimpleTransformIterator<T, T>;
take<T>(limit: number): SimpleTransformIterator<T, T>;
range<T>(start: number, end: number): SimpleTransformIterator<T, T>;
clone(): ClonedIterator<T>;
static range(start?: number, end?: number, step?: number): IntegerIterator;
}
export class EmptyIterator<T> extends AsyncIterator<T> {
_state: 4;
}
export class SingletonIterator<T> extends AsyncIterator<T> {
constructor(item?: T);
}
export class ArrayIterator<T> extends AsyncIterator<T> {
constructor(items?: T[]);
}
export interface IntegerIteratorOptions {
step?: number;
end?: number;
start?: number;
}
export class IntegerIterator extends AsyncIterator<number> {
protected _step: number;
protected _last: number;
protected _next: number;
constructor(options?: IntegerIteratorOptions);
}
export interface BufferedIteratorOptions {
maxBufferSize?: number;
autoStart?: boolean;
}
export class BufferedIterator<T> extends AsyncIterator<T> {
maxBufferSize: number;
protected _pushedCount: number;
protected _buffer: T[];
protected _init(autoStart: boolean): void;
protected _begin(done: () => void): void;
protected _read(count: number, done: () => void): void;
protected _push(item: T): void;
protected _fillBuffer(): void;
protected _completeClose(): void;
protected _flush(done: () => void): void;
constructor(options?: BufferedIteratorOptions);
}
export interface TransformIteratorOptions<S> extends BufferedIteratorOptions {
optional?: boolean;
source?: AsyncIterator<S>;
}
export class TransformIterator<S, T> extends BufferedIterator<T> {
protected _optional: boolean;
source: AsyncIterator<S>;
protected _validateSource(source: AsyncIterator<S>, allowDestination?: boolean): void;
protected _transform(item: S, done: (result: T) => void): void;
protected _closeWhenDone(): void;
constructor(source?: AsyncIterator<S> | TransformIteratorOptions<S>, options?: TransformIteratorOptions<S>);
}
export interface SimpleTransformIteratorOptions<S, T> extends TransformIteratorOptions<S> {
offset?: number;
limit?: number;
prepend?: T[];
append?: T[];
filter?(item: S): boolean;
map?(item: S): T;
transform?(item: S, callback: (result: T) => void): void;
}
export class SimpleTransformIterator<S, T> extends TransformIterator<S, T> {
protected _offset: number;
protected _limit: number;
protected _prepender?: ArrayIterator<T>;
protected _appender?: ArrayIterator<T>;
protected _filter?(item: S): boolean;
protected _map?(item: S): T;
protected _transform(item: S, done: (result: T) => void): void;
protected _insert(inserter: AsyncIterator<S>, done: () => void): void;
constructor(source?: AsyncIterator<S> | SimpleTransformIteratorOptions<S, T>,
options?: SimpleTransformIteratorOptions<S, T>);
}
export class MultiTransformIterator<S, T> extends TransformIterator<S, T> {
_transformerQueue: S[];
protected _createTransformer(): AsyncIterator<S>;
constructor(source?: AsyncIterator<S> | TransformIteratorOptions<S>, options?: TransformIteratorOptions<S>);
}
export class ClonedIterator<T> extends TransformIterator<T, T> {
_readPosition: number;
constructor(source?: AsyncIterator<T>);
}
+23
View 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",
"asynciterator-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -1
View File
@@ -1,8 +1,9 @@
import { Disposable } from "event-kit";
import KeymapManager = require("atom-keymap");
import * as ImportTest from "atom-keymap";
declare const element: HTMLElement;
declare let sub: EventKit.Disposable;
declare let sub: Disposable;
declare const event: KeyboardEvent;
// NPM Examples ===============================================================
+35 -23
View File
@@ -4,15 +4,17 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="event-kit" />
import { Disposable } from "event-kit";
declare global {
namespace AtomKeymap {
/** The event objects that are passed into the callbacks which the user provides to
/**
* The event objects that are passed into the callbacks which the user provides to
* specific API calls.
*/
namespace Events {
/** This custom subclass of CustomEvent exists to provide the ::abortKeyBinding
/**
* This custom subclass of CustomEvent exists to provide the ::abortKeyBinding
* method, as well as versions of the ::stopPropagation methods that record the
* intent to stop propagation so event bubbling can be properly simulated for
* detached elements.
@@ -70,12 +72,14 @@ declare global {
}
interface AddedKeystrokeResolver {
/** The currently resolved keystroke string. If your function returns a falsy
/**
* The currently resolved keystroke string. If your function returns a falsy
* value, this is how Atom will resolve your keystroke.
*/
keystroke: string;
/** The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation
/**
* The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation
* for more details.
*/
event: KeyboardEvent;
@@ -83,7 +87,8 @@ declare global {
/** The OS-specific name of the current keyboard layout. */
layoutName: string;
/** An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
/**
* An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
* typed character for that key in each modifier state, based on the current
* operating system layout.
*/
@@ -91,7 +96,8 @@ declare global {
}
}
/** The option objects that the user is expected to fill out and provide to
/**
* The option objects that the user is expected to fill out and provide to
* specific API calls.
*/
namespace Options {
@@ -120,7 +126,8 @@ declare global {
/** Determines whether the given keystroke matches any contained within this binding. */
matches(keystroke: string): boolean;
/** Compare another KeyBinding to this instance.
/**
* Compare another KeyBinding to this instance.
* Returns <= -1 if the argument is considered lesser or of lower priority.
* Returns 0 if this binding is equivalent to the argument.
* Returns >= 1 if the argument is considered greater or of higher priority.
@@ -128,7 +135,8 @@ declare global {
compare(other: KeyBinding): number;
}
/** Allows commands to be associated with keystrokes in a context-sensitive way.
/**
* Allows commands to be associated with keystrokes in a context-sensitive way.
* In Atom, you can access a global instance of this object via `atom.keymaps`.
*/
interface KeymapManager {
@@ -143,29 +151,30 @@ declare global {
destroy(): void;
// Event Subscription
/** Invoke the given callback when one or more keystrokes completely match a key binding. */
/**
* Invoke the given callback when one or more keystrokes completely match a
* key binding.
*/
onDidMatchBinding(callback: (event: Events.FullKeybindingMatch) => void):
EventKit.Disposable;
Disposable;
/** Invoke the given callback when one or more keystrokes partially match a binding. */
onDidPartiallyMatchBindings(callback: (event: Events.PartialKeybindingMatch) =>
void): EventKit.Disposable;
void): Disposable;
/** Invoke the given callback when one or more keystrokes fail to match any bindings. */
onDidFailToMatchBinding(callback: (event: Events.FailedKeybindingMatch) =>
void): EventKit.Disposable;
void): Disposable;
/** Invoke the given callback when a keymap file is reloaded. */
onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void): Disposable;
/** Invoke the given callback when a keymap file is unloaded. */
onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void): Disposable;
/** Invoke the given callback when a keymap file not able to be loaded. */
onDidFailToReadFile(callback: (error: Events.FailedKeymapFileRead) => void):
EventKit.Disposable;
Disposable;
// Adding and Removing Bindings
/** Construct KeyBindings from an object grouping them by CSS selector. */
@@ -174,7 +183,7 @@ declare global {
/** Add sets of key bindings grouped by CSS selector. */
add(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): EventKit.Disposable;
priority?: number): Disposable;
// Accessing Bindings
/** Get all current key bindings. */
@@ -192,13 +201,15 @@ declare global {
loadKeymap(bindingsPath: string, options?: { watch?: boolean, priority?: number }):
void;
/** Cause the keymap to reload the key bindings file at the given path whenever
/**
* Cause the keymap to reload the key bindings file at the given path whenever
* it changes.
*/
watchKeymap(filePath: string, options?: { priority: number }): void;
// Managing Keyboard Events
/** Dispatch a custom event associated with the matching key binding for the
/**
* Dispatch a custom event associated with the matching key binding for the
* given `KeyboardEvent` if one can be found.
*/
handleKeyboardEvent(event: KeyboardEvent): void;
@@ -208,9 +219,10 @@ declare global {
/** Customize translation of raw keyboard events to keystroke strings. */
addKeystrokeResolver(resolver: (event: Events.AddedKeystrokeResolver) => string):
EventKit.Disposable;
Disposable;
/** Get the number of milliseconds allowed before pending states caused by
/**
* Get the number of milliseconds allowed before pending states caused by
* partial matches of multi-keystroke bindings are terminated.
*/
getPartialMatchTimeout(): number;
+1 -1
View File
@@ -8,7 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
+2 -30
View File
@@ -1,36 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"class-name": true,
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 110],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-any": true,
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
"max-line-length": [true, 100],
"no-any": true
}
}
@@ -1,3 +1,4 @@
import { AtomEnvironment, TestRunnerParams } from "atom";
import { createRunner } from "atom-mocha-test-runner";
import defaultMochaRunner = require("atom-mocha-test-runner");
@@ -20,12 +21,12 @@ testRunner = createRunner({
testSuffixes: ["test.file"],
});
declare const atom: AtomCore.AtomEnvironment;
declare const atom: AtomEnvironment;
declare const blob: object;
declare let num: number;
async function runTests(): Promise<number> {
const runnerArgs: AtomCore.Structures.TestRunnerArgs = {
const runnerArgs: TestRunnerParams = {
testPaths: ["/var/test"],
logFile: "/var/log",
headless: false,
+4 -3
View File
@@ -5,7 +5,8 @@
// TypeScript Version: 2.3
/// <reference types="mocha" />
/// <reference types="atom" />
import { TestRunner } from "atom";
interface AtomMochaOptions {
/** Which reporter to use on the terminal. */
@@ -30,9 +31,9 @@ interface AtomMochaOptions {
// module.exports = createRunner()
// module.exports.createRunner = createRunner
// Which is what we're trying to model here.
interface TestRunnerExport extends AtomCore.TestRunner {
interface TestRunnerExport extends TestRunner {
createRunner(options?: AtomMochaOptions, mochaConfigFunction?:
(mocha: Mocha) => void): AtomCore.TestRunner;
(mocha: Mocha) => void): TestRunner;
}
declare const runner: TestRunnerExport;
+1 -1
View File
@@ -9,7 +9,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
+1 -29
View File
@@ -1,36 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"class-name": true,
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 100],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-any": true,
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
"no-any": true
}
}
-60
View File
@@ -1,60 +0,0 @@
## Atom API Type Definitions
TypeScript type definitions for the [Atom Text Editor](https://atom.io/) public API, which is used to develop packages for the editor. Documentation for the public API can be found [here](https://atom.io/docs/api/v1.21.0/).
### Exports
#### The "atom" Variable
These definitions declare a global static variable named "atom" as ambient. Once these definitions have been referenced within your project, you will be able to access properties and member functions from the [AtomEnvironment](https://atom.io/docs/api/v1.21.0/AtomEnvironment) class off of this variable, as it is an instance of that class.
```ts
if (atom.inDevMode()) {}
```
#### The Atom Namespace
All of the types used by or referenced by the Atom public API have been pulled into the Atom namespace, providing a consistent and easy way to access each of them, without having to care about where that type actually lives within the Atom codebase.
```ts
function example(buffer: Atom.TextBuffer) {}
```
#### The AtomCore Namespace
All classes which are core to Atom itself have been provided under the AtomCore namespace.
```ts
function example(cursor: AtomCore.Cursor) {}
```
### Service Type Definitions
There are many services provided by other Atom packages that you may want to use within your own Atom package. We bundle type definitions for several of these services with these type definitions. All type definitions for services are available only through ES6 imports.
```ts
import { AutocompleteProvider } from "atom/autocomplete-plus";
let completionProvider: AutocompleteProvider;
```
The currently supported services are:
- [Autocomplete](https://github.com/atom/autocomplete-plus) (atom/autocomplete-plus)
- [Linter](https://github.com/atom/linter) (atom/linter)
- [Status Bar](https://github.com/atom/status-bar) (atom/status-bar)
### Exposing Private Methods and Properties
[Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to augment any of the types used within Atom. As an example, if we wanted to reveal the private ```triggerActivationHook``` method within the PackageManager class, then we would create a file with the following contents:
```ts
// <<filename>>.d.ts
declare namespace AtomCore {
interface PackageManager {
triggerActivationHook(name: string): void;
triggerDeferredActivationHooks(): void;
}
}
```
Once this file is either referenced or included within your project, then this new member function would be freely usable on instances of the PackageManager class without TypeScript reporting errors.
+82 -81
View File
@@ -12,59 +12,59 @@ declare let regExp: RegExp;
declare let element: HTMLElement;
declare let elements: HTMLElement[];
declare const div: HTMLDivElement;
declare const keyboardEvent: KeyboardEvent;
declare const event: KeyboardEvent;
declare let buffer: TextBuffer.TextBuffer;
declare const color: AtomCore.Color;
declare let cursor: AtomCore.Cursor;
declare let cursors: AtomCore.Cursor[];
declare let decoration: AtomCore.Decoration;
declare let decorations: AtomCore.Decoration[];
declare let decorationLayerProps: AtomCore.Options.DecorationLayerProps;
declare let dir: PathWatcher.Directory;
declare let dirs: PathWatcher.Directory[];
declare let displayMarker: TextBuffer.DisplayMarker;
declare let displayMarkers: TextBuffer.DisplayMarker[];
declare let displayMarkerLayer: TextBuffer.DisplayMarkerLayer;
declare let dock: AtomCore.Dock;
declare let editor: AtomCore.TextEditor;
declare let editors: AtomCore.TextEditor[];
declare let emitter: EventKit.Emitter;
declare let file: PathWatcher.File;
declare let grammar: FirstMate.Grammar;
declare let grammars: FirstMate.Grammar[];
declare let gutter: AtomCore.Gutter;
declare let gutters: AtomCore.Gutter[];
declare let historyPaths: AtomCore.Structures.HistoryProject[];
declare let layerDecoration: AtomCore.LayerDecoration;
declare let marker: TextBuffer.Marker;
declare let markers: TextBuffer.Marker[];
declare let markerLayer: TextBuffer.MarkerLayer;
declare let notification: AtomCore.Notification;
declare let notifications: AtomCore.Notification[];
declare let pack: AtomCore.Package;
declare let packs: AtomCore.Package[];
declare let pane: AtomCore.Pane;
declare let panes: AtomCore.Pane[];
declare let paneContainer: AtomCore.Dock|AtomCore.WorkspaceCenter;
declare let panel: AtomCore.Panel;
declare let panels: AtomCore.Panel[];
declare let pos: TextBuffer.Point;
declare let posArr: TextBuffer.Point[];
declare let project: AtomCore.Project;
declare let range: TextBuffer.Range;
declare let ranges: TextBuffer.Range[];
declare let registry: FirstMate.GrammarRegistry;
declare let repository: AtomCore.GitRepository;
declare let repositories: AtomCore.GitRepository[];
declare let scopeDescriptor: AtomCore.ScopeDescriptor;
declare let selection: AtomCore.Selection;
declare let selections: AtomCore.Selection[];
declare let styleManager: AtomCore.StyleManager;
declare let subscription: EventKit.Disposable;
declare let subscriptions: EventKit.CompositeDisposable;
declare let tooltips: AtomCore.Structures.Tooltip[];
declare let workspaceCenter: AtomCore.WorkspaceCenter;
declare let buffer: Atom.TextBuffer;
declare const color: Atom.Color;
declare let cursor: Atom.Cursor;
declare let cursors: Atom.Cursor[];
declare let decoration: Atom.Decoration;
declare let decorations: Atom.Decoration[];
declare let decorationLayerProps: Atom.DecorationLayerOptions;
declare let dir: Atom.Directory;
declare let dirs: Atom.Directory[];
declare let displayMarker: Atom.DisplayMarker;
declare let displayMarkers: Atom.DisplayMarker[];
declare let displayMarkerLayer: Atom.DisplayMarkerLayer;
declare let dock: Atom.Dock;
declare let editor: Atom.TextEditor;
declare let editors: Atom.TextEditor[];
declare let emitter: Atom.Emitter;
declare let file: Atom.File;
declare let grammar: Atom.Grammar;
declare let grammars: Atom.Grammar[];
declare let gutter: Atom.Gutter;
declare let gutters: Atom.Gutter[];
declare let historyPaths: Atom.ProjectHistory[];
declare let layerDecoration: Atom.LayerDecoration;
declare let marker: Atom.Marker;
declare let markers: Atom.Marker[];
declare let markerLayer: Atom.MarkerLayer;
declare let notification: Atom.Notification;
declare let notifications: Atom.Notification[];
declare let pack: Atom.Package;
declare let packs: Atom.Package[];
declare let pane: Atom.Pane;
declare let panes: Atom.Pane[];
declare let paneContainer: Atom.Dock|Atom.WorkspaceCenter;
declare let panel: Atom.Panel;
declare let panels: Atom.Panel[];
declare let pos: Atom.Point;
declare let posArr: Atom.Point[];
declare let project: Atom.Project;
declare let range: Atom.Range;
declare let ranges: Atom.Range[];
declare let registry: Atom.GrammarRegistry;
declare let repository: Atom.GitRepository;
declare let repositories: Atom.GitRepository[];
declare let scopeDescriptor: Atom.ScopeDescriptor;
declare let selection: Atom.Selection;
declare let selections: Atom.Selection[];
declare let styleManager: Atom.StyleManager;
declare let subscription: Atom.Disposable;
declare let subscriptions: Atom.CompositeDisposable;
declare let tooltips: Atom.Tooltip[];
declare let workspaceCenter: Atom.WorkspaceCenter;
// AtomEnvironment ============================================================
function testAtomEnvironment() {
@@ -125,8 +125,8 @@ function testAtomEnvironment() {
});
subscription = atom.workspace.observeTextEditors((editor) => {
subscription = editor.onDidStopChanging((keyboardEvent) => {
for (const change of keyboardEvent.changes) {
subscription = editor.onDidStopChanging((event) => {
for (const change of event.changes) {
change.newExtent;
}
});
@@ -276,9 +276,6 @@ function testCommandRegistry() {
// CompositeDisposable ========================================================
function testCompositeDisposable() {
// Properties
bool = subscriptions.disposed;
// Construction and Lifecycle
subscriptions = new Atom.CompositeDisposable();
new Atom.CompositeDisposable(subscription);
@@ -482,7 +479,7 @@ function testCursor() {
// TestRunner =================================================================
function testTestRunner() {
const testRunner: AtomCore.TestRunner = (params) => {
const testRunner: Atom.TestRunner = (params) => {
const delegate = params.buildDefaultApplicationDelegate();
const environment = params.buildAtomEnvironment({
applicationDelegate: delegate,
@@ -803,7 +800,6 @@ function testDisplayMarkerLayer() {
// Disposable =================================================================
function testDisposable() {
bool = subscription.disposed;
if (subscription.disposalAction) subscription.disposalAction();
subscription.dispose();
}
@@ -829,8 +825,12 @@ function testDock() {
subscription = dock.onDidChangeActivePane(pane => pane.activate());
subscription = dock.observeActivePane(pane => pane.activate());
subscription = dock.onDidAddPaneItem(event => event.index && event.item && event.pane);
subscription = dock.onWillDestroyPaneItem(event => event.index && event.item && event.pane);
subscription = dock.onDidDestroyPaneItem(event => event.index && event.item && event.pane);
subscription = dock.onWillDestroyPaneItem(event => {
event.index && event.item && event.pane;
});
subscription = dock.onDidDestroyPaneItem(event => {
event.index && event.item && event.pane;
});
// Pane Items
objs = dock.getPaneItems();
@@ -847,8 +847,6 @@ function testDock() {
function testEmitter() {
emitter = new Atom.Emitter();
bool = emitter.disposed;
emitter.clear();
emitter.dispose();
@@ -1113,7 +1111,7 @@ function testKeymapManager() {
subscription = manager.add("a", {}, 0);
// Accessing Bindings
let bindings: AtomKeymap.KeyBinding[] = manager.getKeyBindings();
let bindings: Atom.KeyBinding[] = manager.getKeyBindings();
bindings = manager.findKeyBindings();
bindings = manager.findKeyBindings({ command: "a" });
bindings = manager.findKeyBindings({ keystrokes: "a" });
@@ -1127,8 +1125,8 @@ function testKeymapManager() {
manager.loadKeymap("Test.file", { watch: true, priority: 0});
// Managing Keyboard Events
manager.handleKeyboardEvent(keyboardEvent);
manager.keystrokeForKeyboardEvent(keyboardEvent);
manager.handleKeyboardEvent(event);
manager.keystrokeForKeyboardEvent(event);
subscription = manager.addKeystrokeResolver((event): string => {
event.layoutName;
@@ -1151,10 +1149,6 @@ function testLayerDecoration() {
function testMarker() {
// Properties
num = marker.id;
bool = marker.tailed;
bool = marker.reversed;
bool = marker.valid;
str = marker.invalidate;
// Lifecycle
marker = marker.copy({
@@ -1301,8 +1295,8 @@ function testNotification() {
});
// Event Subscription
subscription = notification.onDidDismiss(notification => notification.dismissed);
subscription = notification.onDidDisplay(notification => notification.timestamp);
subscription = notification.onDidDismiss(notification => notification.getType());
subscription = notification.onDidDisplay(notification => notification.getMessage());
// Methods
str = notification.getType();
@@ -1377,7 +1371,7 @@ function testPackageManager() {
subscription = atom.packages.onDidActivatePackage(pack => pack.name);
subscription = atom.packages.onDidDeactivatePackage(pack => pack.path);
subscription = atom.packages.onDidLoadPackage(pack => pack.isCompatible());
subscription = atom.packages.onDidUnloadPackage(pack => pack.bundledPackage);
subscription = atom.packages.onDidUnloadPackage(pack => pack.name);
// Package system data
str = atom.packages.getApmPath();
@@ -1618,7 +1612,7 @@ function testPoint() {
point.isGreaterThanOrEqual([0, 0]);
// Operations
const frozenPoint: Readonly<TextBuffer.Point> = point.freeze();
const frozenPoint: Readonly<Atom.Point> = point.freeze();
point = point.translate(point);
point.translate([0, 0]);
@@ -1644,7 +1638,7 @@ function testProject() {
});
subscription = project.onDidAddBuffer(buffer => buffer.id);
subscription = project.observeBuffers(buffer => buffer.file);
subscription = project.observeBuffers(buffer => buffer.getUri());
// Accessing the git repository
repositories = project.getRepositories();
@@ -1707,7 +1701,7 @@ function testRange() {
nums = range.getRows();
// Operations
const frozenRange: Readonly<TextBuffer.Range> = range.freeze();
const frozenRange: Readonly<Atom.Range> = range.freeze();
range = range.union(range);
range = range.translate(pos);
@@ -1923,7 +1917,7 @@ function testStyleManager() {
// Task =======================================================================
function testTask() {
let task: AtomCore.Task = Atom.Task.once("File.path", {}, () => {});
let task: Atom.Task = Atom.Task.once("File.path", {}, () => {});
task = new Atom.Task("File.path");
task.start({}, () => {});
@@ -2282,7 +2276,7 @@ function testTextEditor() {
subscription = editor.onDidChangeSoftWrapped(softWrapped => {});
subscription = editor.onDidChangeEncoding(encoding => {});
subscription = editor.observeGrammar(grammar => grammar.name);
subscription = editor.onDidChangeGrammar(grammar => grammar.scopeName);
subscription = editor.onDidChangeGrammar(grammar => grammar.name);
subscription = editor.onDidChangeModified(modified => {});
subscription = editor.onDidConflict(() => {});
subscription = editor.onWillInsertText(event => event.cancel && event.text);
@@ -2997,8 +2991,9 @@ function testWorkspace() {
subscription = atom.workspace.observeActivePane(pane => pane.activate());
subscription = atom.workspace.onDidAddPaneItem(event => event.index && event.item &&
event.pane);
subscription = atom.workspace.onWillDestroyPaneItem(event => event.index &&
event.item && event.pane);
subscription = atom.workspace.onWillDestroyPaneItem(event => {
event.index && event.item && event.pane;
});
subscription = atom.workspace.onDidDestroyPaneItem(event => event.index &&
event.item && event.pane);
subscription = atom.workspace.onDidAddTextEditor(event => event.index && event.pane &&
@@ -3045,7 +3040,13 @@ function testWorkspace() {
if (result) obj = result;
}
atom.workspace.addOpener(() => element);
atom.workspace.addOpener((uri) => {
if (uri === "test://") {
return {
getTitle: () => "Test Title",
};
}
});
atom.workspace.buildTextEditor(obj);
+128
View File
@@ -0,0 +1,128 @@
import "../index";
declare module "atom" {
interface ConfigValues {
/**
* Suggestions will show as you type if this preference is enabled. If it is
* disabled, you can still see suggestions by using the keymapping for
* 'autocomplete-plus:activate' (shown below).
*/
"autocomplete-plus.enableAutoActivation": boolean;
/**
* If you are experiencing performance issues when typing, you should try
* increasing this value to a non-zero number (e.g. 100).
*/
"autocomplete-plus.autoActivationDelay": number;
/** The suggestion list will only show this many suggestions. */
"autocomplete-plus.maxVisibleSuggestions": number;
/**
* You should use the key(s) indicated here to confirm a suggestion from the
* suggestion list and have it inserted into the file.
*/
"autocomplete-plus.confirmCompletion":
| "tab"
| "enter"
| "tab and enter"
| "tab always, enter when suggestion explicitly selected";
/**
* Disable this if you want to bind your own keystrokes to move around the
* suggestion list. You will also need to add definitions to your keymap.
*/
"autocomplete-plus.useCoreMovementCommands": boolean;
/**
* Suggestions will not be provided for files matching this list, e.g. *.md
* for Markdown files. To blacklist more than one file extension, use comma
* as a separator, e.g. ["*.md", "*.txt"] (both Markdown and text files).
*/
"autocomplete-plus.fileBlacklist": string[];
/** Suggestions will not be provided for scopes matching this list. */
"autocomplete-plus.scopeBlacklist": string[];
/**
* For grammars with no registered provider(s), the default provider will
* include completions from all buffers, instead of just the buffer you are
* currently editing.
*/
"autocomplete-plus.includeCompletionsFromAllBuffers": boolean;
/**
* Fuzzy searching is performed if this is disabled; if it is enabled, suggestions
* must begin with the prefix from the current word.
*/
"autocomplete-plus.strictMatching": boolean;
/**
* Only autocomplete when you've typed at least this many characters.
* Note: May not affect external providers.
*/
"autocomplete-plus.minimumWordLength": number;
/**
* The package comes with a built-in provider that will provide suggestions
* using the words in your current buffer or all open buffers. You will get
* better suggestions by installing additional autocomplete+ providers.
* To stop using the built-in provider, disable this option.
*/
"autocomplete-plus.enableBuiltinProvider": boolean;
/** Don't use the built-in provider for these selector(s). */
"autocomplete-plus.builtinProviderBlacklist": string;
/**
* If enabled, typing `backspace` will show the suggestion list if suggestions
* are available. If disabled, suggestions will not be shown while backspacing.
*/
"autocomplete-plus.backspaceTriggersAutocomplete": boolean;
/**
* If enabled, automatically insert suggestion on manual activation with
* 'autocomplete-plus:activate' when there is only one match.
*/
"autocomplete-plus.enableAutoConfirmSingleSuggestion": boolean;
/**
* With 'Cursor' the suggestion list appears at the cursor's position.
* With 'Word' it appears at the beginning of the word that's being completed.
*/
"autocomplete-plus.suggestionListFollows": "Word"|"Cursor";
/**
* If you're having trouble with autocomplete, you may consider falling back
* to the Symbol provider and filing an issue.
*/
"autocomplete-plus.defaultProvider": "Subsequence"|"Symbol";
/** Don't auto-activate when any of these classes are present in the editor. */
"autocomplete-plus.suppressActivationForEditorClasses": string[];
/**
* Completing a suggestion consumes text following the cursor matching the
* suffix of the chosen suggestion.
*/
"autocomplete-plus.consumeSuffix": boolean;
/**
* -EXPERIMENTAL- Prefers runs of consecutive characters, acronyms and start
* of words.
*/
"autocomplete-plus.useAlternateScoring": boolean;
/** Gives words near the cursor position a higher score than those far away. */
"autocomplete-plus.useLocalityBonus": boolean;
/** Identifies non-latin alphabet characters as letters. */
"autocomplete-plus.enableExtendedUnicodeSupport": boolean;
/**
* Should similar suggestions be removed from the list? If so how to determine
* they are similar.
*/
"autocomplete-plus.similarSuggestionRemoval": "none"|"textOrSnippet";
}
}
@@ -1,16 +1,20 @@
// Autocomplete Plus 2.x
// https://atom.io/packages/autocomplete-plus
/// <reference path="./config.d.ts" />
import { Point, ScopeDescriptor, TextEditor } from "../index";
/** The parameters passed into getSuggestions by Autocomplete+. */
export interface SuggestionsRequestedEvent {
/** The current TextEditor. */
editor: AtomCore.TextEditor;
editor: TextEditor;
/** The position of the cursor. */
bufferPosition: TextBuffer.Point;
bufferPosition: Point;
/** The scope descriptor for the current cursor position. */
scopeDescriptor: AtomCore.ScopeDescriptor;
scopeDescriptor: ScopeDescriptor;
/** The prefix for the word immediately preceding the current cursor position. */
prefix: string;
@@ -21,26 +25,30 @@ export interface SuggestionsRequestedEvent {
/** The parameters passed into onDidInsertSuggestion by Autocomplete+. */
export interface SuggestionInsertedEvent {
editor: AtomCore.TextEditor;
triggerPosition: TextBuffer.Point;
editor: TextEditor;
triggerPosition: Point;
suggestion: TextSuggestion|SnippetSuggestion;
}
/** An autocompletion suggestion for the user.
/**
* An autocompletion suggestion for the user.
* Primary data type for the Atom Autocomplete+ service.
*/
export interface Suggestion<T extends { text: string }|{ snippet: string }> {
/** A string that will show in the UI for this suggestion.
/**
* A string that will show in the UI for this suggestion.
* When not set, snippet || text is displayed.
*/
displayText?: string;
/** The text immediately preceding the cursor, which will be replaced by the text.
/**
* The text immediately preceding the cursor, which will be replaced by the text.
* If not provided, the prefix passed into getSuggestions will be used.
*/
replacementPrefix?: string;
/** The suggestion type. It will be converted into an icon shown against the
/**
* The suggestion type. It will be converted into an icon shown against the
* suggestion.
*/
type?: string;
@@ -51,7 +59,8 @@ export interface Suggestion<T extends { text: string }|{ snippet: string }> {
/** Use this instead of leftLabel if you want to use html for the left label. */
leftLabelHTML?: string;
/** An indicator (e.g. function, variable) denoting the "kind" of suggestion this
/**
* An indicator (e.g. function, variable) denoting the "kind" of suggestion this
* represents.
*/
rightLabel?: string;
@@ -59,22 +68,26 @@ export interface Suggestion<T extends { text: string }|{ snippet: string }> {
/** Use this instead of rightLabel if you want to use html for the right label. */
rightLabelHTML?: string;
/** Class name for the suggestion in the suggestion list. Allows you to style your
/**
* Class name for the suggestion in the suggestion list. Allows you to style your
* suggestion via CSS, if desired.
*/
className?: string;
/** If you want complete control over the icon shown against the suggestion.
/**
* If you want complete control over the icon shown against the suggestion.
* e.g. iconHTML: <i class="icon-move-right"></i>
*/
iconHTML?: string;
/** A doc-string summary or short description of the suggestion. When specified, it
/**
* A doc-string summary or short description of the suggestion. When specified, it
* will be displayed at the bottom of the suggestions list.
*/
description?: string;
/** A url to the documentation or more information about this suggestion.
/**
* A url to the documentation or more information about this suggestion.
* When specified, a More.. link will be displayed in the description area.
*/
descriptionMoreURL?: string;
@@ -86,7 +99,8 @@ export interface TextSuggestion extends Suggestion<TextSuggestion> {
}
export interface SnippetSuggestion extends Suggestion<SnippetSuggestion> {
/** A snippet string. This will allow users to tab through function arguments
/**
* A snippet string. This will allow users to tab through function arguments
* or other options.
*/
snippet: string;
@@ -96,24 +110,28 @@ export type Suggestions = Array<TextSuggestion|SnippetSuggestion>;
/** The interface that all Autocomplete+ providers must implement. */
export interface AutocompleteProvider {
/** Defines the scope selector(s) (can be comma-separated) for which your provider
/**
* Defines the scope selector(s) (can be comma-separated) for which your provider
* should receive suggestion requests.
*/
selector: string;
/** Is called when a suggestion request has been dispatched by autocomplete+ to
/**
* Is called when a suggestion request has been dispatched by autocomplete+ to
* your provider. Return an array of suggestions (if any) in the order you would
* like them displayed to the user. Returning a Promise of an array of suggestions
* is also supported.
*/
getSuggestions(params: SuggestionsRequestedEvent): Suggestions|Promise<Suggestions>;
/** Defines the scope selector(s) (can be comma-separated) for which your provider
/**
* Defines the scope selector(s) (can be comma-separated) for which your provider
* should not be used.
*/
disableForSelector?: string;
/** A number to indicate its priority to be included in a suggestions request.
/**
* A number to indicate its priority to be included in a suggestions request.
* The default provider has an inclusion priority of 0. Higher priority providers
* can suppress lower priority providers with excludeLowerPriority.
*/
@@ -122,12 +140,14 @@ export interface AutocompleteProvider {
/** Will not use lower priority providers when this provider is used. */
excludeLowerPriority?: boolean;
/** A number to determine the sort order of suggestions. The default provider has
/**
* A number to determine the sort order of suggestions. The default provider has
* an suggestion priority of 1.
*/
suggestionPriority?: number;
/** Function that is called when a suggestion from your provider was inserted
/**
* Function that is called when a suggestion from your provider was inserted
* into the buffer.
*/
onDidInsertSuggestion?(params: SuggestionInsertedEvent): void;
+6547 -4087
View File
File diff suppressed because it is too large Load Diff
+26
View File
@@ -0,0 +1,26 @@
import "../index";
declare module "atom" {
interface ConfigValues {
/** Lint tabs while they are still in preview status. */
"linter.lintPreviewTabs": boolean;
/** Lint files automatically when they are opened. */
"linter.lintOnOpen": boolean;
/**
* Lint files while typing, without the need to save (only for supported
* providers).
*/
"linter.lintOnChange": boolean;
/** Interval at which linting is done as you type (in ms). */
"linter.lintOnChangeInterval": number;
/** Ignore files matching this Glob. */
"linter.ignoreGlob": string;
/** Disabled providers. */
"linter.disabledProviders": string[];
}
}
+13 -8
View File
@@ -1,9 +1,13 @@
// Linter 2.x
// https://atom.io/packages/linter
/// <reference path="./config.d.ts" />
import { Disposable, Point, Range, TextEditor } from "../index";
export interface ReplacementSolution {
title?: string;
position: TextBuffer.Range;
position: Range;
priority?: number;
currentText?: string;
replaceWith: string;
@@ -11,7 +15,7 @@ export interface ReplacementSolution {
export interface CallbackSolution {
title?: string;
position: TextBuffer.Range;
position: Range;
priority?: number;
// tslint:disable-next-line:no-any
apply(): any;
@@ -24,7 +28,7 @@ export interface Message {
file: string;
/** The range of the message in the editor. */
position: TextBuffer.Range;
position: Range;
};
/** A reference to a different location in the editor. */
@@ -33,7 +37,7 @@ export interface Message {
file: string;
/** The point being referenced in that file. */
position?: TextBuffer.Point;
position?: Point;
};
/** An HTTP link to a resource explaining the issue. Default is a google search. */
@@ -51,7 +55,8 @@ export interface Message {
/** Possible solutions (which the user can invoke at will). */
solutions?: Array<ReplacementSolution|CallbackSolution>;
/** Markdown long description of the error. Accepts a callback so that you can
/**
* Markdown long description of the error. Accepts a callback so that you can
* do things like HTTP requests.
*/
description?: string|(() => Promise<string>|string);
@@ -63,8 +68,8 @@ export interface IndieDelegate {
clearMessages(): void;
setMessages(filePath: string, messages: Message[]): void;
setAllMessages(messages: Message[]): void;
onDidUpdate(callback: () => void): EventKit.Disposable;
onDidDestroy(callback: () => void): EventKit.Disposable;
onDidUpdate(callback: () => void): Disposable;
onDidDestroy(callback: () => void): Disposable;
dispose(): void;
}
@@ -73,5 +78,5 @@ export interface LinterProvider {
scope: "file"|"project";
lintsOnChange: boolean;
grammarScopes: string[];
lint(textEditor: AtomCore.TextEditor): Message[]|void|Promise<Message[]|undefined>;
lint(textEditor: TextEditor): Message[]|void|Promise<Message[]|undefined>;
}
+23
View File
@@ -0,0 +1,23 @@
import "../index";
declare module "atom" {
interface ConfigValues {
/** Show status bar at the bottom of the workspace. */
"status-bar.isVisible": boolean;
/** Fit the status-bar to the window's full-width. */
"status-bar.fullWidth": boolean;
/**
* Format for the cursor position status bar element, where %L is the line
* number and %C is the column number.
*/
"status-bar.cursorPositionFormat": string;
/**
* Format for the selection count status bar element, where %L is the line
* count and %C is the character count.
*/
"status-bar.selectionCountFormat": string;
}
}
@@ -1,13 +1,17 @@
// Status Bar 1.x
// https://atom.io/packages/status-bar
/// <reference path="./config.d.ts" />
export interface AddTileOptions {
/** A DOM element, a jQuery object, or a model object for which a view provider
/**
* A DOM element, a jQuery object, or a model object for which a view provider
* has been registered in the the view registry.
*/
item: object;
/** Determines the placement of the tile within the status bar. Lower priority
/**
* Determines the placement of the tile within the status bar. Lower priority
* will result in closer placement to the anchor.
*/
priority: number;
@@ -25,12 +29,14 @@ export interface Tile {
}
export interface StatusBar {
/** Add a tile to the left side of the status bar. Lower priority tiles are placed
/**
* Add a tile to the left side of the status bar. Lower priority tiles are placed
* further to the left.
*/
addLeftTile(options: AddTileOptions): Tile;
/** Add a tile to the right side of the status bar. Lower priority tiles are placed
/**
* Add a tile to the right side of the status bar. Lower priority tiles are placed
* further to the right.
*/
addRightTile(options: AddTileOptions): Tile;
+4 -4
View File
@@ -8,7 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,8 +20,8 @@
"files": [
"index.d.ts",
"atom-tests.ts",
"autocomplete-plus.d.ts",
"linter.d.ts",
"status-bar.d.ts"
"autocomplete-plus/index.d.ts",
"linter/index.d.ts",
"status-bar/index.d.ts"
]
}
+2 -30
View File
@@ -2,36 +2,8 @@
"extends": "dtslint/dt.json",
"rules": {
"await-promise": [true, "CancellablePromise"],
"class-name": true,
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 110],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-any": true,
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
"max-line-length": [true, 100],
"no-any": true
}
}
+6
View File
@@ -355,6 +355,12 @@ export class Popup {
domain: string,
/** your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard */
clientId?: string,
/**
* identity provider whose login page will be displayed in the popup.
* If omitted the hosted login page is used.
* {@link https://auth0.com/docs/identityproviders}
*/
connection?: string,
/** url that the Auth0 will redirect after Auth with the Authorization Response */
redirectUri: string,
/**
+92 -13
View File
@@ -1,4 +1,4 @@
// Type definitions for auth0 2.4
// Type definitions for auth0 2.5
// Project: https://github.com/auth0/node-auth0
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>, Amiram Korach <https://github.com/amiram>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -87,6 +87,84 @@ export interface Rule {
order?: number;
}
export interface Client {
/**
* The name of the client.
*/
name?: string;
/**
* Free text description of the purpose of the Client. (Max character length: `140`).
*/
description?: string;
/**
* The id of the client.
*/
client_id?: string;
/**
* The client secret, it must not be public.
*/
client_secret?: string;
/**
* The type of application this client represents.
*/
app_type?: string;
/**
* The URL of the client logo (recommended size: 150x150).
*/
logo_uri?: string;
/**
* Whether this client a first party client or not.
*/
is_first_party?: boolean;
/**
* Whether this client will conform to strict OIDC specifications.
*/
oidc_conformant?: boolean;
/**
* The URLs that Auth0 can use to as a callback for the client.
*/
callbacks?: string[];
allowed_origins?: string[];
web_origins?: string[];
client_aliases?: string[];
allowed_clients?: string[];
allowed_logout_urls?: string[];
jwt_configuration?: any;
/**
* Client signing keys.
*/
signing_keys?: string[];
encryption_key?: any;
sso?: boolean;
/**
* `true` to disable Single Sign On, `false` otherwise (default: `false`)
*/
sso_disabled?: boolean;
/**
* `true` if this client can be used to make cross-origin authentication requests, `false` otherwise (default: `false`)
*/
cross_origin_auth?: boolean;
/**
* Url fo the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page.
*/
cross_origin_loc?: string;
/**
* `true` if the custom login page is to be used, `false` otherwise. (default: `true`)
*/
custom_login_page_on?: boolean;
custom_login_page?: string;
custom_login_page_preview?: string;
form_template?: string;
addons?: any;
/**
* Defines the requested authentication method for the token endpoint. Possible values are 'none' (public client without a client secret), 'client_secret_post' (client uses HTTP POST parameters) or 'client_secret_basic' (client uses HTTP Basic) ['none' or 'client_secret_post' or 'client_secret_basic']
*/
token_endpoint_auth_method?: string;
client_metadata?: any;
mobile?: any;
}
export interface User {
email?: string;
email_verified?: boolean;
@@ -338,21 +416,22 @@ export class ManagementClient {
// Clients
getClients(): Promise<User>;
getClients(cb: (err: Error, data: any) => void): void;
getClients(): Promise<Client[]>;
getClients(cb: (err: Error, clients: Client[]) => void): void;
getClient(params: ClientParams): Promise<User>;
getClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
getClient(params: ClientParams): Promise<Client>;
getClient(params: ClientParams, cb: (err: Error, client: Client) => void): void;
createClient(data: Data): Promise<User>;
createClient(data: Data, cb: (err: Error, data: any) => void): void;
createClient(data: Data): Promise<Client>;
createClient(data: Data, cb: (err: Error, client: Client) => void): void;
updateClient(params: ClientParams, data: Data): Promise<User>;
updateClient(params: ClientParams, data: Data, cb: (err: Error, data: any) => void): void;
updateClient(params: ClientParams, data: Data): Promise<Client>;
updateClient(params: ClientParams, data: Data, cb: (err: Error, client: Client) => void): void;
deleteClient(params: ClientParams): Promise<User>;
deleteClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
deleteClient(params: ClientParams): Promise<void>;
deleteClient(params: ClientParams, cb: (err: Error) => void): void;
// Client Grants
getClientGrants(): Promise<User>;
getClientGrants(cb: (err: Error, data: any) => void): void;
@@ -450,8 +529,8 @@ export class ManagementClient {
deleteEmailProvider(): Promise<any>;
deleteEmailProvider(cb?: (err: Error, data: any) => void): void;
updateEmailProvider(data: Data): Promise<any>;
updateEmailProvider(data: Data, cb?: (err: Error, data: any) => void): void;
updateEmailProvider(params: {}, data: Data): Promise<any>;
updateEmailProvider(params: {}, data: Data, cb?: (err: Error, data: any) => void): void;
// Statistics
+2 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for AutobahnJS v0.9.7
// Project: http://autobahn.ws/js/
// Definitions by: Elad Zelingher <https://github.com/darkl>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>, Wladimir Totino <https://github.com/valepu>
// Definitions by: Elad Zelingher <https://github.com/darkl>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>, Wladimir Totino <https://github.com/valepu>, Mathias Teier <https://github.com/glenroy37/,http://kagent.at>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="when" />
@@ -179,6 +179,7 @@ declare namespace autobahn {
interface ISubscribeOptions {
match?: string;
get_retained?: boolean;
}
interface IRegisterOptions {
+3 -3
View File
@@ -32,19 +32,19 @@ export interface DeviceOptions extends mqtt.IClientOptions {
* same as certPath, but can also accept a buffer containing client
* certificate data
*/
clientCert?: string;
clientCert?: string | Buffer;
/**
* same as keyPath, but can also accept a buffer containing private key
* data
*/
privateKey?: string;
privateKey?: string | Buffer;
/**
* same as caPath, but can also accept a buffer containing CA certificate
* data
*/
caCert?: string;
caCert?: string | Buffer;
/**
* set to "true" to automatically re-subscribe to topics after
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/moskalyk/typed-aws-lambda-mock-context
// Definitions by: Morgan Moskalyk <morgan.moskalyk@gmail.com>, Anand Nimkar <anand.a.nimkar@gmail.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare function context(options?: Options): Context;
+37 -28
View File
@@ -4,6 +4,7 @@ var anyObj: any = { abc: 123 };
var num: number = 5;
var error: Error = new Error();
var b: boolean = true;
var apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext;
var apiGwEvt: AWSLambda.APIGatewayEvent;
var customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent;
var clientCtx: AWSLambda.ClientContext;
@@ -22,33 +23,33 @@ var snsEvtRec: AWSLambda.SNSEventRecord;
var snsMsg: AWSLambda.SNSMessage;
var snsMsgAttr: AWSLambda.SNSMessageAttribute;
var snsMsgAttrs: AWSLambda.SNSMessageAttributes;
var S3EvtRec: AWSLambda.S3EventRecord = {
var S3EvtRec: AWSLambda.S3EventRecord = {
eventVersion: '2.0',
eventSource: 'aws:s3',
awsRegion: 'us-east-1',
eventTime: '1970-01-01T00:00:00.000Z',
eventName: 'ObjectCreated:Put',
userIdentity: {
userIdentity: {
principalId: 'AIDAJDPLRKLG7UEXAMPLE'
},
requestParameters:{
requestParameters:{
sourceIPAddress: '127.0.0.1'
},
responseElements: {
responseElements: {
'x-amz-request-id': 'C3D13FE58DE4C810',
'x-amz-id-2': 'FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD'
},
s3: {
s3: {
s3SchemaVersion: '1.0',
configurationId: 'testConfigRule',
bucket: {
bucket: {
name: 'mybucket',
ownerIdentity: {
ownerIdentity: {
principalId: 'A3NL1KOZZKExample'
},
arn: 'arn:aws:s3:::mybucket'
},
object: {
object: {
key: 'HappyFace.jpg',
size: 1024,
eTag: 'd41d8cd98f00b204e9800998ecf8427e',
@@ -65,6 +66,28 @@ var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent;
var cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent;
var cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse;
/* API Gateway Event request context */
str = apiGwEvtReqCtx.accountId;
str = apiGwEvtReqCtx.apiId;
authResponseContext = apiGwEvtReqCtx.authorizer;
str = apiGwEvtReqCtx.httpMethod;
str = apiGwEvtReqCtx.identity.accessKey;
str = apiGwEvtReqCtx.identity.accountId;
str = apiGwEvtReqCtx.identity.apiKey;
str = apiGwEvtReqCtx.identity.caller;
str = apiGwEvtReqCtx.identity.cognitoAuthenticationProvider;
str = apiGwEvtReqCtx.identity.cognitoAuthenticationType;
str = apiGwEvtReqCtx.identity.cognitoIdentityId;
str = apiGwEvtReqCtx.identity.cognitoIdentityPoolId;
str = apiGwEvtReqCtx.identity.sourceIp;
str = apiGwEvtReqCtx.identity.user;
str = apiGwEvtReqCtx.identity.userAgent;
str = apiGwEvtReqCtx.identity.userArn;
str = apiGwEvtReqCtx.stage;
str = apiGwEvtReqCtx.requestId;
str = apiGwEvtReqCtx.resourceId;
str = apiGwEvtReqCtx.resourcePath;
/* API Gateway Event */
str = apiGwEvt.body;
str = apiGwEvt.headers["example"];
@@ -74,31 +97,17 @@ str = apiGwEvt.path;
str = apiGwEvt.pathParameters["example"];
str = apiGwEvt.queryStringParameters["example"];
str = apiGwEvt.stageVariables["example"];
str = apiGwEvt.requestContext.accountId;
str = apiGwEvt.requestContext.apiId;
str = apiGwEvt.requestContext.httpMethod;
str = apiGwEvt.requestContext.identity.accessKey;
str = apiGwEvt.requestContext.identity.accountId;
str = apiGwEvt.requestContext.identity.apiKey;
str = apiGwEvt.requestContext.identity.caller;
str = apiGwEvt.requestContext.identity.cognitoAuthenticationProvider;
str = apiGwEvt.requestContext.identity.cognitoAuthenticationType;
str = apiGwEvt.requestContext.identity.cognitoIdentityId;
str = apiGwEvt.requestContext.identity.cognitoIdentityPoolId;
str = apiGwEvt.requestContext.identity.sourceIp;
str = apiGwEvt.requestContext.identity.user;
str = apiGwEvt.requestContext.identity.userAgent;
str = apiGwEvt.requestContext.identity.userArn;
str = apiGwEvt.requestContext.stage;
str = apiGwEvt.requestContext.requestId;
str = apiGwEvt.requestContext.resourceId;
str = apiGwEvt.requestContext.resourcePath;
apiGwEvtReqCtx = apiGwEvt.requestContext;
str = apiGwEvt.resource;
/* API Gateway CustomAuthorizer Event */
str = customAuthorizerEvt.type;
str = customAuthorizerEvt.authorizationToken;
str = customAuthorizerEvt.methodArn;
str = customAuthorizerEvt.authorizationToken;
str = apiGwEvt.pathParameters["example"];
str = apiGwEvt.queryStringParameters["example"];
str = apiGwEvt.stageVariables["example"];
apiGwEvtReqCtx = apiGwEvt.requestContext;
/* SNS Event */
snsEvtRecs = snsEvt.Records;
+35 -26
View File
@@ -8,9 +8,36 @@
// Yoriki Yamaguchi <https://github.com/y13i>
// wwwy3y3 <https://github.com/wwwy3y3>
// Ishaan Malhi <https://github.com/OrthoDex>
// Daniel Cottone <https://github.com/daniel-cottone>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// API Gateway "event" request context
interface APIGatewayEventRequestContext {
accountId: string;
apiId: string;
authorizer?: AuthResponseContext | null | undefined;
httpMethod: string;
identity: {
accessKey: string | null;
accountId: string | null;
apiKey: string | null;
caller: string | null;
cognitoAuthenticationProvider: string | null;
cognitoAuthenticationType: string | null;
cognitoIdentityId: string | null;
cognitoIdentityPoolId: string | null;
sourceIp: string;
user: string | null;
userAgent: string | null;
userArn: string | null;
},
stage: string;
requestId: string;
resourceId: string;
resourcePath: string;
}
// API Gateway "event"
interface APIGatewayEvent {
body: string | null;
@@ -21,37 +48,19 @@ interface APIGatewayEvent {
pathParameters: { [name: string]: string } | null;
queryStringParameters: { [name: string]: string } | null;
stageVariables: { [name: string]: string } | null;
requestContext: {
accountId: string;
apiId: string;
httpMethod: string;
identity: {
accessKey: string | null;
accountId: string | null;
apiKey: string | null;
caller: string | null;
cognitoAuthenticationProvider: string | null;
cognitoAuthenticationType: string | null;
cognitoIdentityId: string | null;
cognitoIdentityPoolId: string | null;
sourceIp: string;
user: string | null;
userAgent: string | null;
userArn: string | null;
},
stage: string;
requestId: string;
resourceId: string;
resourcePath: string;
};
requestContext: APIGatewayEventRequestContext;
resource: string;
}
// API Gateway CustomAuthorizer "event"
interface CustomAuthorizerEvent {
type: string;
authorizationToken: string;
methodArn: string;
authorizationToken?: string;
headers?: { [name: string]: string };
pathParameters?: { [name: string]: string } | null;
queryStringParameters?: { [name: string]: string } | null;
requestContext?: APIGatewayEventRequestContext;
}
// SNS "event"
@@ -323,9 +332,9 @@ interface PolicyDocument {
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
*/
interface Statement {
Action: string | [string];
Action: string | string[];
Effect: string;
Resource: string | [string];
Resource: string | string[];
}
/**
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/awslabs/aws-serverless-express
// Definitions by: Ben Speakman <https://github.com/threesquared>, Josh Caffey <https://github.com/jcaffey>, Matthias Meyer <https://github.com/mattmeye>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node"/>
import * as http from 'http';
+1
View File
@@ -3,6 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Johnny Estilles <https://github.com/johnnyestilles>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as t from 'babel-types';

Some files were not shown because too many files have changed in this diff Show More