This commit is contained in:
yushulx
2018-01-16 15:20:00 +08:00
9114 changed files with 452804 additions and 187123 deletions
+3932 -3413
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -1,5 +1,9 @@
If you know how to fix the issue, make a pull request instead.
- [ ] I tried using the `@types/xxxx` package and had problems.
- [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
- [ ] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/). (Please ask any appropriate questions there).
- [ ] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see `Definitions by:` in `index.d.ts`) so they can respond.
- Authors: @....
If you do not mention the authors the issue will be ignored.
+1 -1
View File
@@ -12,7 +12,7 @@ If adding a new definition:
- [ ] The package does not provide its own types, and you can not add them.
- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
- [ ] Create it with `dts-gen --dt`, not by basing it on an existing project.
- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`.
- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, `strictNullChecks`, and `strictFunctionTypes` set to `true`.
If changing an existing definition:
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- node
- 8
sudo: false
+13 -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).
@@ -313,6 +313,18 @@ When `dts-gen` is used to scaffold a scoped package, the `paths` property has to
GitHub doesn't [support](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) file history for renamed files. Use [`git log --follow`](https://www.git-scm.com/docs/git-log) instead.
#### Should I add an empty namespace to a package that doesn't export a module to use ES6 style imports?
Some packages, like [chai-http](https://github.com/chaijs/chai-http), export a function.
Importing this module with an ES6 style import in the form `import * as foo from "foo";` leads to the error:
> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct
This error can be suppressed by merging the function declaration with an empty namespace of the same name, but this practice is discouraged.
This is a commonly cited [Stack Overflow answer](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) regarding this matter.
It is more appropriate to import the module using the `import foo = require("foo");` syntax, or to use a default import like `import foo from "foo";` if using the `--allowSyntheticDefaultImports` flag if your module runtime supports an interop scheme for non-ECMAScript modules as such.
## License
File diff suppressed because it is too large Load Diff
+79
View File
@@ -0,0 +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
}
}
+79
View File
@@ -0,0 +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
}
}
+6 -5
View File
@@ -1,13 +1,14 @@
// Type definitions for accepts 1.3
// Project: https://github.com/jshttp/accepts
// Definitions by: Stefan Reichel <https://github.com/bomret>
// Brice BERNARD <https://github.com/brikou>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace accepts {
interface Headers {
[key: string]: string | string[];
}
/// <reference types="node" />
import { IncomingMessage } from "http";
declare namespace accepts {
interface Accepts {
/**
* Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned.
@@ -55,6 +56,6 @@ declare namespace accepts {
}
}
declare function accepts(req: { headers: accepts.Headers }): accepts.Accepts;
declare function accepts(req: IncomingMessage): accepts.Accepts;
export = accepts;
+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;
/**
+79
View File
@@ -0,0 +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
}
}
+79
View File
@@ -0,0 +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
}
}
+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;
}
+9
View File
@@ -0,0 +1,9 @@
{
"extends": "dtslint/dt.json",
"rules": {
"export-just-namespace": false,
"interface-name": false,
"no-empty-interface": false,
"no-unnecessary-class": false
}
}
+79
View File
@@ -0,0 +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
}
}
+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);
+427
View File
@@ -0,0 +1,427 @@
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});
*
* const noInputs = [
* `I didn't hear a number`,
* `If you're still there, what's the number?`,
* 'What is the number?'
* ];
*
* function mainIntent (app) {
* const ssml = '<speak>Hi! <break time="1"/> ' +
* 'I can read out an ordinal like ' +
* '<say-as interpret-as="ordinal">123</say-as>. Say a number.</speak>';
* const inputPrompt = app.buildInputPrompt(true, ssml, noInputs);
* app.ask(inputPrompt);
* }
*
* function rawInput (app) {
* if (app.getRawInput() === 'bye') {
* app.tell('Goodbye!');
* } else {
* const ssml = '<speak>You said, <say-as interpret-as="ordinal">' +
* app.getRawInput() + '</say-as></speak>';
* const inputPrompt = app.buildInputPrompt(true, ssml, noInputs);
* 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});
*
* const noInputs = [
* `I didn't hear a number`,
* `If you're still there, what's the number?`,
* 'What is the number?'
* ];
*
* function mainIntent (app) {
* const ssml = '<speak>Hi! <break time="1"/> ' +
* 'I can read out an ordinal like ' +
* '<say-as interpret-as="ordinal">123</say-as>. Say a number.</speak>';
* const inputPrompt = app.buildInputPrompt(true, ssml, noInputs);
* app.ask(inputPrompt);
* }
*
* function rawInput (app) {
* if (app.getRawInput() === 'bye') {
* app.tell('Goodbye!');
* } else {
* const ssml = '<speak>You said, <say-as interpret-as="ordinal">' +
* app.getRawInput() + '</say-as></speak>';
* const inputPrompt = app.buildInputPrompt(true, ssml, noInputs);
* 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
+572
View File
@@ -0,0 +1,572 @@
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 v1.
* Doesn't currently support Dialogflow's fulfillment API v2.
*/
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.7
// 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';
+443
View File
@@ -0,0 +1,443 @@
/**
* A collection of response builders.
*/
import { OrderUpdate } from './transactions';
/**
* List of possible options to display the image in a BasicCard.
* When the aspect ratio of an image is not the same as the surface,
* this attribute changes how the image is displayed in the card.
*/
export enum ImageDisplays {
/**
* Pads the gaps between the image and image frame with a blurred copy of the
* same image.
*/
DEFAULT,
/**
* Fill the gap between the image and image container with white bars.
*/
WHITE,
/**
* Image is centered and resized so the image fits perfectly in the container.
*/
CROPPED
}
/**
* 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 ItemBasicCard {
basicCard: BasicCard;
}
export interface ItemSimpleResponse {
simpleResponse: SimpleResponse;
}
export interface ItemStructuredResponse {
structuredResponse: StructuredResponse;
}
export type RichResponseItem = ItemBasicCard | ItemSimpleResponse | ItemStructuredResponse;
/**
* 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. The destination site must be verified
* (https://developers.google.com/actions/console/brand-verification).
*
* @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;
/**
* Sets the display options for the image in this Basic Card.
* Use one of the image display constants. If none is chosen,
* ImageDisplays.DEFAULT will be enforced.
*
* @param option The option for displaying the image.
* @return Returns current constructed BasicCard.
*/
setImageDisplay(option: ImageDisplays): 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;
/**
* Check if given text contains SSML, allowing for whitespace padding.
* @param text Text to check.
* @return True if text contains possibly whitespace padded SSML, false otherwise.
*/
export function isPaddedSsml(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 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+2
View File
@@ -3,6 +3,8 @@
"rules": {
"interface-name": [false],
"ban-types": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-unnecessary-qualifier": false
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
"dependencies": {
"activex-helpers": "*"
}
}
}
+84
View File
@@ -0,0 +1,84 @@
import AuthenticationContext, {
AuthenticationContextOptions,
TokenCallback,
UserCallback
} from "adal-angular";
const onLogin: TokenCallback = (errorDescription, idToken, error) => {
if (error) {
console.error(errorDescription, error);
return;
}
if (config.popUp) {
authenticationContext.getUser(onUser);
}
};
const onToken: TokenCallback = (errorDesc, token, error) => {
if (error) {
console.error(error);
return;
}
console.log('Making request with token:', token);
};
const onUser: UserCallback = (error, user) => {
if (error) {
console.error(error);
return;
}
acquireAnAccessToken();
};
const acquireAnAccessToken = () => {
const resourceId = "https://graph.microsoft.net";
authenticationContext.acquireToken(
resourceId,
(errorDesc, token, error) => {
if (error) {
if (config.popUp) {
authenticationContext.acquireTokenPopup(
resourceId,
null,
null,
onToken
);
} else {
authenticationContext.acquireTokenRedirect(
resourceId,
null,
null
);
}
} else {
onToken(errorDesc, token, error);
}
}
);
};
const config: AuthenticationContextOptions = {
clientId: "7cee0f68-5051-41f6-9e45-80463d21d65d",
redirectUri: "http://localhost:16969/",
instance: "https://login.microsoftonline.com/",
tenant: "contoso.onmicrosoft.com",
extraQueryParameter: "nux=1",
correlationId: "123",
popUp: true,
cacheLocation: "localStorage",
callback: onLogin
};
const authenticationContext = new AuthenticationContext(config);
if (authenticationContext.isCallback(window.location.hash)) {
authenticationContext.handleWindowCallback();
} else if (authenticationContext.getCachedUser() == null) {
authenticationContext.login();
} else {
acquireAnAccessToken();
}
setTimeout(() => {
authenticationContext.logOut();
}, 60000);
+277
View File
@@ -0,0 +1,277 @@
// Type definitions for adal-angular 1.0
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js#readme
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export enum LoggingLevel {
ERROR = 0,
WARNING = 1,
INFO = 2,
VERBOSE = 3
}
export type RequestType = "LOGIN" | "RENEW_TOKEN" | "UNKNOWN";
export type ResponseType = "id_token token" | "token";
export interface RequestInfo {
/**
* Object comprising of fields such as id_token/error, session_state, state, e.t.c.
*/
parameters: any;
/**
* Request type.
*/
requestType: RequestType;
/**
* Whether state is valid.
*/
stateMatch: boolean;
/**
* Unique guid used to match the response with the request.
*/
stateResponse: string;
/**
* Whether `requestType` contains `id_token`, `access_token` or error.
*/
valid: boolean;
}
export interface UserInfo {
/**
* Username assigned from UPN or email.
*/
userName: string;
/**
* Properties parsed from `id_token`.
*/
profile: any;
}
export type TokenCallback = (
errorDesc: string | null,
token: string,
error: any
) => void;
export type UserCallback = (errorDesc: string | null, user: UserInfo) => void;
export interface AuthenticationContextOptions {
/**
* Client ID assigned to your app by Azure Active Directory.
*/
clientId: string;
/**
* Endpoint at which you expect to receive tokens.Defaults to `window.location.href`.
*/
redirectUri: string;
/**
* Azure Active Directory instance. Defaults to `https://login.microsoftonline.com/`.
*/
instance?: string;
/**
* Your target tenant. Defaults to `common`.
*/
tenant?: string;
/**
* Query parameters to add to the authentication request.
*/
extraQueryParameter?: string;
/**
* Unique identifier used to map the request with the response. Defaults to RFC4122 version 4 guid (128 bits).
*/
correlationId?: string;
/**
* User defined function of handling the navigation to Azure AD authorization endpoint in case of login.
*/
displayCall?: (url: string) => void;
/**
* Set this to true to enable login in a popup winodow instead of a full redirect. Defaults to `false`.
*/
popUp?: boolean;
/**
* Set this to the resource to request on login. Defaults to `clientId`.
*/
loginResource?: string;
/**
* Set this to redirect the user to a custom login page.
*/
localLoginUrl?: string;
/**
* Redirects to start page after login. Defaults to `true`.
*/
navigateToLoginRequestUrl?: boolean;
/**
* Set this to redirect the user to a custom logout page.
*/
logOutUri?: string;
/**
* Redirects the user to postLogoutRedirectUri after logout. Defaults to `redirectUri`.
*/
postLogoutRedirectUri?: string;
/**
* Sets browser storage to either 'localStorage' or sessionStorage'. Defaults to `sessionStorage`.
*/
cacheLocation?: "localStorage" | "sessionStorage";
/**
* Array of keywords or URIs. Adal will attach a token to outgoing requests that have these keywords or URIs.
*/
endpoints?: { [resource: string]: string };
/**
* Array of keywords or URIs. Adal will not attach a token to outgoing requests that have these keywords or URIs.
*/
anonymousEndpoints?: string[];
/**
* If the cached token is about to be expired in the expireOffsetSeconds (in seconds), Adal will renew the token instead of using the cached token. Defaults to 300 seconds.
*/
expireOffsetSeconds?: number;
/**
* The number of milliseconds of inactivity before a token renewal response from AAD should be considered timed out. Defaults to 6 seconds.
*/
loadFrameTimeout?: number;
/**
* Callback to be invoked when a token is acquired.
*/
callback?: TokenCallback;
}
export default class AuthenticationContext {
constructor(options: AuthenticationContextOptions);
/**
* Initiates the login process by redirecting the user to Azure AD authorization endpoint.
*/
login(): void;
/**
* Returns whether a login is in progress.
*/
loginInProgress(): boolean;
/**
* Gets token for the specified resource from the cache.
* @param resource A URI that identifies the resource for which the token is requested.
*/
getCachedToken(resource: string): string;
/**
* If user object exists, returns it. Else creates a new user object by decoding `id_token` from the cache.
*/
getCachedUser(): UserInfo;
/**
* Adds the passed callback to the array of callbacks for the specified resource.
* @param resource A URI that identifies the resource for which the token is requested.
* @param expectedState A unique identifier (guid).
* @param callback The callback provided by the caller. It will be called with token or error.
*/
registerCallback(
expectedState: string,
resource: string,
callback: TokenCallback
): void;
/**
* Acquires token from the cache if it is not expired. Otherwise sends request to AAD to obtain a new token.
* @param resource Resource URI identifying the target resource.
* @param callback The callback provided by the caller. It will be called with token or error.
*/
acquireToken(resource: string, callback: TokenCallback): void;
/**
* Acquires token (interactive flow using a popup window) by sending request to AAD to obtain a new token.
* @param resource Resource URI identifying the target resource.
* @param extraQueryParameters Query parameters to add to the authentication request.
* @param claims Claims to add to the authentication request.
* @param callback The callback provided by the caller. It will be called with token or error.
*/
acquireTokenPopup(
resource: string,
extraQueryParameters: string | null | undefined,
claims: string | null | undefined,
callback: TokenCallback
): void;
/**
* Acquires token (interactive flow using a redirect) by sending request to AAD to obtain a new token. In this case the callback passed in the authentication request constructor will be called.
* @param resource Resource URI identifying the target resource.
* @param extraQueryParameters Query parameters to add to the authentication request.
* @param claims Claims to add to the authentication request.
*/
acquireTokenRedirect(
resource: string,
extraQueryParameters?: string | null,
claims?: string | null
): void;
/**
* Redirects the browser to Azure AD authorization endpoint.
* @param urlNavigate URL of the authorization endpoint.
*/
promptUser(urlNavigate: string): void;
/**
* Clears cache items.
*/
clearCache(): void;
/**
* Clears cache items for a given resource.
* @param resource Resource URI identifying the target resource.
*/
clearCacheForResource(resource: string): void;
/**
* Redirects user to logout endpoint. After logout, it will redirect to `postLogoutRedirectUri` if added as a property on the config object.
*/
logOut(): void;
/**
* Calls the passed in callback with the user object or error message related to the user.
* @param callback The callback provided by the caller. It will be called with user or error.
*/
getUser(callback: UserCallback): void;
/**
* Checks if the URL fragment contains access token, id token or error description.
* @param hash Hash passed from redirect page.
*/
isCallback(hash: string): boolean;
/**
* Gets login error.
*/
getLoginError(): string;
/**
* Creates a request info object from the URL fragment and returns it.
*/
getRequestInfo(hash: string): RequestInfo;
/**
* Saves token or error received in the response from AAD in the cache. In case of `id_token`, it also creates the user object.
*/
saveTokenFromHash(requestInfo: RequestInfo): void;
/**
* Gets resource for given endpoint if mapping is provided with config.
* @param endpoint Resource URI identifying the target resource.
*/
getResourceForEndpoint(resource: string): string;
/**
* This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the callbacks with the result.
* @param hash Hash fragment of URL. Defaults to `window.location.hash`.
*/
handleWindowCallback(hash?: string): void;
/**
* Checks the logging Level, constructs the log message and logs it. Users need to implement/override this method to turn on logging.
* @param level Level can be set 0, 1, 2 and 3 which turns on 'error', 'warning', 'info' or 'verbose' level logging respectively.
* @param message Message to log.
* @param error Error to log.
*/
log(level: LoggingLevel, message: string, error: any): void;
/**
* Logs messages when logging level is set to 0.
* @param message Message to log.
* @param error Error to log.
*/
error(message: string, error: any): void;
/**
* Logs messages when logging level is set to 1.
* @param message Message to log.
*/
warn(message: string): void;
/**
* Logs messages when logging level is set to 2.
* @param message Message to log.
*/
info(message: string): void;
/**
* Logs messages when logging level is set to 3.
* @param message Message to log.
*/
verbose(message: string): void;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"adal-angular-tests.ts"
]
}
-40
View File
@@ -1,40 +0,0 @@
// Type definitions for ADAL.JS 1.0.8
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
// Definitions by: mmaitre314 <https://github.com/mmaitre314>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
declare namespace adal {
interface AdalAuthenticationServiceProvider {
init(configOptions: Config, httpProvider: angular.IHttpProvider): void;
}
interface UserInfo {
isAuthenticated: boolean,
userName: string,
loginError: string,
profile: any
}
interface AdalAuthenticationService {
config: Config;
userInfo: UserInfo,
login(): void;
loginInProgress(): boolean;
logOut(): void;
getCachedToken(resource: string): string;
acquireToken(resource: string): angular.IPromise<string>;
getUser(): angular.IPromise<User>;
getResourceForEndpoint(endpoint: string): string,
clearCache(): void;
clearCacheForResource(resource: string): void;
info(message: string): void;
verbose(message: string): void;
}
}
-179
View File
@@ -1,179 +0,0 @@
// Type definitions for ADAL.JS 1.0.14
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
// Definitions by: mmaitre314 <https://github.com/mmaitre314>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare var AuthenticationContext: adal.AuthenticationContextStatic;
declare var Logging: adal.Logging;
declare module 'adal' {
export const AuthenticationContext: adal.AuthenticationContextStatic;
export const Logging: adal.Logging;
}
declare namespace adal {
interface Config {
tenant?: string;
clientId: string;
redirectUri?: string;
instance?: string;
endpoints?: any; // If you need to send CORS api requests.
popUp?: boolean;
localLoginUrl?: string;
displayCall?: (urlNavigate: string) => any;
postLogoutRedirectUri?: string; // redirect url after succesful logout operation
cacheLocation?: string;
anonymousEndpoints?: string[];
expireOffsetSeconds?: number;
correlationId?: string;
loginResource?: string;
resource?: string;
extraQueryParameter?: string;
navigateToLoginRequestUrl?: boolean;
logOutUri?: string;
isAngular?: boolean;
}
interface User {
userName: string;
profile: any;
}
interface RequestInfo {
valid: boolean;
parameters: any;
stateMatch: boolean;
stateResponse: string;
requestType: string;
}
interface Logging {
log: (message: string) => void;
level: LoggingLevel;
}
enum LoggingLevel {
ERROR = 0,
WARNING = 1,
INFO = 2,
VERBOSE = 3
}
interface AuthenticationContextStatic {
new (config: Config): AuthenticationContext;
}
interface AuthenticationContext {
instance: string;
config: Config;
/**
* Gets initial Idtoken for the app backend
* Saves the resulting Idtoken in localStorage.
*/
login(): void;
/**
* Indicates whether login is in progress now or not.
*/
loginInProgress(): boolean;
/**
* Gets token for the specified resource from local storage cache
* @param {string} resource A URI that identifies the resource for which the token is valid.
* @returns {string} token if exists and not expired or null
*/
getCachedToken(resource: string): string;
/**
* Retrieves and parse idToken from localstorage
* @returns {User} user object
*/
getCachedUser(): User;
registerCallback(expectedState: string, resource: string, callback: (message: string, token: string) => any): void;
/**
* Acquire token from cache if not expired and available. Acquires token from iframe if expired.
* @param {string} resource ResourceUri identifying the target resource
* @param {requestCallback} callback
*/
acquireToken(resource: string, callback: (message: string, token: string) => any): void;
/**
* Redirect the Browser to Azure AD Authorization endpoint
* @param {string} urlNavigate The authorization request url
*/
promptUser(urlNavigate: string): void;
/**
* Clear cache items.
*/
clearCache(): void;
/**
* Clear cache items for a resource.
*/
clearCacheForResource(resource: string): void;
/**
* Logout user will redirect page to logout endpoint.
* After logout, it will redirect to post_logout page if provided.
*/
logOut(): void;
/**
* Gets a user profile
* @param {requestCallback} callback - The callback that handles the response.
*/
getUser(callback: (message: string, user?: User) => any): void;
/**
* Checks if hash contains access token or id token or error_description
* @param {string} hash - Hash passed from redirect page
* @returns {Boolean}
*/
isCallback(hash: string): boolean;
/**
* Gets login error
* @returns {string} error message related to login
*/
getLoginError(): string;
/**
* Gets requestInfo from given hash.
* @returns {RequestInfo} for appropriate hash.
*/
getRequestInfo(hash: string): RequestInfo;
/**
* Saves token from hash that is received from redirect.
*/
saveTokenFromHash(requestInfo: RequestInfo): void;
/**
* Gets resource for given endpoint if mapping is provided with config.
* @param {string} endpoint - API endpoint
* @returns {string} resource for this API endpoint
*/
getResourceForEndpoint(endpoint: string): string;
/**
* Handles redirection after login operation.
* Gets access token from url and saves token to the (local/session) storage
* or saves error in case unsuccessful login.
*/
handleWindowCallback(): void;
log(level: number, message: string, error: any): void;
error(message: string, error: any): void;
warn(message: string): void;
info(message: string): void;
verbose(message: string): void;
}
}
-46
View File
@@ -1,46 +0,0 @@
// Code samples from:
// - https://github.com/AzureAD/azure-activedirectory-library-for-js
// - https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp
// Variable provided by AngularJS
var $httpProvider: angular.IHttpProvider = null;
var adalAuthenticationServiceProvider: adal.AdalAuthenticationServiceProvider = null;
var adalAuthenticationService: adal.AdalAuthenticationService = null;
var endpoints = {
"https://yourhost/api": "b6a68585-5287-45b2-ba82-383ba1f60932",
};
adalAuthenticationServiceProvider.init({
tenant: "52d4b072-9470-49fb-8721-bc3a1c9912a1",
clientId: "e9a5a8b6-8af7-4719-9821-0deef255f68e",
endpoints: endpoints
},
$httpProvider
);
adalAuthenticationServiceProvider.init({
clientId: "e9a5a8b6-8af7-4719-9821-0deef255f68e"
},
$httpProvider
);
adalAuthenticationServiceProvider.init(
{
clientId: 'cb68f72f...',
cacheLocation: 'localStorage'
},
$httpProvider // pass http provider to inject request interceptor to attach tokens
);
adalAuthenticationServiceProvider.init({
tenant: 'Enter your tenant name here e.g. contoso.onmicrosoft.com',
clientId: 'Enter your client ID here e.g. e9a5a8b6-8af7-4719-9821-0deef255f68e',
extraQueryParameter: 'nux=1'
},
$httpProvider
);
adalAuthenticationService.login();
adalAuthenticationService.logOut();
-24
View File
@@ -1,24 +0,0 @@
var endpoints = {
"https://yourhost/api": "b6a68585-5287-45b2-ba82-383ba1f60932",
};
var config : adal.Config = {
tenant: "52d4b072-9470-49fb-8721-bc3a1c9912a1", // Optional by default, it sends common
clientId: "e9a5a8b6-8af7-4719-9821-0deef255f68e", // Required
endpoints: endpoints // If you need to send CORS api requests.
};
var auth = new AuthenticationContext(config);
Logging.log = (message: string) => {
console.log(message);
}
Logging.level = 4;
auth.info("Logging message");
var userName: string = auth.getCachedUser().userName;var postLogoutRedirectUrl = auth.config.postLogoutRedirectUri;
var isValidRequest = auth.getRequestInfo('hash').valid;
-26
View File
@@ -1,26 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"adal-angular.d.ts",
"test/index.ts",
"test/angular.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
import addZero from "add-zero";
addZero(5, 2);
+6
View File
@@ -0,0 +1,6 @@
// Type definitions for add-zero 1.0
// Project: https://github.com/rafaelrinaldi/add-zero#readme
// Definitions by: Giles Roadnight <https://github.com/Roaders>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export default function addZero(value: string | number, digits?: number): string;
+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",
"add-zero-tests.ts"
]
}
+79
View File
@@ -0,0 +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
}
}
+79
View File
@@ -0,0 +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
}
}
+7 -8
View File
@@ -455,7 +455,6 @@ declare namespace adone {
* Writes a 32bit le float
*
* @param offset Offset to write to
* @returns {this}
*/
writeFloatLE(value: number, offset?: number): this;
@@ -802,8 +801,7 @@ declare namespace adone {
* Resizes this ByteArray to be backed by a buffer of at least the given capacity.
* Will do nothing if already that large or larger.
*
* @param {number} capacity Capacity required
* @returns {this}
* @param capacity Capacity required
*/
resize(capacity: number): this;
@@ -1654,6 +1652,7 @@ declare namespace adone {
* Ends the stream
*/
end(chunk?: Buffer): void;
end(chunk?: () => void): void;
/**
* Returns the byte at the specified index
@@ -1679,8 +1678,8 @@ declare namespace adone {
* Returns a new BufferList object containing the bytes within the range specified.
* No copies will be performed. All buffers in the result share memory with the original list.
*
* @param {number} start slice from
* @param {number} end slice to
* @param start slice from
* @param end slice to
*/
shallowSlice(start?: number, end?: number): BufferList;
@@ -1705,11 +1704,11 @@ declare namespace adone {
destroy(): void;
then<T1 = Buffer, T2 = never>(
onfulfilled?: ((value: Buffer) => T1 | PromiseLike<T1>) | undefined | null,
onrejected?: ((reason: any) => T2 | PromiseLike<T2>) | undefined | null
onfulfilled?: ((value: Buffer) => T1 | PromiseLike<T1>) | null,
onrejected?: ((reason: any) => T2 | PromiseLike<T2>) | null
): PromiseLike<T1 | T2>;
catch<T>(onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): PromiseLike<T | Buffer>;
catch<T>(onrejected?: ((reason: any) => T | PromiseLike<T>) | null): PromiseLike<T | Buffer>;
}
/**
-3
View File
@@ -731,9 +731,6 @@ declare namespace adone {
*/
creationData(): DatetimeCreationData;
/**
*
*/
parsingFlags(): DatetimeParsingFlags;
/**
+343 -361
View File
File diff suppressed because it is too large Load Diff
-205
View File
@@ -53,41 +53,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
*/
swizzle(a: Float32x4, l1: number, l2: number, l3: number, l4: number): Float32x4;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
*/
shuffle(a: Float32x4, b: Float32x4, l1: number, l2: number, l3: number, l4: number): Float32x4;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Float32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Float32x4): Float32x4;
/**
* Creates a new SIMD.Float32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Float32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -121,16 +107,8 @@ declare namespace adone.math {
div(a: Float32x4, b: Float32x4): Float32x4;
/**
*
* @param a
*/
neg(a: Float32x4): Float32x4;
/**
*
* @param a
*/
abs(a: Float32x4): Float32x4;
min(a: Float32x4, b: Float32x4): Float32x4;
@@ -143,16 +121,8 @@ declare namespace adone.math {
reciprocalApproximation(a: Float32x4, b: Float32x4): Float32x4;
/**
*
* @param a
*/
reciprocalSqrtApproximation(a: Float32x4): Float32x4;
/**
*
* @param a
*/
sqrt(a: Float32x4): Float32x4;
/**
@@ -310,41 +280,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
*/
swizzle(a: Int32x4, l1: number, l2: number, l3: number, l4: number): Int32x4;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
*/
shuffle(a: Int32x4, b: Int32x4, l1: number, l2: number, l3: number, l4: number): Int32x4;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Int32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Int32x4): Int32x4;
/**
* Creates a new SIMD.Int32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Int32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -384,10 +340,6 @@ declare namespace adone.math {
mul(a: Int32x4, b: Int32x4): Int32x4;
/**
*
* @param a
*/
neg(a: Int32x4): Int32x4;
/**
@@ -565,49 +517,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
swizzle(a: Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Int16x8;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
shuffle(a: Int16x8, b: Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Int16x8;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Int16x8. Throws a TypeError otherwise.
* @param a
*/
check(a: Int16x8): Int16x8;
/**
* Creates a new SIMD.Int16x8 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Int16x8;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -647,10 +577,6 @@ declare namespace adone.math {
mul(a: Int16x8, b: Int16x8): Int16x8;
/**
*
* @param a
*/
neg(a: Int16x8): Int16x8;
/**
@@ -803,23 +729,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
swizzle(
a: Int8x16,
@@ -843,24 +752,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
shuffle(
a: Int8x16,
@@ -885,20 +776,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Int8x16. Throws a TypeError otherwise.
* @param a
*/
check(a: Int8x16): Int8x16;
/**
* Creates a new SIMD.Int8x16 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Int8x16;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -938,10 +826,6 @@ declare namespace adone.math {
mul(a: Int8x16, b: Int8x16): Int8x16;
/**
*
* @param a
*/
neg(a: Int8x16): Int8x16;
/**
@@ -1065,41 +949,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
*/
swizzle(a: Uint32x4, l1: number, l2: number, l3: number, l4: number): Uint32x4;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
*/
shuffle(a: Uint32x4, b: Uint32x4, l1: number, l2: number, l3: number, l4: number): Uint32x4;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Uint32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Uint32x4): Uint32x4;
/**
* Creates a new SIMD.Uint32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Uint32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1314,49 +1184,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
swizzle(a: Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Uint16x8;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
shuffle(a: Uint16x8, b: Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Uint16x8;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Uint16x8. Throws a TypeError otherwise.
* @param a
*/
check(a: Uint16x8): Uint16x8;
/**
* Creates a new SIMD.Uint16x8 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Uint16x8;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1546,23 +1394,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
swizzle(
a: Uint8x16,
@@ -1586,24 +1417,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
shuffle(
a: Uint8x16,
@@ -1628,20 +1441,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Uint8x16. Throws a TypeError otherwise.
* @param a
*/
check(a: Uint8x16): Uint8x16;
/**
* Creates a new SIMD.Uint8x16 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Uint8x16;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1802,20 +1612,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Bool32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Bool32x4): Bool32x4;
/**
* Creates a new SIMD.Bool32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: boolean): Bool32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1823,13 +1630,11 @@ declare namespace adone.math {
/**
* If all lane values are `true`, return `true`.
* @param a
*/
allTrue(a: Bool32x4): boolean;
/**
* If any lane values are `true`, return `true`.
* @param a
*/
anyTrue(a: Bool32x4): boolean;
@@ -1888,20 +1693,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Bool16x8. Throws a TypeError otherwise.
* @param a
*/
check(a: Bool16x8): Bool16x8;
/**
* Creates a new SIMD.Bool16x8 data type with all lanes set to a given value.
* @param n
*/
splat(n: boolean): Bool16x8;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1909,13 +1711,11 @@ declare namespace adone.math {
/**
* If all lane values are `true`, return `true`.
* @param a
*/
allTrue(a: Bool16x8): boolean;
/**
* If any lane values are `true`, return `true`.
* @param a
*/
anyTrue(a: Bool16x8): boolean;
@@ -1998,20 +1798,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Bool8x16. Throws a TypeError otherwise.
* @param a
*/
check(a: Bool8x16): Bool8x16;
/**
* Creates a new SIMD.Bool8x16 data type with all lanes set to a given value.
* @param n
*/
splat(n: boolean): Bool8x16;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -2019,13 +1816,11 @@ declare namespace adone.math {
/**
* If all lane values are `true`, return `true`.
* @param a
*/
allTrue(a: Bool8x16): boolean;
/**
* If any lane values are `true`, return `true`.
* @param a
*/
anyTrue(a: Bool8x16): boolean;
+2 -2
View File
@@ -47,8 +47,8 @@ declare namespace adone {
/**
* Converts a function that returns promises to a node.js style callback function
*
* @param {Function} fn Function
* @returns {Promise} the original promise
* @param fn Function
* @returns the original promise
*/
export function callbackify<R>(fn: () => Promise<R>): (callback: (err?: any, result?: R) => void) => Promise<R>;
export function callbackify<T, R>(fn: (a: T) => Promise<R>): (a: T, callback: (err?: any, result?: R) => void) => Promise<R>;
+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;
+2 -2
View File
@@ -113,8 +113,8 @@ declare class Agenda extends EventEmitter {
* @param options The options for the job.
* @param handler The handler to execute.
*/
define(name: string, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void;
define(name: string, options: Agenda.JobOptions, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void;
define(name: string, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
define(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
/**
* Runs job name at the given interval. Optionally, data and options can be passed in.
+79
View File
@@ -0,0 +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
}
}
+79
View File
@@ -0,0 +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
}
}
+779 -18
View File
@@ -4,15 +4,85 @@
// Huw <https://github.com/hoo29>
// pascalwhoop <https://github.com/pascalwhoop>
// Ben <https://github.com/blforce>
// rk-7 <https://github.com/rk-7>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export function handler<T>(event: RequestBody<T>, context: Context, callback?: (err: any, response: any) => void): AlexaObject<T>;
export function CreateStateHandler(state: string, obj: any): any;
export let StateString: string;
export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED";
export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED";
export type ListItemObjectStatus = "active" | "completed";
export type ListObjectState = "active" | "archived";
export type ImageSourceSize = "X_SMALL" | "SMALL" | "MEDIUM" | "LARGE" | "X_LARGE";
export type TemplateBackButtonVisibility = "HIDDEN" | "VISIBLE";
export type TemplateType = "BodyTemplate1" | "BodyTemplate2" | "BodyTemplate3" | "BodyTemplate6" | "BodyTemplate6" | "ListTemplate1" | "ListTemplate2";
export type AudioPlayerActivity = "IDLE" | "PAUSED" | "PLAYING" | "BUFFER_UNDERRUN" | "FINISHED" | "STOPPED";
export type CardType = "Standard" | "Simple" | "LinkAccount" | "AskForPermissionsConsent";
export type HintType = "PlainText";
export type DirectiveTypes = "AudioPlayer.Play" | "AudioPlayer.Stop" | "AudioPlayer.ClearQueue" | "Display.RenderTemplate" | "Hint" | "VideoApp.Launch";
export type TextContentType = "PlainText" | "RichText";
//#region Types
export interface CardImage {
/**
* Recommended size (in px): 720w x 480h
*/
smallImageUrl: string;
/**
* Recommended size (in px): 1200w x 800h
*/
largeImageUrl: string;
}
export interface ImageSource {
url: string;
widthPixels?: number;
heightPixels?: number;
/**
* Recommended sizes for the following dimensions (in px):
* 480 x 320 for X_SMALL,
* 720 x 480 for SMALL,
* 960 x 640 for MEDIUM,
* 1200 x 800 for LARGE,
* 1920 x 1280 for X_LARGE
*/
size?: ImageSourceSize;
}
export interface Image {
contentDescription: string;
sources: ImageSource[];
}
export interface TextField {
text: string;
type: string;
}
export interface TextContent {
primaryText?: TextField;
secondaryText?: TextField;
tertiaryText?: TextField;
}
export interface ListItem {
image?: Image;
token: string;
textContent?: TextContent;
}
export interface Template {
title?: string;
token: string;
backgroundImage?: Image;
/**
* Visibility of the back button.
*/
backButton?: TemplateBackButtonVisibility;
/**
* Template type.
*/
type: TemplateType;
image?: Image;
listItems?: ListItem[];
}
export interface AlexaObject<T> extends Handler<T> {
_event: any;
@@ -38,12 +108,16 @@ export interface Handler<T> {
emitWithState: any;
state: any;
handler: any;
i18n: any;
locale: any;
event: RequestBody<T>;
attributes: any;
context: any;
callback: (param: any) => void;
name: any;
isOverriden: any;
t: (token: string, ...args: any[]) => void;
response: ResponseBuilder;
}
export interface Context {
@@ -55,8 +129,28 @@ export interface Context {
functionVersion: string;
invokeid: string;
awsRequestId: string;
System?: System;
AudioPlayer?: AudioPlayer;
}
export interface Application {
applicationId: string;
[key: string]: string;
}
export interface System {
apiAccessToken: string;
apiEndpoint: string;
application: Application;
device: any;
user: any;
}
export interface AudioPlayer {
token: string;
offsetInMilliseconds: number;
/**
* Player activity
*/
playerActivity: AudioPlayerActivity;
}
export interface RequestBody<T> {
version: string;
session: Session;
@@ -66,20 +160,22 @@ export interface RequestBody<T> {
export interface Session {
new: boolean;
sessionId: string;
attributes: any;
application: SessionApplication;
attributes: { [key: string]: any };
application: Application;
user: SessionUser;
}
export interface SessionApplication {
applicationId: string;
}
export interface SessionUser {
userId: string;
accessToken?: string;
permissions: Permissions;
}
export interface Permissions {
/**
* @deprecated
*/
consentToken: string;
[key: string]: string;
}
export interface LaunchRequest extends Request { }
export interface IntentRequest extends Request {
@@ -144,7 +240,8 @@ export interface Response {
outputSpeech?: OutputSpeech;
card?: Card;
reprompt?: Reprompt;
shouldEndSession: boolean;
directives?: any;
shouldEndSession?: boolean;
}
export interface OutputSpeech {
@@ -154,18 +251,682 @@ export interface OutputSpeech {
}
export interface Card {
type: "Simple" | "Standard" | "LinkAccount";
type: CardType;
title?: string;
content?: string;
text?: string;
image?: Image;
}
export interface Image {
smallImageUrl: string;
largeImageUrl: string;
image?: CardImage;
}
export interface Reprompt {
outputSpeech: OutputSpeech;
}
export interface ApiClientOptions {
hostname: string;
port: string;
path: string;
protocol: string;
headers: string;
method: string;
}
export interface ApiClientResponse {
statusCode: string;
statusText: string;
body: object;
headers: object;
}
/**
* Todo-ListItem class
* Refer https://developer.amazon.com/docs/custom-skills/access-the-alexa-shopping-and-to-do-lists.html
*/
export interface ListItemObject {
/**
* item id (String, limit 60 characters)
*/
id: string;
/**
* item value (String, limit is 256 characters)
*/
value: string;
/**
* item status
*/
status?: ListItemObjectStatus;
/**
* item version (Positive integer)
*/
version?: number | string;
/**
* created time (ISO 8601 time format with time zone)
*/
createdTime: Date;
/**
* updated time (ISO 8601 time format with time zone)
*/
updatedTime: Date;
/**
* URL to retrieve the item (String)
*/
href?: string;
}
/**
* Todo-List class
* Refer https://developer.amazon.com/docs/custom-skills/access-the-alexa-shopping-and-to-do-lists.html
*/
export interface ListObject {
/**
* list id (String)
*/
listId: string;
/**
* list name (String)
*/
name: string;
/**
* state
* "active" or "archived" (Enum)
*/
state?: ListObjectState;
/**
* Possibly status of the list (or state?)
* Fetched from commit eebba0d at https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/
* File path: alexa-skills-kit-sdk-for-nodejs/lib/services/listManagementService.js
*/
status?: string;
/**
* list version (Positive integer)
*/
version?: number;
/**
* Urls to active and completed items
* href is lint to the items having certain status.
* The status can be "active" or "completed".
*/
statusMap: { href: string; status: ListItemObjectStatus; };
/**
* Items that belong to this list.
*/
items: ListItemObject[];
}
//#endregion
//#region templateBuilders
/**
* Generates templates for Echo Show device.
*/
export namespace templateBuilders {
interface SetTextContent<T extends TemplateBuilder<T>> {
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T;
}
interface SetListItems<T extends TemplateBuilder<T>> {
setListItems(listItems: ListItem[]): T;
}
/**
* Refer https://developer.amazon.com/docs/custom-skills/display-interface-reference.html#image-sizes
*/
abstract class TemplateBuilder<T extends TemplateBuilder<T>> {
template: Template;
constructor();
/**
* Sets the title of the template
* @param title title
* @returns TemplateBuilder
*/
setTitle(title: string): T;
/**
* Sets the token of the template
* @param token token
* @returns TemplateBuilder
*/
setToken(token: string): T;
/**
* Sets the background image of the template
* @param image image
* @returns TemplateBuilder
*/
setBackgroundImage(image: Image): T;
/**
* Sets the backButton behavior
* @param backButtonBehavior "VISIBLE" or "HIDDEN"
* @returns TemplateBuilder
*/
setBackButtonBehavior(backButtonBehavior: string): T;
/**
* Builds the template JSON object
* @returns Template
*/
build(): Template;
}
/**
* Used to build a list of ListItems for ListTemplate
*/
class ListItemBuilder {
constructor();
items: ListItem[];
/**
* Add an item to the list of template
* @param image image
* @param token token
* @param primaryText primaryText
* @param secondaryText secondaryText
* @param tertiaryText tertiaryText
*/
addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder;
build(): ListItem[];
}
/**
* Used to create BodyTemplate1 objects
*/
class BodyTemplate1Builder extends TemplateBuilder<BodyTemplate1Builder> implements SetTextContent<BodyTemplate1Builder> {
constructor();
/**
* Sets the text content for the template
* @param primaryText primaryText
* @param secondaryText secondaryText
* @param tertiaryText tertiaryText
* @returns BodyTemplate1Builder
*/
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder;
}
/**
* Used to create BodyTemplate2 objects
*/
class BodyTemplate2Builder extends TemplateBuilder<BodyTemplate2Builder> implements SetTextContent<BodyTemplate2Builder> {
constructor();
/**
* Sets the image for the template
* @param image image
* @returns BodyTemplate2Builder
*/
setImage(image: Image): BodyTemplate2Builder;
/**
* Sets the text content for the template
* @param primaryText primaryText
* @param secondaryText secondaryText
* @param tertiaryText tertiaryText
* @returns BodyTemplate2Builder
*/
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder;
}
/**
* Used to create BodyTemplate3 objects
*/
class BodyTemplate3Builder extends TemplateBuilder<BodyTemplate3Builder> implements SetTextContent<BodyTemplate3Builder> {
constructor();
/**
* Sets the image for the template
* @param image image
* @returns BodyTemplate3Builder
*/
setImage(image: Image): BodyTemplate3Builder;
/**
* Sets the text content for the template
* @param primaryText primaryText
* @param secondaryText secondaryText
* @param tertiaryText tertiaryText
* @returns BodyTemplate3Builder
*/
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder;
}
/**
* Used to create BodyTemplate6 objects
*/
class BodyTemplate6Builder extends TemplateBuilder<BodyTemplate6Builder> implements SetTextContent<BodyTemplate6Builder> {
constructor();
/**
* Sets the image for the template
* @param image image
* @returns BodyTemplate6Builder
*/
setImage(image: Image): BodyTemplate6Builder;
/**
* Sets the text content for the template
* @param primaryText primaryText
* @param secondaryText secondaryText
* @param tertiaryText tertiaryText
* @returns BodyTemplate6Builder
*/
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder;
}
/**
* Used to create BodyTemplate7 objects
*/
class BodyTemplate7Builder extends TemplateBuilder<BodyTemplate7Builder> {
constructor();
/**
* Sets the image for the template
* @param image image
* @returns BodyTemplate7Builder
*/
setImage(image: Image): BodyTemplate7Builder;
}
/**
* Used to create ListTemplate1 objects
*/
class ListTemplate1Builder extends TemplateBuilder<ListTemplate1Builder> implements SetListItems<ListTemplate1Builder> {
constructor();
/**
* Set the items for the list
* @param listItems listItems
* @returns ListTemplate1Builder
*/
setListItems(listItems: ListItem[]): ListTemplate1Builder;
}
/**
* Used to create ListTemplate2 objects
*/
class ListTemplate2Builder extends TemplateBuilder<ListTemplate2Builder> implements SetListItems<ListTemplate2Builder> {
constructor();
/**
* Set the items for the list
* @param listItems listItems
* @returns ListTemplate2Builder
*/
setListItems(listItems: ListItem[]): ListTemplate2Builder;
}
}
//#endregion
//#region services
export namespace services {
interface ApiClient {
/**
* Make a POST API call to the specified uri with headers and optional body
* @param uri http(s?) endpoint to call
* @param headers Key value pair of headers
* @param body post body to send
* @returns Promise<ApiClientResponse>
*/
post(uri: string, headers: object, body?: string): Promise<ApiClientResponse>;
/**
* Make a PUT API call to the specified uri with headers and optional body
* @param uri http(s?) endpoint to call
* @param headers Key value pair of headers
* @param body post body to send
* @returns Promise<ApiClientResponse>
*/
put(uri: string, headers: object, body?: string): Promise<ApiClientResponse>;
/**
* Make a GET API call to the specified uri with headers
* @param uri http(s?) endpoint to call
* @param headers key value pair of headers
* @returns Promise<ApiClientResponse>
*/
get(uri: string, headers: object): Promise<ApiClientResponse>;
/**
* Make a DELETE API call to the specified uri with headers
* @param uri http(s?) endpoint to call
* @param headers key value pair of headers
* @returns Promise<ApiClientResponse>
*/
delete(uri: string, headers: object): Promise<ApiClientResponse>;
}
class DeviceAddressService {
/**
* Create an instance of DeviceAddressService
* @param [apiClient=new ApiClient()] ApiClient
*/
constructor(apiClient: ApiClient);
/**
* Get full address information from Alexa Device Address API
* @param deviceId deviceId from Alexa request
* @param apiEndpoint API apiEndpoint from Alexa request
* @param token bearer token for device address permission
* @returns Promise<object>
*/
getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise<object>;
/**
* Get country and postal information from Alexa Device Address API
* @param deviceId deviceId from Alexa request
* @param apiEndpoint API apiEndpoint from Alexa request
* @param token bearer token for device address permission
* @returns Promise<object>
*/
getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise<object>;
}
class DirectiveService {
/**
* Creates an instance of DirectiveService.
* @param [apiClient=new ApiClient()] ApiClient
*/
constructor(apiClient: ApiClient);
/**
* Send the specified directiveObj to Alexa directive service
*
* @param directive directive to send to service
* @param apiEndpoint API endpoint from Alexa request
* @param token bearer token for directive service
* @returns Promise<void>
*/
enqueue(directive: object, apiEndpoint: string, token: string): Promise<void>;
}
class ListManagementService {
/**
* Create an instance of ListManagementService
* @param apiClient apiClient
*/
constructor(apiClient: ApiClient);
/**
* Set apiEndpoint address, default is "https://api.amazonalexa.com"
* @param apiEndpoint apiEndpoint
* @returns void
*/
setApiEndpoint(apiEndpoint: string): void;
/**
* Get currently set apiEndpoint address
* @returns string
*/
getApiEndpoint(): string;
/**
* Retrieve the metadata for all customer lists, including the customer's default lists
* @param token bearer token for list management permission
* @returns Promise<object>
*/
getListsMetadata(token: string): Promise<object>;
/**
* Create a custom list. The new list name must be different than any existing list name
* @param listObject listObject
* @param token bearer token for list management permission
* @returns Promise<object>
*/
createList(listObject: ListObject, token: string): Promise<object>;
/**
* Retrieve list metadata including the items in the list with requested status
* @param listId unique Id associated with the list
* @param itemStatus itemsStatus can be either "active" or "completed"
* @param token bearer token for list management permission
* @returns Promise<object>
*/
getList(listId: string, itemStatus: ListItemObjectStatus, token: string): Promise<object>;
/**
* Update a custom list. Only the list name or state can be updated
* @param listId unique Id associated with the list
* @param listObject listObject
* @param token bearer token for list management permission
* @returns Promise<object>
*/
updateList(listId: string, listObject: ListObject, token: string): Promise<object>;
/**
* Delete a custom list
* @param listId unique Id associated with the list
* @param token bearer token for list management permission
* @returns Promise<object>
*/
deleteList(listId: string, token: string): Promise<object>;
/**
* Create an item in an active list or in a default list
* @param listId unique Id associated with the list
* @param listItemObject listItemObject
* @param token bearer token for list management permission
* @returns Promise<object>
*/
createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise<object>;
/**
* Retrieve single item within any list by listId and itemId
* @param listId unique Id associated with the list
* @param itemId unique Id associated with the item
* @param token bearer token for list management permission
* @returns Promise<object>
*/
getListItem(listId: string, itemId: string, token: string): Promise<object>;
/**
* Update an item value or item status
* @param listId unique Id associated with the list
* @param itemId unique Id associated with the item
* @param listItemObject listItemObject
* @param token bearer token for list management permission
* @returns Promise<object>
*/
updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise<object>;
/**
* Delete an item in the specified list
* @param listId unique Id associated with the list
* @param itemId unique Id associated with the item
* @param token bearer token for list management permission
* @returns Promise<object>
*/
deleteListItem(listId: string, itemId: string, token: string): Promise<object>;
}
}
//#endregion
//#region ResponseBuilder
/**
* Responsible for building JSON responses as per the Alexa skills kit interface
* https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#response-body-syntax
*/
export class ResponseBuilder {
constructor(alexaHandler: Handler<Request>);
/**
* Have Alexa say the provided speechOutput to the user
* @param speechOutput speechOutput
* @returns ResponseBuilder
*/
speak(speechOutput: string): ResponseBuilder;
/**
* Have alexa listen for speech from the user. If the user doesn't respond within 8 seconds
* then have alexa reprompt with the provided reprompt speech
* @param repromptSpeech repromptSpeech
* @returns ResponseBuilder
*/
listen(repromptSpeech: string): ResponseBuilder;
/**
* Render a card with the following title, content and image
* @param cardTitle cardTitle
* @param cardContent cardContent
* @param cardImage cardImage
* @returns ResponseBuilder
*/
cardRenderer(cardTitle: string, cardContent: string, cardImage: CardImage): ResponseBuilder;
/**
* Render a link account card
* @returns ResponseBuilder
*/
linkAccountCard(): ResponseBuilder;
/**
* Render a askForPermissionsConsent card
* @param permissions permissions
* @returns ResponseBuilder
*/
askForPermissionsConsentCard(permissions: [{ [key: string]: string }]): ResponseBuilder;
/**
* Creates a play, stop or clearQueue audioPlayer directive depending on the directive type passed in.
* @deprecated - use audioPlayerPlay, audioPlayerStop, audioPlayerClearQueue instead
* @param directiveType directiveType
* @param behavior behavior
* @param url url
* @param token token
* @param expectedPreviousToken expectedPreviousToken
* @param offsetInMilliseconds offsetInMilliseconds
* @returns ResponseBuilder
*/
audioPlayer(directiveType: string, behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder;
/**
* Creates an AudioPlayer play directive
* @param behavior Describes playback behavior. Accepted values:
* REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams.
* ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream.
* REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream.
* @param url Identifies the location of audio content at a remote HTTPS location.
* The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the
* files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used.
* The supported formats for the audio file include AAC/MP4, MP3, HLS, PLS and M3U. Bitrates: 16kbps to 384 kbps.
* @param token A token that represents the audio stream. This token cannot exceed 1024 characters
* @param expectedPreviousToken A token that represents the expected previous stream.
* This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions
* if requests to progress through a playlist and change tracks occur at the same time.
* @param offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback.
* Set to 0 to start playing the stream from the beginning. Set to any other value to start playback from that associated point in the stream
* @returns ResponseBuilder
*/
audioPlayerPlay(behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder;
/**
* Creates an AudioPlayer Stop directive - Stops the current audio Playback
* @returns ResponseBuilder
*/
audioPlayerStop(): ResponseBuilder;
/**
* Creates an AudioPlayer ClearQueue directive - clear the queue without stopping the currently playing stream,
* or clear the queue and stop any currently playing stream.
* @param clearBehavior Describes the clear queue behavior. Accepted values:
* CLEAR_ENQUEUED: clears the queue and continues to play the currently playing stream
* CLEAR_ALL: clears the entire playback queue and stops the currently playing stream (if applicable).
* @returns ResponseBuilder
*/
audioPlayerClearQueue(clearBehavior: string): ResponseBuilder;
/**
* Creates a Display RenderTemplate Directive
* Use a template builder to generate a template object
* @param template template
* @returns ResponseBuilder
*/
renderTemplate(template: Template): ResponseBuilder;
/**
* Creates a hint directive - show a hint on the screen of the echo show
* @param hintText text to show on the hint
* @param hintType (optional) Default value : PlainText
* @returns ResponseBuilder
*/
hint(hintText: string, hintType?: HintType): ResponseBuilder;
/**
* Creates a VideoApp play directive to play a video
* @param source Identifies the location of video content at a remote HTTPS location.
* The video file must be hosted at an Internet-accessible HTTPS endpoint.
* @param metadata (optional) Contains an object that provides the
* information that can be displayed on VideoApp.
* @returns ResponseBuilder
*/
playVideo(source: string, metadata?: { title: string, subtitle: string }): ResponseBuilder;
}
//#endregion
//#region directives
export namespace directives {
class VoicePlayerSpeakDirective {
header: { requestId: string };
directive: { type: string, speech: string };
/**
* Creates an instance of VoicePlayerSpeakDirective.
* @param requestId - requestId from which the call is originated from
* @param speechContent - Contents of the speech directive either in plain text or SSML.
*/
constructor(requestId: string, speechContent: string);
}
}
//#endregion
//#region utils
export namespace utils {
namespace ImageUtils {
/**
* Creates an image object with a single source
* These images may be in either JPEG or PNG formats, with the appropriate file extensions.
* An image cannot be larger than 2 MB
* You must host the images at HTTPS URLs that are publicly accessible.
* widthPixels and heightPixels are optional - Do not include them unless they are exactly correct.
* By default, for Echo Show, size takes the value X_SMALL. If the other size values are included,
* then the order of precedence for displaying images begins with X_LARGE and proceeds downward,
* which means that larger images will be downscaled for display on Echo Show if provided.
* example : ImageUtils.makeImage("https://url/to/my/img.png", 300, 400, "SMALL", "image description")
* @param url url of the image
* @param widthPixels (optional) width of the image in pixels
* @param heightPixels (optional) height of the image in pixels
* @param size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE)
* @param description text used to describe the image in a screen reader
* @returns Image
*/
function makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: ImageSourceSize, description?: string): Image;
/**
* Creates an image object with a multiple sources, source images are provided as an array of image objects
* These images may be in either JPEG or PNG formats, with the appropriate file extensions.
* An image cannot be larger than 2 MB
* You must host the images at HTTPS URLs that are publicly accessible.
* widthPixels and heightPixels are optional - Do not include them unless they are exactly correct.
* By default, for Echo Show, size takes the value X_SMALL. If the other size values are included,
* then the order of precedence for displaying images begins with X_LARGE and proceeds downward,
* which means that larger images will be downscaled for display on Echo Show if provided.
* example :
* let imgArr = [
* { "https://url/to/my/small.png", 300, 400, "SMALL" },
* { "https://url/to/my/large.png", 900, 1200, "LARGE" },
* ]
* ImageUtils.makeImage(imgArr, "image description")
*
* @param imgArr Array of Image
* @param description text used to describe the image in a screen reader
* @returns Image
*/
function makeImages(imgArr: Array<{ url: string, widthPixels?: number, heightPixels?: number, size: ImageSourceSize }>, description: string): Image;
}
/**
* Utility methods for building TextField objects
*/
namespace TextUtils {
/**
* Creates a plain TextField object with contents : text
* @param text contents of plain text object
* @returns TextField
*/
function makePlainText(text: string): TextField;
/**
* Creates a rich TextField object with contents : text
* @param text text
* @returns TextField
*/
function makeRichText(text: string): TextField;
/**
* Creates a textContent
* @param primaryText primary Text
* @param secondaryText secondary Text
* @param tertiaryText tertiary Text
* @returns TextContent
*/
function makeTextContent(primaryText: { type: TextContentType, text: string },
secondaryText: { type: TextContentType, text: string }, tertiaryText: { type: TextContentType, text: string }): TextContent;
}
}
//#endregion
+1 -1
View File
@@ -20,4 +20,4 @@
"index.d.ts",
"alexa-sdk-tests.ts"
]
}
}
+10 -9
View File
@@ -1,10 +1,11 @@
{ "extends": "dtslint/dt.json",
"rules": {
"object-literal-shorthand": false,
"object-literal-key-quote": false,
"no-empty-interface": false,
"prefer-method-signature": false,
"object-literal-key-quotes": false,
"no-any": false
}
{
"extends": "dtslint/dt.json",
"rules": {
"object-literal-shorthand": false,
"object-literal-key-quote": false,
"no-empty-interface": false,
"prefer-method-signature": false,
"object-literal-key-quotes": false,
"no-any": false
}
}
+128 -119
View File
@@ -1,144 +1,153 @@
import * as algoliasearch from "algoliasearch";
import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, AlgoliaResponse,
AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch";
import * as algoliasearch from 'algoliasearch';
import {
ClientOptions,
SynonymOption,
AlgoliaApiKeyOptions,
SearchSynonymOptions,
AlgoliaResponse,
AlgoliaSecuredApiOptions,
AlgoliaIndexSettings,
AlgoliaQueryParameters,
AlgoliaIndex,
} from 'algoliasearch';
let _algoliaResponse: AlgoliaResponse = {
hits: [{}, {}],
page: 0,
nbHits: 12,
nbPages: 6,
hitsPerPage: 2,
processingTimeMS: 32,
query: "",
params: "",
hits: [{}, {}],
page: 0,
nbHits: 12,
nbPages: 6,
hitsPerPage: 2,
processingTimeMS: 32,
query: '',
params: '',
};
let _clientOptions: ClientOptions = {
timeout: 12,
protocol: "",
httpAgent: "",
timeout: 12,
protocol: '',
httpAgent: '',
};
let _synonymOption: SynonymOption = {
forwardToSlaves: false,
replaceExistingSynonyms: false,
forwardToReplicas: false,
replaceExistingSynonyms: false,
};
let _algoliaUserKeyOptions: AlgoliaUserKeyOptions = {
validity: 0,
maxQueriesPerIPPerHour: 0,
indexes: [""],
queryParameters: { attributesToRetrieve: ["algolia"] },
description: "",
let _algoliaApiKeyOptions: AlgoliaApiKeyOptions = {
validity: 0,
maxQueriesPerIPPerHour: 0,
indexes: [''],
queryParameters: { attributesToRetrieve: ['algolia'] },
description: '',
};
let _searchSynonymOptions: SearchSynonymOptions = {
query: "",
page: 0,
type: "",
hitsPerPage: 0,
query: '',
page: 0,
type: '',
hitsPerPage: 0,
};
let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
filters: "",
validUntil: 0,
restrictIndices: "",
userToken: "",
filters: '',
validUntil: 0,
restrictIndices: '',
userToken: '',
};
let _algoliaIndexSettings: AlgoliaIndexSettings = {
attributesToIndex: [""],
attributesForFaceting: [""],
unretrievableAttributes: [""],
attributesToRetrieve: [""],
ranking: [""],
customRanking: [""],
slaves: [""],
maxValuesPerFacet: "",
attributesToHighlight: [""],
attributesToSnippet: [""],
highlightPreTag: "",
highlightPostTag: "",
snippetEllipsisText: "",
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: "",
separatorsToIndex: "",
queryType: "",
removeWordsIfNoResults: "",
advancedSyntax: false,
optionalWords: [""],
removeStopWords: [""],
disablePrefixOnAttributes: [""],
disableExactOnAttributes: [""],
exactOnSingleWordQuery: "",
alternativesAsExact: false,
attributeForDistinct: "",
distinct: false,
numericAttributesToIndex: [""],
allowCompressionOfIntegerArray: false,
altCorrections: [{}],
minProximity: 0,
placeholders: "",
attributesToIndex: [''],
attributesForFaceting: [''],
unretrievableAttributes: [''],
attributesToRetrieve: [''],
ranking: [''],
customRanking: [''],
replicas: [''],
maxValuesPerFacet: '',
attributesToHighlight: [''],
attributesToSnippet: [''],
highlightPreTag: '',
highlightPostTag: '',
snippetEllipsisText: '',
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: '',
separatorsToIndex: '',
queryType: '',
removeWordsIfNoResults: '',
advancedSyntax: false,
optionalWords: [''],
removeStopWords: [''],
disablePrefixOnAttributes: [''],
disableExactOnAttributes: [''],
exactOnSingleWordQuery: '',
alternativesAsExact: false,
attributeForDistinct: '',
distinct: false,
numericAttributesToIndex: [''],
allowCompressionOfIntegerArray: false,
altCorrections: [{}],
minProximity: 0,
placeholders: '',
};
let _algoliaQueryParameters: AlgoliaQueryParameters = {
query: "",
filters: "",
attributesToRetrieve: [""],
restrictSearchableAttributes: [""],
facets: "",
maxValuesPerFacet: "",
attributesToHighlight: [""],
attributesToSnippet: [""],
highlightPreTag: "",
highlightPostTag: "",
snippetEllipsisText: "",
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
page: 0,
offset: 0,
length: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: "",
aroundLatLng: "",
aroundLatLngViaIP: "",
aroundRadius: "",
aroundPrecision: 0,
minimumAroundRadius: 0,
insideBoundingBox: "",
queryType: "",
insidePolygon: "",
removeWordsIfNoResults: "",
advancedSyntax: false,
optionalWords: [""],
removeStopWords: [""],
disableExactOnAttributes: [""],
exactOnSingleWordQuery: "",
alternativesAsExact: true,
distinct: 0,
getRankingInfo: false,
numericAttributesToIndex: [""],
numericFilters: [""],
tagFilters: "",
facetFilters: "",
analytics: false,
analyticsTags: [""],
synonyms: true,
replaceSynonymsInHighlight: false,
minProximity: 0,
query: '',
filters: '',
attributesToRetrieve: [''],
restrictSearchableAttributes: [''],
facets: '',
maxValuesPerFacet: '',
attributesToHighlight: [''],
attributesToSnippet: [''],
highlightPreTag: '',
highlightPostTag: '',
snippetEllipsisText: '',
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
page: 0,
offset: 0,
length: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: '',
aroundLatLng: '',
aroundLatLngViaIP: '',
aroundRadius: 0,
aroundPrecision: 0,
minimumAroundRadius: 0,
insideBoundingBox: [[0]],
queryType: '',
insidePolygon: [[0]],
removeWordsIfNoResults: '',
advancedSyntax: false,
optionalWords: [''],
removeStopWords: [''],
disableExactOnAttributes: [''],
exactOnSingleWordQuery: '',
alternativesAsExact: true,
distinct: 0,
getRankingInfo: false,
numericAttributesToIndex: [''],
numericFilters: [''],
tagFilters: '',
facetFilters: '',
analytics: false,
analyticsTags: [''],
synonyms: true,
replaceSynonymsInHighlight: false,
minProximity: 0,
};
let index: AlgoliaIndex = algoliasearch("", "").initIndex("");
let index: AlgoliaIndex = algoliasearch('', '').initIndex('');
let search = index.search({query: ""});
index.search({query: ""}, (err, res) => {});
let search = index.search({ query: '' });
index.search({ query: '' }, (err, res) => {});
+1909 -1500
View File
File diff suppressed because it is too large Load Diff
+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"]
}
+79
View File
@@ -0,0 +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
}
}
+79
View File
@@ -0,0 +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
}
}
@@ -3,7 +3,7 @@ declare var process: { env: any };
import amazon = require('amazon-product-api');
var client = amazon.createClient({
let client = amazon.createClient({
awsId: process.env.AWS_ACCESS_KEY_ID,
awsSecret: process.env.AWS_SECRET,
awsTag: process.env.AWS_ASSOCIATE_TAG
@@ -12,7 +12,7 @@ var client = amazon.createClient({
// Item Search
var searchQuery = {
let searchQuery = {
director: 'Quentin Tarantino',
actor: 'Samuel L. Jackson',
searchIndex: 'DVD',
@@ -37,11 +37,11 @@ client.itemSearch(searchQuery, (err, results) => {
// Item Lookup
var lookupQuery = {
let lookupQuery = {
itemId: 'B00008OE6I',
idType: 'ASIN',
responseGroup: 'OfferFull',
Condition: 'All'
condition: 'All'
};
client.itemLookup(lookupQuery).then((results) => {
@@ -58,9 +58,22 @@ client.itemLookup(lookupQuery, (err, results) => {
console.log(getResultCount(results) + " lookup results");
});
let lookupQueryWithItemIdArray = {
itemId: ['B00008OE6I', 'B00008OE6E'],
idType: 'ASIN',
responseGroup: 'OfferFull',
condition: 'All'
};
client.itemLookup(lookupQueryWithItemIdArray).then((results) => {
console.log(getResultCount(results) + " lookup results");
}).catch(function(err){
console.log(err);
});
// Browse Node Lookup
var nodeLookupQuery = {
let nodeLookupQuery = {
browseNodeId: '2625373011'
};
@@ -81,4 +94,4 @@ client.browseNodeLookup(nodeLookupQuery, (err, results) => {
function getResultCount(results: Object[]) {
return results != undefined ? results.length : 0;
}
}
+29 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for amazon-product-api
// Project: https://github.com/t3chnoboy/amazon-product-api
// Definitions by: Matti Lehtinen <https://github.com/MattiLehtinen>
// Definitions by: Matti Lehtinen <https://github.com/MattiLehtinen>, Alex Leon <https://github.com/alien35>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -15,10 +15,35 @@ interface IAmazonProductQueryCallback {
(err: string, results: Object[]): void;
}
interface IItemSearchOptions {
condition?: string;
keywords?: string;
responseGroup?: string;
searchIndex?: string;
itemPage?: number;
sort?: string;
}
interface IItemLookupOptions {
condition?: string;
idType?: string;
includeReviewsSummary?: boolean;
itemId?: string | string[];
responseGroup?: string;
searchIndex?: string;
truncateReviewsAt?: number;
variationPage?: string;
}
interface IBrowseNodeLookupOptions {
browseNodeId?: string;
responseGroup?: string;
}
interface IAmazonProductClient {
itemSearch(query: any, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
itemLookup(query: any, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
browseNodeLookup(query: any, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
itemSearch(query: IItemSearchOptions, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
itemLookup(query: IItemLookupOptions, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
browseNodeLookup(query: IBrowseNodeLookupOptions, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
}
export declare function createClient(credentials: ICredentials): IAmazonProductClient;
+79
View File
@@ -0,0 +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
}
}
+629
View File
@@ -0,0 +1,629 @@
import AmBalloon from "./AmBalloon";
import AmChart from "./AmChart";
import AmLegend from "./AmLegend";
import ExportSettings from "./ExportSettings";
import GaugeArrow from "./GaugeArrow";
import GaugeAxis from "./GaugeAxis";
import Label from "./Label";
import Title from "./Title";
/**
* AmAngularGauge Extension for AmChart to create gauge charts.
*/
export default class AmAngularGauge extends AmChart {
/**
* When enabled, chart adds aria-label attributes to columns, bullets or map objects.
* You can control values of these labels using properties like accessibleLabel of AmGraph.
* Note, not all screen readers support these tags.
* We tested this mostly with NVDA Screen reader.
* WAI-ARIA is now official W3 standard, so in future more readers will handle this well.
* We will be improving accessibility on our charts, so we would be glad to hear your feedback.
* @default true
*/
accessible: boolean;
/**
* Description which will be added to node of SVG element.
* Most of the screen readers will read this description.
*/
accessibleDescription: string;
/**
* Description which is added to of a SVG element. Some of the screen readers will read this description.
*/
accessibleTitle: string;
/**
* Specifies, if class names should be added to chart elements.
* @default false
*/
addClassNames: boolean;
/**
* Uses the whole space of the canvas to draw the gauge.
* @default true
*/
adjustSize: boolean;
/**
* Array of Labels. Example of label object, with all possible properties:
* {
* "x": 20,
* "y": 20,
* "text": "this is label",
* "align": "left",
* "size": 12,
* "color": "#CC0000",
* "alpha": 1,
* "rotation": 0,
* "bold": true,
* "url": "http://www.amcharts.com"
* }
* @default []
*/
allLabels: [Label];
/**
* Array of arrows.
*/
arrows: [GaugeArrow];
/**
* If you set it to true the chart will automatically monitor changes of display style of chart’s container
* (or any of it’s parents) and will render chart correctly if it is changed from none to block.
* We recommend setting it to true if you change this style at a run time, as it affects performance a bit.
* @default false
*/
autoDisplay: boolean;
/**
* Set this to false if you don't want chart to resize itself whenever its parent container size changes.
* @default true
*/
autoResize: boolean;
/**
* If you set it to true and your chart div (or any of the parent div) has css scale applied,
* the chart will position mouse at a correct position.
* Default value is false because this operation consumes some CPU and quite a
* few people are using css transfroms.
* @default false
*/
autoTransform: boolean;
/**
* Array of axes.
* @default [GaugeAxis]
*/
axes: [GaugeAxis];
/**
* Opacity of background. Set it to >0 value if you want backgroundColor to work.
* However we recommend changing div's background-color style for changing background color.
* @default 0
*/
backgroundAlpha: number;
/**
* Background color. You should set backgroundAlpha to >0 value in order background to be visible.
* We recommend setting background color directly on a chart's DIV instead of using this property.
* @default #FFFFFF
*/
backgroundColor: string;
/**
* The chart creates AmBalloon class itself.
* If you want to customize balloon, get balloon instance using this property,
* and then change balloon's properties.
* @default AmBalloon
*/
balloon: AmBalloon;
/**
* Opacity of chart's border. Value range is 0 - 1.
* @default 0
*/
borderAlpha: number;
/**
* Color of chart's border. You should set borderAlpha >0 in order border to be visible.
* We recommend setting border color directly on a chart's DIV instead of using this property.
* @default #000000
*/
borderColor: string;
/**
* This prefix is added to all class names which are added to all visual elements of a chart
* in case addClassNames is set to true.
* @default amcharts
*/
classNamePrefix: string;
/**
* In case you use gauge to create a clock, set this to true.
* @default false
*/
clockWiseOnly: boolean;
/**
* Text color.
* @default #000000
*/
color: string;
/**
* Non-commercial version only. Specifies position of link to amCharts site.
* Allowed values are: top-left, top-right, bottom-left and bottom-right.
* @default 'top - left'
*/
creditsPosition: string;
/**
* A config object for Data Loader plugin. Please refer to the following page for more information.
*/
dataLoader: object;
/**
* Array of data objects, for example:
* [
* {country:"US", value:524},
* {country:"UK", value:624},
* {country:"Lithuania", value:824}
* ]
* You can have any number of fields and use any field names.
* In case of AmMap, data provider should be MapData object.
* The data set data.
* Important: if you are using date/time-based category axis, the data points needs to come pre-ordered
* in ascending order. Data with incorrect order might result in visual and functional glitches on the chart.
*/
dataProvider: [object];
/**
* Decimal separator.
* @default "."
*/
decimalSeparator: string;
/**
* Using this property you can add any additional information to SVG, like SVG filters or clip paths.
* The structure of this object should be identical to XML structure of a object you are adding,
* only in JSON format.
*/
defs: object;
/**
* Export config. Specifies how export to image/data export/print/annotate menu will look and behave.
* You can find a lot of examples in amcharts/plugins/export folder. More details can be found here.
*/
export: ExportSettings;
/**
* Gauge face opacity.
* @default 0
*/
faceAlpha: number;
/**
* Gauge face border opacity.
* @default 0
*/
faceBorderAlpha: number;
/**
* Gauge face border color.
* @default #555555
*/
faceBorderColor: string;
/**
* Gauge face border width.
* @default 1
*/
faceBorderWidth: number;
/**
* Gauge face color, requires faceAlpha > 0
* @default #FAFAFA
*/
faceColor: string;
/**
* Gauge face image-pattern.
* Example: {"url":"../amcharts/patterns/black/pattern1.png", "width":4, "height":4}
* fontFamily String Verdana Font family.
* fontSize Number 11 Font size.
*/
facePattern: object;
/**
* Gauge's horizontal position in pixel, origin is the center. Centered by default.
*/
gaugeX: number;
/**
* Gauge's vertical position in pixel, origin is the center. Centered by default.
*/
gaugeY: number;
/**
* If you set this to true, the lines of the chart will be distorted and will produce hand-drawn effect.
* Try to adjust chart.handDrawScatter and chart.handDrawThickness properties for a more scattered result.
* @default false
*/
handDrawn: boolean;
/**
* Defines by how many pixels hand-drawn line (when handDrawn is set to true) will fluctuate.
* @default 2
*/
handDrawScatter: number;
/**
* Defines by how many pixels line thickness will fluctuate (when handDrawn is set to true).
* @default 1
*/
handDrawThickness: number;
/**
* Time, in milliseconds after which balloon is hidden if the user rolls-out of the object.
* Might be useful for AmMap to avoid balloon flickering while moving mouse over the areas.
* Note, this is not duration of fade-out. Duration of fade-out is set in AmBalloon class.
* @default 150
*/
hideBalloonTime: number;
/**
* Allows changing language easily.
* Note, you should include language js file from amcharts/lang or ammap/lang folder and then use
* variable name used in this file, like chart.language = "de"; Note, for maps this works differently -
* you use language only for country names, as there are no other strings in the maps application.
*/
language: string;
/**
* Legend of a chart.
*/
legend: AmLegend;
/**
* Read-only. Reference to the div of the legend.
*/
legendDiv: HTMLElement;
/**
* You can add listeners of events using this property.
* Example: listeners = [{"event":"dataUpdated", "method":handleEvent}];
* @default [Object]
*/
listeners: [object];
/**
* Bottom spacing between chart and container.
* @default 10
*/
marginBottom: number;
/**
* Left-hand spacing between chart and container.
* @default 10
*/
marginLeft: number;
/**
* Right-hand spacing between chart and container.
* @default 10
*/
marginRight: number;
/**
* Top spacing between chart and container.
* @default 10
*/
marginTop: number;
/**
* Minimum radius of a gauge.
* @default 10
*/
minRadius: number;
/**
* This setting affects touch-screen devices only.
* If a chart is on a page, and panEventsEnabled are set to true, the page won't move if
* the user touches the chart first. If a chart is big enough and occupies all the screen of your touch device,
* the user won’t be able to move the page at all.
* If you think that selecting/panning the chart or moving/pinching the map is a primary purpose of your users,
* you should set panEventsEnabled to true, otherwise - false.
* @default true
*/
panEventsEnabled: boolean;
/**
* Specifies absolute or relative path to amCharts files, i.e."amcharts/". (where all.js files are located)
* If relative URLs are used, they will be relative to the current web page, displaying the chart.
* You can also set path globally, using global JavaScript variable AmCharts_path.If this variable is set,
* and "path" is not set in chart config, the chart will assume the path from the global variable.
* This allows setting amCharts path globally.
* I.e.:
* let AmCharts_path = "/libs/amcharts/";
* "path" parameter will be used by the charts to locate it's files, like images, plugins or patterns.
* @default 'amcharts/'
*/
path: string;
/**
* Specifies path to the folder where images like resize grips, lens and similar are.
* IMPORTANT: Since V3.14.12, you should use "path" to point to amCharts directory instead.
* The "pathToImages" will be automatically set and does not need to be in the chart config,
* unless you keep your images separately from other amCharts files.
*/
pathToImages: string;
/**
* Precision of percent values. -1 means percent values won't be rounded at all and show as they are.
* @default 2
*/
percentPrecision: number;
/**
* Precision of values. -1 means values won't be rounded at all and show as they are.
* @default -1
*/
precision: number;
/**
* Prefixes which are used to make big numbers shorter: 2M instead of 2000000, etc.
* Prefixes are used on value axes and in the legend.
* To enable prefixes, set usePrefixes property to true.
* @default [
* {"number": 1e+3, "prefix": "k"},
* {"number": 1e+6, "prefix": "M"},
* {"number": 1e+9, "prefix": "G"},
* {"number": 1e+12, "prefix": "T"},
* {"number": 1e+15, "prefix": "P"},
* {"number": 1e+18, "prefix": "E"},
* {"number": 1e+21, "prefix": "Z"},
* {"number": 1e+24, "prefix": "Y"}
* ]
*/
prefixesOfBigNumbers: [{ number: number; prefix: string }];
/**
* Prefixes which are used to make small numbers shorter: 2μ instead of 0.000002, etc.
* Prefixes are used on value axes and in the legend.
* To enable prefixes, set usePrefixes property to true.
* @default [
* {"number": 1e-24, "prefix": "y"},
* {"number": 1e-21, "prefix": "z"},
* {"number": 1e-18, "prefix": "a"},
* {"number": 1e-15, "prefix": "f"},
* {"number": 1e-12, "prefix": "p"},
* {"number": 1e-9, "prefix": "n"},
* {"number": 1e-6, "prefix": "μ"},
* {"number": 1e-3, "prefix": "m"}
* ]
*/
prefixesOfSmallNumbers: [{ number: number; prefix: string }];
/**
* If processTimeout is > 0, 1000 data items will be parsed at a time,
* then the chart will make pause and continue parsing data until it finishes.
* @default 1000
*/
processCount: number;
/**
* If you set it to 1 millisecond or some bigger value, chart will be built in chunks instead of all at once.
* This is useful if you work with a lot of data and the initial build of the chart takes a lot of time,
* which freezes the whole web application by not allowing other processes to do their
* job while the chart is busy.
* @default 0
*/
processTimeout: number;
/**
* A config object for Responsive plugin. Please refer to the following page for more information.
*/
responsive: object;
/**
* Duration of arrow animation.
* @default 1
*/
startDuration: number;
/**
* Transition effect of the arrows, possible effects: easeOutSine, easeInSine, elastic, bounce.
* @default easeInSine
*/
startEffect: string;
/**
* Charts will use SVG icons (some are loaded from images folder and some are drawn inline)
* if browser supports SVG. his makes icons look good on retina displays on all resolutions.
* @default true
*/
svgIcons: boolean;
/**
* Charts which require gestures like swipe (charts with scrollbar/cursor) or pinch (maps) used to prevent
* regular page scrolling and could result page to stick to the same spot if the chart occupied whole screen.
* Now, in order these gestures to start working user has to touch the chart/maps once.
* Regular touch events like touching on the bar/slice/map area do not require the first tap and will
* show balloons and perform other tasks as usual.
* If you have a map or chart which occupies full screen and your page does not require scrolling,
* set tapToActivate to false – this will bring old behavior back.
* @default true
*/
tapToActivate: boolean;
/**
* Theme of a chart. Config files of themes can be found in amcharts/themes/ folder.
* More info about using themes.
* @default none
*/
theme: string;
/**
* Thousands separator.
* @default ,
*/
thousandsSeparator: string;
/**
* Array of Title objects.
* @default []
*/
titles: [Title];
/**
* If you set it to 200 (milliseconds) or so, the chart will fire clickGraphItem or clickSlice (AmSlicedChart)
* or clickMapObject only if user holds his/her finger for 0.2 seconds (200 ms) on the
* column/bullet/slice/map object.
* @default 0
*/
touchClickDuration: number;
/**
* Type of a chart. Required when creating chart using JSON.
* Possible types are: serial, pie, xy, radar, funnel, gauge, map, gantt, stock.
*/
type: string;
/**
* If true, prefixes will be used for big and small numbers.
* You can set arrays of prefixes via prefixesOfSmallNumbers and prefixesOfBigNumbers properties.
* @default false
*/
usePrefixes: boolean;
/**
* Read-only. Indicates current version of a script.
*/
version: string;
/**
* Adds arrow to the chart.
*/
addArrow(arrow: GaugeArrow): void;
/**
* Adds axis to angular gauge.
*/
addAxis(axis: GaugeAxis): void;
/**
* Adds a label on a chart. You can use it for labeling axes, adding chart title,
* etc. x and y coordinates can be set in number, percent, or a number with ! in front of it -
* coordinate will be calculated from right or bottom instead of left or top.
*/
addLabel(
x: number,
y: number,
text: string,
align: string,
size: number,
color: string,
rotation: number,
alpha: number,
bold: boolean,
url: string,
): void;
/**
* Adds a legend to the chart. By default, you don't need to create div for your legend,
* however if you want it to be positioned in some different way,
* you can create div anywhere you want and pass id or reference to your div as a second parameter.
* NOTE: This method will not work on StockPanel.
*/
addLegend(legend: AmLegend, legendDivId?: string): void;
/**
* Adds a legend to the chart.
* By default, you don't need to create div for your legend,
* however if you want it to be positioned in some different way,
* you can create div anywhere you want and pass id or reference to your div as a second parameter.
* NOTE: This method will not work on StockPanel.
* @param legend - The legend.
* @param legendDiv - Legend div (optional).
*/
addLegend(legend: AmLegend, legendDiv: HTMLElement): void;
/**
* Adds event listener to the object.
*/
addListener(
type: string,
handler: (
e: {
type: string;
chart: AmChart;
},
) => void,
): void;
/**
* Adds title to the top of the chart. Pie, Radar positions are updated so that they won't overlap.
* Plot area of Serial/XY chart is also updated unless autoMargins property is set to false.
* You can add any number of titles - each of them will be placed in a new line.
* To remove titles, simply clear titles array: chart.titles = []; and call chart.validateNow() method.
*/
addTitle(text: string, size: number, color: string, alpha: number, bold: boolean): void;
/**
* Clears the chart area, intervals, etc.
*/
clear(): void;
/**
* Removes all labels added to the chart.
*/
clearLabels(): void;
/**
* Use this method to force the chart to resize to it's current container size.
*/
invalidateSize(): void;
/**
* This method allows to create charts with a single config.
*/
makeChart(container: string, config: any, delay: number): AmChart;
/**
* Removes arrow from the chart.
*/
removeArrow(arrow: GaugeArrow): void;
/**
* Removes axis from the chart.
*/
removeAxis(axis: GaugeAxis): void;
/**
* Removes chart's legend.
*/
removeLegend(): void;
/**
* Removes event listener from chart object.
*/
removeListener(chart: AmChart, type: string, handler: any): void;
/**
* This method should be called after data in your data provider changed or a new array was set to dataProvider.
* After calling this method the chart will parse data and redraw.
*/
validateData(): void;
/**
* This method should be called after you changed one or more properties of any class.
* The chart will redraw after this method is called.
* Both attributes, validateData and skipEvents are optional (false by default).
*/
validateNow(): void;
/**
* Adds chart to the specified DIV.
*/
write(container: string | HTMLDivElement): void;
}
+107
View File
@@ -0,0 +1,107 @@
/**
* AmBalloon is the class which generates balloons (datatips).
* Balloon follows the mouse when you roll-over the pie slice/line bullet/column/etc, chart indicator of
* serial charts displays value balloons and category balloon.
* Balloon instance is created by the chart automatically and can be accessed via "balloon" property of AmChart.
* Chart shows/hides and sets position for every balloon automatically,
* so all you need to do is to change balloon appearance, if you want to.
* @example
* let chart = new AmCharts.AmSerialChart();
* // get balloon intance
* let balloon = chart.balloon;
* // set properties
* balloon.adjustBorderColor = true;
* balloon.color = "#000000";
* balloon.cornerRadius = 5;
* balloon.fillColor = "#FFFFFF";
*/
export default class AmBalloon {
/**
* If this is set to true, border color instead of background color will be changed
* when user rolls-over the slice, graph, etc.
*/
adjustBorderColor: boolean;
/**
* Balloon border opacity. Value range is 0 - 1.
* @default 1
*/
borderAlpha: number;
/**
* Balloon border color. #FFFFFF
*/
borderColor: string;
/**
* Balloon border thickness.
* @default 2
*/
borderThickness: number;
/**
* Color of text in the balloon. #FFFFFF
*/
color: string;
/**
* Balloon corner radius.
* @default 6
*/
cornerRadius: number;
/**
* Balloon background opacity.
* @default 1
*/
fillAlpha: number;
/**
* Balloon background color. Usually balloon background color is set by the chart.
* Only if "adjustBorderColor" is "true" this color will be used.
* @default "#CC0000"
*/
fillColor: string;
/**
* Size of text in the balloon. Chart's fontSize is used by default.
*/
fontSize: string;
/**
* Horizontal padding of the balloon.
* @default 8
*/
horizontalPadding: number;
/**
* The width of the pointer (arrow) "root". Only used if cornerRadius is 0.
* @default 10
*/
pointerWidth: number;
/**
* If cornerRadius of a balloon is >0, showBullet is set to true for value balloons when ChartCursor is used.
* If you don't want the bullet near the balloon, set it to false: chart.balloon.showBullet = false
*/
showBullet: boolean;
/**
* Text alignment, possible values "left", "middle" and "right" middle
*/
textAlign: string;
/**
* Color of the text shadow. #000000
*/
textShadowColor: string;
/**
* Vertical padding of the balloon.
* @default 5
*/
verticalPadding: number;
/**
* Hides balloon.
*/
hide(): void;
/**
* Defines a square within which the balloon should appear.
* Bounds are set by chart class, you don't need to call this method yourself.
*/
setBounds(left: number, top: number, right: number, bottom: number): void;
/**
* Sets coordinates the balloon should point to.
*/
setPosition(x: number, y: number): void;
/**
* Specifies the text which should be displayed.
*/
show(value: string): void;
}
+358
View File
@@ -0,0 +1,358 @@
import AmBalloon from "./AmBalloon";
import AmLegend from "./AmLegend";
import ExportSettings from "./ExportSettings";
import Label from "./Label";
import Title from "./Title";
/**
* AmChart is a base class of all charts. It can not be instantiated explicitly.
* AmCoordinateChart, AmPieChart and AmMap extend AmChart class.
*/
export default class AmChart {
/**
* used when constructing a chart with a theme
*/
constructor(theme?: any);
/**
* Specifies, if class names should be added to chart elements.
*/
addClassNames: boolean;
/**
* Array of Labels. Example of label object, with all possible properties:
* {
* "x": 20,
* "y": 20,
* "text": "this is label",
* "align": "left",
* "size": 12,
* "color": "#CC0000",
* "alpha": 1,
* "rotation": 0,
* "bold": true,
* "url": "http://www.amcharts.com"
* }
*/
allLabels: Label[];
/**
* Set this to false if you don't want chart to resize itself whenever its parent container size changes.
*/
autoResize: boolean;
/**
* Opacity of background. Set it to >0 value if you want backgroundColor to work.
* However we recommend changing div's background-color style for changing background color.
*/
backgroundAlpha: number;
/**
* Background color. You should set backgroundAlpha to >0 value in order background to be visible.
* We recommend setting background color directly on a chart's DIV instead of using this property.
* @default "#FFFFFF"
*/
backgroundColor: string;
/**
* The chart creates AmBalloon class itself.
* If you want to customize balloon, get balloon instance using this property,
* and then change balloon's properties.
*/
balloon: AmBalloon;
/**
* Opacity of chart's border. Value range is 0 - 1.
*/
borderAlpha: number;
/**
* Color of chart's border. You should set borderAlpha >0 in order border to be visible.
* We recommend setting border color directly on a chart's DIV instead of using this property.
* @default #000000
*/
borderColor: string;
/**
* This prefix is added to all class names which are added to all visual elements of a chart
* in case addClassNames is set to true.
*/
classNamePrefix: string;
/**
* Text color. #000000
*/
color: string;
/**
* Non-commercial version only. Specifies position of link to amCharts site.
* Allowed values are: top-left, top-right, bottom-left and bottom-right.
* @default 'top-left'
*/
creditsPosition: string;
/**
* Array of data objects, for example:
* [{country:"US", value:524}, {country:"UK", value:624}, {country:"Lithuania", value:824}].
* You can have any number of fields and use any field names.
* In case of AmMap, data provider should be MapData object.
*/
dataProvider: any[];
/**
* Decimal separator.
* @default "."
*/
decimalSeparator: string;
/**
* Using this property you can add any additional information to SVG, like SVG filters or clip paths.
* The structure of this object should be identical to XML structure of a object you are adding,
* only in JSON format.
*/
defs: any;
/**
* Export config. Specifies how export to image/data export/print/annotate menu will look and behave.
* You can find a lot of examples in amcharts/plugins/export folder.
*/
export: ExportSettings;
/**
* Font family. Verdana
*/
fontFamily: string;
/**
* Font size.
* @default 11
*/
fontSize: string;
/**
* If you set this to true, the lines of the chart will be distorted and will produce hand-drawn effect.
* Try to adjust chart.handDrawScatter and chart.handDrawThickness properties for a more scattered result.
* @default false
*/
handDrawn: boolean;
/**
* Defines by how many pixels hand-drawn line (when handDrawn is set to true) will fluctuate.
* @default 2
*/
handDrawScatter: number;
/**
* Defines by how many pixels line thickness will fluctuate (when handDrawn is set to true).
* @default 1
*/
handDrawThickness: number;
/**
* Time, in milliseconds after which balloon is hidden if the user rolls-out of the object.
* Might be useful for AmMap to avoid balloon flickering while moving mouse over the areas.
* Note, this is not duration of fade-out. Duration of fade-out is set in AmBalloon class.
* @default 150
*/
hideBalloonTime: number;
/**
* Legend of a chart.
*/
legend: AmLegend;
/**
* Reference to the div of the legend.
*/
legendDiv: HTMLElement;
/**
* You can add listeners of events using this property. Example:
* listeners = [{"event":"dataUpdated", "method":handleEvent}];
*/
listerns: object[];
/**
* This setting affects touch-screen devices only.
* If a chart is on a page, and panEventsEnabled are set to true, the page won't move
* if the user touches the chart first.
* If a chart is big enough and occupies all the screen of your touch device,
* the user won’t be able to move the page at all. That's why the default value is "false".
* If you think that selecting/panning the chart or moving/pinching the map is a primary purpose of your users,
* you should set panEventsEnabled to true.
*/
panEventsEnabled: boolean;
/**
* Specifies absolute or relative path to amCharts files, i.e. "amcharts/". (where all .js files are located)
* If relative URLs are used, they will be relative to the current web page, displaying the chart.
* You can also set path globally, using global JavaScript variable AmCharts_path.
* If this variable is set, and "path" is not set in chart config, the chart will assume the path from the
* global variable. This allows setting amCharts path globally. I.e.:
* let AmCharts_path = "/libs/amcharts/";
* "path" parameter will be used by the charts to locate it's files, like images, plugins or patterns.
*/
path: string;
/**
* Specifies path to the folder where images like resize grips, lens and similar are.
* IMPORTANT: Since V3.14.12, you should use "path" to point to amCharts directory instead.
* The "pathToImages" will be automatically set and does not need to be in the chart config,
* unless you keep your images separately from other amCharts files.
*/
pathToImages: string;
/**
* Precision of percent values. -1 means percent values won't be rounded at all and show as they are.
* @default 2
*/
percentPrecision: number;
/**
* Precision of values. -1 means values won't be rounded at all and show as they are.
* @default 1
*/
precision: number;
/**
* Prefixes which are used to make big numbers shorter: 2M instead of 2000000, etc.
* Prefixes are used on value axes and in the legend.
* To enable prefixes, set usePrefixes property to true.
* [
* {number:1e+3,prefix:"k"},
* {number:1e+6,prefix:"M"},
* {number:1e+9,prefix:"G"},
* {number:1e+12,prefix:"T"},
* {number:1e+15,prefix:"P"},
* {number:1e+18,prefix:"E"},
* {number:1e+21,prefix:"Z"},
* {number:1e+24,prefix:"Y"}
* ]
*/
prefixesOfBigNumbers: any[];
/**
* Prefixes which are used to make small numbers shorter: 2μ instead of 0.000002, etc.
* Prefixes are used on value axes and in the legend.
* To enable prefixes, set usePrefixes property to true.
* [
* {number:1e-24, prefix:"y"},
* {number:1e-21, prefix:"z"},
* {number:1e-18, prefix:"a"},
* {number:1e-15, prefix:"f"},
* {number:1e-12, prefix:"p"},
* {number:1e-9, prefix:"n"},
* {number:1e-6, prefix:"μ"},
* {number:1e-3, prefix:"m"}
* ]
*/
prefixesOfSmallNumbers: any[];
/**
* Theme of a chart. Config files of themes can be found in amcharts/themes/ folder.
* More info about using themes.
*/
theme: string;
/**
* Thousands separator.
* @default "."
*/
thousandsSeparator: string;
/**
* Array of Title objects.
*/
titles: Title[];
/**
* Type of a chart. Required when creating chart using JSON.
* Possible types are: serial, pie, xy, radar, funnel, gauge, map, stock.
*/
type: string;
/**
* If true, prefixes will be used for big and small numbers.
* You can set arrays of prefixes via prefixesOfSmallNumbers and prefixesOfBigNumbers properties.
*/
usePrefixes: boolean;
/**
* Read-only. Indicates current version of a script.
*/
version: string;
/**
* Adds a label on a chart.
* You can use it for labeling axes, adding chart title, etc. x and y coordinates can be set in
* number, percent, or a number with ! in front of it -
* coordinate will be calculated from right or bottom instead of left or top.
* x - horizontal coordinate
* y - vertical coordinate
* text - label's text
* align - alignment (left/right/center)
* size - text size
* color - text color
* rotation - angle of rotation
* alpha - label alpha
* bold - specifies if text is bold (true/false),
* url - url
*/
addLabel(
x: number | string,
y: number | string,
text: string,
align: string,
size?: number,
color?: string,
rotation?: number,
alpha?: number,
bold?: boolean,
url?: string,
): any;
/**
* Adds a legend to the chart.
* By default, you don't need to create div for your legend,
* however if you want it to be positioned in some different way,
* you can create div anywhere you want and pass id or reference to your div as a second parameter.
* (NOTE: This method will not work on StockPanel.)
* @param legend - The legend.
* @param legendDivId - Id of the legend div (optional).
*/
addLegend(legend: AmLegend, legendDivId?: string): void;
/**
* Adds a legend to the chart.
* By default, you don't need to create div for your legend,
* however if you want it to be positioned in some different way,
* you can create div anywhere you want and pass id or reference to your div as a second parameter.
* (NOTE: This method will not work on StockPanel.)
* @param legend - The legend.
* @param legendDiv - Legend div (optional).
*/
addLegend(legend: AmLegend, legendDiv: HTMLElement): void;
/**
* Adds title to the top of the chart. Pie, Radar positions are updated so that they won't overlap.
* Plot area of Serial/XY chart is also updated unless autoMargins property is set to false.
* You can add any number of titles - each of them will be placed in a new line.
* To remove titles, simply clear titles array: chart.titles = []; and call chart.validateNow() method.
* text - text of a title size - font size color - title color alpha - title opacity bold -
* boolean value indicating if title should be bold.
*/
addTitle(text: string, size: number, color: string, alpha: number, bold: boolean): void;
/**
* Clears the chart area, intervals, etc.
*/
clear(): void;
/**
* Removes all labels added to the chart.
*/
clearLabels(): void;
/**
* Use this method to force the chart to resize to it's current container size.
*/
invalidateSize(): void;
/**
* Removes chart's legend.
*/
removeLegend(): void;
/**
* This method should be called after data in your data provider changed or a new array was set to dataProvider.
* After calling this method the chart will parse data and redraw.
*/
validateData(): void;
/**
* This method should be called after you changed one or more properties of any class.
* The chart will redraw after this method is called.
*/
validateNow(): void;
/**
* Adds chart to the specified DIV.
*/
write(container: string | HTMLDivElement): void;
/**
* Adds event listener of the type "dataUpdated" or "init" to the object.
* @param type "dataUpdated" or "init".
* @param handler
* If the type is "dataUpdated".
* Dispatched when chart is build for the first time or after validateData() method was called.
* If the type is "init". Dispatched when chart is build for the first time.
*/
addListener(
type: string,
handler: (
e: {
type: string; // Either "dataUpdated" or "init".
chart: AmChart;
},
) => void,
): void;
/**
* Removes event listener from chart object.
*/
removeListener(chart: AmChart, type: string, handler: any): void;
}
+151
View File
@@ -0,0 +1,151 @@
import AmChart from "./AmChart";
import AmGraph from "./AmGraph";
import GraphDataItem from "./GraphDataItem";
import Guide from "./Guide";
import ValueAxis from "./ValueAxis";
/**
* AmCoordinateChart is a base class of AmRectangularChart. It can not be instantiated explicitly.
*/
export default class AmCoordinateChart extends AmChart {
/**
* Array, holding processed chart's data.
*/
chartData: object[];
/**
* Specifies the colors of the graphs if the lineColor of a graph is not set.
* It there are more graphs then colors in this array, the chart picks random color.
* @default ['#FF6600','#FCD202','#B0DE09','#0D8ECF','#2A0CD0','#CD0D74','#CC0000','#00CC00',
* '#0000CC','#DDDDDD','#999999','#333333','#990000']
*/
colors: string[];
/**
* The array of graphs belonging to this chart.
* To add/remove graph use addGraph/removeGraph methods instead of adding/removing graphs directly to array.
*/
graphs: AmGraph[];
/**
* Specifies if grid should be drawn above the graphs or below. Will not work properly with 3D charts.
* @default false
*/
gridAboveGraphs: boolean;
/**
* Instead of adding guides to the axes, you can push all of them to this array.
* In case guide has category or date defined, it will automatically will be assigned to the category axis.
* Otherwise to first value axis, unless you specify a different valueAxis for the guide.
*/
guides: Guide[];
/**
* Specifies whether the animation should be sequenced or all objects should appear at once.
* @default true
*/
sequencedAnimation: boolean;
/**
* The initial opacity of the column/line.
* If you set startDuration to a value higher than 0, the columns/lines will fade in from startAlpha.
* Value range is 0 - 1.
* @default 1
*/
startAlpha: number;
/**
* Duration of the animation, in seconds.
*/
startDuration: number;
/**
* Animation effect.
* Possible values are ">", "<", elastic" and "bounce".
* @default "elastic"
*/
startEffect: string;
/**
* Target of url.
* @default this
*/
urlTarget: any;
/**
* The array of value axes.
* To add/remove value axis use addValueAxis/removeValueAxis methods instead of
* adding/removing axes directly to array.
* Chart creates one value axis automatically, so if you need only one value axis, you don't need to create it.
*/
valueAxes: any[];
/**
* Adds a graph to the chart.
*/
addGraph(graph: AmGraph): void;
/**
* Adds value axis to the chart.
* One value axis is created automatically, so if you don't want to change anything or add more value axes,
* you don't need to add it.
*/
addValueAxis(axis: ValueAxis): void;
/**
* You can trigger the animation of the chart.
*/
animateAgain(): void;
/**
* AmGraph Returns graph by id.
*/
getGraphById(graphId: string): AmGraph;
/**
* Returns value axis by id.
*/
getValueAxisById(axisId: string): ValueAxis;
/**
* Hide the graph (if it is visible).
* Usually this method is called from the Legend, when you click on the legend marker.
*/
hideGraph(graph: AmGraph): void;
/**
* Hide value balloon of a graph.
* Usually this method is called from the Legend, when you click on the legend text.
*/
hideGraphsBalloon(graph: AmGraph): void;
/**
* Highlight the graph. Usually this method is called from the Legend, when you roll-over the legend entry.
*/
highlightGraph(graph: AmGraph): void;
/**
* Removes graph from the chart.
*/
removeGraph(graph: AmGraph): void;
/**
* Removes value axis from the chart.
* When you remove value axis, all graphs assigned to this axis are also removed.
*/
removeValueAxis(axis: ValueAxis): void;
/**
* Show the graph (if it is hidden).
* Usually this method is called from the Legend, when you click on the legend marker.
*/
showGraph(graph: AmGraph): void;
/**
* Show value balloon of a graph.
* Usually this method is called from the Legend, when you click on the legend text.
*/
showGraphsBalloon(graph: AmGraph): void;
/**
* UnhighlightGraph the graph.
* Usually this method is called from the Legend, when you roll-out the legend entry.
*/
unhighlightGraph(graph: AmGraph): void;
/**
* Adds event listener of the type "clickGraphItem" or "doubleClickGraphItem" or
* "rightClickGraphItem" or "rollOutGraphItem" or "rollOverGraphItem" to the object.
* @param type Either "clickGraphItem" or "doubleClickGraphItem" or "rightClickGraphItem"
* or "rollOutGraphItem" or "rollOverGraphItem".
* @param handler Dispatched when user clicks on the data item (column/bullet)
*/
addListener(
type: string,
handler: (
e: {
type: string;
graph: AmGraph;
item: GraphDataItem;
index: number;
chart: AmChart;
},
) => void,
): void;
}
+652
View File
@@ -0,0 +1,652 @@
import AmBalloon from "./AmBalloon";
import GraphDataItem from "./GraphDataItem";
import ValueAxis from "./ValueAxis";
/**
* AmGraph class displays all types of graphs - line, column, step line, smoothed line, ohlc and candlestick.
* @example
* let chart = new AmCharts.AmSerialChart();
* let graph = new AmCharts.AmGraph();
* graph.valueField = 'value';
* graph.type = 'column';
* graph.fillAlphas = 1;
* chart.addGraph(graph);
*/
export default 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 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]]
* 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
* @default false
*/
behindColumns: boolean;
/**
* 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 0
*/
bulletBorderAlpha: number;
/**
* Bullet border color. Will use lineColor if not set.
*/
bulletBorderColor: string;
/**
* Bullet border thickness.
* @default 2
*/
bulletBorderThickness: number;
/**
* Bullet color. Will use lineColor if not set.
*/
bulletColor: string;
/**
* Name of the bullet field in your dataProvider.
*/
bulletField: string;
/**
* 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
*/
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;
/**
* 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.
* @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
*/
cursorBulletAlpha: number;
/**
* Path to the image of custom bullet.
*/
customBullet: string;
/**
* Name of the custom bullet field in your dataProvider.
*/
customBulletField: string;
/**
* 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;
/**
* 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. 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;
/**
* 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: 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.
* @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.
* @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;
/**
* 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;
/**
* 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.colors array will be used for each subsequent graph.
*/
lineColor: string;
/**
* 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
*/
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, 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).
* @default 4
*/
minBulletSize: number;
/**
* 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: 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;
/**
* 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;
/**
* 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;
/**
* 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".
* "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;
/**
* 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;
/**
* 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.
* @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;
/**
* Specifies whether this graph should be shown in the Legend.
* @default true
*/
visibleInLegend: boolean;
/**
* 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.
* @default ValueAxis
*/
yAxis: ValueAxis;
/**
* XY chart only. Name of the y field in your dataProvider.
*/
yField: string;
}
+247
View File
@@ -0,0 +1,247 @@
import AmChart from "./AmChart";
/**
* AmLegend is the class that displays legend of the chart.
* Legend to the chart should be added using chart.addLegend(legend) method.
* @example
* let chart = new AmCharts.AmSerialChart();
* let legend = new AmCharts.AmLegend();
* chart.addLegend(legend);
*/
export default class AmLegend {
/**
* Alignment of legend entries. Possible values are: "left", "center", "right". left
*/
align: string;
/**
* Used if chart is Serial or XY.
* In case true, margins of the legend are adjusted and made equal to chart's margins.
* @default true
*/
autoMargins: boolean;
/**
* Opacity of legend's background. Value range is 0 - 1
*/
backgroundAlpha: number;
/**
* Background color. You should set backgroundAlpha to >0 vallue in order background to be visible.
* @default "#FFFFFF"
*/
backgroundColor: string;
/**
* Opacity of chart's border. Value range is 0 - 1.
*/
borderAlpha: number;
/**
* Color of legend's border. You should set borderAlpha >0 in order border to be visible.
* @default "#000000"
*/
borderColor: string;
/**
* In case legend position is set to "absolute", you can set distance from bottom of the chart, in pixels.
*/
bottom: number;
/**
* Text color. Will use chart's color if not set.
*/
color: string;
/**
* This can be used by AmMap only.
* You can pass array of objects with title, color, markerType values, for example:
* [{title: "One", color: "#3366CC"},{title: "Two", color: "#FFCC33"}]
*/
data: any[];
/**
* Specifies if each of legend entry should be equal to the most wide entry.
* Won't look good if legend has more than one line.
* @default true
*/
equalWidths: boolean;
/**
* Font size. Will use chart's font size if not set.
*/
fontSize: string;
/**
* Horizontal space between legend item and left/right border.
*/
horizontalGap: number;
/**
* The text which will be displayed in the legend.
* Tag [[title]] will be replaced with the title of the graph. [[title]]
*/
labelText: string;
/**
* In case legend position is set to "absolute", you can set distance from left side of the chart, in pixels.
*/
left: number;
/**
* Bottom margin.
*/
marginBottom: number;
/**
* Left margin.
* This property will be ignored if chart is Serial or XY
* and autoMargins property of the legend is true (default).
* @default 20
*/
marginLeft: number;
/**
* Right margin.
* This property will be ignored if chart is Serial or XY
* and autoMargins property of the legend is true (default).
* @default 20
*/
marginRight: number;
/**
* Top margin.
*/
marginTop: number;
/**
* Marker border opacity 1.
*/
markerBorderAlpha: number;
/**
* Marker border color. If not set, will use the same color as marker.
*/
markerBorderColor: string;
/**
* Thickness of the legend border.
* The default value (0) means the line will be a "hairline" (1 px).
* In case marker type is line, this style will be used for line thickness.
* @default 1
*/
markerBorderThickness: number;
/**
* The color of the disabled marker (when the graph is hidden). #AAB3B3
*/
markerDisabledColor: string;
/**
* Space between legend marker and legend text, in pixels.
* @default 5
*/
markerLabelGap: number;
/**
* Size of the legend marker (key).
* @default 16
*/
markerSize: number;
/**
* Shape of the legend marker (key).
* Possible values are:
* "square", "circle", "line", "dashedLine", "triangleUp", "triangleDown", "bubble", "none". square
*/
markerType: string;
/**
* Maximum number of columns in the legend.
* If Legend's position is set to "right" or "left", maxColumns is automatically set to 1.
*/
maxColumns: number;
/**
* Position of a legend. Possible values are: "bottom", "top", "left", "right" and "absolute".
* In case "absolute", you should set left and top properties too. (this setting is ignored in Stock charts).
* In case legend is used with AmMap, position is set to "absolute" automatically. bottom
*/
position: string;
/**
* Specifies whether legend entries should be placed in reversed order.
*/
reversedOrder: boolean;
/**
* In case legend position is set to "absolute", you can set distance from right side of the chart, in pixels.
*/
right: number;
/**
* Legend item text color on roll-over. #CC0000
*/
rollOverColor: string;
/**
* When you roll-over the legend entry, all other graphs can reduce their opacity,
* so that the graph you rolled-over would be distinguished. This style specifies the opacity of the graphs.
* @default 1
*/
rollOverGraphAlpha: number;
/**
* You can use this property to turn all the legend entries off.
* @default true
*/
showEntries: boolean;
/**
* Horizontal space between legend items, in pixels.
* @default 10
*/
spacing: number;
/**
* Whether showing/hiding of graphs by clicking on the legend marker is enabled or not.
* In case legend is used with AmMap, this is set to false automatically.
* @default true
*/
switchable: boolean;
/**
* Legend switch color. #FFFFFF
*/
switchColor: string;
/**
* Legend switch type (in case the legend is switchable). Possible values are "x" and "v". x
*/
switchType: string;
/**
* If true, clicking on the text will show/hide balloon of the graph.
* Otherwise it will show/hide graph/slice, if switchable is set to true.
*/
textClickEnabled: boolean;
/**
* In case legend position is set to "absolute", you can set distance from top of the chart, in pixels.
*/
top: number;
/**
* Legend markers can mirror graph’s settings, displaying a line and a real bullet as in the graph itself.
* Set this property to true if you want to enable this feature.
* Note, if you set graph colors in dataProvider, they will not be reflected in the marker.
* @default false
*/
useGraphSettings: boolean;
/**
* Specifies if legend labels should be use same color as corresponding markers.
*/
useMarkerColorForLabels: boolean;
/**
* Alignment of the value text. Possible values are "left" and "right". right
*/
valueAlign: string;
/**
* The text which will be displayed in the value portion of the legend.
* You can use tags like
* [[value]], [[open]], [[high]], [[low]], [[close]], [[percents]], [[description]]. [[value]]
*/
valueText: string;
/**
* Width of the value text.
* @default 80
*/
valueWidth: number;
/**
* Vertical space between legend items also between legend border and first and last legend row.
* @default: 10
*/
verticalGap: number;
/**
* Adds event listener of the type "clickLabel" or "clickMarker" or "hideItem" to the object.
* @param type Either "clickLabel" or "clickMarker" or "hideItem".
* @param handler The event handler.
*/
addListener(
type: string,
handler: (
e: {
type: string;
dataItem: object;
chart: AmChart;
},
) => void,
): void;
/**
* Removes event listener from chart object.
*/
removeListener(chart: AmChart, type: string, handler: any): void;
}
+314
View File
@@ -0,0 +1,314 @@
import AmChart from "./AmChart";
import Slice from "./Slice";
/**
* AmPieChart class creates pie/donut chart.
* In order to display pie chart you need to set at least these three properties
* dataProvider, titleField and valueField.
* @example
* let chartData = [{title:"Pie I have eaten",value:70},{title:"Pie I haven\'t eaten",value:30}];
* let chart = new AmCharts.AmPieChart();
* chart.valueField = "value";
* chart.titleField = "title";
* chart.dataProvider = chartData;
* chart.write("chartdiv");
*/
export default class AmPieChart extends AmChart {
/**
* Name of the field in chart's dataProvider which holds slice's alpha.
*/
alphaField: string;
/**
* Pie lean angle (for 3D effect). Valid range is 0 - 90.
*/
angle: number;
/**
* Balloon text. The following tags can be used:
* [[value]], [[title]], [[percents]], [[description]]. [[title]]: [[percents]]% ([[value]])\n[[description]]
*/
balloonText: string;
/**
* Read-only. Array of Slice objects.
*/
chartData: any[];
/**
* Name of the field in chart's dataProvider which holds slice's color.
*/
colorField: string;
/**
* Specifies the colors of the slices, if the slice color is not set.
* If there are more slices than colors in this array, the chart picks random color.
* [
* "#FF0F00", "#FF6600", "#FF9E01", "#FCD202", "#F8FF01", "#B0DE09", "#04D215", "#0D8ECF",
* "#0D52D1", "#2A0CD0", "#8A0CCF", "#CD0D74", "#754DEB", "#DDDDDD", "#999999", "#333333",
* "#000000", "#57032A", "#CA9726", "#990000", "#4B0C25"
* ]
*/
colors: any[];
/**
* Depth of the pie (for 3D effect).
*/
depth3D: number;
/**
* Name of the field in chart's dataProvider which holds a string with description.
*/
descriptionField: string;
/**
* Example: [-0.2,0.2]. Will make slices to be filled with color gradients.
*/
gradientRatio: number[];
/**
* Opacity of the group slice. Value range is 0 - 1.
* @default 1
*/
groupedAlpha: number;
/**
* Color of the group slice. The default value is not set -
* this means the next available color from "colors" array will be used.
*/
groupedColor: string;
/**
* Description of the group slice.
*/
groupedDescription: string;
/**
* If this is set to true, the group slice will be pulled out when the chart loads.
*/
groupedPulled: boolean;
/**
* Title of the group slice. Other
*/
groupedTitle: string;
/**
* If there is more than one slice whose percentage of the pie is less than this number,
* those slices will be grouped together into one slice.
* This is the "other" slice. It will always be the last slice in a pie.
*/
groupPercent: number;
/**
* Slices with percent less then hideLabelsPercent won't display labels.
* This is useful to avoid cluttering up the chart, if you have a lot of small slices.
* 0 means all labels will be shown.
*/
hideLabelsPercent: number;
/**
* Opacity of a hovered slice. Value range is 0 - 1.
* @default 1
*/
hoverAlpha: number;
/**
* Inner radius of the pie, in pixels or percents.
*/
innerRadius: any;
/**
* The distance between the label and the slice, in pixels.
* You can use negative values to put the label on the slice.
* @default 30
*/
labelRadius: number;
/**
* Name of the field in dataProvider which specifies the length of a tick.
* Note, the chart will not try to arrange labels automatically if this property is set.
*/
labelRadiusField: string;
/**
* Specifies whether data labels are visible.
* @default true
*/
labelsEnabled: boolean;
/**
* Label text. The following tags can be used:
* [[value]], [[title]], [[percents]], [[description]]. [[title]]: [[percents]]%
*/
labelText: string;
/**
* Label tick opacity. Value range is 0 - 1. 0.2
*/
labelTickAlpha: number;
/**
* Label tick color. #000000
*/
labelTickColor: string;
/**
* Bottom margin of the chart.
* @default 5
*/
marginBottom: number;
/**
* Left margin of the chart.
*/
marginLeft: number;
/**
* Right margin of the chart.
*/
marginRight: number;
/**
* Top margin of the chart.
* @default 5
*/
marginTop: number;
/**
* Minimum radius of the pie, in pixels.
* @default 10
*/
minRadius: number;
/**
* Pie outline opacity. Value range is 0 - 1.
*/
outlineAlpha: number;
/**
* Pie outline color. #FFFFFF
*/
outlineColor: string;
/**
* Pie outline thickness.
* @default 1
*/
outlineThickness: number;
/**
* Opacity of the slices. You can set the opacity of individual slice too.
* @default 1
*/
pieAlpha: number;
/**
* Color of the first slice. All the other will be colored with darker or brighter colors.
*/
pieBaseColor: string;
/**
* Lightness increase of each subsequent slice. This is only useful if pieBaseColor is set.
* Use negative values for darker colors. Value range is from -255 to 255.
* @default 30
*/
pieBrightnessStep: number;
/**
* You can set fixed position of a pie center, in pixels or in percents.
*/
pieX: any;
/**
* You can set fixed position of a pie center, in pixels or in percents.
*/
pieY: any;
/**
* Name of the field in chart's dataProvider which holds a boolean value
* telling the chart whether this slice must be pulled or not.
*/
pulledField: string;
/**
* Pull out duration, in seconds.
* @default 1
*/
pullOutDuration: number;
/**
* Pull out effect. Possible values are ">", "<", elastic" and "bounce". bounce
*/
pullOutEffect: string;
/**
* If this is set to true, only one slice can be pulled out at a time.
* If the viewer clicks on a slice, any other pulled-out slice will be pulled in.
*/
pullOutOnlyOne: boolean;
/**
* Pull out radius, in pixels or percents 0.2
*/
pullOutRadius: any;
/**
* Radius of a pie, in pixels or percents. By default, radius is calculated automatically.
*/
radius: any;
/**
* Specifies whether the animation should be sequenced or all slices should appear at once.
*/
sequencedAnimation: boolean;
/**
* Initial opacity of all slices. If you set startDuration higher than 0, slices will fade in from startAlpha.
* @default 1
*/
startAlpha: number;
/**
* Angle of the first slice, in degrees. This will work properly only if "depth3D" is set to 0.
* If "depth3D" is greater than 0, then there can be two angles only: 90 and 270. Value range is 0-360.
* @default 90
*/
startAngle: number;
/**
* Duration of the animation, in seconds.
* @default 1
*/
startDuration: number;
/**
* Animation effect. Possible values are ">", "<", "elastic" and "bounce". bounce
*/
startEffect: string;
/**
* Radius of the positions from which the slices will fly in.
* @default 5
*/
startRadius: any;
/**
* Name of the field in chart's dataProvider which holds slice's title.
*/
titleField: string;
/**
* Name of the field in chart's dataProvider
* which holds url which would be accessed if the user clicks on a slice.
*/
urlField: string;
/**
* If url is specified for a slice, it will be opened when user clicks on it.
* urlTarget specifies target of this url. Use _blank if you want url to be opened in a new window. _self
*/
urlTarget: string;
/**
* Name of the field in chart's dataProvider which holds slice's value.
*/
valueField: string;
/**
* Name of the field in chart's dataProvider which holds boolean variable
* defining whether this data item should have an entry in the legend.
*/
visibleInLegendField: string;
/**
* You can trigger the animation of the pie chart.
*/
animateAgain(): void;
/**
* You can trigger the click on a slice from outside. index - the number of a slice or Slice object.
*/
clickSlice(index: number): void;
/**
* Hides slice. index - the number of a slice or Slice object.
*/
hideSlice(index: number): void;
/**
* You can simulate roll-out of a slice from outside. index - the number of a slice or Slice object.
*/
rollOutSlice(index: number): void;
/**
* You can simulate roll-over a slice from outside. index - the number of a slice or Slice object.
*/
rollOverSlice(index: number): void;
/**
* Shows slice. index - the number of a slice or Slice object.
*/
showSlice(index: number): void;
/**
* Adds event listener of the type "clickSlice" or "pullInSlice" or "pullOutSlice" to the object.
* @param type Always "clickSlice" or "pullInSlice" or "pullOutSlice".
* @param handler
* If the type is "clickSlice", dispatched when user clicks on a slice.
* If the type is "pullInSlice", dispatched when user clicks on a slice and the slice is pulled-in.
* If the type is "pullOutSlice", dispatched when user clicks on a slice and the slice is pulled-out.
* If the type is "rollOutSlice", dispatched when user rolls-out of the slice.
* If the type is "rollOverSlice", dispatched when user rolls-over the slice.
*/
addListener(
type: string,
handler: (
e: {
type: string; // Always "rollOverSlice".
dataItem: Slice;
chart: AmChart;
},
) => void,
): void;
}
+60
View File
@@ -0,0 +1,60 @@
import AmCoordinateChart from "./AmCoordinateChart";
/**
* AmRadarChart is the class you have to use for radar and polar chart types.
* @example
* let chart;
* let chartData = [
* {country:"Czech Republic",litres:156.90},
* {country:"Ireland",litres:131.10},
* {country:"Germany",litres:115.80},
* {country:"Australia",litres:109.90},
* {country:"Austria",litres:108.30},
* {country:"UK",litres:99.00}
* ];
*
* window.onload = function() {
* chart = new AmCharts.AmRadarChart();
* chart.dataProvider = chartData;
* chart.categoryField = "country";
* chart.startDuration = 2;
*
* let valueAxis = new AmCharts.ValueAxis();
* valueAxis.axisAlpha = 0.15;
* valueAxis.minimum = 0;
* valueAxis.dashLength = 3;
* valueAxis.axisTitleOffset = 20;
* valueAxis.gridCount = 5;
* chart.addValueAxis(valueAxis);
*
* let graph = new AmCharts.AmGraph();
* graph.valueField = "litres";
* graph.bullet = "round";
* graph.balloonText = "[[value]] litres of beer per year"
* chart.addGraph(graph);
*
* chart.write("chartdiv");
* };
*/
export default class AmRadarChart extends AmCoordinateChart {
/**
* Bottom margin of the chart.
*/
marginBottom: number;
/**
* Left margin of the chart.
*/
marginLeft: number;
/**
* Right margin of the chart.
*/
marginRight: number;
/**
* Top margin of the chart.
*/
marginTop: number;
/**
* Radius of a radar. 0.35
*/
radius: any;
}
+171
View File
@@ -0,0 +1,171 @@
import AmCoordinateChart from "./AmCoordinateChart";
import ChartCursor from "./ChartCursor";
import ChartScrollbar from "./ChartScrollbar";
import TrendLine from "./TrendLine";
/**
* AmRectangularChart is a base class of AmSerialChart and AmXYChart. It can not be instantiated explicitly.
*/
export default class AmRectangularChart extends AmCoordinateChart {
/**
* The angle of the 3D part of plot area. This creates a 3D effect (if the "depth3D" is > 0).
* @default 0
*/
angle: number;
/**
* Space left from axis labels/title to the chart's outside border, if autoMargins set to true.
* @default 10
*/
autoMarginOffset: number;
/**
* Specifies if margins of a chart should be calculated automatically so that labels of axes would fit.
* The chart will adjust only margins with axes.
* Other margins will use values set with marginRight, marginTop, marginLeft and marginBottom properties.
* @default true
*/
autoMargins: boolean;
/**
* Cursor of a chart.
*/
chartCursor: ChartCursor;
/**
* Chart scrollbar.
*/
chartScrollbar: ChartScrollbar;
/**
* The depth of the 3D part of plot area. This creates a 3D effect (if the "angle" is > 0).
* @default 0
*/
depth3D: number;
/**
* Number of pixels between the container's bottom border and plot area.
* This space can be used for bottom axis' values.
* If autoMargin is true and bottom side has axis, this property is ignored.
* @default 20
*/
marginBottom: number;
/**
* Number of pixels between the container's left border and plot area.
* This space can be used for left axis' values.
* If autoMargin is true and left side has axis, this property is ignored.
* @default 20
*/
marginLeft: number;
/**
* Number of pixels between the container's right border and plot area.
* This space can be used for Right axis' values.
* If autoMargin is true and right side has axis, this property is ignored.
* @default 20
*/
marginRight: number;
/**
* Flag which should be set to false if you need margins to be recalculated on next chart.validateNow() call.
* @default false
*/
marginsUpdated: boolean;
/**
* Number of pixels between the container's top border and plot area.
* This space can be used for top axis' values.
* If autoMargin is true and top side has axis, this property is ignored.
* @default 20
*/
marginTop: number;
/**
* The opacity of plot area's border. Value range is 0 - 1.
* @default 0
*/
plotAreaBorderAlpha: number;
/**
* The color of the plot area's border.
* Note, the it is invisible by default, as plotAreaBorderAlpha default value is 0.
* Set it to a value higher than 0 to make it visible.
* @default '#000000'
*/
plotAreaBorderColor: string;
/**
* Opacity of plot area. 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
*/
plotAreaFillAlphas: number;
/**
* You can set both one color if you need a solid color or array of colors to generate gradients, for example:
* ["#000000", "#0000CC"]
* @default '#FFFFFF'
*/
plotAreaFillColors: any;
/**
* If you are using gradients to fill the plot area, you can use this property to set gradient angle.
* The only allowed values are horizontal and vertical: 0, 90, 180, 270.
* @default 0
*/
plotAreaGradientAngle: number;
/**
* Array of trend lines added to a chart.
* You can add trend lines to a chart using this array or access already existing trend lines
*/
trendLines: TrendLine[];
/**
* Opacity of zoom-out button background.
* @default 0
*/
zoomOutButtonAlpha: number;
/**
* Zoom-out button background color.
* @default '#e5e5e5'
*/
zoomOutButtonColor: string;
/**
* Name of zoom-out button image. In the images folder there is another lens image, called lensWhite.png.
* You might want to have white lens when background is dark. Or you can simply use your own image.
* @default lens.png
*/
zoomOutButtonImage: string;
/**
* Size of zoom-out button image
* @default: 17
*/
zoomOutButtonImageSize: number;
/**
* Padding around the text and image.
* @default: 8
*/
zoomOutButtonPadding: number;
/**
* Opacity of zoom-out button background when mouse is over it.
* @default: 1
*/
zoomOutButtonRollOverAlpha: number;
/**
* Text in the zoom-out button. Show all
*/
zoomOutText: string;
/**
* Adds a ChartCursor object to a chart
*/
addChartCursor(cursor: ChartCursor): void;
/**
* Adds a ChartScrollbar to a chart
*/
addChartScrollbar(scrollbar: ChartScrollbar): void;
/**
* Adds a TrendLine to a chart.
* You should call chart.validateNow() after this method is called in order the trend line to be visible.
*/
addTrendLine(trendLine: TrendLine): void;
/**
* Removes cursor from the chart
*/
removeChartCursor(): void;
/**
* Removes scrollbar from the chart
*/
removeChartScrollbar(): void;
/**
* Removes a trend line from a chart.
* You should call chart.validateNow() in order the changes to be visible.
*/
removeTrendLine(trendLine: TrendLine): void;
}
+130
View File
@@ -0,0 +1,130 @@
import AmRectangularChart from "./AmRectangularChart";
import CategoryAxis from "./CategoryAxis";
/**
* AmSerialChart is the class you have to use for majority of chart types.
* The supported chart types are: line, area, column, bar, step line, smoothed line, candlestick and OHLC.
* The chart can be rotated by 90 degrees so the column chart becomes bar chart.
* The chart supports simple and logarithmic scales, it can have multiple value axes.
* The chart can place data points at equal intervals or can parse dates and place data points
* at irregular intervals.
* @example
* let chartData = [{title:"sample 1",value:130},{title:"sample 2",value:26}];
*
* let chart = new AmCharts.AmSerialChart();
* chart.categoryField = "title";
* chart.dataProvider = chartData;
*
* let graph = new AmCharts.AmGraph();
* graph.valueField = "value";
* graph.type = "column";
* graph.fillAlphas = 1;
* chart.addGraph(graph);
*
* chart.write("chartdiv");
*/
export default class AmSerialChart extends AmRectangularChart {
/**
* Date format of the graph balloon (if chart parses dates and you don't use chartCursor).
* @default 'MMM DD, YYYY'
*/
balloonDateFormat: string;
/**
* Read-only. Chart creates category axis itself.
* If you want to change some properties, you should get this axis from the chart and
* set properties to this object.
*/
categoryAxis: CategoryAxis;
/**
* Category field name tells the chart the name of the field in your dataProvider object
* which will be used for category axis values.
*/
categoryField: string;
/**
* The gap in pixels between two columns of the same category.
* @default 5
*/
columnSpacing: number;
/**
* Space between 3D stacked columns.
* @default 0
*/
columnSpacing3D: number;
/**
* Relative width of columns. Value range is 0 - 1.
* @default 0.8
*/
columnWidth: number;
/**
* Read-only. If category axis parses dates endDate indicates date to which the chart is currently displayed.
*/
endDate: Date;
/**
* Read-only. Category index to which the chart is currently displayed.
*/
endIndex: number;
/**
* Maximum number of series allowed to select.
*/
maxSelectedSeries: number;
/**
* The longest time span allowed to select (in milliseconds) for example
* 259200000 will limit selection to 3 days.
*/
maxSelectedTime: number;
/**
* The shortest time span allowed to select (in milliseconds) for example
* 1000 will limit selection to 1 second.
* @default 0
*/
minSelectedTime: number;
/**
* Specifies if scrolling of a chart with mouse wheel is enabled.
* If you press shift while rotating mouse wheel, the chart will zoom-in/out.
*/
mouseWheelScrollEnabled: boolean;
/**
* Specifies if zooming of a chart with mouse wheel is enabled.
* If you press shift while rotating mouse wheel, the chart will scroll.
*/
mouseWheelZoomEnabled: boolean;
/**
* If you set this to true, the chart will be rotated by 90 degrees (the columns will become bars).
*/
rotate: boolean;
/**
* Read-only.
* If category axis parses dates startDate indicates date from which the chart is currently displayed.
*/
startDate: Date;
/**
* Read-only. Category index from which the chart is currently displayed.
*/
startIndex: number;
/**
* Specifies if chart should zoom-out when data is updated.
* @default true
*/
zoomOutOnDataUpdate: boolean;
/**
* Number Returns index of the specified category value.
*/
getCategoryIndexByValue(value: number): void;
/**
* Zooms out, charts shows all available data.
*/
zoomOut(): void;
/**
* Zooms the chart by the value of the category axis.
*/
zoomToCategoryValues(start: Date, end: Date): void;
/**
* Zooms the chart from one date to another.
*/
zoomToDates(start: Date, end: Date): void;
/**
* Zooms the chart by the index of the category.
*/
zoomToIndexes(start: Date, end: Date): void;
}
+198
View File
@@ -0,0 +1,198 @@
import AmBalloon from "./AmBalloon";
import AmChart from "./AmChart";
import AmSerialChart from "./AmSerialChart";
import CategoryAxesSettings from "./CategoryAxesSettings";
import ChartCursorSettings from "./ChartCursorSettings";
import ChartScrollbarSettings from "./ChartScrollbarSettings";
import DataSet from "./DataSet";
import DataSetSelector from "./DataSetSelector";
import LegendSettings from "./LegendSettings";
import PanelsSettings from "./PanelSettings";
import PeriodSelector from "./PeriodSelector";
import StockEvent from "./StockEvent";
import StockGraph from "./StockGraph";
import StockPanel from "./StockPanel";
import ValueAxesSettings from "./ValueAxesSettings";
/**
* AmStockChart is a main class Stock chart.
*/
export default class AmStockChart {
/**
* Specifies if animation was already played.
* Animation is only played once, when chart is rendered for the first time.
* If you want the animation to be repeated, set this property to false.
*/
animationPlayed: boolean;
/**
* Balloon object.
*/
balloon: AmBalloon;
/**
* Settings for category axes.
*/
categoryAxesSettings: CategoryAxesSettings;
/**
* Indicates if the chart is created.
*/
chartCreated: boolean;
/**
* Chart cursor settings.
*/
chartCursorSettings: ChartCursorSettings;
/**
* Chart scrollbar settings.
*/
chartScrollbarSettings: ChartScrollbarSettings;
/**
* Array of colors used by data sets if no color was set explicitly on data set itself.
* [
* #FF6600, "#FCD202", "#B0DE09", "#0D8ECF", "#2A0CD0", "#CD0D74", "#CC0000",
* "#00CC00", "#0000CC", "#DDDDDD", "#999999", "#333333", "#990000"
* ]
*/
colors: any[];
/**
* Array of data sets selected for comparing.
*/
comparedDataSets: any[];
/**
* Array of DataSets.
*/
dataSets: any[];
/**
* DataSetSelector object.
* You can add it if you have more than one data set and want users to be able to select/compare them.
*/
dataSetSelector: DataSetSelector;
/**
* Current end date of the selected period, get only.
* To set start/end dates, use stockChart.zoom(startDate, endDate) method.
*/
endDate: Date;
/**
* Defines on which day week starts. 0 - Sunday, 1 - Monday..
* @default 1
*/
firstDayOfWeek: number;
/**
* If set to true the scope of the data view will be set to the end after data update.
*/
glueToTheEnd: boolean;
/**
* Legend settings.
*/
legendSettings: LegendSettings;
/**
* Data set selected as main.
*/
mainDataSet: DataSet;
/**
* Array of StockPanels (charts).
*/
panels: any[];
/**
* Settings for stock panels.
*/
panelsSettings: PanelsSettings;
/**
* Period selector object.
* You can add it if you want user's to be able to enter date ranges or
* zoom chart with predefined period buttons.
*/
periodSelector: PeriodSelector;
/**
* Scrollbar's chart object, get only.
*/
scrollbarChart: AmSerialChart;
/**
* Current start date of the selected period, get only.
* To set start/end dates, use stockChart.zoom(startDate, endDate) method.
*/
startDate: Date;
/**
* Settings for stock events.
*/
stockEventsSettings: any;
/**
* Settings for value axes.
*/
valueAxesSettings: ValueAxesSettings;
/**
* read-only. Indicates current version of a script.
*/
version: string;
/**
* Specifies whether the chart should zoom-out when main data set is changed.
*/
zoomOutOnDataSetChange: boolean;
/**
* Adds panel to the stock chart. Requires stockChart.validateNow() method to be called after this action.
*/
addPanel(panel: StockPanel): void;
/**
* Adds panel to the stock chart at a specified index.
* Requires stockChart.validateNow() method to be called after this action.
*/
addPanelAt(panel: StockPanel, index: number): void;
/**
* Destroys chart, all timeouts and listeners.
*/
clear(): void;
/**
* Hides event bullets.
*/
hideStockEvents(): void;
/**
* Removes panel from the stock chart. Requires stockChart.validateNow() method to be called after this action.
*/
removePanel(panel: StockPanel): void;
/**
* Shows event bullets.
*/
showStockEvents(): void;
/**
* Method which should be called after data was changed.
*/
validateData(): void;
/**
* Method which forces the stock chart to rebuild. Should be called after properties are changed.
*/
validateNow(): void;
/**
* Zooms chart to specified dates. startDate, endDate - Date objects.
*/
zoom(startDate: Date, endDate: Date): void;
/**
* Zooms out the chart.
*/
zoomOut(): void;
/**
* Adds event listener.
* @param type - One of
* "buildStarted", "clickStockEvent", "dataUpdated", "init", "panelRemoved", "rendered", "rollOutStockEvent",
* "rollOverStockEvent", "zoomed".
* @param handler - The event handler.
*/
addListener(
type: string,
handler: (
e: {
chart: AmStockChart;
date?: Date;
endDate?: Date;
eventObject?: StockEvent;
graph?: StockGraph;
panel?: StockPanel;
period?: string;
startDate?: Date;
type: string;
},
) => void,
): void;
/**
* Removes event listener from chart object.
*/
removeListener(chart: AmChart, type: string, handler: any): void;
}
+68
View File
@@ -0,0 +1,68 @@
import AmRectangularChart from "./AmRectangularChart";
/**
* AmXYChart is the class you have to use for XY/Bubble/Scatter chart types.
* The chart supports simple and logarithmic scales, it can have multiple value axes.
* @example
* let chartData = [
* {x:10, y:14, value:59},
* {x:5, y:3, value:50},
* {x:-10, y:-3, value:19},
* {x:-6, y:5, value:65},
* {x:15, y:-4, value:92},
* {x:13, y:1, value:8},
* {x:1, y:6, value:35}
* ];
*
* let chart = new AmCharts.AmXYChart();
* chart.pathToImages = "../../amcharts/javascript/images/";
* chart.dataProvider = chartData;
* chart.marginLeft = 35;
* chart.startDuration = 1.5;
*
* let xAxis = new AmCharts.ValueAxis();
* xAxis.position = "left";
* xAxis.autoGridCount = true;
* chart.addValueAxis(xAxis);
*
* let yAxis = new AmCharts.ValueAxis();
* yAxis.position = "bottom";
* yAxis.autoGridCount = true;
* chart.addValueAxis(yAxis);
*
* let graph = new AmCharts.AmGraph();
* graph.valueField = "value";
* graph.xField = "x";
* graph.yField = "y";
* graph.lineAlpha = 0;
* graph.bullet = "round";
* chart.addGraph(graph);
*
* let chartCursor = new AmCharts.ChartCursor();
* chart.addChartCursor(chartCursor);
*
* let chartScrollbar = new AmCharts.ChartScrollbar();
* chartScrollbar.hideResizeGrips = false;
* chart.addChartScrollbar(chartScrollbar);
*
* chart.write("chartdiv);
*/
export default class AmXYChart extends AmRectangularChart {
/**
* Specifies if Scrollbar of X axis (horizontal) should be hidden.
*/
hideXScrollbar: boolean;
/**
* Specifies if Scrollbar of Y axis (vertical) should be hidden.
*/
hideYScrollbar: boolean;
/**
* Maximum zoom factor of the chart.
* @default 20
*/
maxZoomFactor: number;
/**
* Zooms out, charts shows all available data.
*/
zoomOut(): void;
}
+92
View File
@@ -0,0 +1,92 @@
/**
* AreasSettings is a class which holds common settings of all MapArea objects.
*/
export default class AreasSettings {
/**
* Opacity of areas.
* @default 1
*/
alpha: number;
/**
* Specifies if the areas should be zoomed-in when user clicks on them, event if zoom properties are not set.
*/
autoZoom: boolean;
/**
* Text which is displayed in a roll-over balloon. You can use the following tags:
* [[title]], [[description]], [[value]] and [[percent]] [[title]]
*/
balloonText: string;
/**
* Color of the areas.
* @default "#FFCC00"
*/
color: string;
/**
* Color of area with highest value.
* Colors for areas with values less then highest will be colored with intermediate colors
* between color and colorSolid.
* Use colorSteps property of AmMap to change the number of intermediate colors.
* @default "#990000"
*/
colorSolid: string;
/**
* Height of a description window.
*/
descriptionWindowHeight: number;
/**
* Width of a description window.
* @default 250
*/
descriptionWindowWidth: number;
/**
* X position of a description window.
*/
descriptionWindowX: number;
/**
* Y position of a description window.
*/
descriptionWindowY: number;
/**
* Opacity of area's outline.
* @default 1
*/
outlineAlpha: number;
/**
* Color of area's outline. #FFFFFF
*/
outlineColor: string;
/**
* Thickness of area's outline. 0.5
*/
outlineThickness: number;
/**
* Color of area when user rolls-over it. undefined
*/
rollOverColor: string;
/**
* Color of area's outline when user rolls-over it. #CC0000
*/
rollOverOutlineColor: string;
/**
* Color of area which is currently selected. #CC0000
*/
selectedColor: string;
/**
* Opacity of all areas which are in the map svg file, but not listed as areas in DataSet.
* @default 1
*/
unlistedAreasAlpha: number;
/**
* Color of all areas which are in the map svg file, but not listed as areas in DataSet. #DDDDDD
*/
unlistedAreasColor: string;
/**
* Opacity of all areas' outline which are in the map svg file, but not listed as areas in DataSet.
* @default 1
*/
unlistedAreasOutlineAlpha: number;
/**
* Color of all areas' outline which are in the map svg file, but not listed as areas in DataSet. #FFFFFF
*/
unlistedAreasOutlineColor: string;
}
+148
View File
@@ -0,0 +1,148 @@
import Guide from "./Guide";
/**
* AxisBase is the base class for ValueAxis and CategoryAxis. It can not be instantiated explicitly.
*/
export default class AxisBase {
/**
* Specifies whether number of gridCount is specified automatically, acoarding to the axis size.
* @default true
*/
autoGridCount: boolean;
/**
* Axis opacity. Value range is 0 - 1.
* @default 1
*/
axisAlpha: number;
/**
* Axis color. #000000
*/
axisColor: string;
/**
* Thickness of the axis.
* @default 1
*/
axisThickness: number;
/**
* Color of axis value labels. Will use chart's color if not set.
*/
color: string;
/**
* Length of a dash. 0 means line is not dashed.
*/
dashLength: number;
/**
* Fill opacity. Every second space between grid lines can be filled with color.
* Set fillAlpha to a value greater than 0 to see the fills.
*/
fillAlpha: number;
/**
* Fill color. Every second space between grid lines can be filled with color.
* Set fillAlpha to a value greater than 0 to see the fills.
* @default "#FFFFFF"
*/
fillColor: string;
/**
* Size of value labels text. Will use chart's fontSize if not set.
*/
fontSize: string;
/**
* Opacity of grid lines. 0.2
*/
gridAlpha: number;
/**
* Color of grid lines. #000000
*/
gridColor: string;
/**
* Number of grid lines. In case this is value axis, or your categoryAxis parses dates,
* the number is approximate. The default value is 5. If you set autoGridCount to true,
* this property is ignored.
* @default 5
*/
gridCount: number;
/**
* Thickness of grid lines.
* @default 1
*/
gridThickness: number;
/**
* The array of guides belonging to this axis.
*/
guides: any[];
/**
* If autoMargins of a chart is set to true, but you want this axis not to be measured when calculating margin,
* set ignoreAxisWidth to true.
*/
ignoreAxisWidth: boolean;
/**
* Specifies whether values should be placed inside or outside plot area.
*/
inside: boolean;
/**
* Frequency at which labels should be placed. Doesn't work for CategoryAxis if parseDates is set to true.
* @default 1
*/
labelFrequency: number;
/**
* Rotation angle of a label. Only horizontal axis' values can be rotated.
* If you set this for vertical axis, the setting will be ignored.
*/
labelRotation: number;
/**
* Specifies whether axis displays category axis' labels and value axis' values.
* @default true
*/
labelsEnabled: boolean;
/**
* The distance of the axis to the plot area, in pixels. Negative values can also be used.
*/
offset: number;
/**
* Possible values are: "top", "bottom", "left", "right".
* If axis is vertical, default position is "left".
* If axis is horizontal, default position is "bottom".
*/
position: string;
/**
* Whether to show first axis label or not.
* @default true
*/
showFirstLabel: boolean;
/**
* Whether to show last axis label or not.
* @default true
*/
showLastLabel: boolean;
/**
* Length of the tick marks.
* @default 5
*/
tickLength: number;
/**
* Title of the axis.
*/
title: string;
/**
* Specifies if title should be bold or not.
* @default true
*/
titleBold: boolean;
/**
* Color of axis title. Will use text color of chart if not set any.
*/
titleColor: string;
/**
* Font size of axis title. Will use font size of chart plus two pixels if not set any.
*/
titlefontSize: string;
/**
* Adds guide to the axis.
*/
addGuide(guide: Guide): void;
/**
* Removes guide from the axis.
*/
removeGuide(guide: Guide): void;
}
+135
View File
@@ -0,0 +1,135 @@
/**
* CategoryAxesSettings settings set's settings common for all CategoryAxes of StockPanels.
* If you change a property after the chart is initialized, you should call stockChart.validateNow() method in
* order for it to work. If there is no default value specified, default value of CategoryAxis class will be used.
*/
export default class CategoryAxesSettings {
/**
* Specifies whether number of gridCount is specified automatically, according to the axis size.
* @default true
*/
autoGridCount: boolean;
/**
* Axis opacity.
*/
axisAlpha: number;
/**
* Axis color.
*/
axisColor: string;
/**
* Height of category axes. Set it to 0 if you set inside property to true.
* @default 28
*/
axisHeight: number;
/**
* Thickness of the axis.
*/
axisThickness: number;
/**
* Text color.
*/
color: string;
/**
* Length of a dash.
*/
dashLength: number;
/**
* Date formats of different periods.
* Possible period values:
* fff - milliseconds,
* ss - seconds,
* mm - minutes,
* hh - hours,
* DD - days,
* MM - months,
* WW - weeks,
* YYYY - years
* Check this page for date formatting strings.
*/
dateFormats: any[];
/**
* If you want data points to be placed at equal intervals (omiting dates with no data),
* set equalSpacing to true.
*/
equalSpacing: boolean;
/**
* Fill opacity. Every second space between grid lines can be filled with fillColor.
*/
fillAlpha: number;
/**
* Fill color. Every second space between grid lines can be filled with color.
* Set fillAlpha to a value greater than 0 to see the fills.
*/
fillColor: string;
/**
* Text size.
*/
fontSize: string;
/**
* Opacity of grid lines.
*/
gridAlpha: number;
/**
* Color of grid lines.
*/
gridColor: string;
/**
* Approximate number of grid lines.
* You should set autoGridCount to false in order this property not to be ignored.
* @default 10
*/
gridCount: number;
/**
* Thickness of grid lines.
*/
gridThickness: number;
/**
* Periods to which data will be gruoped in case there are more data items in
* the selected period than specified in maxSeries property.
* ["ss", "10ss", "30ss", "mm", "10mm", "30mm", "hh", "DD", "WW", "MM", "YYYY"]
*/
groupToPeriods: any[];
/**
* Specifies whether values should be placed inside or outside of plot area.
*/
inside: boolean;
/**
* Rotation angle of a label.
*/
labelRotation: number;
/**
* Maximum series shown at a time.
* In case there are more data points in the selection than maxSeries,
* the chart will group data to longer periods, for example - you have 250 days in the selection,
* and maxSeries is 150 - the chart will group data to weeks.
* @default 150
*/
maxSeries: number;
/**
* Specifies the shortest period of your data.
* fff - millisecond,
* ss - second,
* mm - minute,
* hh - hour,
* DD - day,
* MM - month,
* YYYY - year
* @default "DD"
*/
minPeriod: string;
/**
* top or "bottom".
*/
position: string;
/**
* Specifies whether the graph should start on axis or not.
* In case you display columns, it is recommended to set this to false.
* startOnAxis can be set to true only if equalSpacing is set to true.
*/
startOnAxis: boolean;
/**
* Tick length.
*/
tickLength: number;
}
+106
View File
@@ -0,0 +1,106 @@
import AxisBase from "./AxisBase";
export default class CategoryAxis extends AxisBase {
/**
* When parse dates is on for the category axis, the chart will try to highlight the beginning of the periods,
* like month, in bold. Set this to false to disable the functionality.
* @default true
*/
boldPeriodBeginning: boolean;
/**
* Date formats of different periods. Possible period values:
* fff - milliseconds, ss - seconds, mm - minutes, hh - hours, DD - days, MM - months, WW - weeks, YYYY - years.
* Check this page for date formatting strings.
* [
* {period:'fff',format:'JJ:NN:SS'},
* {period:'ss',format:'JJ:NN:SS'},
* {period:'mm',format:'JJ:NN'},
* {period:'hh',format:'JJ:NN'},
* {period:'DD',format:'MMM DD'},
* {period:'WW',format:'MMM DD'},
* {period:'MM',format:'MMM'},
* {period:'YYYY',format:'YYYY'}
* ]
*/
dateFormats: any[];
/**
* In case your category axis values are Date objects and parseDates is set to true,
* the chart will parse dates and will place your data points at irregular intervals.
* However if you want dates to be parsed (displayed on the axis, baloons, etc),
* but data points to be placed at equal intervals (omiting dates with no data), set equalSpacing to true.
*/
equalSpacing: boolean;
/**
* Field in data provider which specifies if the category value should always be shown.
* For example: categoryAxis.forceShowField = "forceShow";
* Field in data provider which specifies if the category value should always be shown.
* For example: categoryAxis.forceShowField = "forceShow";
* And in data:
* {category:"one", forceShow:true, value:100}
* Note, this works only when parseDates is set to false.
*/
forceShowField: string;
/**
* Specifies if a grid line is placed on the center of a cell or on the beginning of a cell.
* Possible values are: "start" and "middle" This setting doesn't work if parseDates is set to true.
* @default "middle"
*/
gridPosition: string;
/**
* Specifies if minor grid should be displayed.
* NOTE: If equalSpacing is set to true, this setting will be ignored.
* @default false
*/
minorGridEnabled: boolean;
/**
* Specifies the shortest period of your data. This should be set only if parseDates is set to "true".
* Possible period values:
* fff - milliseconds, ss - seconds, mm - minutes, hh - hours, DD - days, MM - months, YYYY - years.
* @default "DD"
*/
minPeriod: string;
/**
* In case your category axis values are Date objects, set this to true.
* In this case the chart will parse dates and will place your data points at irregular intervals.
* If you want dates to be parsed, but data points to be placed at equal intervals,
* set both parseDates and equalSpacing to true.
*/
parseDates: boolean;
/**
* Specifies whether the graph should start on axis or not.
* In case you display columns, it is recommended to set this to false.
* If parseDates is set to true, startOnAxis will allways be false, unless equalSpacing is set to true.
*/
startOnAxis: boolean;
/**
* Works only when parseDates is set to true and equalSpacing is false.
* If you set it to true, at the position where bigger period changes,
* category axis will display date strings of bot small and big period, in two rows.
* @default false
*/
twoLineMode: boolean;
/**
* Use line color for bullet
* @default false
*/
useLineColorForBulletBorder: boolean;
/**
* Number returns coordinate of a category. Works only if parseDates is false.
* If parseDates is true, use dateToCoordinate method.
*/
categoryToCoordinate(category: string): void;
/**
* date - Date object Returns Date of the coordinate, in case parseDates is set to true and
* equalSpacing is set to false.
*/
coordinateToDate(coordinate: number): void;
/**
* Number Returns coordinate of the date, in case parseDates is set to true.
* If parseDates is false, use categoryToCoordinate method.
*/
dateToCoordinate(date: Date): void;
/**
* Number Returns index of the category which is most close to specified coordinate.
*/
xToIndex(x: number): void;
}
+149
View File
@@ -0,0 +1,149 @@
import AmChart from "./AmChart";
import AmGraph from "./AmGraph";
/**
* ChartCursor is a class which displays a cursor which follows the mouse.
* In case of Serial chart it also shows value and category balloons.
* @example
* let chart = new AmCharts.AmSerialChart();
* let chartCursor = new AmCharts.ChartCursor();
* chart.addChartCursor(chartCursor);
*/
export default class ChartCursor {
/**
* Specifies if bullet for each graph will follow the cursor.
*/
bulletsEnabled: boolean;
/**
* Size of bullets, following the cursor.
* @default 8
*/
bulletSize: number;
/**
* Opacity of the category balloon.
* @default 1
*/
categoryBalloonAlpha: number;
/**
* Color of the category balloon. cursorColor is used if not set.
*/
categoryBalloonColor: string;
/**
* Category balloon date format (used only if category axis parses dates).
* Check this page for instructions on how to format dates. MMM DD, YYYY
*/
categoryBalloonDateFormat: string;
/**
* Specifies whether category balloon is enabled.
* @default true
*/
categoryBalloonEnabled: boolean;
/**
* Text color. #FFFFFF
*/
color: string;
/**
* Opacity of the cursor line. 1
*/
cursorAlpha: number;
/**
* Color of the cursor line. #CC0000
*/
cursorColor: string;
/**
* Specifies where the cursor line 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).
* If you want the cursor to follow mouse and not to glue to the nearest data point, set "mouse" here.
* Possible values are: "start", "middle", "mouse".
*/
cursorPosition: string;
/**
* Specifies whether cursor is enabled.
* @default true
*/
enabled: boolean;
/**
* If set to true, instead of a cursor line user will see a fill which width will always
* be equal to the width of one data item.
* Recommend setting cursorAlpha to 0.1 or some other small number if using this feature.
* @default false
*/
fullWidth: boolean;
/**
* If this is set to true, only one balloon at a time will be displayed. Note, this is quite CPU consuming.
*/
oneBalloonOnly: boolean;
/**
* If this is set to true, the user will be able to pan the chart (Serial only) instead of zooming.
*/
pan: boolean;
/**
* Opacity of the selection.
*/
selectionAlpha: number;
/**
* Specifies if cursor should only mark selected area but not zoom-in after user releases mouse button.
*/
selectWithoutZooming: boolean;
/**
* Specifies whether value balloons are enabled.
* In case they are not, the balloons might be displayed anyway, when the user rolls-over the column or bullet.
* @default true
*/
valueBalloonsEnabled: boolean;
/**
* Specifies if the user can zoom-in the chart.
* If pan is set to true, zoomable is switched to false automatically.
* @default true
*/
zoomable: boolean;
/**
* Indicates if currently user is selecting some chart area to zoom-in.
*/
zooming: boolean;
/**
* Hides cursor.
*/
hideCursor(): void;
/**
* You can force cursor to appear at specified cateogry or date.
*/
showCursorAt(category: string | Date): void;
/**
* Adds event listener.
* @param type One of "changed", "draw", "moved", "onHideCursor", "onShowCursor", "panning",
* "selected", "zoomed", "zoomStarted".
* @param handler The event handler.
*/
addListener(
type: string,
handler: (
e: {
chart: AmChart;
delta2X?: number;
delta2Y?: number;
deltaX?: number;
deltaY?: number;
end?: number;
finalX?: number;
finalY?: number;
index?: number;
initialX?: number;
initialY?: number;
mostCloseGraph?: AmGraph;
start?: number;
target?: ChartCursor;
type: string;
x?: number;
y?: number;
zooming?: boolean;
},
) => void,
): void;
/**
* Removes event listener from chart object.
*/
removeListener(chart: AmChart, type: string, handler: any): void;
}
+81
View File
@@ -0,0 +1,81 @@
/**
* ChartCursorSettings settings set's settings for chart cursor.
* If you change a property after the chart is initialized, you should call stockChart.validateNow() method
* in order for it to work. If there is no default value specified, default value of ChartCursor class will be used.
*/
export default class ChartCursorSettings {
/**
* Specifies if bullet for each graph will follow the cursor.
*/
bulletsEnabled: boolean;
/**
* Size of bullets, following the cursor.
*/
bulletSize: number;
/**
* Opacity of the category balloon.
*/
categoryBalloonAlpha: number;
/**
* Color of the category balloon.
*/
categoryBalloonColor: string;
/**
* Array of date format objects. Date format object must have "period" and "format" items.
* Available periods are:
* fff - millisecond,
* ss - second,
* mm - minute,
* hh - hour,
* DD - date,
* WW - week,
* MM - month,
* YYYY - year
* [
* {period:"YYYY", format:"YYYY"},
* {period:"MM", format:"MMM, YYYY"},
* {period:"WW", format:"MMM DD, YYYY"},
* {period:"DD", format:"MMM DD, YYYY"},
* {period:"hh", format:"JJ:NN"},
* {period:"mm", format:"JJ:NN"},
* {period:"ss", format:"JJ:NN:SS"},
* {period:"fff", format:"JJ:NN:SS"}
* ]
*/
categoryBalloonDateFormats: any[];
/**
* Specifies whether category balloon is enabled.
*/
categoryBalloonEnabled: boolean;
/**
* Opacity of the cursor line.
*/
cursorAlpha: number;
/**
* Color of the cursor line.
*/
cursorColor: string;
/**
* Possible values: "start", "middle" and "mouse".
*/
cursorPosition: string;
/**
* Set this to "false" if you don't want chart cursor to appear in your charts.
* @default true
*/
enabled: boolean;
/**
* If this is set to true, the user will be able to pan the chart instead of zooming.
*/
pan: boolean;
/**
* Specifies whether value balloons are enabled.
* In case they are not, the balloons might be displayed anyway, when the user rolls-over the column or bullet.
*/
valueBalloonsEnabled: boolean;
/**
* Specifies if the user can zoom-in the chart.
* If pan is set to true, zoomable is switched to false automatically.
*/
zoomable: boolean;
}
+121
View File
@@ -0,0 +1,121 @@
import AmGraph from "./AmGraph";
import CategoryAxis from "./CategoryAxis";
/**
* ChartScrollbar class displays chart scrollbar. Supported by AmSerialChart and AmXYChart.
* @example
* let chart = new AmCharts.AmSerialChart();
* let chartScrollbar = new AmCharts.ChartScrollbar();
* chart.addChartScrollbar(chartScrollbar);
*/
export default class ChartScrollbar {
/**
* Specifies whether number of gridCount is specified automatically, acoarding to the axis size.
*/
autoGridCount: boolean;
/**
* Background opacity.
* @default 1
*/
backgroundAlpha: number;
/**
* Background color of the scrollbar.
* @default #D4D4D4
*/
backgroundColor: string;
/**
* Read-only. Category axis of the scrollbar.
*/
categoryAxis: CategoryAxis;
/**
* Text color. Will use chart's color if not set.
*/
color: string;
/**
* Specifies which graph will be displayed in the scrollbar. Only Serial chart's scrollbar can display a graph.
*/
graph: AmGraph;
/**
* Graph fill opacity. Value range is 0 - 1. 0.1
*/
graphFillAlpha: number;
/**
* Graph fill color. #000000
*/
graphFillColor: string;
/**
* Graph line opacity. Value range is 0 - 1.
*/
graphLineAlpha: number;
/**
* Graph line color. #000000
*/
graphLineColor: string;
/**
* By default the graph type is the same as the original graph's type,
* however in case of "candlestick" or "ohlc" you might want to show line graph in the scrollbar.
* Possible values are: "line", "column", "step", "smoothedLine", "candlestick", "ohlc".
*/
graphType: string;
/**
* Grid opacity. Value range is 0 - 1. 0.7
*/
gridAlpha: number;
/**
* Grid color. #FFFFFF
*/
gridColor: string;
/**
* The number of grid lines.
*/
gridCount: number;
/**
* Specifies whether resize grips are hidden when mouse is away from the scrollbar.
*/
hideResizeGrips: boolean;
/**
* Specifies whether scrollbar has a resize feature.
* @default true
*/
resizeEnabled: boolean;
/**
* Height (width, if chart is rotated) of a scrollbar.
* @default 20
*/
scrollbarHeight: number;
/**
* Duration of scrolling, when the user clicks on scrollbar's background, in seconds.
* @default 2
*/
scrollDuration: number;
/**
* Selected backround opacity.
* @default 1
*/
selectedBackgroundAlpha: number;
/**
* Selected background color. #EFEFEF
*/
selectedBackgroundColor: string;
/**
* Selected graph's fill opacity. Value range is 0 - 1. 0.5
*/
selectedGraphFillAlpha: number;
/**
* Selected graph's fill color. #000000
*/
selectedGraphFillColor: string;
/**
* Selected graph's line opacity. Value range is 0 - 1.
*/
selectedGraphLineAlpha: number;
/**
* Selected graph's line color. #000000
*/
selectedGraphLineColor: string;
/**
* Specifies if the chart should be updated while dragging/resizing the scrollbar or only at the moment
* when user releases mouse button.
*/
updateOnReleaseOnly: boolean;
}
+117
View File
@@ -0,0 +1,117 @@
import AmGraph from "./AmGraph";
/**
* ChartScrollbarSettings settings set's settings for chart scrollbar.
* If you change a property after the chart is initialized, you should call stockChart.validateNow() method in
* order for it to work. If there is no default value specified, default value of ChartScrollbar class will be used.
*/
export default class ChartScrollbarSettings {
/**
* Specifies whether number of gridCount is specified automatically, according to the axis size.
* @default true
*/
autoGridCount: boolean;
/**
* Background opacity.
*/
backgroundAlpha: number;
/**
* Background color of the scrollbar.
*/
backgroundColor: string;
/**
* Text color.
*/
color: string;
/**
* Set false if you don't need scrollbar.
* @default true
*/
enabled: boolean;
/**
* Font size.
*/
fontSize: string;
/**
* Specifies which graph will be displayed in the scrollbar.
*/
graph: AmGraph;
/**
* Graph fill opacity.
*/
graphFillAlpha: number;
/**
* Graph fill color.
*/
graphFillColor: string;
/**
* Graph line opacity.
*/
graphLineAlpha: number;
/**
* Graph line color.
*/
graphLineColor: string;
/**
* Type of chart scrollbar's graph.
* By default the graph type is the same as the original graph's type, however in case of "candlestick" or
* "ohlc" you might want to show line graph in the scrollbar.
* Possible values are: line, column, step, smoothedLine, candlestick, ohlc.
*/
graphType: string;
/**
* Grid opacity.
*/
gridAlpha: number;
/**
* Grid color.
*/
gridColor: string;
/**
* Grid count. You should set autoGridCount to false in order this property to work.
*/
gridCount: number;
/**
* Height of scrollbar, in pixels.
* @default 40
*/
height: number;
/**
* Specifies whether resize grips are hidden when mouse is away from the scrollbar.
*/
hideResizeGrips: boolean;
/**
* Duration of scrolling, when the user clicks on scrollbar's background, in seconds.
*/
scrollDuration: number;
/**
* Selected background opacity.
*/
selectedBackgroundAlpha: number;
/**
* Selected background color.
*/
selectedBackgroundColor: string;
/**
* Selected graph'sfill opacity.
*/
selectedGraphFillAlpha: number;
/**
* Selected graph'sfill color.
*/
selectedGraphFillColor: string;
/**
* Selected graph'sline opacity.
*/
selectedGraphLineAlpha: number;
/**
* Selected graph's line color.
*/
selectedGraphLineColor: string;
/**
* Specifies if the chart should be updated while dragging/resizing the scrollbar or only at the moment when
* user releases mouse button. Usefull when working with large data sets.
* @default true
*/
updateOnReleaseOnly: boolean;
}
+50
View File
@@ -0,0 +1,50 @@
import StockEvent from "./StockEvent";
/**
* DataSet is objects which holds all information about data.
*/
export default class DataSet {
/**
* Category field name in your dataProvider.
*/
categoryField: string;
/**
* Color of the data set. One of colors from AmStockChart.colors array will be used if not set.
*/
color: string;
/**
* Whether this data set is selected for comparing.
* If you change this property, you should call stockChart.validateData() method
* in order the changes to be applied.
*/
compared: boolean;
/**
* Data provider of the data set.
*/
dataProvider: any[];
/**
* Array of field mappings. Field mapping is an object with fromField and toField properties.
* fromField is a name of your value field in dataProvider.
* toField might be chosen freely, it will be used to set value/open/close/high/low fields for the StockGraph.
* Example: {fromField:"val1", toField:"value"}.
*/
fieldMappings: any[];
/**
* Specifies whether this data set should be visible in "compare to" list.
* @default true
*/
showInCompare: boolean;
/**
* Specifies whether this data set should be visible in "select" dropdown.
* @default true
*/
showInSelect: boolean;
/**
* Array of StockEvent objects.
*/
stockEvents: StockEvent[];
/**
* DataSet title.
*/
title: string;
}

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