Merge remote-tracking branch 'refs/remotes/DefinitelyTyped/master' into lkay/redux-auth=wrapper-update

This commit is contained in:
Karol Janyst
2017-08-19 15:01:20 +09:00
17860 changed files with 645185 additions and 588848 deletions
-20
View File
@@ -1,22 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
@@ -1,25 +1,23 @@
Please fill in this template.
- [ ] Make your PR against the `master` branch.
- [ ] Use a meaningful title for the pull request. Include the name of the package modified.
- [ ] Test the change in your own code. (Compile and run.)
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).
- [ ] Run `tsc` without errors.
- [ ] Run `npm run lint package-name` if a `tslint.json` is present.
- [ ] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present).
Select one of these and delete the others:
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 `npm run new-package package-name`, not by basing it on an existing project.
- [ ] 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`.
If changing an existing definition:
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
- [ ] Increase the version number in the header if appropriate.
- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "../tslint.json" }`.
- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dslint/dt.json" }`.
If removing a declaration:
- [ ] If a package was never on DefinitelyTyped, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.)
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 6.9.2
- node
sudo: false
-1
View File
@@ -1 +0,0 @@
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) at [definitelytyped.org](http://definitelytyped.org/guides/contributing.html) for information on how to contribute to DefinitelyTyped.
-1893
View File
File diff suppressed because it is too large Load Diff
+29 -22
View File
@@ -71,7 +71,9 @@ Add to your `tsconfig.json`:
Create `types/foo/index.d.ts` containing declarations for the module "foo".
You should now be able import from `"foo"` in your code and it will route to the new type definition.
Then build *and* run the code to make sure your type definition actually corresponds to what happens at runtime.
Once you've tested your definitions with real code, make a PR contributing the definition by copying `types/foo` to `DefinitelyTyped/foo` and adding a `tsconfig.json` and `foo-tests.ts`.
Once you've tested your definitions with real code, make a [PR](#make-a-pull-request)
then follow the instructions to [edit an existing package](#edit-an-existing-package) or
[create a new package](#create-a-new-package).
### Make a pull request
@@ -83,7 +85,7 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in
#### Edit an existing package
* `cd my-package-to-edit`
* `cd types/my-package-to-edit`
* Make changes. Remember to edit tests.
* You may also want to add yourself to "Definitions by" section of the package header.
- Do this by adding your name to the end of the line, as in `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
@@ -110,15 +112,14 @@ Your package should have this structure:
| tsconfig.json | This allows you to run `tsc` within the package. |
| tslint.json | Enables linting. |
Generate these by running `npm run new-package -- --name my-package-name --template module`.
(Other templates are `module-class`, `module-function`, `module-plugin`, `global`, `global-plugin`, and `global-modifying-module`.
This just wraps [dts-gen](https://github.com/Microsoft/dts-gen), so it supports all options from that.)
Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`.
See all options at [dts-gen](https://github.com/Microsoft/dts-gen).
You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option.
DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/base64-js).
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js).
#### Common mistakes
@@ -154,22 +155,24 @@ If a package was never on DefinitelyTyped, it does not need to be added to `notN
#### Lint
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "../tslint.json" }`. All new packages must be linted.
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "dtslint/dt.json" }`. All new packages must be linted.
If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
```json
```js
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
// This package uses the Function type, and it will take effort to fix.
"forbidden-types": false
"ban-types": false
}
}
```
(To indicate that a lint rule truly does not apply, use `// tslint:disable:rule-name` or better, `//tslint:disable-next-line:rule-name`.)
(To indicate that a lint rule truly does not apply, use `// tslint:disable rule-name` or better, `//tslint:disable-next-line rule-name`.)
Test by running `npm run lint package-name` where `package-name` is the name of your package.
This script uses [dtslint](https://github.com/Microsoft/dtslint).
Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint.
## FAQ
@@ -183,15 +186,10 @@ This usually happens within an hour of changes being merged.
If the module you're referencing is an external module (uses `export`), use an import.
If the module you're referencing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
#### What do I do about older versions of typings?
Currently we don't support this, though it is [planned](https://github.com/Microsoft/types-publisher/issues/3).
If you're adding a new major version of a library, you can copy `index.d.ts` to `foo-v2.3.d.ts` and edit `index.d.ts` to be the new version.
#### I notice some packages having a `package.json` here.
Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it.
A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/pikaday/package.json).
A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json).
We do not allow other fields, such as `"description"`, to be defined manually.
Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json.
@@ -213,7 +211,7 @@ If default imports work in your environment, consider turning on the [`--allowSy
Do not change the type definition if it is accurate.
For an NPM package, `export =` is accurate if `node -p 'require("foo")'` is the export, and `export default` is accurate if `node -p 'require("foo").default'` is the export.
#### I want to use features from TypeScript 2.1.
#### I want to use features from TypeScript 2.1 or above.
Then you will have to add a comment to the last line of your definition header (after `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`.
@@ -231,7 +229,7 @@ Before making your change, please create a new subfolder with the current versio
1. Update the relative paths in `tsconfig.json` as well as `tslint.json`.
2. Add path mapping rules to ensure that tests are running against the intended version.
For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/history/v2/tsconfig.json) looks like:
For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) looks like:
```json
{
@@ -250,11 +248,20 @@ For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi
```
Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*.
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`;
transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router-bootstrap/tsconfig.json).
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`;
transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json).
Also, `/// <reference types=".." />` will not work with path mapping, so dependencies must use `import`.
#### What about scoped packages?
Types for a scoped package `@foo/bar` should go in `types/foo__bar`. Note the double underscore.
#### The file history in GitHub looks incomplete.
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.
## License
-473
View File
@@ -1,473 +0,0 @@
// Type definitions for Ably Realtime and Rest client library 0.9
// Project: https://www.ably.io/
// Definitions by: Ably <https://github.com/ably/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace ablyLib {
namespace ChannelState {
type INITIALIZED = 'initialized';
type ATTACHING = 'attaching';
type ATTACHED = "attached";
type DETACHING = "detaching";
type DETACHED = "detached";
type SUSPENDED = "suspended";
type FAILED = "failed";
}
type ChannelState = ChannelState.FAILED | ChannelState.INITIALIZED | ChannelState.SUSPENDED | ChannelState.ATTACHED | ChannelState.ATTACHING | ChannelState.DETACHED | ChannelState.DETACHING;
namespace ConnectionState {
type INITIALIZED = "initialized";
type CONNECTING = "connecting";
type CONNECTED = "connected";
type DISCONNECTED = "disconnected";
type SUSPENDED = "suspended";
type CLOSING = "closing";
type CLOSED = "closed";
type FAILED = "failed";
}
type ConnectionState = ConnectionState.INITIALIZED | ConnectionState.CONNECTED | ConnectionState.CONNECTING | ConnectionState.DISCONNECTED |
ConnectionState.SUSPENDED | ConnectionState.CLOSED | ConnectionState.CLOSING | ConnectionState.FAILED;
namespace ConnectionEvent {
type INITIALIZED = "initialized";
type CONNECTING = "connecting";
type CONNECTED = "connected";
type DISCONNECTED = "disconnected";
type SUSPENDED = "suspended";
type CLOSING = "closing";
type CLOSED = "closed";
type FAILED = "failed";
type UPDATE = "update";
}
type ConnectionEvent = ConnectionEvent.INITIALIZED | ConnectionEvent.CONNECTED | ConnectionEvent.CONNECTING | ConnectionEvent.DISCONNECTED |
ConnectionEvent.SUSPENDED | ConnectionEvent.CLOSED | ConnectionEvent.CLOSING | ConnectionEvent.FAILED | ConnectionEvent.UPDATE;
namespace PresenceAction {
type ABSENT = "absent";
type PRESENT = "present";
type ENTER = "enter";
type LEAVE = "leave";
type UPDATE = "update";
}
type PresenceAction = PresenceAction.ABSENT | PresenceAction.PRESENT | PresenceAction.ENTER | PresenceAction.LEAVE | PresenceAction.UPDATE;
namespace StatsIntervalGranularity {
type MINUTE = "minute";
type HOUR = "hour";
type DAY = "day";
type MONTH = "month";
}
type StatsIntervalGranularity = StatsIntervalGranularity.MINUTE | StatsIntervalGranularity.HOUR | StatsIntervalGranularity.DAY | StatsIntervalGranularity.MONTH;
namespace HTTPMethods {
type POST = "POST";
type GET = "GET";
}
type HTTPMethods = HTTPMethods.GET | HTTPMethods.POST;
// Interfaces
interface ClientOptions extends AuthOptions {
/**
* When true will automatically connect to Ably when library is instanced. This is true by default
*/
autoConnect?: boolean;
/**
* Optional clientId that can be used to specify the identity for this client. In most cases
* it is preferable to instead specift a clientId in the token issued to this client.
*/
clientId?: string;
defaultTokenParams?: TokenParams;
/**
* When true, messages published on channels by this client will be echoed back to this client.
* This is true by default
*/
echoMessages?: boolean;
/**
* Use this only if you have been provided a dedicated environment by Ably
*/
environment?: string;
/**
* Logger configuration
*/
log?: LogInfo;
port?: number;
/**
* When true, messages will be queued whilst the connection is disconnected. True by default.
*/
queueMessages?: boolean;
restHost?: string;
realtimeHost?: string;
fallbackHosts?: string[];
/**
* Can be used to explicitly recover a connection.
* See https://www.ably.io/documentation/realtime/connection#connection-state-recovery
*/
recover?: standardCallback | string;
/**
* Use a non-secure connection connection. By default, a TLS connection is used to connect to Ably
*/
tls?: boolean;
tlsPort?: number;
/**
* When true, the more efficient MsgPack binary encoding is used.
* When false, JSON text encoding is used.
*/
useBinaryProtocol?: boolean;
}
interface AuthOptions {
/**
* A function which is called when a new token is required.
* The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically
* by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object.
**/
authCallback?: (data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void) => void;
authHeaders?: { [index: string]: string };
authMethod?: HTTPMethods;
authParams?: { [index: string]: string };
/**
* A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format).
**/
authUrl?: string;
key?: string;
queryTime?: boolean;
token?: TokenDetails | string;
tokenDetails?: TokenDetails;
useTokenAuth?: boolean;
}
interface TokenParams {
capability?: string;
clientId?: string;
nonce?: string;
timestamp?: number;
ttl?: number;
}
interface CipherParams {
algorithm: string;
key: any;
keyLength: number;
mode: string;
}
interface ErrorInfo {
code: number;
message: string;
statusCode: number;
}
interface StatsMessageCount {
count: number;
data: number;
}
interface StatsMessageTypes {
all: StatsMessageCount;
messages: StatsMessageCount;
presence: StatsMessageCount;
}
interface StatsRequestCount {
failed: number;
refused: number;
succeeded: number;
}
interface StatsResourceCount {
mean: number;
min: number;
opened: number;
peak: number;
refused: number;
}
interface StatsConnectionTypes {
all: StatsResourceCount;
plain: StatsResourceCount;
tls: StatsResourceCount;
}
interface StatsMessageTraffic {
all: StatsMessageTypes;
realtime: StatsMessageTypes;
rest: StatsMessageTypes;
webhook: StatsMessageTypes;
}
interface TokenDetails {
capability: string;
clientId?: string;
expires: number;
issued: number;
token: string;
}
interface TokenRequest {
capability: string;
clientId?: string;
keyName: string;
mac: string;
nonce: string;
timestamp: number;
ttl?: number;
}
interface ChannelOptions {
cipher: any;
}
interface RestPresenceHistoryParams {
start?: number;
end?: number;
direction?: string;
limit?: number;
}
interface RestPresenceParams {
limit?: number;
clientId?: string;
connectionId?: string;
}
interface RealtimePresenceParams {
waitForSync?: boolean;
clientId?: string;
connectionId?: string;
}
interface RealtimePresenceHistoryParams {
start?: number;
end?: number;
direction?: string;
limit?: number;
untilAttach?: boolean;
}
interface LogInfo {
/**
* A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only),
* 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output).
**/
level?: number;
/**
* A function to handle each line of log output. If handler is not specified, console.log is used.
**/
handler?: (...args: any[]) => void;
}
interface ChannelEvent {
state: ChannelState;
}
interface ChannelStateChange {
current: ChannelState;
previous: ChannelState;
reason?: ErrorInfo;
resumed: boolean;
}
interface ConnectionStateChange {
current: ConnectionState;
previous: ConnectionState;
reason?: ErrorInfo;
retryIn?: number;
}
// Common Listeners
type paginatedResultCallback<T> = (error: ErrorInfo, results: PaginatedResult<T> ) => void;
type standardCallback = (error: ErrorInfo, results: any) => void;
type messageCallback<T> = (message: T) => void;
type errorCallback = (error: ErrorInfo) => void;
type channelEventCallback = (channelEvent: ChannelEvent, changeStateChange: ChannelStateChange) => void;
type connectionEventCallback = (connectionEvent: ConnectionEvent, connectionStateChange: ConnectionStateChange) => void;
type timeCallback = (error: ErrorInfo, time: number) => void;
type realtimePresenceGetCallback = (error: ErrorInfo, messages: PresenceMessage[]) => void;
type tokenDetailsCallback = (error: ErrorInfo, Results: TokenDetails) => void;
type tokenRequestCallback = (error: ErrorInfo, Results: TokenRequest) => void;
type fromEncoded<T> = (JsonObject: any, channelOptions?: ChannelOptions) => T;
type fromEncodedArray<T> = (JsonArray: any[], channelOptions?: ChannelOptions) => T[];
// Internal Classes
class EventEmitter<T> {
on: (eventOrCallback: string | T, callback?: T) => void;
once: (eventOrCallback: string | T, callback?: T) => void;
off: (eventOrCallback?: string | T, callback?: T) => void;
}
// Classes
class Auth {
clientId: string;
authorize: (tokenParams?: TokenParams | tokenDetailsCallback, authOptions?: AuthOptions | tokenDetailsCallback, callback?: tokenDetailsCallback) => void;
createTokenRequest: (tokenParams?: TokenParams | tokenRequestCallback, authOptions?: AuthOptions | tokenRequestCallback, callback?: tokenRequestCallback) => void;
requestToken: (TokenParams?: TokenParams | tokenDetailsCallback, authOptions?: AuthOptions | tokenDetailsCallback, callback?: tokenDetailsCallback) => void;
}
class Presence {
get: (params: RestPresenceParams | paginatedResultCallback<PresenceMessage>, callback?: paginatedResultCallback<PresenceMessage>) => void;
history: (params: RestPresenceHistoryParams | paginatedResultCallback<PresenceMessage>, callback?: paginatedResultCallback<PresenceMessage>) => void;
}
class RealtimePresence {
syncComplete: () => boolean;
get: (Params: realtimePresenceGetCallback | RealtimePresenceParams, callback?: realtimePresenceGetCallback) => void;
history: (ParamsOrCallback: RealtimePresenceHistoryParams | paginatedResultCallback<PresenceMessage>, callback?: paginatedResultCallback<PresenceMessage>) => void;
subscribe: (presenceOrCallback: PresenceAction | messageCallback<PresenceMessage>, listener?: messageCallback<PresenceMessage>) => void;
unsubscribe: (presence?: PresenceAction, listener?: messageCallback<PresenceMessage>) => void;
enter: (data?: errorCallback | any, callback?: errorCallback) => void;
update: (data?: errorCallback | any, callback?: errorCallback) => void;
leave: (data?: errorCallback | any, callback?: errorCallback) => void;
enterClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void;
updateClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void;
leaveClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void;
}
class Channel {
name: string;
presence: Presence;
history: (paramsOrCallback?: RestPresenceHistoryParams | paginatedResultCallback<Message>, callback?: paginatedResultCallback<Message>) => void;
publish: (messagesOrName: any, messagedataOrCallback?: errorCallback | any, callback?: errorCallback) => void;
}
class RealtimeChannel extends EventEmitter<channelEventCallback> {
name: string;
errorReason: ErrorInfo;
state: ChannelState;
presence: RealtimePresence;
attach: (callback?: standardCallback) => void;
detach: (callback?: standardCallback) => void;
history: (paramsOrCallback?: RealtimePresenceHistoryParams | paginatedResultCallback<Message>, callback?: paginatedResultCallback<Message>) => void;
subscribe: (eventOrCallback: messageCallback<Message> | string, listener?: messageCallback<Message>) => void;
unsubscribe: (eventOrCallback?: messageCallback<Message> | string, listener?: messageCallback<Message>) => void;
publish: (messagesOrName: any, messageDataOrCallback?: errorCallback | any, callback?: errorCallback) => void;
setOptions: (options: any, callback?: errorCallback) => void;
}
class Channels<T> {
get: (name: string, channelOptions?: ChannelOptions) => T;
release: (name: string) => void;
}
class Message {
constructor();
static fromEncoded: fromEncoded<Message>;
static fromEncodedArray: fromEncodedArray<Message>;
clientId: string;
connectionId: string;
data: any;
encoding: string;
extras: any;
id: string;
name: string;
timestamp: number;
}
interface MessageStatic {
fromEncoded: fromEncoded<Message>;
fromEncodedArray: fromEncodedArray<Message>;
}
class PresenceMessage {
constructor();
static fromEncoded: fromEncoded<PresenceMessage>;
static fromEncodedArray: fromEncodedArray<PresenceMessage>;
action: PresenceAction;
clientId: string;
connectionId: string;
data: any;
encoding: string;
id: string;
timestamp: number;
}
interface PresenceMessageStatic {
fromEncoded: fromEncoded<PresenceMessage>;
fromEncodedArray: fromEncodedArray<PresenceMessage>;
}
interface Crypto {
generateRandomKey: (callback: (error: ErrorInfo, key: string) => void) => void;
}
class Connection extends EventEmitter<connectionEventCallback> {
errorReason: ErrorInfo;
id: string;
key: string;
recoveryKey: string;
serial: number;
state: ConnectionState;
close: () => void;
connect: () => void;
ping: (callback?: (error: ErrorInfo, responseTime: number ) => void ) => void;
}
class Stats {
all: StatsMessageTypes;
apiRequests: StatsRequestCount;
channels: StatsResourceCount;
connections: StatsConnectionTypes;
inbound: StatsMessageTraffic;
intervalId: string;
outbound: StatsMessageTraffic;
persisted: StatsMessageTypes;
tokenRequests: StatsRequestCount;
}
class PaginatedResult<T> {
items: T[];
first: (results: paginatedResultCallback<T>) => void;
next: (results: paginatedResultCallback<T>) => void;
current: (results: paginatedResultCallback<T>) => void;
hasNext: () => boolean;
isLast: () => boolean;
}
class HttpPaginatedResponse extends PaginatedResult<any> {
items: string[];
statusCode: number;
success: boolean;
errorCode: number;
errorMessage: string;
headers: any;
}
}
export declare class Rest {
constructor(options: ablyLib.ClientOptions | string);
static Crypto: ablyLib.Crypto;
static Message: ablyLib.MessageStatic;
static PresenceMessage: ablyLib.PresenceMessageStatic;
auth: ablyLib.Auth;
channels: ablyLib.Channels<ablyLib.Channel>;
request: (method: string, path: string, params?: any, body?: any[] | any, headers?: any, callback?: (error: ablyLib.ErrorInfo, response: ablyLib.HttpPaginatedResponse) => void) => void;
stats: (paramsOrCallback?: ablyLib.paginatedResultCallback<ablyLib.Stats> | any, callback?: ablyLib.paginatedResultCallback<ablyLib.Stats>) => void;
time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void;
}
export declare class Realtime {
constructor(options: ablyLib.ClientOptions | string);
static Crypto: ablyLib.Crypto;
static Message: ablyLib.MessageStatic;
static PresenceMessage: ablyLib.PresenceMessageStatic;
auth: ablyLib.Auth;
channels: ablyLib.Channels<ablyLib.RealtimeChannel>;
clientId: string;
connection: ablyLib.Connection;
request: (method: string, path: string, params?: any, body?: any[] | any, headers?: any, callback?: (error: ablyLib.ErrorInfo, response: ablyLib.HttpPaginatedResponse) => void) => void;
stats: (paramsOrCallback?: ablyLib.paginatedResultCallback<ablyLib.Stats> | any, callback?: ablyLib.paginatedResultCallback<ablyLib.Stats>) => void;
close: () => void;
connect: () => void;
time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void;
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-62
View File
@@ -1,62 +0,0 @@
// Type definitions for accepts 1.3
// Project: https://github.com/jshttp/accepts
// Definitions by: Stefan Reichel <https://github.com/bomret>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace accepts {
export interface Headers {
[key: string]: string | string[];
}
export interface Accepts {
/**
* Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned.
*/
charset(charsets: string[]): string | false;
charset(...charsets: string[]): string | false;
/**
* Return the charsets that the request accepts, in the order of the client's preference (most preferred first).
*/
charsets(): string[];
/**
* Return the first accepted encoding. If nothing in `encodings` is accepted, then `false` is returned.
*/
encoding(encodings: string[]): string | false;
encoding(...encodings: string[]): string | false;
/**
* Return the encodings that the request accepts, in the order of the client's preference (most preferred first).
*/
encodings(): string[];
/**
* Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned.
*/
language(languages: string[]): string | false;
language(...languages: string[]): string | false;
/**
* Return the languages that the request accepts, in the order of the client's preference (most preferred first).
*/
languages(): string[];
/**
* Return the first accepted type (and it is returned as the same text as what appears in the `types` array). If nothing in `types` is accepted, then `false` is returned.
*
* The `types` array can contain full MIME types or file extensions. Any value that is not a full MIME types is passed to `require('mime-types').lookup`.
*/
type(types: string[]): string | false;
type(...types: string[]): string | false;
/**
* Return the types that the request accepts, in the order of the client's preference (most preferred first).
*/
types(): string[];
}
}
declare function accepts(req: { headers: accepts.Headers }): accepts.Accepts;
export = accepts;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-261
View File
@@ -1,261 +0,0 @@
// Type definitions for Acorn v4.0.3
// 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';
declare namespace acorn {
interface PlainObject {
[name: string]: any;
}
interface PluginsObject {
[name: string]: (p: Parser, config: any) => void;
}
interface Options {
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 2015 | 2016 | 2017;
sourceType?: 'script' | 'module';
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => void;
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => void;
allowReserved?: boolean;
allowReturnOutsideFunction?: boolean;
allowImportExportEverywhere?: boolean;
allowHashBang?: boolean;
locations?: boolean;
onToken?: ((token: Token) => any) | Token[];
onComment?: ((
isBlock: boolean, text: string, start: number, end: number, startLoc?: ESTree.Position,
endLoc?: ESTree.Position
) => void) | Comment[];
ranges?: boolean;
program?: ESTree.Program;
sourceFile?: string;
directSourceFile?: string;
preserveParens?: boolean;
plugins?: PlainObject;
}
class Parser {
constructor(options: Options, input: string, startPos?: number);
parse(): ESTree.Program;
}
const plugins: PluginsObject;
const defaultOptions: Options;
class Position implements ESTree.Position {
line: number;
column: number;
constructor(line: number, col: number);
offset(n: number): Position;
}
class SourceLocation implements ESTree.SourceLocation {
start: Position;
end: Position;
source?: string;
constructor(p: Parser, start: Position, end: Position);
}
function getLineInfo(input: string, offset: number): ESTree.Position;
class Node {
type: string;
start: number;
end: number;
loc?: ESTree.SourceLocation;
sourceFile?: string;
range?: [number, number];
constructor(parser: Parser, pos: number, loc: number);
}
interface TokeTypeConfig {
keyword: string;
beforeExpr?: boolean;
startsExpr?: boolean;
isLoop?: boolean;
isAssign?: boolean;
prefix?: boolean;
postfix?: boolean;
binop?: number;
}
class TokenType {
label: string;
keyword: string;
beforeExpr: boolean;
startsExpr: boolean;
isLoop: boolean;
isAssign: boolean;
prefix: boolean;
postfix: boolean;
binop: number;
updateContext: (prevType: TokenType) => void;
constructor(label: string, conf?: TokeTypeConfig);
}
const tokTypes: {
num: TokenType;
regexp: TokenType;
string: TokenType;
name: TokenType;
eof: TokenType;
bracketL: TokenType;
bracketR: TokenType;
braceL: TokenType;
braceR: TokenType;
parenL: TokenType;
parenR: TokenType;
comma: TokenType;
semi: TokenType;
colon: TokenType;
dot: TokenType;
question: TokenType;
arrow: TokenType;
template: TokenType;
ellipsis: TokenType;
backQuote: TokenType;
dollarBraceL: TokenType;
eq: TokenType;
assign: TokenType;
incDec: TokenType;
prefix: TokenType;
logicalOR: TokenType;
logicalAND: TokenType;
bitwiseOR: TokenType;
bitwiseXOR: TokenType;
bitwiseAND: TokenType;
equality: TokenType;
relational: TokenType;
bitShift: TokenType;
plusMin: TokenType;
modulo: TokenType;
star: TokenType;
slash: TokenType;
starstar: TokenType;
_break: TokenType;
_case: TokenType;
_catch: TokenType;
_continue: TokenType;
_debugger: TokenType;
_default: TokenType;
_do: TokenType;
_else: TokenType;
_finally: TokenType;
_for: TokenType;
_function: TokenType;
_if: TokenType;
_return: TokenType;
_switch: TokenType;
_throw: TokenType;
_try: TokenType;
_var: TokenType;
_const: TokenType;
_while: TokenType;
_with: TokenType;
_new: TokenType;
_this: TokenType;
_super: TokenType;
_class: TokenType;
_extends: TokenType;
_export: TokenType;
_import: TokenType;
_null: TokenType;
_true: TokenType;
_false: TokenType;
_in: TokenType;
_instanceof: TokenType;
_typeof: TokenType;
_void: TokenType;
_delete: TokenType;
}
class TokContext {
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override: (p: Parser) => void);
}
const tokContexts: {
b_stat: TokContext;
b_expr: TokContext;
b_tmpl: TokContext;
p_stat: TokContext;
p_expr: TokContext;
q_tmpl: TokContext;
f_expr: TokContext;
};
function isIdentifierStart(code: number, astral?: boolean): boolean;
function isIdentifierChar(code: number, astral?: boolean): boolean;
interface AbstractToken {
start: number;
end: number;
loc?: SourceLocation;
range?: [number, number];
}
interface Comment extends AbstractToken {
type: string;
value: string;
}
class Token {
constructor(p: Parser);
}
interface Token extends AbstractToken {
type: TokenType;
value: any;
}
function isNewLine(code: number): boolean;
const lineBreak: RegExp;
const lineBreakG: RegExp;
const version: string;
interface 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>
}
function tokenizer(input: string, options: Options): ITokenizer;
let parse_dammit: IParse | undefined;
let LooseParser: ILooseParserClass | undefined;
let pluginsLoose: PluginsObject | undefined;
interface ILooseParserClass {
new (input: string, options?: Options): ILooseParser
}
interface ILooseParser {
}
function addLooseExports(parse: IParse, parser: ILooseParserClass, plugins: PluginsObject): void;
}
-174
View File
@@ -1,174 +0,0 @@
// Type definitions for ADAL.JS 1.0.13
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
// Definitions by: mmaitre314 <https://github.com/mmaitre314>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var AuthenticationContext: adal.AuthenticationContextStatic;
declare var Logging: adal.Logging;
declare module 'adal' {
export = { AuthenticationContext, 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;
}
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;
}
}
-167
View File
@@ -1,167 +0,0 @@
// Type definitions for Alt 0.16.10
// Project: https://github.com/goatslacker/alt
// Definitions by: Michael Shearer <https://github.com/Shearerbeard>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
///<reference types="react"/>
declare namespace AltJS {
interface StoreReduce {
action:any;
data: any;
}
export interface StoreModel<S> {
//Actions
bindAction?( action:Action<any>, handler:ActionHandler):void;
bindActions?(actions:ActionsClass):void;
//Methods/Listeners
exportPublicMethods?(exportConfig:any):void;
bindListeners?(config:{[methodName:string]:Action<any> | Actions}):void;
exportAsync?(source:Source):void;
registerAsync?(datasource:Source):void;
//state
setState?(state:S):void;
setState?(stateFn:(currentState:S, nextState:S) => S):void;
getState?():S;
waitFor?(store:AltStore<any>):void;
//events
onSerialize?(fn:(data:any) => any):void;
onDeserialize?(fn:(data:any) => any):void;
on?(event:AltJS.lifeCycleEvents, callback:() => any):void;
emitChange?():void;
waitFor?(storeOrStores:AltStore<any> | Array<AltStore<any>>):void;
otherwise?(data:any, action:AltJS.Action<any>):void;
observe?(alt:Alt):any;
reduce?(state:any, config:StoreReduce):Object;
preventDefault?():void;
afterEach?(payload:Object, state:Object):void;
beforeEach?(payload:Object, state:Object):void;
// TODO: Embed dispatcher interface in def
dispatcher?:any;
//instance
getInstance?():AltJS.AltStore<S>;
alt?:Alt;
displayName?:string;
}
export type Source = {[name:string]: () => SourceModel<any>};
export interface SourceModel<S> {
local(state:any, ...args: any[]):any;
remote(state:any, ...args: any[]):Promise<S>;
shouldFetch?(fetchFn:(...args:Array<any>) => boolean):void;
loading?:(args:any) => void;
success?:(state:S) => void;
error?:(args:any) => void;
interceptResponse?(response:any, action:Action<any>, ...args:Array<any>):any;
}
export interface AltStore<S> {
getState():S;
listen(handler:(state:S) => any):() => void;
unlisten(handler:(state:S) => any):void;
emitChange():void;
}
export enum lifeCycleEvents {
bootstrap,
snapshot,
init,
rollback,
error
}
export type Actions = {[action:string]:Action<any>};
export interface Action<T> {
( args:T):void;
defer(data:any):void;
}
export interface ActionsClass {
generateActions?( ...action:Array<string>):void;
dispatch( ...payload:Array<any>):void;
actions?:Actions;
}
type StateTransform = (store:StoreModel<any>) => AltJS.AltStore<any>;
interface AltConfig {
dispatcher?:any;
serialize?:(serializeFn:(data:Object) => string) => void;
deserialize?:(deserializeFn:(serialData:string) => Object) => void;
storeTransforms?:Array<StateTransform>;
batchingFunction?:(callback:( ...data:Array<any>) => any) => void;
}
class Alt {
constructor(config?:AltConfig);
actions:Actions;
bootstrap(jsonData:string):void;
takeSnapshot( ...storeNames:Array<string>):string;
flush():Object;
recycle( ...stores:Array<AltJS.AltStore<any>>):void;
rollback():void;
dispatch(action?:AltJS.Action<any>, data?:Object, details?:any):void;
//Actions methods
addActions(actionsName:string, ActionsClass: ActionsClassConstructor):void;
createActions<T>(ActionsClass: ActionsClassConstructor, exportObj?: Object):T;
createActions<T>(ActionsClass: ActionsClassConstructor, exportObj?: Object, ...constructorArgs:Array<any>):T;
generateActions<T>( ...actions:Array<string>):T;
getActions(actionsName:string):AltJS.Actions;
//Stores methods
addStore(name:string, store:StoreModel<any>, saveStore?:boolean):void;
createStore<S>(store:StoreModel<S>, name?:string):AltJS.AltStore<S>;
getStore(name:string):AltJS.AltStore<any>;
}
export interface AltFactory {
new(config?:AltConfig):Alt;
}
type ActionsClassConstructor = new (alt:Alt) => AltJS.ActionsClass;
type ActionHandler = ( ...data:Array<any>) => any;
type ExportConfig = {[key:string]:(...args:Array<any>) => any};
}
declare module "alt/utils/chromeDebug" {
function chromeDebug(alt:AltJS.Alt):void;
export = chromeDebug;
}
declare module "alt/AltContainer" {
import React = require("react");
interface ContainerProps {
store?:AltJS.AltStore<any>;
stores?:Array<AltJS.AltStore<any>>;
inject?:{[key:string]:any};
actions?:{[key:string]:Object};
render?:(...props:Array<any>) => React.ReactElement<any>;
flux?:AltJS.Alt;
transform?:(store:AltJS.AltStore<any>, actions:any) => any;
shouldComponentUpdate?:(props:any) => boolean;
component?:React.Component<any, any>;
}
type AltContainer = React.ReactElement<ContainerProps>;
var AltContainer:React.ComponentClass<ContainerProps>;
export = AltContainer;
}
declare module "alt" {
var alt:AltJS.AltFactory;
export = alt;
}
-6
View File
@@ -1,6 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"forbidden-types": false
}
}
-179
View File
@@ -1,179 +0,0 @@
// Type definitions for AmplifyJs 1.1
// Project: http://amplifyjs.com/
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
declare namespace amplify {
interface RequestSettings {
resourceId: string;
data?: any;
success?: (...args: any[]) => void;
error?: (...args: any[]) => void;
}
type Decoder =
(
data?: any,
status?: string,
xhr?: JQueryXHR,
success?: (...args: any[]) => void,
error?: (...args: any[]) => void
) => void;
interface Decoders {
[decoderName: string]: Decoder;
jsSend: Decoder;
}
interface AjaxSettings extends JQueryAjaxSettings {
cache?: any;
dataMap?: {} | ((data: any) => {});
decoder?: any /* string or amplifyDecoder */;
}
interface Request {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
* data: A set of key/value pairs of data to be sent to the resource.
* callback: A function to invoke if the resource is retrieved successfully.
*/
(resourceId: string, hash?: any, callback?: Function): void;
/***
* Request a resource.
* settings: A set of key/value pairs of settings for the request.
* resourceId: Identifier string for the resource.
* data (optional): Data associated with the request.
* success (optional): Function to invoke on success.
* error (optional): Function to invoke on error.
*/
(settings: RequestSettings): any;
/***
* Define a resource.
* resourceId: Identifier string for the resource.
* requestType: The type of data retrieval method from the server. See the request types sections for more information.
* settings: A set of key/value pairs that relate to the server communication technology. The following settings are available:
* Any settings found in jQuery.ajax().
* cache: See the cache section for more details.
* decoder: See the decoder section for more details.
*/
define(resourceId: string, requestType: string, settings?: AjaxSettings): void;
/***
* Define a custom request.
* resourceId: Identifier string for the resource.
* resource: Function to handle requests. Receives a hash with the following properties:
* resourceId: Identifier string for the resource.
* data: Data provided by the user.
* success: Callback to invoke on success.
* error: Callback to invoke on error.
*/
define(resourceId: string, resource: (settings: RequestSettings) => void): void;
decoders: Decoders;
cache: any;
}
interface Subscribe {
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, callback: Function, priority?: number): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* context: What this will be when the callback is invoked.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, context: any, callback: Function, priority?: number): void;
}
interface StorageTypeStore {
/***
* Stores a value for a given key using the default storage type.
*
* key: Identifier for the value being stored.
* value: The value to store. The value can be anything that can be serialized as JSON.
* [options]: A set of key/value pairs that relate to settings for storing the value.
*/
(key: string, value: any, options?: any): void;
/***
* Gets a stored value based on the key.
*/
(key: string): any;
/***
* Gets a hash of all stored values.
*/
(): any;
}
interface Store extends StorageTypeStore {
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
localStorage: StorageTypeStore;
/***
* IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
sessionStorage: StorageTypeStore;
/***
* Firefox 2+
*/
globalStorage: StorageTypeStore;
/***
* IE 5 - 7
*/
userData: StorageTypeStore;
/***
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: StorageTypeStore;
}
interface Static {
subscribe: Subscribe;
/***
* Remove a subscription.
* topic: The topic being unsubscribed from.
* callback: The callback that was originally subscribed.
*/
unsubscribe(topic: string, callback: Function): void;
/***
* Publish a message.
* topic: The name of the message to publish.
* Any additional parameters will be passed to the subscriptions.
* amplify.publish returns a boolean indicating whether any subscriptions returned false.
* The return value is true if none of the subscriptions returned false, and false otherwise.
* Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
*/
publish(topic: string, ...args: any[]): boolean;
store: Store;
request: Request;
}
}
declare var amplify: amplify.Static;
export = amplify;
export as namespace amplify;
-7
View File
@@ -1,7 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"forbidden-types": false,
"unified-signatures": false
}
}
-6
View File
@@ -1,6 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"no-empty-interface": false
}
}
-21
View File
@@ -1,21 +0,0 @@
// Type definitions for angular-file-saver 1.1
// Project: https://github.com/alferov/angular-file-saver
// Definitions by: Donald Nairn <https://github.com/deenairn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
declare namespace angular {
/**
* A core Angular factory proving FileSaver functionality.
*/
interface FileSaver {
/**
* Immediately starts saving a file
* @param data: a Blob instance;
* @param filename: a String custom filename (an extension is optional);
* @param disableAutoBOM : (optional) Boolean Disable automatically provided Unicode text encoding hints;
*/
saveAs(blob: Blob, fileName: string, disableBOM?: boolean): void;
}
}
-637
View File
@@ -1,637 +0,0 @@
// Type definitions for angular-formly 7.2.3
// Project: https://github.com/formly-js/angular-formly
// Definitions by: Scott Hatcher <https://github.com/scatcher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
declare module 'AngularFormly' {
export = AngularFormly;
}
declare module 'angular-formly' {
var angularFormlyDefaultExport: string;
export = angularFormlyDefaultExport;
}
declare namespace AngularFormly {
interface IFieldArray extends Array<IFieldConfigurationObject | IFieldGroup> {
}
interface IFieldGroup {
data?: {
[key: string]: any;
};
className?: string;
elementAttributes?: string;
fieldGroup?: IFieldArray;
form?: Object;
hide?: boolean;
hideExpression?: string | IExpressionFunction;
key?: string | number;
model?: string | {
[key: string]: any;
};
options?: IFormOptionsAPI;
templateOptions?: ITemplateOptions;
wrapper?: string | string[];
}
interface IFormOptionsAPI {
data?: {
[key: string]: any;
};
fieldTransform?: Function;
formState?: Object;
removeChromeAutoComplete?: boolean;
resetModel?: Function;
templateManipulators?: ITemplateManipulators;
updateInitialValue?: Function;
wrapper?: string | string[];
}
/**
* see http://docs.angular-formly.com/docs/formly-expressions#expressionproperties-validators--messages
*/
interface IExpressionFunction {
($viewValue: any, $modelValue: any, scope: ITemplateScope): any;
}
interface IModelOptions {
updateOn?: string;
debounce?: number;
allowInvalid?: boolean;
getterSetter?: string;
timezone?: string;
}
interface ITemplateManipulator {
(template: string | HTMLElement, options: Object, scope: ITemplateScope): string | HTMLElement;
}
interface ITemplateManipulators {
preWrapper?: ITemplateManipulator[];
postWrapper?: ITemplateManipulator[];
}
interface ISelectOption {
name: string;
value?: string;
group?: string;
}
/**
* see http://docs.angular-formly.com/docs/ngmodelattrstemplatemanipulator
*/
interface ITemplateOptions {
// both attribute or regular attribute
disabled?: boolean;
maxlength?: number;
minlength?: number;
pattern?: string;
required?: boolean;
//attribute only
max?: number;
min?: number;
placeholder?: number | string;
tabindex?: number;
type?: string;
//expression types
onBlur?: string | IExpressionFunction;
onChange?: string | IExpressionFunction;
onClick?: string | IExpressionFunction;
onFocus?: string | IExpressionFunction;
onKeydown?: string | IExpressionFunction;
onKeypress?: string | IExpressionFunction;
onKeyup?: string | IExpressionFunction;
//Bootstrap types
label?: string;
description?: string;
[key: string]: any;
// types for select/radio fields
options?: Array<ISelectOption>;
groupProp?: string; // default: group
valueProp?: string; // default: value
labelProp?: string; // default: name
}
/**
* see http://docs.angular-formly.com/docs/field-configuration-object#validators-object
*/
interface IValidator {
expression: string | IExpressionFunction;
message?: string | IExpressionFunction;
}
/**
* An object which has at least two properties called expression and listener. The watch.expression
* is added to the formly-form directive's scope (to allow it to run even when hide is true). You
* can specify a type ($watchCollection or $watchGroup) via the watcher.type property (defaults to
* $watch) and whether you want it to be a deep watch via the watcher.deep property (defaults to false).
*
* see http://docs.angular-formly.com/docs/field-configuration-object#watcher-objectarray-of-watches
*/
interface IWatcher {
deep?: boolean; //Defaults to false
expression?: string | { (field: string, scope: ITemplateScope): boolean };
listener: (field: string, newValue: any, oldValue: any, scope: ITemplateScope, stopWatching: Function) => void;
type?: string; //Defaults to $watch but can be set to $watchCollection or $watchGroup
}
// see http://docs.angular-formly.com/docs/field-configuration-object
interface IFieldConfigurationObject {
/**
* Added in 6.18.0
*
* Demo
* see http://angular-formly.com/#/example/other/unique-value-async-validation
*/
asyncValidators?: {
[key: string]: string | IExpressionFunction | IValidator;
};
/**
* This is a great way to add custom behavior to a specific field. It is injectable with the $scope of the
* field, and anything else you have in your injector.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#controller-controller-name-as-string--controller-f
*/
controller?: string | Function;
/**
* This is reserved for the developer. You have our guarantee to be able to use this and not worry about
* future versions of formly overriding your usage and preventing you from upgrading :-)
*
* see http://docs.angular-formly.com/docs/field-configuration-object#data-object
*/
data?: {
[key: string]: any;
};
/**
* Use defaultValue to initialize it the model. If this is provided and the value of the
* model at compile-time is undefined, then the value of the model will be assigned to defaultValue.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#defaultvalue-any
*/
defaultValue?: any;
/**
* You can specify your own class that will be applied to the formly-field directive (or ng-form of
* a fieldGroup).
*
* see http://docs.angular-formly.com/docs/field-configuration-object#classname-string
*/
className?: string;
elementAttributes?: {
[key: string]: string;
};
/**
* An object where the key is a property to be set on the main field config and the value is an
* expression used to assign that property. The value is a formly expressions. The returned value is
* wrapped in $q.when so you can return a promise from your function :-)
*
* see http://docs.angular-formly.com/docs/field-configuration-object#expressionproperties-object
*/
expressionProperties?: {
[key: string]: string | IExpressionFunction | IValidator;
};
/**
* Uses ng-if. Whether to hide the field. Defaults to false. If you wish this to be conditional, use
* hideExpression. See below.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#hide-boolean
*/
hide?: boolean;
/**
* This is similar to expressionProperties with a slight difference. You should (hopefully) never
* notice the difference with the most common use case. This is available due to limitations with
* expressionProperties and ng-if not working together very nicely.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#hideexpression-string--function
*/
hideExpression?: string | IExpressionFunction;
/**
* This allows you to specify the id of your field (which will be used for its name as well unless
* a name is provided). Note, you can also override the id generation code using the formlyConfig
* extra called getFieldId.
*
* AVOID THIS
* If you don't have to do this, don't. Specifying IDs makes it harder to re-use things and it's
* just extra work. Part of the beauty that angular-formly provides is the fact that you don't need
* to concern yourself with making sure that this is unique.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#id-string
*/
id?: string;
initialValue?: any;
/**
* Can be set instead of type or template to use a custom html template form field. Works
* just like a directive templateUrl and uses the $templateCache
*
* see http://docs.angular-formly.com/docs/field-configuration-object#key-string
*/
key?: string | number;
/**
* This allows you to specify a link function. It is invoked after your template has finished compiling.
* You are passed the normal arguments for a normal link function.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#link-link-function
*/
link?: ng.IDirectiveLinkFn;
/**
* By default, the model passed to the formly-field directive is the same as the model passed to the
* formly-form. However, if the field has a model specified, then it is used for that field (and that
* field only). In addition, a deep watch is added to the formly-field directive's scope to run the
* expressionProperties when the specified model changes.
*
* Note, the formly-form directive will allow you to specify a string which is an (almost) formly
* expression which allows you to define the model as relative to the scope of the form.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#model-object--string
*/
model?: string | {
[key: string]: any;
};
/**
* Allows you to take advantage of ng-model-options directive. Formly's built-in templateManipulator (see
* below) will add this attribute to your ng-model element automatically if this property exists. Note,
* if you use the getter/setter option, formly's templateManipulator will change the value of ng-model
* to options.value which is a getterSetter that formly adds to field options.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#modeloptions
*/
modelOptions?: IModelOptions;
/**
* If you wish to, you can specify a specific name for your ng-model. This is useful if you're posting
* the form to a server using techniques of yester-year.
*
* AVOID THIS
* If you don't have to do this, don't. It's just extra work. Part of the beauty that angular-formly
* provides is the fact that you don't need to concern yourself with stuff like this.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#name-string
*/
name?: string;
/**
* This is used by ngModelAttrsTemplateManipulator to automatically add attributes to the ng-model element
* of field templates. You will likely not use this often. This object is a little complex, but extremely
* powerful. It's best to explain this api via an example. For more information, see the guide on ngModelAttrs.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#ngmodelattrs-object
*/
ngModelAttrs?: {
attribute?: any;
bound?: any;
expression?: any;
value?: any;
[key: string]: any;
};
/**
* This allows you to place attributes with string values on the ng-model element.
* Easy to use alternative to ngModelAttrs option.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#ngmodelelattrs-object
*/
ngModelElAttrs?: {
[key: string]: string;
};
/**
* Used to tell angular-formly to not attempt to add the formControl property to your object. This is useful
* for things like validation, but not necessary if your "field" doesn't use ng-model (if it's just a horizontal
* line for example). Defaults to undefined.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#noformcontrol-boolean
*/
noFormControl?: boolean;
/**
* Allows you to specify extra types to get options from. Duplicate options are overridden in later priority
* (index 1 will override index 0 properties). Also, these are applied after the type's defaultOptions and
* hence will override any duplicates of those properties as well.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#optionstypes-string--array-of-strings
*/
optionsTypes?: string | string[];
/**
* Can be set instead of type or templateUrl to use a custom html
* template form field. Recommended to be used with one-liners mostly
* (like a directive), or if you're using webpack with the ability to require templates :-)
*
* If a function is passed, it is invoked with the field configuration object and can return
* either a string for the template or a promise that resolves to a string.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#template-string--function
*/
template?: string | { (fieldConfiguration: IFieldConfigurationObject): string | ng.IPromise<string> };
/**
* Allows you to specify custom template manipulators for this specific field. (use defaultOptions in a
* type configuration if you want it to apply to all fields of a certain type).
*
* see http://docs.angular-formly.com/docs/field-configuration-object#templatemanipulator-object-of-arrays-of-functions
*/
templateManipulators?: ITemplateManipulators;
/**
* This is reserved for the templates. Any template-specific options go in here. Look at your specific
* template implementation to know the options required for this.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#templateoptions-object
*/
templateOptions?: ITemplateOptions;
/**
* Can be set instead of type or template to use a custom html template form field. Works
* just like a directive templateUrl and uses the $templateCache
*
* see http://docs.angular-formly.com/docs/field-configuration-object#templateurl-string--function
*/
templateUrl?: string | { (fieldConfiguration: IFieldConfigurationObject): string | ng.IPromise<string> };
/**
* The type of field to be rendered. This is the recommended method
* for defining fields. Types must be pre-defined using formlyConfig.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#type-string
*/
type?: string;
/**
* An object with a few useful properties mostly handy when used in combination with ng-messages
*/
validation?: {
/**
* This is set by angular-formly. This is a boolean indicating whether an error message should be shown. Because
* you generally only want to show error messages when the user has interacted with a specific field, this value
* is set to true based on this rule: field invalid && (field touched || validation.show) (with slight difference
* for pre-angular 1.3 because it doesn't have touched support).
*/
errorExistsAndShouldBeVisible?: boolean;
/**
* A map of Formly Expressions mapped to message names. This is really useful when you're using ng-messages
* like in this example.
*/
messages?: {
[key: string]: IExpressionFunction | string;
}
/**
* A boolean you as the developer can set to specify to force options.validation.errorExistsAndShouldBeVisible
* to be set to true when there are $errors. This is useful when you're trying to call the user's attention to
* some fields for some reason.
*/
show?: boolean;
};
/**
* An object where the keys are the name of the validator and the values are Formly Expressions;
*
* Async Validation
* All function validators can return true/false/Promise. A validator passes if it returns true or a promise
* that is resolved. A validator fails if it returns false or a promise that is rejected.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#validators-object
*/
validators?: {
[key: string]: string | IExpressionFunction | IValidator;
};
/**
* This is a getter/setter function for the value that your field is representing. Useful when using getterSetter: true
* in the modelOptions (in fact, if you don't disable the ngModelAttrsTemplateManipulator that comes built-in with formly,
* it will automagically change your field's ng-model attribute to use options.value.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#value-gettersetter-function
*/
value?(): any; //Getter
value?(val: any): void; //Setter
/**
* An object which has at least two properties called expression and listener. The watch.expression is added
* to the formly-form directive's scope (to allow it to run even when hide is true). You can specify a type
* ($watchCollection or $watchGroup) via the watcher.type property (defaults to $watch) and whether you want
* it to be a deep watch via the watcher.deep property (defaults to false).
*
* see http://docs.angular-formly.com/docs/field-configuration-object#watcher-objectarray-of-watches
*/
watcher?: IWatcher | IWatcher[];
/**
* This makes reference to setWrapper in formlyConfig. It is expected to be the name of the wrapper. If
* given an array, the formly field template will be wrapped by the first wrapper, then the second, then
* the third, etc. You can also specify these as part of a type (which is the recommended approach).
* Specifying this property will override the wrappers for the type for this field.
*
* http://docs.angular-formly.com/docs/field-configuration-object#wrapper-string--array-of-strings
*/
wrapper?: string | string[];
//ALL PROPERTIES BELOW ARE ADDED (So you should not be setting them yourself.)
/**
* This is the NgModelController for the field. It provides you with awesome stuff like $errors :-)
*
* see http://docs.angular-formly.com/docs/field-configuration-object#formcontrol-ngmodelcontroller
*/
formControl?: ng.IFormController | ng.IFormController[];
/**
* Will reset the field's model and the field control to the last initialValue. This is used by the
* formly-form's options.resetModel function.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#resetmodel-function
*/
resetModel?: () => void;
/**
* It is not likely that you'll ever want to invoke this function. It simply runs the expressionProperties expressions.
* It is used internally and you shouldn't have to use it, but you can if you want to, and any breaking changes to the
* way it works will result in a major version change, so you can rely on its api.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#runexpressions-function
*/
runExpressions?: () => void;
/**
* Will reset the field's initialValue to the current state of the model. Useful if you load the model asynchronously.
* Invoke this when the model gets set. This is used by the formly-form's options.updateInitialValue function.
*
* see http://docs.angular-formly.com/docs/field-configuration-object#updateinitialvalue-function
*/
updateInitialValue?: () => void;
}
/**
*
*
* see http://docs.angular-formly.com/docs/custom-templates#section-formlyconfig-settype-options
*/
interface ITypeOptions {
apiCheck?: { [key: string]: Function };
apiCheckFunction?: string; //'throw' or 'warn
apiCheckInstance?: any;
apiCheckOptions?: Object;
defaultOptions?: IFieldConfigurationObject | Function;
controller?: Function | string | any[];
data?: {
[key: string]: any;
};
extends?: string;
link?: ng.IDirectiveLinkFn;
overwriteOk?: boolean;
name: string;
template?: Function | string;
templateUrl?: Function | string;
validateOptions?: Function;
wrapper?: string | string[];
}
interface IWrapperOptions {
apiCheck?: { [key: string]: Function };
apiCheckFunction?: string; //'throw' or 'warn
apiCheckInstance?: any;
apiCheckOptions?: Object;
overwriteOk?: boolean;
name?: string;
template?: string;
templateUrl?: string;
types?: string[];
validateOptions?: Function;
}
interface IFormlyConfigExtras {
disableNgModelAttrsManipulator: boolean;
apiCheckInstance: any;
ngModelAttrsManipulatorPreferUnbound: boolean;
removeChromeAutoComplete: boolean;
defaultHideDirective: string;
errorExistsAndShouldBeVisibleExpression: any;
getFieldId: Function;
fieldTransform: Function;
explicitAsync: boolean;
}
interface IFormlyConfig {
disableWarnings: boolean;
extras: IFormlyConfigExtras;
setType(typeOptions: ITypeOptions): void;
setWrapper(wrapperOptions: IWrapperOptions): void;
templateManipulators: ITemplateManipulators;
}
interface ITemplateScopeOptions {
formControl: ng.IFormController | ng.IFormController[];
templateOptions: ITemplateOptions;
validation: Object;
}
/**
* see http://docs.angular-formly.com/docs/custom-templates#templates-scope
*/
interface ITemplateScope {
options: ITemplateScopeOptions;
//Shortcut to options.formControl
fc: ng.IFormController | ng.IFormController[];
//all the fields for the form
fields: IFieldArray;
//the form controller the field is in
form: any;
//The object passed as options.formState to the formly-form directive. Use this to share state between fields.
formState: Object;
//The id of the field. You shouldn't have to use this.
id: string;
//The index of the field the form is on (in ng-repeat)
index: number;
//the model of the form (or the model specified by the field if it was specified).
model?: string | {
[key: string]: any;
};
//Shortcut to options.validation.errorExistsAndShouldBeVisible
showError: boolean;
//Shortcut to options.templateOptions
to: ITemplateOptions;
}
/**
* see http://docs.angular-formly.com/docs/formlyvalidationmessages#addtemplateoptionvaluemessage
*/
interface IValidationMessages {
addTemplateOptionValueMessage(name: string, prop: string, prefix: string, suffix: string, alternate: string): void;
addStringMessage(name: string, string: string): void;
messages: { [key: string]: ($viewValue: any, $modelValue: any, scope: ITemplateScope) => string };
}
}
-61
View File
@@ -1,61 +0,0 @@
namespace angular_gettext_tests {
// Configuring angular-gettext
// https://angular-gettext.rocketeer.be/dev-guide/configure/
//Setting the language
angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) {
gettextCatalog.setCurrentLanguage('nl');
});
//Highlighting untranslated strings
angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) {
gettextCatalog.debug = true;
});
// Marking strings in JavaScript code as translatable.
// https://angular-gettext.rocketeer.be/dev-guide/annotate-js/
angular.module("myApp").controller("helloController", function (gettext: angular.gettext.gettextFunction) {
var myString = gettext("Hello");
});
//Translating directly in JavaScript.
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var translated: string = gettextCatalog.getString("Hello");
});
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds");
});
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" });
});
// Setting strings manually
// https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/
angular.module("myApp").run(function (gettextCatalog: angular.gettext.gettextCatalog) {
// Load the strings automatically during initialization.
gettextCatalog.setStrings("nl", {
"Hello": "Hallo",
"One boat": ["Een boot", "{{$count}} boats"]
});
});
interface helloControllerScope extends ng.IScope {
switchLanguage: (lang: string) => void;
}
// Lazy-loading languages
// https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/
angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular.gettext.gettextCatalog) {
$scope.switchLanguage = function (lang: string) {
gettextCatalog.setCurrentLanguage(lang);
gettextCatalog.loadRemote("/languages/" + lang + ".json");
};
});
}
-145
View File
@@ -1,145 +0,0 @@
// Type definitions for angular-gridster (gridster module) 0.13
// Project: https://github.com/ManifestWebDesign/angular-gridster
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from "angular";
export default "gridster";
declare module "angular" {
export namespace gridster {
interface GridsterConfig {
// number of columns in the grid
columns?: number;
// whether to push other items out of the way
// whether to push other items out of the way
pushing?: boolean;
// whether to automatically float items up so they stack
floating?: boolean;
// whether or not to have items switch places instead of push down if they are the same size
swapping?: boolean;
// width of the grid. "auto" will expand the grid to its parent container
width?: string;
// width of grid columns. "auto" will divide the width of the grid evenly among the columns
colWidth?: string;
// height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels,
// '/2' is half the column width, '*5' is five times the column width, etc.
rowHeight?: string;
// margins in between grid items
margins?: number[];
// whether to set the outer margin
outerMargin?: boolean;
// toggle mobile view
isMobile?: boolean;
// width threshold to toggle mobile mode
mobileBreakPoint?: number;
// whether or not to toggle mobile mode when screen width is less than mobileBreakPoint
mobileModeEnabled?: boolean;
// minimum amount of columns the grid can scale down to
minColumns?: number;
// minimum amount of rows to show if the grid is empty
minRows?: number;
// maximum amount of rows in the grid
maxRows?: number;
// default width of an item in columns
defaultSizeX?: number;
// default height of an item in rows
defaultSizeY?: number;
// minimum column width of an item
minSizeX?: number;
// maximum column width of an item
maxSizeX?: number;
// minumum row height of an item
minSizeY?: number;
// maximum row height of an item
maxSizeY?: number;
saveGridItemCalculatedHeightInMobile?: boolean;
// grid item height in mobile display. true- to use the calculated height by sizeY given
// options to pass to resizable handler
resizable?: {
// whether the items are resizable
enabled?: boolean;
// location of the resize handles
// e.g // ['s', 'e', 'n', 'w', 'se', 'ne', 'sw', 'nw']
handles?: string[];
// optional callback fired when drag is started
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
// optional callback fired when item is resized
resize?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
// optional callback fired when item is finished dragging
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
};
// options to pass to draggable handler
draggable?: {
// whether the items are resizable
enabled?: boolean;
// Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer
scrollSensitivity?: number;
// Speed at which the window should scroll once the mouse pointer gets within scrollSensitivity distance
scrollSpeed?: number;
// optional selector for drag handle
handle?: string;
// optional callback fired when drag is started
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
// optional callback fired when item is moved,
drag?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
// optional callback fired when item is finished dragging
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
};
}
interface StandardGridsterItem {
// width of the item expressed in terms of number of columns it will occupy
sizeX: number;
// height of the item expressed in terms of number of rows it will occupy
sizeY: number;
// starting row where the item will be placed
row: number;
// starting column where the item will be placed
col: number;
}
}
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-54
View File
@@ -1,54 +0,0 @@
// Type definitions for angular-hotkeys
// Project: https://github.com/chieffancypants/angular-hotkeys
// Definitions by: Jason Zhao <https://github.com/jlz27>, Stefan Steinhart <https://github.com/reppners>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
import * as ng from 'angular';
declare module 'angular' {
export namespace hotkeys {
interface HotkeysProvider {
template: string;
templateTitle: string;
includeCheatSheet: boolean;
cheatSheetHotkey: string;
cheatSheetDescription: string;
add(combo: string | string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
add(combo: string | string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey;
bindTo(scope: ng.IScope): ng.hotkeys.HotkeysProviderChained;
del(combo: string | string[]): void;
del(hotkeyObj: ng.hotkeys.Hotkey): void;
get(combo: string | string[]): ng.hotkeys.Hotkey;
toggleCheatSheet(): void;
purgeHotkeys(): void;
}
interface HotkeysProviderChained {
add(combo: string | string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;
add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained;
}
interface Hotkey {
combo: string | string[];
description?: string;
callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void;
action?: string;
allowIn?: Array<string>;
persistent?: boolean;
}
}
}
-237
View File
@@ -1,237 +0,0 @@
var myApp = angular.module('testModule', ['ngMaterial']);
myApp.config((
$mdThemingProvider: ng.material.IThemingProvider,
$mdIconProvider: ng.material.IIconProvider,
$mdProgressCircularProvider: ng.material.IProgressCircularProvider) => {
$mdThemingProvider.alwaysWatchTheme(true);
var neonRedMap: ng.material.IPalette = $mdThemingProvider.extendPalette('red', {
'500': 'ff0000'
});
// Register the new color palette map with the name <code>neonRed</code>
$mdThemingProvider.definePalette('neonRed', neonRedMap);
// Use that theme for the primary intentions
$mdThemingProvider.theme('default')
.primaryPalette('neonRed')
.accentPalette('blue')
.backgroundPalette('grey')
.warnPalette('red')
.dark(true);
var browserColors: ng.material.IBrowserColors = {
theme: 'default',
palette: 'neonRed',
hue: '500'
};
$mdThemingProvider.enableBrowserColor(browserColors);
// Disable theming generation at runtime
$mdThemingProvider.disableTheming();
$mdIconProvider
.defaultIconSet('my/app/icons.svg') // Register a default set of SVG icons
.iconSet('social', 'my/app/social.svg') // Register a named icon set of SVGs
.icon('android', 'my/app/android.svg') // Register a specific icon (by name)
.icon('work:chair', 'my/app/chair.svg'); // Register icon in a specific set
// Example of changing the default progress options.
$mdProgressCircularProvider.configure({
progressSize: 100,
strokeWidth: 20,
duration: 800
});
});
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => {
$scope['openBottomSheet'] = () => {
$mdBottomSheet.show({
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>',
clickOutsideToClose: true,
disableBackdrop: true,
disableParentScroll: false,
parent: () => {}
});
};
$scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide');
$scope['cancelBottomSheet'] = $mdBottomSheet.cancel.bind($mdBottomSheet, 'cancel');
});
myApp.controller('ColorController', ($scope: ng.IScope, $mdColor: ng.material.IColorService) => {
var colorExpression : ng.material.IColorExpression;
var element : Element;
colorExpression = { color: '#FFFFFF' }
element = new Element();
$scope['applyThemeColors'] = () => {
$mdColor.applyThemeColors(element, colorExpression);
};
$scope['getThemeColor'] = () => {
$mdColor.getThemeColor('default-neonRed')
};
$scope['hasTheme'] = () => {
$mdColor.hasTheme();
};
});
myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService) => {
$scope['openDialog'] = () => {
$mdDialog.show({
template: '<md-dialog>Hello!</md-dialog>'
});
};
$scope['alertDialog'] = () => {
$mdDialog.show($mdDialog.alert().textContent('Alert!'));
};
$scope['alertDialog'] = () => {
$mdDialog.show($mdDialog.alert().htmlContent('<span>Alert!</span>'));
};
$scope['confirmDialog'] = () => {
$mdDialog.show($mdDialog.confirm().textContent('Confirm!'));
};
$scope['confirmDialog'] = () => {
$mdDialog.show($mdDialog.confirm().htmlContent('<span>Confirm!</span>'));
};
$scope['promptDialog'] = () => {
$mdDialog.show($mdDialog.prompt().textContent('Prompt!'));
};
$scope['promptDialog'] = () => {
$mdDialog.show($mdDialog.prompt().htmlContent('<span>Prompt!</span>'));
};
$scope['promptDialog'] = () => {
$mdDialog.show($mdDialog.prompt().cancel('Prompt "Cancel" button text'));
};
$scope['promptDialog'] = () => {
$mdDialog.show($mdDialog.prompt().placeholder('Prompt input placeholder text'));
};
$scope['promptDialog'] = () => {
$mdDialog.show($mdDialog.prompt().initialValue('Buddy'));
};
$scope['prerenderedDialog'] = () => {
$mdDialog.show({
template: '<md-dialog>Hello!</md-dialog>',
contentElement: '#myDialog',
clickOutsideToClose: true
});
};
$scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide');
$scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel');
});
class IconDirective implements ng.IDirective {
private $mdIcon: ng.material.IIcon;
constructor($mdIcon: ng.material.IIcon) {
this.$mdIcon = $mdIcon;
}
public link($scope: ng.IScope, $elm: ng.IAugmentedJQuery) {
this.$mdIcon('android').then((iconEl: Element) => $elm.append(iconEl));
this.$mdIcon('work:chair').then((iconEl: Element) => $elm.append(iconEl));
// Load and cache the external SVG using a URL
this.$mdIcon('img/icons/android.svg').then((iconEl: Element) => {
$elm.append(iconEl);
});
}
}
myApp.directive('icon-directive', ($mdIcon: ng.material.IIcon) => new IconDirective($mdIcon));
myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.IMedia) => {
$scope.$watch(() => $mdMedia('lg'), (big: boolean) => {
$scope['bigScreen'] = big;
});
$scope['screenIsSmall'] = $mdMedia('sm');
$scope['customQuery'] = $mdMedia('(min-width: 1234px)');
$scope['anotherCustom'] = $mdMedia('max-width: 300px');
});
myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.material.ISidenavService) => {
var componentId = 'left';
$scope['toggle'] = () => $mdSidenav(componentId).toggle();
$scope['open'] = () => $mdSidenav(componentId).open();
$scope['close'] = () => $mdSidenav(componentId).close();
$scope['isOpen'] = $mdSidenav(componentId).isOpen();
$scope['isLockedOpen'] = $mdSidenav(componentId).isLockedOpen();
$scope['asyncLookup'] = $mdSidenav(componentId, true).then((instance) => {
instance.toggle();
instance.open();
instance.close();
instance.isOpen();
instance.isLockedOpen();
});
$scope['onClose'] = $mdSidenav(componentId).onClose(() => {});
});
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
$scope['openToast'] = () => {
$mdToast.show($mdToast.simple().textContent('Hello!'));
$mdToast.updateTextContent('New Content');
}
$scope['customToast'] = () => {
var options = {
hideDelay: 3000,
position: 'top right',
controller : 'ToastCtrl',
templateUrl : 'toast-template.html',
toastClass: 'my-class'
};
$mdToast.show(options);
}
});
myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService) => {
$scope['createPanel'] = () => {
var config = {
id: 'myPanel',
template: '<h1>Hello!</h1>',
hasBackdrop: true,
disableParentScroll: true,
zIndex: 150
};
$mdPanel.create(config);
var panelRef = $mdPanel.create(config);
panelRef.open()
.then((ref: ng.material.IPanelRef) => {
ref.addClass('foo');
ref.removeClass('bar');
ref.close();
})
.finally(() => {
panelRef = undefined;
});
};
$scope['openPanel'] = () => {
$mdPanel.open({
template: '<h1>Hello!</h1>',
hasBackdrop: true,
disableParentScroll: true,
zIndex: 150
})
.then((panelRef: ng.material.IPanelRef) => {
panelRef.addClass('foo');
panelRef.removeClass('bar');
panelRef.close();
});
};
$scope['newPanelPosition'] = () => {
$mdPanel.newPanelPosition().absolute().center();
$mdPanel.newPanelPosition().relativeTo('.demo-menu-open-button').addPanelPosition("ALIGN_START", "BELOW");
};
$scope['newPanelAnimation'] = () => {
$mdPanel.newPanelAnimation().openFrom('.some-target');
$mdPanel.newPanelAnimation().openFrom({top: 0, left: 0});
};
});
-455
View File
@@ -1,455 +0,0 @@
// Type definitions for Angular Material (angular.material module) 1.1
// Project: https://github.com/angular/material
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from 'angular';
declare var _: string;
export = _;
declare module 'angular' {
export namespace material {
interface IBottomSheetOptions {
templateUrl?: string;
template?: string;
scope?: angular.IScope; // default: new child scope
preserveScope?: boolean; // default: false
controller?: string | Function;
locals?: { [index: string]: any };
clickOutsideToClose?: boolean;
disableBackdrop?: boolean;
escapeToClose?: boolean;
resolve?: { [index: string]: () => angular.IPromise<any> };
controllerAs?: string;
parent?: Function | string | Object; // default: root node
disableParentScroll?: boolean; // default: true
}
interface IBottomSheetService {
show(options: IBottomSheetOptions): angular.IPromise<any>;
hide(response?: any): void;
cancel(response?: any): void;
}
interface IPresetDialog<T> {
title(title: string): T;
textContent(textContent: string): T;
htmlContent(htmlContent: string): T;
ok(ok: string): T;
theme(theme: string): T;
templateUrl(templateUrl?: string): T;
template(template?: string): T;
targetEvent(targetEvent?: MouseEvent): T;
scope(scope?: angular.IScope): T; // default: new child scope
preserveScope(preserveScope?: boolean): T; // default: false
disableParentScroll(disableParentScroll?: boolean): T; // default: true
hasBackdrop(hasBackdrop?: boolean): T; // default: true
clickOutsideToClose(clickOutsideToClose?: boolean): T; // default: false
escapeToClose(escapeToClose?: boolean): T; // default: true
focusOnOpen(focusOnOpen?: boolean): T; // default: true
controller(controller?: string | Function): T;
locals(locals?: { [index: string]: any }): T;
bindToController(bindToController?: boolean): T; // default: false
resolve(resolve?: { [index: string]: () => angular.IPromise<any> }): T;
controllerAs(controllerAs?: string): T;
parent(parent?: string | Element | JQuery): T; // default: root node
onComplete(onComplete?: Function): T;
ariaLabel(ariaLabel: string): T;
}
interface IAlertDialog extends IPresetDialog<IAlertDialog> {
}
interface IConfirmDialog extends IPresetDialog<IConfirmDialog> {
cancel(cancel: string): IConfirmDialog;
}
interface IPromptDialog extends IPresetDialog<IPromptDialog> {
cancel(cancel: string): IPromptDialog;
placeholder(placeholder: string): IPromptDialog;
initialValue(initialValue: string): IPromptDialog;
}
interface IColorExpression {
[cssPropertyName: string]: string;
}
interface IColorService {
applyThemeColors(element: Element | JQuery, colorExpression: IColorExpression): void;
getThemeColor(expression: string): string;
hasTheme(): boolean;
}
interface IDialogOptions {
templateUrl?: string;
template?: string;
contentElement?: string | Element;
autoWrap?: boolean; // default: true
targetEvent?: MouseEvent;
openFrom?: any;
closeTo?: any;
scope?: angular.IScope; // default: new child scope
preserveScope?: boolean; // default: false
disableParentScroll?: boolean; // default: true
hasBackdrop?: boolean; // default: true
clickOutsideToClose?: boolean; // default: false
escapeToClose?: boolean; // default: true
focusOnOpen?: boolean; // default: true
controller?: string | Function;
locals?: { [index: string]: any };
bindToController?: boolean; // default: false
resolve?: { [index: string]: () => angular.IPromise<any> }
controllerAs?: string;
parent?: string | Element | JQuery; // default: root node
onShowing?: Function;
onComplete?: Function;
onRemoving?: Function;
skipHide?: boolean;
multiple?: boolean;
fullscreen?: boolean; // default: false
}
interface IDialogService {
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): angular.IPromise<any>;
confirm(): IConfirmDialog;
alert(): IAlertDialog;
prompt(): IPromptDialog;
hide(response?: any): angular.IPromise<any>;
cancel(response?: any): void;
}
interface IIcon {
(id: string): angular.IPromise<Element>; // id is a unique ID or URL
}
interface IIconProvider {
icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24
iconSet(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24
defaultIconSet(url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24
defaultViewBoxSize(viewBoxSize: number): IIconProvider; // default: 24
defaultFontSet(name: string): IIconProvider;
}
interface IMedia {
(media: string): boolean;
}
interface ISidenavObject {
toggle(): angular.IPromise<void>;
open(): angular.IPromise<void>;
close(): angular.IPromise<void>;
isOpen(): boolean;
isLockedOpen(): boolean;
onClose(onClose: Function): void;
}
interface ISidenavService {
(component: string, enableWait: boolean): angular.IPromise<ISidenavObject>;
(component: string): ISidenavObject;
}
interface IToastPreset<T> {
textContent(content: string): T;
action(action: string): T;
highlightAction(highlightAction: boolean): T;
highlightClass(highlightClass: string): T;
capsule(capsule: boolean): T;
theme(theme: string): T;
hideDelay(delay: number | false): T;
position(position: string): T;
parent(parent?: string | Element | JQuery): T; // default: root node
toastClass(toastClass: string): T;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
}
interface IToastOptions {
templateUrl?: string;
template?: string;
autoWrap?: boolean;
scope?: angular.IScope; // default: new child scope
preserveScope?: boolean; // default: false
hideDelay?: number | false; // default (ms): 3000
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
toastClass?: string;
controller?: string | Function;
locals?: { [index: string]: any };
bindToController?: boolean; // default: false
resolve?: { [index: string]: () => angular.IPromise<any> }
controllerAs?: string;
parent?: string | Element | JQuery; // default: root node
}
interface IToastService {
show(optionsOrPreset: IToastOptions | IToastPreset<any>): angular.IPromise<any>;
showSimple(content: string): angular.IPromise<any>;
simple(): ISimpleToastPreset;
build(): IToastPreset<any>;
updateContent(newContent: string): void;
updateTextContent(newContent: string): void;
hide(response?: any): void;
cancel(response?: any): void;
}
interface IPalette {
0?: string;
50?: string;
100?: string;
200?: string;
300?: string;
400?: string;
500?: string;
600?: string;
700?: string;
800?: string;
900?: string;
A100?: string;
A200?: string;
A400?: string;
A700?: string;
contrastDefaultColor?: string;
contrastDarkColors?: string | string[];
contrastLightColors?: string | string[];
}
interface IThemeHues {
default?: string;
'hue-1'?: string;
'hue-2'?: string;
'hue-3'?: string;
}
interface IThemePalette {
name: string;
hues: IThemeHues;
}
interface IBrowserColors {
theme: string;
palette: string;
hue: string;
}
interface IThemeColors {
accent: IThemePalette;
background: IThemePalette;
primary: IThemePalette;
warn: IThemePalette;
}
interface IThemeGrayScalePalette {
1: string;
2: string;
3: string;
4: string;
name: string;
}
interface ITheme {
name: string;
isDark: boolean;
colors: IThemeColors;
foregroundPalette: IThemeGrayScalePalette;
foregroundShadow: string;
accentPalette(name: string, hues?: IThemeHues): ITheme;
primaryPalette(name: string, hues?: IThemeHues): ITheme;
warnPalette(name: string, hues?: IThemeHues): ITheme;
backgroundPalette(name: string, hues?: IThemeHues): ITheme;
dark(isDark?: boolean): ITheme;
}
interface IThemeConfig {
disableTheming: boolean;
generateOnDemand: boolean;
nonce: string;
defaultTheme: string;
alwaysWatchTheme: boolean;
registeredStyles: Array<string>;
}
interface IThemingProvider {
alwaysWatchTheme(alwaysWatch: boolean): void;
definePalette(name: string, palette: IPalette): IThemingProvider;
enableBrowserColor(browserColors: IBrowserColors): Function;
extendPalette(name: string, palette: IPalette): IPalette;
registerStyles(styles: String): void;
setDefaultTheme(theme: string): void;
setNonce(nonce: string): void;
theme(name: string, inheritFrom?: string): ITheme;
generateThemesOnDemand(onDemand: boolean): void;
disableTheming(isDisabled?: boolean): void;
configuration(): IThemeConfig;
}
interface IDateLocaleProvider {
months: string[];
shortMonths: string[];
days: string[];
shortDays: string[];
dates: string[];
firstDayOfWeek: number;
parseDate(dateString: string): Date;
formatDate(date: Date): string;
monthHeaderFormatter(date: Date): string;
weekNumberFormatter(weekNumber: number): string;
msgCalendar: string;
msgOpenCalendar: string;
}
interface IMenuService {
hide(response?: any, options?: any): angular.IPromise<any>;
}
interface IColorPalette {
red: IPalette;
pink: IPalette;
'deep-purple': IPalette;
indigo: IPalette;
blue: IPalette;
'light-blue': IPalette;
cyan: IPalette;
teal: IPalette;
green: IPalette;
'light-green': IPalette;
lime: IPalette;
yellow: IPalette;
amber: IPalette;
orange: IPalette;
'deep-orange': IPalette;
brown: IPalette;
grey: IPalette;
'blue-grey': IPalette;
}
interface IPanelConfig {
id?: string;
template?: string;
templateUrl?: string;
controller?: string | Function;
controllerAs?: string;
bindToController?: boolean; // default: true
locals?: { [index: string]: any };
resolve?: { [index: string]: () => angular.IPromise<any> }
attachTo?: string | JQuery | Element;
propagateContainerEvents?: boolean;
panelClass?: string;
zIndex?: number; // default: 80
position?: IPanelPosition;
clickOutsideToClose?: boolean; // default: false
escapeToClose?: boolean; // default: false
trapFocus?: boolean; // default: false
focusOnOpen?: boolean; // default: true
fullscreen?: boolean; // default: false
animation?: IPanelAnimation;
hasBackdrop?: boolean; // default: false
disableParentScroll?: boolean; // default: false
onDomAdded?: Function;
onOpenComplete?: Function;
onRemoving?: Function;
onDomRemoved?: Function;
origin?: string | JQuery | Element;
onCloseSuccess?: ((panel: IPanelRef, closeReason: string) => any);
}
interface IPanelRef {
id: string;
config: IPanelConfig;
isAttached: boolean;
panelContainer: JQuery;
panelEl: JQuery;
open(): angular.IPromise<any>;
close(): angular.IPromise<any>;
attach(): angular.IPromise<any>;
detach(): angular.IPromise<any>;
show(): angular.IPromise<any>;
hide(): angular.IPromise<any>;
destroy(): void;
addClass(newClass: string): void;
removeClass(oldClass: string): void;
toggleClass(toggleClass: string): void;
updatePosition(position: IPanelPosition): void;
registerInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
removeInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
removeAllInterceptors(type?: string): IPanelRef;
}
interface IPanelPosition {
absolute(): IPanelPosition;
relativeTo(someElement: string | JQuery | Element): IPanelPosition;
top(top?: string): IPanelPosition; // default: '0'
bottom(bottom?: string): IPanelPosition; // default: '0'
start(start?: string): IPanelPosition; // default: '0'
end(end?: string): IPanelPosition; // default: '0'
left(left?: string): IPanelPosition; // default: '0'
right(right?: string): IPanelPosition; // default: '0'
centerHorizontally(): IPanelPosition;
centerVertically(): IPanelPosition;
center(): IPanelPosition;
addPanelPosition(xPosition: string, yPosition: string): IPanelPosition;
withOffsetX(offsetX: string | ((panel: IPanelPosition) => string)): IPanelPosition;
withOffsetY(offsetY: string | ((panel: IPanelPosition) => string)): IPanelPosition;
}
interface IPanelAnimation {
openFrom(from: string | Element | Event | { top: number, left: number }): IPanelAnimation;
closeTo(to: string | Element | { top: number, left: number }): IPanelAnimation;
withAnimation(cssClass: string | { open: string, close: string }): IPanelAnimation;
}
interface IPanelService {
create(opt_config: IPanelConfig): IPanelRef;
open(opt_config: IPanelConfig): angular.IPromise<IPanelRef>;
newPanelPosition(): IPanelPosition;
newPanelAnimation(): IPanelAnimation;
xPosition: {
CENTER: string,
ALIGN_START: string,
ALIGN_END: string,
OFFSET_START: string,
OFFSET_END: string,
};
yPosition: {
CENTER: string,
ALIGN_TOPS: string,
ALIGN_BOTTOMS: string,
ABOVE: string,
BELOW: string,
};
animation: {
SLIDE: string,
SCALE: string,
FADE: string,
};
interceptorTypes: {
CLOSE: string,
};
closeReasons: {
CLICK_OUTSIDE: string,
ESCAPE: string,
};
absPosition: {
TOP: string,
RIGHT: string,
BOTTOM: string,
LEFT: string,
};
}
interface IProgressCircularConfig {
progressSize?: number;
strokeWidth?: number;
duration?: number;
easeFn?: Function;
durationIndeterminate?: number;
startIndeterminate?: number;
endIndeterminate?: number;
easeFnIndeterminate?: Function;
}
interface IProgressCircularProvider {
configure(options: IProgressCircularConfig): void;
}
}
}
-49
View File
@@ -1,49 +0,0 @@
// Type definitions for angular-oauth2 4.1
// Project: https://github.com/oauthjs/angular-oauth2
// Definitions by: Antério Vieira <https://github.com/anteriovieira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from 'angular';
declare module 'angular' {
export namespace oauth2 {
interface OAuthConfig {
baseUrl: string;
clientId: string;
clientSecret?: string;
grantPath?: string;
revokePath?: string;
}
interface OAuthProvider {
configure(params: OAuthConfig): OAuthConfig;
}
interface Data {
username: string;
password: string;
}
interface OAuth {
isAuthenticated(): boolean;
getAccessToken(data: Data, options?: any): angular.IPromise<string>;
getRefreshToken(data?: Data, options?: any): angular.IPromise<string>;
revokeToken(data?: Data, options?: any): angular.IPromise<string>;
}
interface OAuthTokenConfig {
name: string;
options: any;
}
interface OAuthTokenOptions {
secure: boolean;
}
interface OAuthTokenProvider {
configure(params: OAuthTokenConfig): OAuthTokenConfig;
}
}
}
-20
View File
@@ -1,20 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"angular-oauth2-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-30
View File
@@ -1,30 +0,0 @@
// Type definitions for angular-promise-tracker 2.2.2
// Project: https://github.com/ajoslin/angular-promise-tracker
// Definitions by: Rufus Linke <https://github.com/rufusl/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
import * as angular from 'angular';
declare module 'angular' {
export namespace promisetracker {
interface PromiseTrackerOptions {
activationDelay: number;
minDuration: number;
}
interface PromiseTracker {
active(): boolean;
tracking(): boolean;
trackingCount(): number;
addPromise<T>(promise: angular.IPromise<T>): angular.IDeferred<void>;
createPromise(): angular.IDeferred<void>;
cancel(): void;
}
interface PromiseTrackerService {
(options?: PromiseTrackerOptions): PromiseTracker;
}
}
}
@@ -1,74 +0,0 @@
angular
.module('app', ['SignalR'])
.factory('Employees', ngSignalrTest.EmployeesFactory);
namespace ngSignalrTest {
export class EmployeesFactory {
static $inject = ['$rootScope', 'Hub', '$timeout'];
private hub: ngSignalr.Hub;
public all: Array<Employee>;
constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) {
// declaring the hub connection
this.hub = new Hub('employee', {
// client-side methods
listeners: {
'lockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = true;
$rootScope.$apply();
},
'unlockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = false;
$rootScope.$apply();
}
},
// server-side methods
methods: ['lock', 'unlock'],
// query params sent on initial connection
queryParams:{
'token': 'exampletoken'
},
// handle connection error
errorHandler: (message: string) => {
console.error(message);
},
stateChanged: (state: SignalR.StateChanged) => {
// your code here
}
});
}
private find(id: number) {
for (var i = 0; i < this.all.length; i++) {
if (this.all[i].Id === id) return this.all[i];
}
return null;
}
public edit = (employee: Employee) => {
employee.Edit = true;
this.hub.invoke('lock', employee.Id);
};
public done = (employee: Employee) => {
employee.Edit = false;
this.hub.invoke('unlock', employee.Id);
}
}
interface Employee {
Id: number;
Name: string;
Email: string;
Salary: number;
Edit: boolean;
Locked: boolean;
}
}
-12
View File
@@ -1,12 +0,0 @@
/// <reference types="angular" />
var myApp = angular.module('testModule');
namespace AngularSpinnerTest {
var app = angular.module("angularSpinnerTest", ["angular-spinner"]);
app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) {
usSpinnerService.spin('key1');
usSpinnerService.stop('key2');
}]);
}
-123
View File
@@ -1,123 +0,0 @@
// Type definitions for Angular Translate (pascalprecht.translate module) 2.4
// Project: https://github.com/PascalPrecht/angular-translate
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
import * as angular from 'angular';
declare module 'angular' {
export namespace translate {
interface ITranslationTable {
[key: string]: string | ITranslationTable;
}
interface ILanguageKeyAlias {
[key: string]: string;
}
interface IStorage {
get(name: string): string;
put(name: string, value: string): void;
}
interface IStaticFilesLoaderOptions {
prefix: string;
suffix: string;
key?: string;
}
interface IPartialLoader<T> {
addPart(name: string, priority?: number): T;
deletePart(name: string): T;
isPartAvailable(name: string): boolean;
}
interface ITranslatePartialLoaderService extends IPartialLoader<ITranslatePartialLoaderService> {
getRegisteredParts(): Array<string>;
isPartLoaded(name: string, lang: string): boolean;
}
interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader<ITranslatePartialLoaderProvider> {
setPart(lang: string, part: string, table: ITranslationTable): ITranslatePartialLoaderProvider;
}
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
fallbackLanguage(langKey?: string): string;
fallbackLanguage(langKey?: string[]): string;
instant(translationId: string, interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): string;
instant(translationId: string[], interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): { [key: string]: string };
isPostCompilingEnabled(): boolean;
preferredLanguage(langKey?: string): string;
proposedLanguage(): string;
refresh(langKey?: string): angular.IPromise<void>;
storage(): IStorage;
storageKey(): string;
use(): string;
use(key: string): angular.IPromise<string>;
useFallbackLanguage(langKey?: string): void;
versionInfo(): string;
loaderCache(): any;
isReady(): boolean;
onReady(): angular.IPromise<void>;
resolveClientLocale(): string;
}
interface ITranslateProvider extends angular.IServiceProvider {
translations(key?: string): ITranslationTable;
translations(key: string, translationTable: ITranslationTable): ITranslateProvider;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
addInterpolation(factory: any): ITranslateProvider;
useMessageFormatInterpolation(): ITranslateProvider;
useInterpolation(factory: string): ITranslateProvider;
useSanitizeValueStrategy(value: string): ITranslateProvider;
preferredLanguage(): ITranslateProvider;
preferredLanguage(language: string): ITranslateProvider;
translationNotFoundIndicator(indicator: string): ITranslateProvider;
translationNotFoundIndicatorLeft(): string;
translationNotFoundIndicatorLeft(indicator: string): ITranslateProvider;
translationNotFoundIndicatorRight(): string;
translationNotFoundIndicatorRight(indicator: string): ITranslateProvider;
fallbackLanguage(): ITranslateProvider;
fallbackLanguage(language: string): ITranslateProvider;
fallbackLanguage(languages: string[]): ITranslateProvider;
forceAsyncReload(value: boolean): ITranslateProvider;
use(): string;
use(key: string): ITranslateProvider;
storageKey(): string;
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
uniformLanguageTag(options: string | Object): ITranslateProvider;
useUrlLoader(url: string): ITranslateProvider;
useStaticFilesLoader(options: IStaticFilesLoaderOptions | { files: IStaticFilesLoaderOptions[] }): ITranslateProvider;
useLoader(loaderFactory: string, options?: any): ITranslateProvider;
useLocalStorage(): ITranslateProvider;
useCookieStorage(): ITranslateProvider;
useStorage(storageFactory: any): ITranslateProvider;
storagePrefix(): string;
storagePrefix(prefix: string): ITranslateProvider;
useMissingTranslationHandlerLog(): ITranslateProvider;
useMissingTranslationHandler(factory: string): ITranslateProvider;
usePostCompiling(value: boolean): ITranslateProvider;
directivePriority(): number;
directivePriority(priority: number): ITranslateProvider;
determinePreferredLanguage(fn?: () => void): ITranslateProvider;
registerAvailableLanguageKeys(): string[];
registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider;
useLoaderCache(cache?: any): ITranslateProvider;
resolveClientLocale(): string;
}
}
interface IFilterService {
(name: 'translate'): {
(translationId: string, interpolateParams?: any, interpolation?: string): string;
};
}
}
-918
View File
@@ -1,918 +0,0 @@
// Type definitions for Angular UI Bootstrap 0.13.3
// Project: https://github.com/angular-ui/bootstrap
// Definitions by: Brian Surowiec <https://github.com/xt0rted>, Ryan Southgate <https://github.com/ry8806>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
import * as angular from 'angular';
export type IAccordionConfig = angular.ui.bootstrap.IAccordionConfig;
export type IButtonConfig = angular.ui.bootstrap.IButtonConfig;
export type IDatepickerConfig = angular.ui.bootstrap.IDatepickerConfig;
export type IDatepickerPopupConfig = angular.ui.bootstrap.IDatepickerPopupConfig;
export type IDropdownConfig = angular.ui.bootstrap.IDropdownConfig;
export type IModalProvider = angular.ui.bootstrap.IModalProvider;
export type IModalService = angular.ui.bootstrap.IModalService;
export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance;
export type IModalScope = angular.ui.bootstrap.IModalScope;
export type IModalSettings = angular.ui.bootstrap.IModalSettings;
export type IModalStackService = angular.ui.bootstrap.IModalStackService;
export type IModalStackedMapKeyValuePair = angular.ui.bootstrap.IModalStackedMapKeyValuePair;
export type IPaginationConfig = angular.ui.bootstrap.IPaginationConfig;
export type IPagerConfig = angular.ui.bootstrap.IPagerConfig;
export type IPositionCoordinates = angular.ui.bootstrap.IPositionCoordinates;
export type IPositionService = angular.ui.bootstrap.IPositionService;
export type IProgressConfig = angular.ui.bootstrap.IProgressConfig;
export type IRatingConfig = angular.ui.bootstrap.IRatingConfig;
export type ITimepickerConfig = angular.ui.bootstrap.ITimepickerConfig;
export type ITooltipOptions = angular.ui.bootstrap.ITooltipOptions;
export type ITooltipProvider = angular.ui.bootstrap.ITooltipProvider;
export type ITransitionService = angular.ui.bootstrap.ITransitionService;
export type ITransitionServiceOptions = angular.ui.bootstrap.ITransitionServiceOptions;
declare module 'angular' {
export namespace ui.bootstrap {
interface IAccordionConfig {
/**
* Controls whether expanding an item will cause the other items to close.
*
* @default true
*/
closeOthers?: boolean;
}
interface IButtonConfig {
/**
* @default: 'active'
*/
activeClass?: string;
/**
* @default: 'Click'
*/
toggleEvent?: string;
}
interface IDropdownConfigNgOptions extends angular.INgModelOptions {
allowInvalid?: boolean;
timezone?: string;
}
interface IDatepickerConfig {
/**
* Format of day in month.
*
* @default 'dd'
*/
formatDay?: string;
/**
* Format of month in year.
*
* @default 'MMM'
*/
formatMonth?: string;
/**
* Format of year in year range.
*
* @default 'yyyy'
*/
formatYear?: string;
/**
* Format of day in week header.
*
* @default 'EEE'
*/
formatDayHeader?: string;
/**
* Format of title when selecting day.
*
* @default 'MMM yyyy'
*/
formatDayTitle?: string;
/**
* Format of title when selecting month.
*
* @default 'yyyy'
*/
formatMonthTitle?: string;
/**
* Current mode of the datepicker (day|month|year). Can be used to initialize datepicker to specific mode.
*
* @default 'day'
*/
datepickerMode?: string;
/**
* Set a lower limit for mode.
*
* @default 'day'
*/
minMode?: string;
/**
* Set an upper limit for mode.
*
* @default 'year'
*/
maxMode?: string;
/**
* Whether to display week numbers.
*
* @default true
*/
showWeeks?: boolean;
/**
* Starting day of the week from 0-6 where 0=Sunday and 6=Saturday.
*
* @default 0
*/
startingDay?: number;
/**
* Number of years displayed in year selection.
*
* @default 20
*/
yearRange?: number;
/**
* Defines the minimum available date.
*
* @default null
*/
minDate?: any;
/**
* Defines the maximum available date.
*
* @default null
*/
maxDate?: any;
/**
* Defines the initial date, when no model value is specified.
*
* @default null
*/
initDate?: any;
/**
* An option to disable or enable shortcut's event propagation
*
* @default false
*/
shortcutPropagation?: boolean;
/**
* The number of columns displayed in month selection.
*
* @default 3
*/
monthColumns?: number;
/**
* The number of columns displayed in year selection.
*
* @default 5
*/
yearColumns?: number;
/**
* The number of rows displayed in year selection
*
* @default 4
*/
yearRows?: number;
/**
* All supported angular ngModelOptions plus some
*
* @default {}
*/
ngModelOptions?: IDropdownConfigNgOptions
}
interface IDatepickerPopupConfig {
/**
* A list of alternate formats acceptable for manual entry.
*
* @default []
*/
altInputFormats?: string[];
/**
* The format for displayed dates.
*
* @default 'yyyy-MM-dd'
*/
datepickerPopup?: string;
/**
* Allows overriding of default template of the popup.
*
* @default 'template/datepicker/popup.html'
*/
datepickerPopupTemplateUrl?: string;
/**
* Allows overriding of default template of the datepicker used in popup.
*
* @default 'template/datepicker/popup.html'
*/
datepickerTemplateUrl?: string;
/**
* Allows overriding of the default format for html5 date inputs.
*/
html5Types?: {
date?: string;
'datetime-local'?: string;
month?: string;
};
/**
* The text to display for the current day button.
*
* @default 'Today'
*/
currentText?: string;
/**
* The text to display for the clear button.
*
* @default 'Clear'
*/
clearText?: string;
/**
* The text to display for the close button.
*
* @default 'Done'
*/
closeText?: string;
/**
* Whether to close calendar when a date is chosen.
*
* @default true
*/
closeOnDateSelection?: boolean;
/**
* Append the datepicker popup element to `body`, rather than inserting after `datepicker-popup`.
*
* @default false
*/
appendToBody?: boolean;
/**
* Whether to display a button bar underneath the datepicker.
*
* @default true
*/
showButtonBar?: boolean;
/**
* Whether to focus the datepicker popup upon opening.
*
* @default true
*/
onOpenFocus?: boolean;
/**
* Passing in 'auto' separated by a space before the placement will enable auto positioning, e.g: "auto bottom-left". The popup will attempt to position where it fits in the closest scrollable ancestor.
*
* @default 'auto bottom-left'
*/
placement?: string;
}
interface IDropdownConfig {
/**
* @default: 'uib-dropdown-open'
*/
appendToOpenClass?: string;
/**
* @default: 'open'
*/
openClass?: string;
}
interface IModalProvider {
/**
* Default options all modals will use.
*/
options: IModalSettings;
}
interface IModalService {
/**
* @param {IModalSettings} options
* @returns {IModalServiceInstance}
*/
open(options: IModalSettings): IModalServiceInstance;
}
interface IModalServiceInstance {
/**
* A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*/
close(result?: any): void;
/**
* A method that can be used to dismiss a modal, passing a reason. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*/
dismiss(reason?: any): void;
/**
* A promise that is resolved when a modal is closed and rejected when a modal is dismissed.
*/
result: angular.IPromise<any>;
/**
* A promise that is resolved when a modal gets opened after downloading content's template and resolving all variables.
*/
opened: angular.IPromise<any>;
/**
* A promise that is resolved when a modal is rendered.
*/
rendered: angular.IPromise<any>;
/**
* A promise that is resolved when a modal is closed and the animation completes.
*/
closed: angular.IPromise<any>;
}
interface IModalScope extends angular.IScope {
/**
* Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*
* @returns true if the modal was closed; otherwise false
*/
$dismiss(reason?: any): boolean;
/**
* Close the dialog resolving the promise to the given value. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*
* @returns true if the modal was closed; otherwise false
*/
$close(result?: any): boolean;
}
interface IModalSettings {
/**
* a path to a template representing modal's content
*/
templateUrl?: string | (() => string);
/**
* inline template representing the modal's content
*/
template?: string;
/**
* a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope).
* Defaults to `$rootScope`.
*/
scope?: angular.IScope | IModalScope;
/**
* a controller for a modal instance - it can initialize scope used by modal.
* A controller can be injected with `$modalInstance`
* If value is an array, it must be in Inline Array Annotation format for injection (strings followed by factory method)
*/
controller?: string | Function | Array<string | Function>;
/**
* an alternative to the controller-as syntax, matching the API of directive definitions.
* Requires the controller option to be provided as well
*/
controllerAs?: string;
/**
* When used with controllerAs and set to true, it will bind the controller properties onto the $scope directly.
*
* @default false
*/
bindToController?: boolean;
/**
* members that will be resolved and passed to the controller as locals; it is equivalent of the `resolve` property for AngularJS routes
* If property value is an array, it must be in Inline Array Annotation format for injection (strings followed by factory method)
*/
resolve?: { [key: string]: string | Function | Array<string | Function> | Object };
/**
* Set to false to disable animations on new modal/backdrop. Does not toggle animations for modals/backdrops that are already displayed.
*
* @default true
*/
animation?: boolean;
/**
* controls the presence of a backdrop
* Allowed values:
* - true (default)
* - false (no backdrop)
* - 'static' backdrop is present but modal window is not closed when clicking outside of the modal window
*
* @default true
*/
backdrop?: boolean | string;
/**
* indicates whether the dialog should be closable by hitting the ESC key
*
* @default true
*/
keyboard?: boolean;
/**
* additional CSS class(es) to be added to a modal backdrop template
*/
backdropClass?: string;
/**
* additional CSS class(es) to be added to a modal window template
*/
windowClass?: string;
/**
* Optional suffix of modal window class. The value used is appended to the `modal-` class, i.e. a value of `sm` gives `modal-sm`.
*/
size?: string;
/**
* a path to a template overriding modal's window template
*/
windowTemplateUrl?: string;
/**
* The class added to the body element when the modal is opened.
*
* @default 'model-open'
*/
openedClass?: string;
/**
* CSS class(es) to be added to the top modal window.
*/
windowTopClass?: string;
/**
* Appends the modal to a specific element.
*
* @default 'body'
*/
appendTo?: angular.IAugmentedJQuery;
/**
* A string reference to the component to be rendered that is registered with Angular's compiler. If using a directive, the directive must have `restrict: 'E'` and a template or templateUrl set.
*
* It supports these bindings:
* - `close` - A method that can be used to close a modal, passing a result. The result must be passed in this format: `{$value: myResult}`
* - `dismiss` - A method that can be used to dismiss a modal, passing a result. The result must be passed in this format: `{$value: myRejectedResult}`
* - `modalInstance` - The modal instance. This is the same `$uibModalInstance` injectable found when using `controller`.
* - `resolve` - An object of the modal resolve values. See [UI Router resolves] for details.
*/
component?: string;
/**
* Sets the `aria-describedby` property on the modal.
* The string should be an id (without the leading '#') pointing to the element that describes your modal.
* @type {string}
* @memberOf IModalSettings
*/
ariaDescribedBy?: string;
/**
* Sets the `aria-labelledby` property on the modal.
* The string should be an id (without the leading '#') pointing to the element that labels your modal.
* @type {string}
* @memberOf IModalSettings
*/
ariaLabelledBy?: string;
}
interface IModalStackService {
/**
* Opens a new modal instance.
*/
open(modalInstance: IModalServiceInstance, modal: any): void;
/**
* Closes a modal instance with an optional result.
*/
close(modalInstance: IModalServiceInstance, result?: any): void;
/**
* Dismisses a modal instance with an optional reason.
*/
dismiss(modalInstance: IModalServiceInstance, reason?: any): void;
/**
* Dismiss all open modal instances with an optional reason that will be passed to each instance.
*/
dismissAll(reason?: any): void;
/**
* Gets the topmost modal instance that is open.
*/
getTop(): IModalStackedMapKeyValuePair;
}
interface IModalStackedMapKeyValuePair {
key: IModalServiceInstance;
value: any;
}
interface IPaginationConfig {
/**
* Total number of items in all pages.
*/
totalItems?: number;
/**
* Maximum number of items per page. A value less than one indicates all items on one page.
*
* @default 10
*/
itemsPerPage?: number;
/**
* Limit number for pagination size.
*
* @default: null
*/
maxSize?: number;
/**
* An optional expression assigned the total number of pages to display.
*
* @default angular.noop
*/
numPages?: number;
/**
* Whether to keep current page in the middle of the visible ones.
*
* @default true
*/
rotate?: boolean;
/**
* Whether to display Previous / Next buttons.
*
* @default true
*/
directionLinks?: boolean;
/**
* Text for Previous button.
*
* @default 'Previous'
*/
previousText?: string;
/**
* Text for Next button.
*
* @default 'Next'
*/
nextText?: string;
/**
* Whether to display First / Last buttons.
*
* @default false
*/
boundaryLinks?: boolean;
/**
* Whether to always display the first and last page numbers. If max-size is smaller than the number of pages, then the first and last page numbers are still shown with ellipses in-between as necessary. NOTE: max-size refers to the center of the range. This option may add up to 2 more numbers on each side of the displayed range for the end value and what would be an ellipsis but is replaced by a number because it is sequential.
*
* @default false
*/
boundaryLinkNumbers?: boolean;
/**
* Text for First button.
*
* @default 'First'
*/
firstText?: string;
/**
* Text for Last button.
*
* @default 'Last'
*/
lastText?: string;
/**
* Override the template for the component with a custom provided template.
*
* @default 'template/pagination/pagination.html'
*/
templateUrl?: string;
/**
* Also displays ellipses when rotate is true and max-size is smaller than the number of pages.
*
* @default false
*/
forceEllipses?: boolean;
}
interface IPagerConfig {
/**
* Whether to align each link to the sides.
*
* @default true
*/
align?: boolean;
/**
* Maximum number of items per page. A value less than one indicates all items on one page.
*
* @default 10
*/
itemsPerPage?: number;
/**
* Text for Previous button.
*
* @default '« Previous'
*/
previousText?: string;
/**
* Text for Next button.
*
* @default 'Next »'
*/
nextText?: string;
}
interface IPositionCoordinates {
width?: number;
height?: number;
top?: number;
left?: number;
}
interface IPositionService {
/**
* Provides a read-only equivalent of jQuery's position function.
*/
position(element: JQuery): IPositionCoordinates;
/**
* Provides a read-only equivalent of jQuery's offset function.
*/
offset(element: JQuery): IPositionCoordinates;
}
interface IProgressConfig {
/**
* Whether bars use transitions to achieve the width change.
*
* @default: true
*/
animate?: boolean;
/**
* A number that specifies the total value of bars that is required.
*
* @default: 100
*/
max?: number;
}
interface IRatingConfig {
/**
* Changes the number of icons.
*
* @default: 5
*/
max?: number;
/**
* A variable used in the template to specify the state for selected icons.
*
* @default: null
*/
stateOn?: string;
/**
* A variable used in the template to specify the state for unselected icons.
*
* @default: null
*/
stateOff?: string;
/**
* An array of strings defining titles for all icons.
*
* @default: ["one", "two", "three", "four", "five"]
*/
titles?: Array<string>;
}
interface ITimepickerConfig {
/**
* Number of hours to increase or decrease when using a button.
*
* @default 1
*/
hourStep?: number;
/**
* Number of minutes to increase or decrease when using a button.
*
* @default 1
*/
minuteStep?: number;
/**
* Number of seconds to increase or decrease when using a button.
*
* @default 1
*/
secondStep?: number;
/**
* Whether to display 12H or 24H mode.
*
* @default true
*/
showMeridian?: boolean;
/**
* Meridian labels based on locale. To override you must supply an array like ['AM', 'PM'].
*
* @default null
*/
meridians?: Array<string>;
/**
* Whether the user can type inside the hours & minutes input.
*
* @default false
*/
readonlyInput?: boolean;
/**
* Whether the user can scroll inside the hours & minutes input to increase or decrease it's values.
*
* @default true
*/
mousewheel?: boolean;
/**
* Whether the user can use up/down arrowkeys inside the hours & minutes input to increase or decrease it's values.
*
* @default true
*/
arrowkeys?: boolean;
/**
* Shows spinner arrows above and below the inputs.
*
* @default true
*/
showSpinners?: boolean;
/**
* Show seconds input.
*
* @default false
*/
showSeconds?: boolean;
/**
* Add the ability to override the template used on the component.
*
* @default 'uib/template/timepicker/timepicker.html'
*/
templateUrl?: string;
}
interface ITooltipOptions {
/**
* Where to place it? Defaults to 'top', but also accepts 'right', 'bottom', or 'left'.
*
* @default 'top'
*/
placement?: string;
/**
* Should the modal fade in and out?
*
* @default true
*/
animation?: boolean;
/**
* Popup delay in milliseconds until it opens.
*
* @default 0
*/
popupDelay?: number;
/**
* For how long should the tooltip remain open after the close trigger event?
*
* @default 0
*/
popupCloseDelay?: number;
/**
* Should the tooltip be appended to `$body` instead of the parent element?
*
* @default false
*/
appendToBody?: boolean;
/**
* What should trigger a show of the tooltip? Supports a space separated list of event names.
*
* @default 'mouseenter' for tooltip, 'click' for popover
*/
trigger?: string;
/**
* Should an expression on the scope be used to load the content?
*
* @default false
*/
useContentExp?: boolean;
}
interface ITooltipProvider {
/**
* Provide a set of defaults for certain tooltip and popover attributes.
*/
options(value: ITooltipOptions): void;
/**
* Extends the default trigger mappings with mappings of your own. E.g. `{ 'openTrigger': 'closeTrigger' }`.
*/
setTriggers(triggers: Object): void;
}
/**
* WARNING: $transition is now deprecated. Use $animate from ngAnimate instead.
*/
interface ITransitionService {
/**
* The browser specific animation event name.
*/
animationEndEventName: string;
/**
* The browser specific transition event name.
*/
transitionEndEventName: string;
/**
* Provides a consistent interface to trigger CSS 3 transitions and to be informed when they complete.
*
* @param element The DOMElement that will be animated
* @param trigger The thing that will cause the transition to start:
* - As a string, it represents the css class to be added to the element.
* - As an object, it represents a hash of style attributes to be applied to the element.
* - As a function, it represents a function to be called that will cause the transition to occur.
* @param options Optional settings for the transition.
*
* @return A promise that is resolved when the transition finishes.
*/
(element: angular.IAugmentedJQuery, trigger: any, options?: ITransitionServiceOptions): angular.IPromise<angular.IAugmentedJQuery>;
}
interface ITransitionServiceOptions {
animation?: boolean;
}
}
}
-2062
View File
File diff suppressed because it is too large Load Diff
-33
View File
@@ -1,33 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"class-name": true,
"curly": true,
"max-line-length": false,
"no-consecutive-blank-lines": true,
"no-shadowed-variable": true,
"quotemark": [
true,
"single"
],
"align": true,
"callable-types": false,
"forbidden-types": false,
"indent": [
true,
"spaces"
],
"interface-name": false,
"linebreak-style": [
true,
"LF"
],
"no-empty-interface": false,
"unified-signatures": false,
"variable-name": [
true,
"check-format"
],
"void-return": false
}
}
-8
View File
@@ -1,8 +0,0 @@
namespace AnimationFrameTests {
var animation = new AnimationFrame();
function frame() {
animation.request(frame);
}
animation.request(frame);
}
-31
View File
@@ -1,31 +0,0 @@
// Type definitions for anydb-sql-migrations
// Project: https://github.com/spion/anydb-sql-migrations
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="bluebird" />
import Promise = require('bluebird');
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
export interface Migration {
version: string;
}
export interface MigrationsTable extends Table<Migration> {
version: Column<string>;
}
export interface MigFn {
(tx: Transaction): Promise<any>;
}
export interface MigrationTask {
up: MigFn;
down: MigFn;
name: string;
}
export declare function create(db: AnydbSql, tasks: any): {
run: () => Promise<any>;
migrateTo: (target?: string) => Promise<any>;
check: (f: (m: {
type: string;
items: MigrationTask[];
}) => any) => Promise<any>;
};
-70
View File
@@ -1,70 +0,0 @@
import anydbsql = require('anydb-sql');
import { Table, Column } from 'anydb-sql'
function do_not_run() {
var db = anydbsql({
url: 'postgres://user:pass@host:port/database',
connections: { min: 2, max: 20 }
});
// Table Post
interface Post {
content: string;
userId: string;
date: string;
}
interface PostTable extends Table<Post> {
content: Column<string>;
userId: Column<string>;
date: Column<string>;
}
var post = <PostTable>db.define<Post>({
name: 'posts',
columns: {
content: {},
userId: {},
date: {}
}
});
// Table User
interface User {
id: string;
email: string;
password: string;
name: string;
}
interface UserTable extends Table<User> {
id: Column<string>;
email: Column<string>;
password: Column<string>;
name: Column<string>;
}
var user = <UserTable>db.define<User>({
name: 'users',
columns: {
id: { primaryKey: true },
email: {},
password: {},
name: {},
date: {}
},
has: {
posts: { from: 'posts', many: true },
group: { from: 'groups'}
}
});
user.select(user.name, post.content)
.from(user.join(post).on(user.id.equals(post.userId)))
.where(post.date.gt('123'))
.all()
}
-193
View File
@@ -1,193 +0,0 @@
// Type definitions for anydb-sql
// Project: https://github.com/doxout/anydb-sql
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface AnyDBPool extends anydbSQL.DatabaseConnection {
query: (text: string, values: any[], callback: (err: Error, result: any) => void) => void
begin: () => anydbSQL.Transaction
close: (err: Error) => void
}
interface Dictionary<T> { [key: string]: T; }
declare namespace anydbSQL {
export interface OrderByValueNode { }
export interface ColumnDefinition {
primaryKey?: boolean;
dataType?: string;
references?: { table: string; column: string }
notNull?: boolean
}
export interface TableDefinition {
name: string
columns: Dictionary<ColumnDefinition>
has?: Dictionary<{ from: string; many?: boolean }>
}
export interface QueryLike {
query: string;
values: any[]
text: string
}
export interface DatabaseConnection {
queryAsync<T>(query: string, ...params: any[]): Promise<{ rowCount: number; rows: T[] }>
queryAsync<T>(query: QueryLike): Promise<{ rowCount: number; rows: T[] }>
}
export interface Transaction extends DatabaseConnection {
rollback(): void
commitAsync(): Promise<void>
}
export interface SubQuery<T> {
select(node: Column<T>): SubQuery<T>
where(...nodes: any[]): SubQuery<T>
from(table: TableNode): SubQuery<T>
group(...nodes: any[]): SubQuery<T>
order(criteria: OrderByValueNode): SubQuery<T>
notExists(subQuery: SubQuery<any>): SubQuery<T>
}
interface Executable<T> {
get(): Promise<T>
getWithin(tx: DatabaseConnection): Promise<T>
exec(): Promise<void>
all(): Promise<T[]>
execWithin(tx: DatabaseConnection): Promise<void>
allWithin(tx: DatabaseConnection): Promise<T[]>
toQuery(): QueryLike;
}
interface Queryable<T> {
where(...nodes: any[]): Query<T>
delete(): ModifyingQuery
select<U>(...nodes: any[]): Query<U>
selectDeep<U>(table: Table<T>): Query<T>
selectDeep<U>(...nodesOrTables: any[]): Query<U>
}
export interface Query<T> extends Executable<T>, Queryable<T> {
from(table: TableNode): Query<T>
update(o: Dictionary<any>): ModifyingQuery
update(o: {}): ModifyingQuery
group(...nodes: any[]): Query<T>
order(...criteria: OrderByValueNode[]): Query<T>
limit(l: number): Query<T>
offset(o: number): Query<T>
}
export interface ModifyingQuery extends Executable<void> {
returning<U>(...nodes: any[]): Query<U>
where(...nodes: any[]): ModifyingQuery
}
export interface TableNode {
join(table: TableNode): JoinTableNode
leftJoin(table: TableNode): JoinTableNode
}
export interface JoinTableNode extends TableNode {
on(filter: BinaryNode): TableNode
on(filter: string): TableNode
}
interface CreateQuery extends Executable<void> {
ifNotExists(): Executable<void>
}
interface DropQuery extends Executable<void> {
ifExists(): Executable<void>
}
export interface Table<T> extends TableNode, Queryable<T> {
create(): CreateQuery
drop(): DropQuery
as(name: string): Table<T>
update(o: any): ModifyingQuery
insert(row: T): ModifyingQuery
insert(rows: T[]): ModifyingQuery
select(): Query<T>
select<U>(...nodes: any[]): Query<U>
from<U>(table: TableNode): Query<U>
star(): Column<any>
subQuery<U>(): SubQuery<U>
eventEmitter: {
emit: (type: string, ...args: any[]) => void
on: (eventName: string, handler: Function) => void
}
columns: Column<any>[]
sql: SQL;
alter(): AlterQuery<T>
}
export interface AlterQuery<T> extends Executable<void> {
addColumn(column: Column<any>): AlterQuery<T>;
addColumn(name: string, options: string): AlterQuery<T>;
dropColumn(column: Column<any>): AlterQuery<T>;
renameColumn(column: Column<any>, newColumn: Column<any>): AlterQuery<T>;
renameColumn(column: Column<any>, newName: string): AlterQuery<T>;
renameColumn(name: string, newName: string): AlterQuery<T>;
rename(newName: string): AlterQuery<T>
}
export interface SQL {
functions: {
LOWER(c: Column<string>): Column<string>
}
}
export interface BinaryNode {
and(node: BinaryNode): BinaryNode
or(node: BinaryNode): BinaryNode
}
export interface Column<T> {
in(arr: T[]): BinaryNode
in(subQuery: SubQuery<T>): BinaryNode
notIn(arr: T[]): BinaryNode
equals(node: any): BinaryNode
notEquals(node: any): BinaryNode
gte(node: any): BinaryNode
lte(node: any): BinaryNode
gt(node: any): BinaryNode
lt(node: any): BinaryNode
like(str: string): BinaryNode
multiply: {
(node: Column<T>): Column<T>
(n: number): Column<number>
}
isNull(): BinaryNode
isNotNull(): BinaryNode
sum(): Column<number>
count(): Column<number>
count(name: string): Column<number>
distinct(): Column<T>
as(name: string): Column<T>
ascending: OrderByValueNode
descending: OrderByValueNode
asc: OrderByValueNode
desc: OrderByValueNode
}
export interface AnydbSql extends DatabaseConnection {
define<T>(map: TableDefinition): Table<T>;
transaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>
allOf(...tables: Table<any>[]): any
models: Dictionary<Table<any>>
functions: {
LOWER: (name: Column<string>) => Column<string>
RTRIM: (name: Column<string>) => Column<string>
}
makeFunction(name: string): Function
begin(): Transaction
open(): void;
close(): void;
getPool(): AnyDBPool;
dialect(): string;
}
}
declare function anydbSQL(config: Object): anydbSQL.AnydbSql;
export = anydbSQL;
-22
View File
@@ -1,22 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"anydb-sql-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
@@ -1,163 +0,0 @@
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
var config: Microsoft.ApplicationInsights.IConfig = {
instrumentationKey: "<your iKey>",
endpointUrl: "endpointUrl",
emitLineDelimitedJson: false,
accountId: "accountId",
sessionRenewalMs: 30,
sessionExpirationMs: 24 * 60 * 60 * 1000,
maxBatchSizeInBytes: 100 * 1024,
maxBatchInterval: 15,
enableDebug: false,
disableTelemetry: false,
verboseLogging: false,
diagnosticLogInterval: 10,
samplingPercentage: 100,
autoTrackPageVisitTime: true,
disableExceptionTracking: false,
disableAjaxTracking: false,
overridePageViewDuration: false,
maxAjaxCallsPerView: -1,
disableDataLossAnalysis: true,
disableCorrelationHeaders: true,
disableFlushOnBeforeUnload: false,
enableSessionStorageBuffer: false,
cookieDomain: "",
isCookieUseDisabled: true,
isRetryDisabled: true,
isPerfAnalyzerEnabled: true,
isStorageUseDisabled: true
};
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
config: config,
context: null,
queue: null,
startTrackPage(name?: string) { return null; },
stopTrackPage(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackPageView(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, duration?: number) { return null; },
startTrackEvent(name: string) { return null; },
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) { return null; },
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null; },
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null; },
trackTrace(message: string, properties?: { [name: string]: string; }) { return null; },
flush() { return null; },
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) { return null; },
clearAuthenticatedUserContext() { return null; },
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error) { return null; }
};
// trackPageView
appInsights.trackPageView("page1");
appInsights.trackPageView("page2", "http://example.com", null, null, 1000);
// startTrackPage
appInsights.startTrackPage("page");
// stopTrackPage
appInsights.stopTrackPage("page");
appInsights.stopTrackPage("page", "http://example.com", null, null);
// trackEvent
appInsights.trackEvent("page1");
appInsights.trackEvent("page1", null, null);
// trackMetric
appInsights.trackMetric("page1", 999);
appInsights.trackMetric("page1", 999, 1, 1, 2, null);
// trackException
appInsights.trackException(new Error("sample error"));
appInsights.trackException(new Error("sample error"), "handledAt", null, null);
// trackTrace
appInsights.trackTrace("message");
appInsights.trackTrace("message", null);
// trackDependency
appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null);
// flush
appInsights.flush();
// setAuthenticatedUserContext
appInsights.setAuthenticatedUserContext("userId");
appInsights.setAuthenticatedUserContext("userId", "accountId");
// set config dynamically
appInsights.config.instrumentationKey = "<new key>";
// TelementryContext
var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
context.application.ver = "v0.0.0";
context.application.build = "1.1.1";
context.device.type = "sampleDevice";
context.device.locale = "en-US";
context.user.id = "userId";
context.user.authenticatedId = "authId";
context.session.id = "sessionId";
context.session.isFirst = true;
context.location.ip = "127.0.0.1";
context.operation.id = "1";
context.operation.syntheticSource = "testAgent";
// track
var data = new Microsoft.Telemetry.Base();
var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
context.track(envelope);
context.addTelemetryInitializer((envelope) => false);
// track event
var eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
var eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Event>(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
var eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
context.track(eventEnvelope);
// track exception
var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
context.track(exceptionEnvelope);
// track metric
var metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
var metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Metric>(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
var metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
context.track(metricEnvelope);
// track page view
var pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
var pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageView>(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
var pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
context.track(pageViewEnvelope);
// track page view performance
var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
context.track(pageViewPerfEnvelope);
// track remote dependency
var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
context.track(pageViewPerfEnvelope);
// track trace
var traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
var traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
var traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
context.track(traceEnvelope);
-800
View File
@@ -1,800 +0,0 @@
// Type definitions for ApplicationInsights-JS 1.0
// Project: https://github.com/Microsoft/ApplicationInsights-JS
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module AI {
enum SeverityLevel {
Verbose = 0,
Information = 1,
Warning = 2,
Error = 3,
Critical = 4,
}
enum DependencyKind {
SQL = 0,
Http = 1,
Other = 2,
}
enum DependencySourceType {
Undefined = 0,
Aic = 1,
Apmc = 2,
}
class StackFrame {
level: number;
method: string;
assembly: string;
fileName: string;
line: number;
constructor();
}
class ExceptionDetails {
id: number;
outerId: number;
typeName: string;
message: string;
hasFullStack: boolean;
stack: string;
parsedStack: StackFrame[];
constructor();
}
enum DataPointType {
Measurement = 0,
Aggregation = 1,
}
class DataPoint {
name: string;
kind: AI.DataPointType;
value: number;
count: number;
min: number;
max: number;
stdDev: number;
constructor();
}
class EventData extends Microsoft.Telemetry.Domain {
ver: number;
name: string;
properties: any;
measurements: any;
constructor();
}
class PageViewData extends AI.EventData {
ver: number;
url: string;
name: string;
duration: string;
referrer: string;
referrerData: string;
properties: any;
measurements: any;
constructor();
}
class PageViewPerfData extends AI.PageViewData {
ver: number;
url: string;
perfTotal: string;
name: string;
duration: string;
networkConnect: string;
referrer: string;
sentRequest: string;
referrerData: string;
receivedResponse: string;
domProcessing: string;
properties: any;
measurements: any;
constructor();
}
class RemoteDependencyData extends Microsoft.Telemetry.Domain {
ver: number;
name: string;
id: string;
resultCode: string;
kind: AI.DataPointType;
value: number;
count: number;
min: number;
max: number;
stdDev: number;
dependencyKind: AI.DependencyKind;
success: boolean;
async: boolean;
dependencySource: AI.DependencySourceType;
commandName: string;
dependencyTypeName: string;
properties: any;
constructor();
}
class MessageData extends Microsoft.Telemetry.Domain {
ver: number;
message: string;
severityLevel: AI.SeverityLevel;
properties: any;
constructor();
}
}
declare module Microsoft.ApplicationInsights.Context {
interface IApplication {
/**
* The application version.
*/
ver: string;
/**
* The application build version.
*/
build: string;
}
interface IDevice {
/**
* The type for the current device.
*/
type: string;
/**
* A device unique ID.
*/
id: string;
/**
* The device OEM for the current device.
*/
oemName: string;
/**
* The device model for the current device.
*/
model: string;
/**
* The IANA interface type for the internet connected network adapter.
*/
network: number;
/**
* The application screen resolution.
*/
resolution: string;
/**
* The current display language of the operating system.
*/
locale: string;
/**
* The IP address.
*/
ip: string;
/**
* The device language.
*/
language: string;
/**
* The OS name.
*/
os: string;
/**
* The OS version.
*/
osversion: string;
}
interface ILocation {
/**
* Client IP address for reverse lookup
*/
ip: string;
}
interface IInternal {
/**
* The SDK version used to create this telemetry item.
*/
sdkVersion: string;
/**
* The SDK agent version.
*/
agentVersion: string;
}
interface ISample {
/**
* Sample rate
*/
sampleRate: number;
}
interface ISession {
/**
* The session ID.
*/
id: string;
/**
* The true if this is the first session
*/
isFirst: boolean;
/**
* The date at which this guid was genereated.
* Per the spec the ID will be regenerated if more than acquisitionSpan milliseconds ellapse from this time.
*/
acquisitionDate: number;
/**
* The date at which this session ID was last reported.
* This value should be updated whenever telemetry is sent using this ID.
* Per the spec the ID will be regenerated if more than renewalSpan milliseconds elapse from this time with no activity.
*/
renewalDate: number;
}
interface IOperation {
/**
* Operation id
*/
id: string;
/**
* Operation name
*/
name: string;
/**
* Parent operation id
*/
parentId: string;
/**
* Root operation id
*/
rootId: string;
/**
* Synthetic source of the operation
*/
syntheticSource: string;
}
interface IUser {
/**
* The telemetry configuration.
*/
config: any;
/**
* The user ID.
*/
id: string;
/**
* Authenticated user id
*/
authenticatedId: string;
/**
* The account ID.
*/
accountId: string;
/**
* The account acquisition date.
*/
accountAcquisitionDate: string;
/**
* The user agent string.
*/
agent: string;
/**
* The store region.
*/
storeRegion: string;
}
}
declare module Microsoft.Telemetry {
class Domain {
constructor();
}
class Base {
baseType: string;
constructor();
}
class Data<TDomain> extends Microsoft.Telemetry.Base {
baseType: string;
baseData: TDomain;
constructor();
}
}
declare module Microsoft.ApplicationInsights.Telemetry {
class Event implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
ver: number;
name: string;
properties: any;
measurements: any;
aiDataContract: {
ver: Microsoft.ApplicationInsights.FieldType;
name: Microsoft.ApplicationInsights.FieldType;
properties: Microsoft.ApplicationInsights.FieldType;
measurements: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new instance of the EventTelemetry object
*/
constructor(name: string, properties?: any, measurements?: any);
}
class Exception implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
ver: number;
handledAt: string;
exceptions: AI.ExceptionDetails[];
severityLevel: AI.SeverityLevel;
problemId: string;
crashThreadId: number;
properties: any;
measurements: any;
aiDataContract: {
ver: Microsoft.ApplicationInsights.FieldType;
handledAt: Microsoft.ApplicationInsights.FieldType;
exceptions: Microsoft.ApplicationInsights.FieldType;
severityLevel: Microsoft.ApplicationInsights.FieldType;
properties: Microsoft.ApplicationInsights.FieldType;
measurements: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new isntance of the ExceptionTelemetry object
*/
constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel);
/**
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
*/
static CreateSimpleException(message: string, typeName: string, assembly: string, fileName: string, details: string, line: number, handledAt?: string): Telemetry.Exception;
}
class Metric implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
ver: number;
metrics: AI.DataPoint[];
properties: any;
aiDataContract: {
ver: Microsoft.ApplicationInsights.FieldType;
metrics: Microsoft.ApplicationInsights.FieldType;
properties: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new instance of the MetricTelemetry object
*/
constructor(name: string, value: number, count?: number, min?: number, max?: number, properties?: any);
}
class PageView extends AI.PageViewData implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
aiDataContract: {
ver: Microsoft.ApplicationInsights.FieldType;
name: Microsoft.ApplicationInsights.FieldType;
url: Microsoft.ApplicationInsights.FieldType;
duration: Microsoft.ApplicationInsights.FieldType;
properties: Microsoft.ApplicationInsights.FieldType;
measurements: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new instance of the PageEventTelemetry object
*/
constructor(name?: string, url?: string, durationMs?: number, properties?: any, measurements?: any);
}
class PageViewPerformance extends AI.PageViewPerfData implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
aiDataContract: {
ver: Microsoft.ApplicationInsights.FieldType;
name: Microsoft.ApplicationInsights.FieldType;
url: Microsoft.ApplicationInsights.FieldType;
duration: Microsoft.ApplicationInsights.FieldType;
perfTotal: Microsoft.ApplicationInsights.FieldType;
networkConnect: Microsoft.ApplicationInsights.FieldType;
sentRequest: Microsoft.ApplicationInsights.FieldType;
receivedResponse: Microsoft.ApplicationInsights.FieldType;
domProcessing: Microsoft.ApplicationInsights.FieldType;
properties: Microsoft.ApplicationInsights.FieldType;
measurements: Microsoft.ApplicationInsights.FieldType;
};
/**
* Field indicating whether this instance of PageViewPerformance is valid and should be sent
*/
private isValid;
/**
* Indicates whether this instance of PageViewPerformance is valid and should be sent
*/
getIsValid(): boolean;
private durationMs;
/**
* Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
*/
getDurationMs(): number;
/**
* Constructs a new instance of the PageEventTelemetry object
*/
constructor(name: string, url: string, unused: number, properties?: any, measurements?: any);
static getPerformanceTiming(): PerformanceTiming;
/**
* Returns true is window performance timing API is supported, false otherwise.
*/
static isPerformanceTimingSupported(): PerformanceTiming;
/**
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
* Returns true if ready, false otherwise.
*/
static isPerformanceTimingDataReady(): boolean;
static getDuration(start: any, end: any): number;
}
class RemoteDependencyData extends AI.RemoteDependencyData implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
aiDataContract: {
id: Microsoft.ApplicationInsights.FieldType;
ver: Microsoft.ApplicationInsights.FieldType;
name: Microsoft.ApplicationInsights.FieldType;
kind: Microsoft.ApplicationInsights.FieldType;
value: Microsoft.ApplicationInsights.FieldType;
count: Microsoft.ApplicationInsights.FieldType;
min: Microsoft.ApplicationInsights.FieldType;
max: Microsoft.ApplicationInsights.FieldType;
stdDev: Microsoft.ApplicationInsights.FieldType;
dependencyKind: Microsoft.ApplicationInsights.FieldType;
success: Microsoft.ApplicationInsights.FieldType;
async: Microsoft.ApplicationInsights.FieldType;
dependencySource: Microsoft.ApplicationInsights.FieldType;
commandName: Microsoft.ApplicationInsights.FieldType;
dependencyTypeName: Microsoft.ApplicationInsights.FieldType;
properties: Microsoft.ApplicationInsights.FieldType;
resultCode: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new instance of the RemoteDependencyData object
*/
constructor(id: string, absoluteUrl: string, commandName: string, value: number, success: boolean, resultCode: number, method?: string);
private formatDependencyName(method, absoluteUrl);
}
class Trace extends AI.MessageData implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
aiDataContract: {
ver: Microsoft.ApplicationInsights.FieldType;
message: Microsoft.ApplicationInsights.FieldType;
severityLevel: Microsoft.ApplicationInsights.FieldType;
measurements: Microsoft.ApplicationInsights.FieldType;
properties: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new instance of the MetricTelemetry object
*/
constructor(message: string, properties?: any);
}
}
declare module Microsoft.ApplicationInsights.Telemetry.Common {
class Base extends Microsoft.Telemetry.Base implements Microsoft.ApplicationInsights.ISerializable {
/**
* The data contract for serializing this object.
*/
aiDataContract: {};
}
class Data<TDomain> extends Microsoft.Telemetry.Data<TDomain> implements Microsoft.ApplicationInsights.ISerializable {
/**
* The data contract for serializing this object.
*/
aiDataContract: {
baseType: FieldType;
baseData: FieldType;
};
/**
* Constructs a new instance of telemetry data.
*/
constructor(type: string, data: TDomain);
}
class Envelope implements IEnvelope {
ver: number;
name: string;
time: string;
sampleRate: number;
seq: string;
iKey: string;
flags: number;
deviceId: string;
os: string;
osVer: string;
appId: string;
appVer: string;
userId: string;
tags: any;
data: Base;
/**
* The data contract for serializing this object.
*/
aiDataContract: any;
/**
* Constructs a new instance of telemetry data.
*/
constructor(data: Microsoft.Telemetry.Base, name: string);
}
class DataSanitizer {
static sanitizeKeyAndAddUniqueness(key: any, map: any): any;
static sanitizeKey(name: any): any;
static sanitizeString(value: any): any;
static sanitizeUrl(url: any): any;
static sanitizeMessage(message: any): any;
static sanitizeException(exception: any): any;
static sanitizeProperties(properties: any): any;
static sanitizeMeasurements(measurements: any): any;
static padNumber(num: any): string;
}
}
declare module Microsoft.ApplicationInsights {
interface IConfig {
instrumentationKey?: string;
endpointUrl?: string;
emitLineDelimitedJson?: boolean;
accountId?: string;
sessionRenewalMs?: number;
sessionExpirationMs?: number;
maxBatchSizeInBytes?: number;
maxBatchInterval?: number;
enableDebug?: boolean;
disableExceptionTracking?: boolean;
disableTelemetry?: boolean;
verboseLogging?: boolean;
diagnosticLogInterval?: number;
samplingPercentage?: number;
autoTrackPageVisitTime?: boolean;
disableAjaxTracking?: boolean;
overridePageViewDuration?: boolean;
maxAjaxCallsPerView?: number;
disableDataLossAnalysis?: boolean;
disableCorrelationHeaders?: boolean;
disableFlushOnBeforeUnload?: boolean;
enableSessionStorageBuffer?: boolean;
isCookieUseDisabled?: boolean;
cookieDomain?: string;
isRetryDisabled?: boolean;
isPerfAnalyzerEnabled?: boolean;
url?: string;
isStorageUseDisabled?: boolean;
}
/**
* Enum is used in aiDataContract to describe how fields are serialized.
* For instance: (Fieldtype.Required | FieldType.Array) will mark the field as required and indicate it's an array
*/
enum FieldType {
Default = 0,
Required = 1,
Array = 2,
Hidden = 4,
}
interface ISerializable {
/**
* The set of fields for a serializeable object.
* This defines the serialization order and a value of true/false
* for each field defines whether the field is required or not.
*/
aiDataContract: any;
}
interface IEnvelope extends ISerializable {
ver: number;
name: string;
time: string;
sampleRate: number;
seq: string;
iKey: string;
flags: number;
deviceId: string;
os: string;
osVer: string;
appId: string;
appVer: string;
userId: string;
tags: {
[name: string]: any;
};
}
interface ITelemetryContext {
/**
* The object describing a component tracked by this object.
*/
application: Context.IApplication;
/**
* The object describing a device tracked by this object.
*/
device: Context.IDevice;
/**
* The object describing internal settings.
*/
internal: Context.IInternal;
/**
* The object describing a location tracked by this object.
*/
location: Context.ILocation;
/**
* The object describing a operation tracked by this object.
*/
operation: Context.IOperation;
/**
* The object describing sampling settings.
*/
sample: Context.ISample;
/**
* The object describing a user tracked by this object.
*/
user: Context.IUser;
/**
* The object describing a session tracked by this object.
*/
session: Context.ISession;
/**
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
* before telemetry item is pushed for sending and in the order they were added.
*/
addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any;
/**
* Tracks telemetry object.
*/
track(envelope: Microsoft.ApplicationInsights.IEnvelope): any;
}
interface IAppInsights {
config: IConfig;
context: ITelemetryContext;
queue: Array<() => void>;
/**
* Starts timing how long the user views a page or other item. Call this when the page opens.
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
startTrackPage(name?: string): any;
/**
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackPage(name?: string, url?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
/**
* Logs that a page or other item was viewed.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
*/
trackPageView(name?: string, url?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}, duration?: number): any;
/**
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
* @param name A string that identifies this event uniquely within the document.
*/
startTrackEvent(name: string): any;
/**
* Log an extended event that you started timing with {@link startTrackEvent}.
* @param name The string you used to identify this event in startTrackEvent.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackEvent(name: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
/**
* Log a user action or other occurrence.
* @param name A string to identify this event in the portal.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
trackEvent(name: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
/**
* Log a dependency call
* @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id.
* @param method represents request verb (GET, POST, etc.)
* @param absoluteUrl absolute url used to make the dependency request
* @param pathName the path part of the absolute url
* @param totalTime total request time
* @param success indicates if the request was sessessful
* @param resultCode response code returned by the dependency request
*/
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number): any;
/**
* Log an exception you have caught.
* @param exception An Error from a catch clause, or the string error message.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param severityLevel AI.SeverityLevel - severity level
*/
trackException(exception: Error, handledAt?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}, severityLevel?: AI.SeverityLevel): any;
/**
* Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
* To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
* telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
* @param name A string that identifies the metric.
* @param average Number representing either a single measurement, or the average of several measurements.
* @param sampleCount The number of measurements represented by the average. Defaults to 1.
* @param min The smallest measurement in the sample. Defaults to the average.
* @param max The largest measurement in the sample. Defaults to the average.
*/
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {
[name: string]: string;
}): any;
/**
* Log a diagnostic message.
* @param message A message string
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
*/
trackTrace(message: string, properties?: {
[name: string]: string;
}): any;
/**
* Immediately send all queued telemetry.
*/
flush(): any;
/**
* Sets the autheticated user id and the account id in this session.
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
*
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
*/
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
/**
* Clears the authenticated user id and the account id from the user context.
*/
clearAuthenticatedUserContext(): any;
downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): any;
/**
* The custom error handler for Application Insights
* @param {string} message - The error message
* @param {string} url - The url where the error was raised
* @param {number} lineNumber - The line number where the error was raised
* @param {number} columnNumber - The column number for the line where the error was raised
* @param {Error} error - The Error object
*/
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
}
}
declare module 'applicationinsights-js' {
export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
}
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
-8
View File
@@ -1,8 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"interface-name": [ false ],
"no-internal-module": false,
"no-single-declare-module": false
}
}
-30
View File
@@ -1,30 +0,0 @@
import Map = require("esri/Map");
import MapView = require("esri/views/MapView");
import Point = require("esri/geometry/Point");
export = MapController;
class MapController {
map: Map;
constructor(public mapDiv: string) {
}
start() {
let point = new Point({
latitude: 37.75,
longitude: -122.45
});
this.map = new Map({
basemap: "topo"
});
let view = new MapView({
center: point,
container: this.mapDiv,
map: this.map,
zoom: 13
});
}
}
-8417
View File
File diff suppressed because it is too large Load Diff
-23
View File
@@ -1,23 +0,0 @@
import esri = require("esri");
import Map = require("esri/map");
import Point = require("esri/geometry/Point");
export = MapController;
class MapController {
map: Map;
constructor(public mapDiv: string) {
}
start() {
let point = new Point(-122.45, 37.75); // long, lat
let mapOptions: esri.MapOptions = {};
mapOptions.basemap = "topo";
mapOptions.center = point;
mapOptions.zoom = 13;
this.map = new Map(this.mapDiv, mapOptions);
}
}
-220
View File
@@ -1,220 +0,0 @@
// Type definitions for arcgis-to-geojson-utils 10.4
// Project: http://resources.arcgis.com/en/help/arcgis-rest-api/
// Definitions by: Jeff Jacobson <https://github.com/JeffJacobson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Feature {
geometry: Geometry;
attributes: any;
}
export interface Field {
name: string;
type: string;
alias?: string;
length?: number;
}
export interface FeatureSet extends HasZM {
objectIdFieldName?: string; // optional
globalIdFieldName?: string; // optional
displayFieldName?: string; // optional
geometryType?: esriGeometryType; // for feature layers only
spatialReference?: SpatialReference; // for feature layers only.
fields?: Field[];
features: Feature[];
}
export type Position2D = [number, number];
export type Position = Position2D | [number, number, number] | [number, number, number, number];
export interface CircularArc {
"c": [Position, Position2D];
}
export interface Arc {
"a": [
Position, // End point: x, y, <z>, <m>
Position2D, // Center point: center_x, center_y
number, // minor
number, // clockwise
number, // rotation
number, // axis
number // ratio
];
}
export type ElipticArc = Arc;
export interface OldCircularArc {
"a": [
Position, // End point: x, y, <z>, <m>
Position2D, // Center point: center_x, center_y
number, // minor
number // clockwise
];
}
export interface BezierCurve {
"b": [
Position,
Position2D,
Position2D
];
}
export type JsonCurve = CircularArc | Arc | OldCircularArc | BezierCurve;
export interface SpatialReferenceWkid {
wkid?: number;
latestWkid?: number;
vcsWkid?: number;
latestVcsWkid?: number;
}
export interface SpatialReferenceWkt {
wkt?: string;
latestWkt?: string;
}
export type SpatialReference = SpatialReferenceWkt | SpatialReferenceWkid;
export interface Geometry {
spatialReference?: SpatialReference;
}
export interface HasZM {
hasZ?: boolean;
hasM?: boolean;
}
export interface Point extends Geometry {
x: number;
y: number;
z?: number;
m?: number;
}
export interface Polyline extends HasZM, Geometry {
paths: Position[][];
}
export interface PolylineWithCurves extends HasZM, Geometry {
curvePaths: Array<Array<(Position | JsonCurve)>>;
}
export interface Polygon extends HasZM, Geometry {
rings: Position[][];
}
export interface PolygonWithCurves extends HasZM, Geometry {
curveRings: Array<Array<(Position | JsonCurve)>>;
}
export interface Multipoint extends HasZM, Geometry {
points: Position[];
}
export interface Envelope extends Geometry {
xmin: number;
xmax: number;
ymin: number;
ymax: number;
zmin?: number;
zmax?: number;
mmin?: number;
mmax?: number;
}
export type esriGeometryType = "esriGeometryPoint" | "esriGeometryMultipoint" | "esriGeometryPolyline" | "esriGeometryPolygon" | "esriGeometryEnvelope";
export type Color = [number, number, number, number];
export type SimpleMarkerSymbolStyle = "esriSMSCircle" | "esriSMSCross" | "esriSMSDiamond" | "esriSMSSquare" | "esriSMSX" | "esriSMSTriangle";
export type SimpleLineSymbolStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSNull" | "esriSLSSolid";
export type SimpleFillSymbolStyle =
"esriSFSBackwardDiagonal" | "esriSFSCross" | "esriSFSDiagonalCross" | "esriSFSForwardDiagonal" | "esriSFSHorizontal" | "esriSFSNull" | "esriSFSSolid" | "esriSFSVertical";
export type SymbolType = "esriSLS" | "esriSMS" | "esriSFS" | "esriPMS" | "esriPFS" | "esriTS";
export interface Symbol {
"type": SymbolType;
"style"?: string;
}
export interface SimpleLineSymbol extends Symbol {
"type": "esriSLS";
"style"?: SimpleLineSymbolStyle;
"color"?: Color;
"width"?: number;
}
export interface MarkerSymbol extends Symbol {
"angle"?: number;
"xoffset"?: number;
"yoffset"?: number;
}
export interface SimpleMarkerSymbol extends MarkerSymbol {
"type": "esriSMS";
"style"?: SimpleMarkerSymbolStyle;
"color"?: Color;
"size"?: number;
"outline"?: SimpleLineSymbol;
}
export interface SimpleFillSymbol extends Symbol {
"type": "esriSFS";
"style"?: SimpleFillSymbolStyle;
"color"?: Color;
"outline"?: SimpleLineSymbol; // if outline has been specified
}
export interface PictureSourced {
"url"?: string; // Relative URL for static layers and full URL for dynamic layers. Access relative URL using http://<mapservice-url>/<layerId1>/images/<imageUrl11>
"imageData"?: string; // "<base64EncodedImageData>";
"contentType"?: string;
"width"?: number;
"height"?: number;
"angle"?: number;
"xoffset"?: number;
"yoffset"?: number;
}
export interface PictureMarkerSymbol extends MarkerSymbol, PictureSourced {
"type": "esriPMS";
}
export interface PictureFillSymbol extends Symbol, PictureSourced {
"type": "esriPFS";
"outline"?: SimpleLineSymbol; // if outline has been specified
"xscale"?: number;
"yscale"?: number;
}
export interface Font {
"family"?: string; // "<fontFamily>";
"size"?: number; // <fontSize>;
"style"?: "italic" | "normal" | "oblique";
"weight"?: "bold" | "bolder" | "lighter" | "normal";
"decoration"?: "line-through" | "underline" | "none";
}
export interface TextSymbol extends MarkerSymbol {
"type": "esriTS";
"color"?: Color;
"backgroundColor"?: Color;
"borderLineSize"?: number; // <size>;
"borderLineColor"?: Color;
"haloSize"?: number; // <size>;
"haloColor"?: Color;
"verticalAlignment"?: "baseline" | "top" | "middle" | "bottom";
"horizontalAlignment"?: "left" | "right" | "center" | "justify";
"rightToLeft"?: boolean;
"kerning"?: boolean;
"font"?: Font;
"text"?: string; // only applicable when specified as a client-side graphic.
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-18
View File
@@ -1,18 +0,0 @@
// Type definitions for arcgis-to-geojson-utils 1.0
// Project: https://github.com/Esri/arcgis-to-geojson-utils
// Definitions by: Jeff Jacobson <https://github.com/JeffJacobson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="geojson" />
import * as ArcGis from "arcgis-rest-api";
/**
* Converts an ArcGIS geometry into a GeoJSON geometry.
*/
export function arcgisToGeoJSON<T extends ArcGis.Geometry>(arcgis: T): GeoJSON.GeometryObject;
/**
* Converts a GeoJSON geometry into a ArcGIS geometry.
*/
export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-22
View File
@@ -1,22 +0,0 @@
/// <reference types="node" />
import Archiver = require('archiver');
import FS = require('fs');
var archiver = Archiver.create('zip');
var writeStream = FS.createWriteStream('./archiver.d.ts');
var readStream = FS.createReadStream('./archiver.d.ts');
archiver.pipe(writeStream);
archiver.append(readStream, {name: 'archiver.d.ts'});
archiver.finalize();
archiver.directory('./path', './someOtherPath');
archiver.directory('./path', { name: "testName"} );
archiver.directory('./', "", {});
archiver.directory('./', {name: 'test'}, {});
archiver.bulk({ mappaing: {} });
-48
View File
@@ -1,48 +0,0 @@
// Type definitions for archiver v0.15.0
// Project: https://github.com/archiverjs/node-archiver
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* =================== USAGE ===================
import Archiver = require('archiver);
var archiver = Archiver.create('zip');
archiver.pipe(FS.createWriteStream('xxx'));
archiver.append(FS.createReadStream('xxx'));
archiver.finalize();
=============================================== */
/// <reference types="node" />
import * as FS from 'fs';
import * as STREAM from 'stream';
declare function archiver(format: string, options?: archiver.Options): archiver.Archiver;
declare namespace archiver {
export function create(format: string, options?: Options): Archiver;
export interface nameInterface {
name?: string;
}
export interface Archiver extends STREAM.Transform {
append(source: STREAM.Readable | Buffer | string, name: nameInterface): void;
directory(dirpath: string, destpath: nameInterface | string): void;
directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void;
bulk(mappings: any): void;
finalize(): void;
}
export interface Options {
}
}
export = archiver;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-5
View File
@@ -1,5 +0,0 @@
import arrayUniq = require("array-uniq");
arrayUniq([1, 1, 2, 3, 3]);
arrayUniq(["foo", "foo", "bar", "foo"]);
-8
View File
@@ -1,8 +0,0 @@
// Type definitions for array-uniq 1.0
// Project: https://github.com/sindresorhus/array-uniq
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function arrayUniq<T>(arr: T[]): T[];
export = arrayUniq;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-513
View File
@@ -1,513 +0,0 @@
// Type definitions for artyom.js 1.0
// Project: https://github.com/sdkcarlos/artyom.js
// Definitions by: Sema García (José Manuel García) <https://github.com/semagarcia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Extension of Window interface
*/
interface ArtyomWindow extends Window {
webkitSpeechRecognition: any;
SpeechRecognition: any;
SpeechSynthesisUtterance: any;
}
interface SpeechRecognition extends EventTarget {
grammars: SpeechGrammarList;
lang: string;
continuous: boolean;
interimResults: boolean;
maxAlternatives: number;
serviceURI: string;
start(): void;
stop(): void;
abort(): void;
onaudiostart: (ev: Event) => any;
onsoundstart: (ev: Event) => any;
onspeechstart: (ev: Event) => any;
onspeechend: (ev: Event) => any;
onsoundend: (ev: Event) => any;
onresult: (ev: SpeechRecognitionEvent) => any;
onnomatch: (ev: SpeechRecognitionEvent) => any;
onerror: (ev: SpeechRecognitionError) => any;
onstart: (ev: Event) => any;
onend: (ev: Event) => any;
}
interface SpeechRecognitionStatic {
prototype: SpeechRecognition;
new (): SpeechRecognition;
}
declare var SpeechRecognition: SpeechRecognitionStatic;
declare var webkitSpeechRecognition: SpeechRecognitionStatic;
interface SpeechRecognitionError extends Event {
error: string;
message: string;
}
interface SpeechRecognitionAlternative {
transcript: string;
confidence: number;
}
interface SpeechRecognitionResult {
length: number;
item(index: number): SpeechRecognitionAlternative;
[index: number]: SpeechRecognitionAlternative;
isFinal: boolean;
}
interface SpeechRecognitionResultList {
length: number;
item(index: number): SpeechRecognitionResult;
[index: number]: SpeechRecognitionResult;
}
interface SpeechRecognitionEvent extends Event {
resultIndex: number;
results: SpeechRecognitionResultList;
interpretation: any;
emma: Document;
}
interface SpeechGrammar {
src: string;
weight: number;
}
interface SpeechGrammarStatic {
prototype: SpeechGrammar;
new (): SpeechGrammar;
}
declare var SpeechGrammar: SpeechGrammarStatic;
declare var webkitSpeechGrammar: SpeechGrammarStatic;
interface SpeechGrammarList {
length: number;
item(index: number): SpeechGrammar;
[index: number]: SpeechGrammar;
addFromURI(src: string, weight: number): void;
addFromString(string: string, weight: number): void;
}
interface SpeechGrammarListStatic {
prototype: SpeechGrammarList;
new (): SpeechGrammarList;
}
declare var SpeechGrammarList: SpeechGrammarListStatic;
declare var webkitSpeechGrammarList: SpeechGrammarListStatic;
interface SpeechSynthesis extends EventTarget {
pending: boolean;
speaking: boolean;
paused: boolean;
onvoiceschanged: (ev: Event) => any;
speak(utterance: SpeechSynthesisUtterance): void;
cancel(): void;
pause(): void;
resume(): void;
getVoices(): SpeechSynthesisVoice[];
}
interface SpeechSynthesisGetter {
speechSynthesis: SpeechSynthesis;
}
declare var speechSynthesis: SpeechSynthesis;
interface SpeechSynthesisUtterance extends EventTarget {
text: string;
lang: string;
voice: SpeechSynthesisVoice;
volume: number;
rate: number;
pitch: number;
onstart: (ev: SpeechSynthesisEvent) => any;
onend: (ev: SpeechSynthesisEvent) => any;
onerror: (ev: SpeechSynthesisErrorEvent) => any;
onpause: (ev: SpeechSynthesisEvent) => any;
onresume: (ev: SpeechSynthesisEvent) => any;
onmark: (ev: SpeechSynthesisEvent) => any;
onboundary: (ev: SpeechSynthesisEvent) => any;
}
interface SpeechSynthesisUtteranceStatic {
prototype: SpeechSynthesisUtterance;
new (text?: string): SpeechSynthesisUtterance;
}
declare var SpeechSynthesisUtterance: SpeechSynthesisUtteranceStatic;
interface SpeechSynthesisEvent extends Event {
utterance: SpeechSynthesisUtterance;
charIndex: number;
elapsedTime: number;
name: string;
}
interface SpeechSynthesisErrorEvent extends SpeechSynthesisEvent {
error: string;
}
interface SpeechSynthesisVoice {
voiceURI: string;
name: string;
lang: string;
localService: boolean;
default: boolean;
}
declare namespace Artyom {
interface ArtyomDevice {
isChrome(): boolean;
isMobile(): boolean;
}
interface ArtyomBrowserVoiceObject {
default: boolean;
lang: string;
localService: false;
name: string;
voiceURI: string;
}
interface ArtyomConfigProperties {
/** Set the default language of artyom with this property */
lang?: string;
recognizing?: boolean;
/** Choose if should listen one command and then stops, or listening forever */
continuous?: boolean;
/** Moderates the speed with which Artyom talks (0 ~ 1) */
speed?: number;
/** Adjust the volume of the voice of artyom */
volume?: number;
/** If listen is equal to true the voice recognition will be started otherwise this property can be ignored */
listen: boolean;
/** Recognition mode: normal, quick, remote */
mode?: string;
/** Displays all the grammars recognized in the console */
debug: boolean;
helpers?: {
redirectRecognizedTextOutput: any;
remoteProcessorHandler: any;
lastSay: any;
};
/** Set a keyword that allows your command to be executed immediately when you say this word (Useful in noisy environments) */
executionKeyword?: string;
/** Set a keyword that allows to enable the command recognition automatically if this word is recognized while artyom is paused (artyom.dontObey) */
obeyKeyword?: string;
speaking?: boolean;
obeying?: boolean;
soundex?: boolean;
}
interface ArtyomCommand {
/** Triggers of the command */
indexes: string[];
/** Logic to execute when the command is triggered */
action: (i: number, wildcard?: string, full?: string) => void;
/** Description of the command */
description?: string;
/** Flag to specify is a command is either normal or smart */
smart?: boolean;
}
interface ArtyomFlags {
restartRecognition: boolean;
}
interface ArtyomRecognizer {
lang: string;
continuous: boolean;
interimResults: boolean;
start(): void;
stop(): void;
onstart(): void;
onresult(event: any): void;
onerror(event: any): void;
onend(): void;
}
export interface ArtyomJS {
/**
* Contains some basic information that artyom needs to know as the type of device and browser
* @see http://ourcodeworld.com/projects/projects-documentation/6/read-doc/artyom-device/artyom-js
*/
device: ArtyomDevice;
/**
* Object which provides the speech interface, and set some of its attributes and event handlers
*/
artyomWSR: ArtyomRecognizer;
/**
* Artyom can return inmediately the voices available in your browser.
* @see http://ourcodeworld.com/projects/projects-documentation/14/read-doc/artyom-getvoices/artyom-js
* @returns {Array}
*/
getVoices(): SpeechSynthesisVoice[];
/**
* Returns an array with all the available commands for artyom.
* @see http://ourcodeworld.com/projects/projects-documentation/10/read-doc/artyom-getavailablecommands/artyom-js
* @returns {Array}
*/
getAvailableCommands(): ArtyomCommand[];
/**
* Set up artyom for the application. This function will set the default language used by artyom
* or notice the user if artyom is not supported in the actual browser.
* @see http://ourcodeworld.com/projects/projects-documentation/15/read-doc/artyom-initialize/artyom-js
* @param {ArtyomConfigProperties} config
* @returns {Boolean}
*/
initialize(config: ArtyomConfigProperties): boolean;
/**
* Force artyom to stop listen even if is in continuos mode.
* @see http://ourcodeworld.com/projects/projects-documentation/9/read-doc/artyom-fatality/artyom-js
* @returns {Boolean}
*/
fatality(): boolean;
/**
* Add dinamically commands to artyom using. You can even add commands while artyom is active.
* @see http://ourcodeworld.com/projects/projects-documentation/4/read-doc/artyom-addcommands/artyom-js
* @param {ArtyomCommand | Array[ArtyomCommand]} newCommand
* @returns {Boolean}
*/
addCommands(newCommand: ArtyomCommand | ArtyomCommand[]): boolean;
/**
* Remove the commands of artyom with indexes that matches with the given text.
* @see http://ourcodeworld.com/projects/projects-documentation/19/read-doc/artyom-removecommands/artyom-js
* @param {string} identifier
* @returns {Array}
*/
removeCommands(identifier: string): number[];
/**
* Removes all the added commands of artyom.
* @see http://ourcodeworld.com/projects/projects-documentation/7/read-doc/artyom-emptycommands/artyom-js
* @returns {Array}
*/
emptyCommands(): ArtyomCommand[];
/**
* Stops the actual and pendings messages that artyom have to say.
* @see http://ourcodeworld.com/projects/projects-documentation/23/read-doc/artyom-shutup/artyom-js
*/
shutUp(): void;
/**
* Returns an object with the actual properties of artyom.
* @see http://ourcodeworld.com/projects/projects-documentation/12/read-doc/artyom-getproperties/artyom-js
* @returns {ArtyomConfigProperties}
*/
getProperties(): ArtyomConfigProperties;
/**
* Create a listener when an artyom action is called.
* @see http://ourcodeworld.com/projects/projects-documentation/24/read-doc/artyom-when/artyom-js
*/
when(event: any, action: any): any;
/**
* Returns the code language of artyom according to initialize function.
* @see http://ourcodeworld.com/projects/projects-documentation/11/read-doc/artyom-getlanguage/artyom-js
* @returns {String} Language
*/
getLanguage(): string;
/**
* Talks a text according to the given parameters (private function).
* @param {String} text Text to be spoken
* @param {Int} actualChunk Number of chunk of the
* @param {Int} totalChunks
* @param {any} callbacks
*/
artyomTalk(text: any, actualChunk: any, totalChunks: any, callbacks: any): any;
/**
* Splits a string into an array of strings with a limited size (chunk_length).
* @param {String} input text to split into chunks
* @param {Integer} chunk_length limit of characters in every chunk
*/
splitStringByChunks(input: any, chunk_length: any): string[];
/**
* Process the given text into chunks and execute the private function artyom_talk.
* @param {String} message Text to be spoken
* @param {Object} callbacks { onStart, onEnd }
* @see http://ourcodeworld.com/projects/projects-documentation/20/read-doc/artyom-say/artyom-js
*/
say(message: any, callbacks: any): void;
/**
* Repeats the last sentence that artyom said. Useful in noisy environments.
* @param {Boolean} returnObject If set to true, an object with the text and the timestamp when was executed will be returned.
* @see http://ourcodeworld.com/projects/projects-documentation/25/read-doc/artyom-repeatlastsay/artyom-js
*/
repeatLastSay(returnObject: any): void;
/**
* Verify if the browser supports speechSynthesis.
* @see http://ourcodeworld.com/projects/projects-documentation/40/read-doc/artyom-speechsupported/artyom-js
* @returns {Boolean}
*/
speechSupported(): boolean;
/**
* Verify if the browser supports webkitSpeechRecognition.
* @see http://ourcodeworld.com/projects/projects-documentation/39/read-doc/artyom-recognizingsupported/artyom-js
* @returns {Boolean}
*/
recognizingSupported(): boolean;
/**
* Simulate a voice command via JS.
* @see http://ourcodeworld.com/projects/projects-documentation/22/read-doc/artyom-simulateinstruction/artyom-js
* @param {string} sentence
* @returns {Boolean}
*/
simulateInstruction(sentence: string): boolean;
/**
* Returns an object with data of the matched element.
* @param {string} voiceCommand
* @returns {Object | Function}. There is a result field when the function should return a boolean value.
*/
artyomExecute(voiceCommand: string): any;
/**
* Displays a message in the console if the artyom propery DEBUG is set to true.
* @param {string} error The error to be debugged
* @param {string} traceLevel Error level: { error | warn | info }
* @see http://ourcodeworld.com/projects/projects-documentation/38/read-doc/artyom-debug/artyom-js
*/
debug(stringEvent: string, traceLevel: string): void;
/**
* Allows to retrieve the recognized spoken text of artyom and do something with it everytime something is recognized.
* @param {Function} action
* @returns {Boolean}
*/
redirectRecognizedTextOutput(action: () => void): boolean;
/**
* Says a random quote and returns it's object.
* @param data
*/
sayRandom(data: any): any;
/**
* Artyom provide an easy way to create a dictation for your user. Just create an instance and start and stop when you want.
*/
newDictation(settings: any): any;
/**
* A voice prompt will be executed.
*/
newPrompt(config: any): any;
/**
* Artyom awaits for orders when this function is executed. If artyom gets a first parameter the instance will be stopped.
*/
artyomHey(): any;
/**
* This function will return the webkitSpeechRecognition object used by artyom retrieve it only to debug on it or get some
* values, do not make changes directly.
*/
getNativeApi(): any;
/**
* This function returns a boolean according to the SpeechRecognition status if artyom is listening, will return true.
* Note: This is not a feature of SpeechRecognition, therefore this value hangs on the fiability of the onStart and onEnd
* events of the SpeechRecognition
* @returns {Boolean}
*/
isRecognizing(): boolean;
/**
* This function returns a boolean according to the speechSynthesis status if artyom is speaking, will return true.
* Note: This is not a feature of speechSynthesis, therefore this value hangs on the fiability of the onStart and onEnd
* events of the speechSynthesis.
* @returns {Boolean}
*/
isSpeaking(): boolean;
/**
* The SpeechSynthesisUtterance objects are stored in the artyom_garbage_collector variable to prevent the wrong behaviour
* of artyom.say. Use this method to clear all spoken SpeechSynthesisUtterance unused objects.
* @returns {Boolean}
*/
clearGarbageCollection(): any;
/**
* Returns the SpeechSynthesisUtterance garbageobjects.
*/
getGarbageCollection(): any;
/**
* Pause the processing of commands. Artyom still listening in the background and it can be resumed after a couple of seconds.
* @returns {Boolean}
*/
dontObey(): any;
/**
* Allow artyom to obey commands again.
* @returns {Boolean}
*/
obey(): any;
/**
* A boolean to check if artyom is obeying commands or not.
* @returns {Boolean}
*/
isObeying(): boolean;
/**
* Process the recognized text if artyom is active in remote mode.
* @returns {Boolean}
*/
remoteProcessorService(action: any): any;
/**
* Returns a string with the actual version of Artyom script.
* @returns {String}
*/
getVersion(): string;
/**
* Add commands like an artisan. If you use artyom for simple
* tasks then probably you don't like to write a lot to achieve it.
* Use the artisan syntax to write less, but with the same accuracy.
* @disclaimer Not a promise-based implementation, just syntax.
* @returns {Object}
*/
on(indexes: any, smart: any): any;
}
/**
* ArtyomBuilder bla, bla...
*/
export class ArtyomBuilder {
/**
* Method to bla, bla, bla...
*/
static getInstance(): ArtyomJS
}
}
// tslint:disable-next-line:export-just-namespace
export = Artyom;
export as namespace Artyom;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-357
View File
@@ -1,357 +0,0 @@
// Type definitions for assert-plus 1.0
// Project: https://github.com/mcavage/node-assert-plus#readme
// Definitions by: Костя Третяк <https://github.com/KostyaTretyak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import {Stream} from 'stream';
export function array(arr: any[], message ?: string): void;
export function bool(bool: boolean, message ?: string): void;
export function buffer(buffer: Buffer, message ?: string): void;
export function func(func: any, message ?: string): void;
export function number(number: number, message ?: string): void;
export function finite(finite: number, message ?: string): void;
export function object(obj: any, message ?: string): void;
export function string(str: string, message ?: string): void;
export function stream(stream: Stream, message ?: string): void;
export function date(date: Date, message ?: string): void;
export function regexp(regexp: RegExp, message ?: string): void;
export function uuid(uuid: string, message ?: string): void;
export function arrayOfArray(arr: any[][], message ?: string): void;
export function arrayOfBool(arr: boolean[], message ?: string): void;
export function arrayOfBuffer(arr: Buffer[], message ?: string): void;
export function arrayOfFunc(arr: any[], message ?: string): void;
export function arrayOfNumber(arr: number[], message ?: string): void;
export function arrayOfFinite(arr: number[], message ?: string): void;
export function arrayOfObject(arr: any[], message ?: string): void;
export function arrayOfString(arr: string[], message ?: string): void;
export function arrayOfStream(arr: Stream[], message ?: string): void;
export function arrayOfDate(arr: Date[], message ?: string): void;
export function arrayOfRegexp(arr: RegExp[], message ?: string): void;
export function arrayOfUuid(arr: string[], message ?: string): void;
export function optionalArray(arr: any[] | undefined, message ?: string): void;
export function optionalBool(bool: boolean | undefined, message ?: string): void;
export function optionalBuffer(buffer: Buffer | undefined, message ?: string): void;
export function optionalFunc(options: any, message ?: string): void;
export function optionalNumber(options: number | undefined, message ?: string): void;
export function optionalFinite(options: number | undefined, message ?: string): void;
export function optionalObject(options: any, message ?: string): void;
export function optionalString(options: string | undefined, message ?: string): void;
export function optionalStream(options: Stream | undefined, message ?: string): void;
export function optionalDate(options: Date | undefined, message ?: string): void;
export function optionalRegexp(options: RegExp | undefined, message ?: string): void;
export function optionalUuid(options: string | undefined, message ?: string): void;
export function optionalArrayOfArray(arr: any[][] | undefined, message ?: string): void;
export function optionalArrayOfBool(arr: boolean[] | undefined, message ?: string): void;
export function optionalArrayOfBuffer(arr: Buffer[] | undefined, message ?: string): void;
export function optionalArrayOfFunc(arr: any[] | undefined, message ?: string): void;
export function optionalArrayOfNumber(arr: number[] | undefined, message ?: string): void;
export function optionalArrayOfFinite(arr: number[] | undefined, message ?: string): void;
export function optionalArrayOfObject(arr: any[] | undefined, message ?: string): void;
export function optionalArrayOfString(arr: string[] | undefined, message ?: string): void;
export function optionalArrayOfStream(arr: Stream[] | undefined, message ?: string): void;
export function optionalArrayOfDate(arr: Date[] | undefined, message ?: string): void;
export function optionalArrayOfRegexp(arr: RegExp[] | undefined, message ?: string): void;
export function optionalArrayOfUuid(arr: string[] | undefined, message ?: string): void;
export function AssertionError(options: any, message ?: string): void;
/**
* Throws an `AssertionError`. If `message` is falsy, the error message is set
* as the values of `actual` and `expected` separated by the provided `operator`.
* Otherwise, the error message is the value of `message`.
*
* ```js
* const assert = require('assert');
*
* assert.fail(1, 2, undefined, '>');
* // AssertionError: 1 > 2
*
* assert.fail(1, 2, 'whoops', '>');
* // AssertionError: whoops
* ```
*/
export function fail(actual: any, expected: any, message: any, operator: any): void;
/**
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
* If `value` is not truthy, an `AssertionError` is thrown with a `message` property
* set equal to the value of the `message` parameter.
* If the `message` parameter is `undefined`, a default error message is assigned.
*
* ```js
* const assert = require('assert');
*
* assert.ok(true);
* // OK
* assert.ok(1);
* // OK
* assert.ok(false);
* // throws "AssertionError: false == true"
* assert.ok(0);
* // throws "AssertionError: 0 == true"
* assert.ok(false, 'it\'s false');
* // throws "AssertionError: it's false"
* ```
*/
export function ok(options: any, message ?: string): void;
/**
* Tests shallow, coercive equality between the actual and expected parameters
* using the equal comparison operator ( `==` ).
*
* ```js
* const assert = require('assert');
*
* assert.equal(1, 1);
* // OK, 1 == 1
* assert.equal(1, '1');
* // OK, 1 == '1'
*
* assert.equal(1, 2);
* // AssertionError: 1 == 2
* assert.equal({a: {b: 1}}, {a: {b: 1}});
* //AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
* ```
*
* If the values are not equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
*/
export function equal(actual: any, expected: any, message ?: string): void;
/**
* Tests shallow, coercive inequality with the not equal comparison operator ( `!=` ).
*
* ```js
* const assert = require('assert');
*
* assert.notEqual(1, 2);
* // OK
*
* assert.notEqual(1, 1);
* // AssertionError: 1 != 1
*
* assert.notEqual(1, '1');
* // AssertionError: 1 != '1'
* ```
*
* If the values are equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
*/
export function notEqual(actual: any, expected: any, message ?: string): void;
/**
* Tests for deep equality between the `actual` and `expected` parameters.
* Primitive values are compared with the equal comparison operator ( `==` ).
*
* Only enumerable "own" properties are considered.
* The `deepEqual()` implementation does not test object prototypes, attached symbols,
* or non-enumerable properties. This can lead to some potentially surprising results.
* For example, the following example does not throw an `AssertionError` because
* the properties on the Error object are non-enumerable:
*
* ```js
* // WARNING: This does not throw an AssertionError!
* assert.deepEqual(Error('a'), Error('b'));
* ```
*
* "Deep" equality means that the enumerable "own" properties of child objects are evaluated also.
*
* If the values are not equal, an `AssertionError` is thrown with a `message` property
* set equal to the value of the `message` parameter. If the `message` parameter is undefined,
* a default error message is assigned.
*/
export function deepEqual<T>(actual: T, expected: T, message ?: string): void;
/**
* Tests for any deep inequality. Opposite of `assert.deepEqual()`.
*
* ```js
* const assert = require('assert');
*
* const obj1 = { a : { b : 1 } };
* const obj2 = { a : { b : 2 } };
* const obj3 = { a : { b : 1 } };
* const obj4 = Object.create(obj1);
*
* assert.notDeepEqual(obj1, obj1);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
*
* assert.notDeepEqual(obj1, obj2);
* // OK, obj1 and obj2 are not deeply equal
*
* assert.notDeepEqual(obj1, obj3);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
*
* assert.notDeepEqual(obj1, obj4);
* // OK, obj1 and obj2 are not deeply equal
* ```
*
* If the values are deeply equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
*/
export function notDeepEqual(actual: any, expected: any, message ?: string): void;
/**
* Tests strict equality as determined by the strict equality operator ( `===` ).
*
* ```js
* const assert = require('assert');
*
* assert.strictEqual(1, 2);
* // AssertionError: 1 === 2
*
* assert.strictEqual(1, 1);
* // OK
*
* assert.strictEqual(1, '1');
* // AssertionError: 1 === '1'
* ```
*
* If the values are not strictly equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
*/
export function strictEqual<T>(actual: T, expected: T, message ?: string): void;
/**
* Tests strict inequality as determined by the strict not equal operator ( `!==` ).
*
* ```js
* const assert = require('assert');
*
* assert.notStrictEqual(1, 2);
* // OK
*
* assert.notStrictEqual(1, 1);
* // AssertionError: 1 !== 1
*
* assert.notStrictEqual(1, '1');
* // OK
* ```
*
* If the values are strictly equal, an `AssertionError` is thrown with a `message` property
* set equal to the value of the `message` parameter. If the `message` parameter is undefined,
* a default error message is assigned.
*/
export function notStrictEqual(actual: any, expected: any, message ?: string): void;
export function throws(block: any, error ?: any, message ?: string): void;
/**
* Asserts that the function `block` does not throw an error. See `assert.throws()` for more details.
*
* When `assert.doesNotThrow()` is called, it will immediately call the `block` function.
*
* If an error is thrown and it is the same type as that specified by the `error` parameter,
* then an `AssertionError` is thrown. If the error is of a different type,
* or if the `error` parameter is undefined, the error is propagated back to the caller.
*
* The following, for instance, will throw the TypeError because there is no matching error type in the assertion:
* ```js
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* SyntaxError
* );
* ```
*
* However, the following will result in an `AssertionError` with the message 'Got unwanted exception (TypeError)..':
* ```js
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* TypeError
* );
* ```
*
* If an `AssertionError` is thrown and a value is provided for the `message` parameter,
* the value of `message` will be appended to the `AssertionError` message:
* ```js
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* TypeError,
* 'Whoops'
* );
* // Throws: AssertionError: Got unwanted exception (TypeError). Whoops
* ```
*/
export function doesNotThrow(block: any, error ?: any, message ?: string): void;
/**
* Throws `value` if `value` is truthy. This is useful when testing the `error` argument in callbacks.
* ```js
* const assert = require('assert');
*
* assert.ifError(0);
* // OK
* assert.ifError(1);
* // Throws 1
* assert.ifError('error');
* // Throws 'error'
* assert.ifError(new Error());
* // Throws Error
* ```
*/
export function ifError(value: any): void;
export as namespace AssertPlus;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-229
View File
@@ -1,229 +0,0 @@
// Type definitions for Async 2.0.1
// Project: https://github.com/caolan/async
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>, Joe Herman <https://github.com/Penryn>, Angus Fenying <https://github.com/fenying>, Pascal Martin <https://github.com/pascalmartin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Dictionary<T> { [key: string]: T; }
interface ErrorCallback<T> { (err?: T): void; }
interface AsyncWaterfallCallback<E> { (err: E, ...args: any[]): void; }
interface AsyncBooleanResultCallback<E> { (err: E, truthValue: boolean): void; }
interface AsyncResultCallback<T, E> { (err: E, result: T): void; }
interface AsyncResultArrayCallback<T, E> { (err: E, results: T[]): void; }
interface AsyncResultObjectCallback<T, E> { (err: E, results: Dictionary<T>): void; }
interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncMemoIterator<T, R, E> { (memo: R, item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncBooleanIterator<T, E> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
interface AsyncVoidFunction<E> { (callback: ErrorCallback<E>): void; }
interface AsyncQueue<T> {
length(): number;
started: boolean;
running(): number;
idle(): boolean;
concurrency: number;
push<E>(task: T, callback?: ErrorCallback<E>): void;
push<E>(task: T, callback?: AsyncResultCallback<T, E>): void;
push<E>(task: T[], callback?: ErrorCallback<E>): void;
unshift<E>(task: T, callback?: ErrorCallback<E>): void;
unshift<E>(task: T[], callback?: ErrorCallback<E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
paused: boolean;
pause(): void
resume(): void;
kill(): void;
workersList(): {
data: T,
callback: Function
}[];
error(error: Error, data: any): void;
unsaturated(): void;
buffer: number;
}
interface AsyncPriorityQueue<T> {
length(): number;
concurrency: number;
started: boolean;
paused: boolean;
push<E>(task: T, priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
push<E>(task: T[], priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
running(): number;
idle(): boolean;
pause(): void;
resume(): void;
kill(): void;
workersList(): {
data: T,
priority: number,
callback: Function
}[];
error(error: Error, data: any): void;
unsaturated(): void;
buffer: number;
}
interface AsyncCargo {
length(): number;
payload: number;
push(task: any, callback? : Function): void;
push(task: any[], callback? : Function): void;
saturated(): void;
empty(): void;
drain(): void;
idle(): boolean;
pause(): void;
resume(): void;
kill(): void;
}
interface Async {
// Collections
each<T, E>(arr: T[], iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
each<T, E>(arr: Dictionary<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
eachSeries: typeof async.each;
eachLimit<T, E>(arr: T[], limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
eachLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
forEach: typeof async.each;
forEachSeries: typeof async.each;
forEachLimit: typeof async.eachLimit;
forEachOf<T, E>(obj: T[], iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOf<T, E>(obj: Dictionary<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOfSeries: typeof async.forEachOf;
forEachOfLimit<T, E>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOfLimit<T, E>(obj: Dictionary<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
eachOf: typeof async.forEachOf;
eachOfSeries: typeof async.forEachOf;
eachOfLimit: typeof async.forEachOfLimit;
map<T, R, E>(arr: T[], iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
map<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapSeries: typeof async.map;
mapLimit<T, R, E>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapLimit<T, R, E>(arr: Dictionary<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapValuesLimit<T, R, E>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
mapValuesSeries: typeof async.mapValues;
filter<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filter<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filterSeries: typeof async.filter;
filterLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filterLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
select: typeof async.filter;
selectSeries: typeof async.filter;
selectLimit: typeof async.filterLimit;
reject: typeof async.filter;
rejectSeries: typeof async.filter;
rejectLimit: typeof async.filterLimit;
reduce<T, R, E>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R, E>, callback?: AsyncResultCallback<R, E>): void;
inject: typeof async.reduce;
foldl: typeof async.reduce;
reduceRight: typeof async.reduce;
foldr: typeof async.reduce;
detect<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detect<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detectSeries: typeof async.detect;
detectLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detectLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
find: typeof async.detect;
findSeries: typeof async.detect;
findLimit: typeof async.detectLimit;
sortBy<T, V, E>(arr: T[], iterator: AsyncResultIterator<T, V, E>, callback?: AsyncResultArrayCallback<T, E>): void;
some<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
some<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
someSeries: typeof async.some;
someLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
someLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
any: typeof async.some;
anySeries: typeof async.someSeries;
anyLimit: typeof async.someLimit;
every<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
every<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
everySeries: typeof async.every;
everyLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
everyLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
all: typeof async.every;
allSeries: typeof async.every;
allLimit: typeof async.everyLimit;
concat<T, R, E>(arr: T[], iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
concat<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
concatSeries: typeof async.concat;
// Control Flow
series<T, E>(tasks: AsyncFunction<T, E>[], callback?: AsyncResultArrayCallback<T, E>): void;
series<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
parallel<T, E>(tasks: Array<AsyncFunction<T, E>>, callback?: AsyncResultArrayCallback<T, E>): void;
parallel<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
parallelLimit<T, E>(tasks: Array<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultArrayCallback<T, E>): void;
parallelLimit<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultObjectCallback<T, E>): void;
whilst<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doWhilst<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
until<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doUntil<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T,E>): void;
compose(...fns: Function[]): Function;
seq(...fns: Function[]): Function;
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
applyEachSeries(fns: Function[], argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
queue<T, E>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncQueue<T>;
queue<T, R, E>(worker: AsyncResultIterator<T, R, E>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T, E>(worker: AsyncWorker<T, E>, concurrency: number): AsyncPriorityQueue<T>;
cargo<E>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
auto<E>(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any, E>): void;
autoInject<E>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E>): void;
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E>;
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E>;
nextTick(callback: Function, ...args: any[]): void;
setImmediate: typeof async.nextTick;
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E>;
timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E>;
times<T, E> (n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesSeries<T, E>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesLimit<T, E>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
unmemoize(fn: Function): Function;
ensureAsync(fn: (... argsAndCallback: any[]) => void): Function;
constant(...values: any[]): Function;
asyncify(fn: Function): Function;
wrapSync(fn: Function): Function;
log(fn: Function, ...arguments: any[]): void;
dir(fn: Function, ...arguments: any[]): void;
}
declare var async: Async;
declare module "async" {
export = async;
}
-44
View File
@@ -1,44 +0,0 @@
interface StringCallback { (err: Error, result: string): void; }
interface AsyncStringGetter { (callback: StringCallback): void; }
var taskArray: AsyncStringGetter[] = [
function (callback) {
setTimeout(function () {
callback(null, 'one');
}, 200);
},
function (callback) {
setTimeout(function () {
callback(null, 'two');
}, 100);
},
];
async.series(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallel(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallelLimit(taskArray, 3, function (err, results) { console.log(results[0].match(/o/)) });
interface Lookup<T> { [key: string]: T; }
interface NumberCallback { (err: Error, result: number): void; }
interface AsyncNumberGetter { (callback: NumberCallback): void; }
var taskDict: Lookup<AsyncNumberGetter> = {
one: function(callback){
setTimeout(function(){
callback(null, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
callback(null, 2);
}, 100);
}
}
async.series(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallel(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallelLimit(taskDict, 3, function(err, results) { console.log(results['one'].toFixed(1)) });
-839
View File
@@ -1,839 +0,0 @@
/// <reference types="node" />
import fs = require("fs");
import process = require("process");
declare var path: {
exists: (path: string, callback?: (err: Error, exists: boolean) => any) => void;
};
function funcStringCbErrBoolean(v:string, cb:(err:Error,res:boolean) => void) {}
function callback() { }
async.map(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.filter(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.filterSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.filterLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.select(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.selectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.selectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.reject(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.rejectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.rejectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.parallel([
function () { },
function () { }
], callback);
async.series([
function () { },
function () { }
]);
var data: any[] = [];
function asyncProcess(item: any, callback: (err: Error, result: any) => void) { }
async.map(data, asyncProcess, function (err, results) {
console.log(results);
});
var openFiles = ['file1', 'file2'];
var openFilesObj = {
file1: "fileOne",
file2: "fileTwo"
}
var saveFile = function (file:string,cb:(err:Error)=>void) { }
async.each(openFiles, saveFile, function (err:Error) { });
async.eachSeries(openFiles, saveFile, function (err:Error) { });
var documents: any, requestApi: any;
async.eachLimit(documents, 20, requestApi, function (err) { });
// forEachOf* functions. May accept array or object.
function forEachOfIterator(item: string, key: string, forEachOfIteratorCallback: any) {
console.log("ForEach: item=" + item + ", key=" + key);
forEachOfIteratorCallback();
}
async.forEachOf(openFiles, forEachOfIterator, function (err) { });
async.forEachOf(openFilesObj, forEachOfIterator, function (err) { });
async.forEachOfSeries(openFiles, forEachOfIterator, function (err) { });
async.forEachOfSeries(openFilesObj, forEachOfIterator, function (err) { });
async.forEachOfLimit(openFiles, 2, forEachOfIterator, function (err) { });
async.forEachOfLimit(openFilesObj, 2, forEachOfIterator, function (err) { });
var numArray = [1, 2, 3];
function reducer(memo: any, item: any, callback: any) {
process.nextTick(function () {
callback(null, memo + item)
});
}
async.reduce(numArray, 0, reducer, function (err, result) { });
async.inject(numArray, 0, reducer, function (err, result) { });
async.foldl(numArray, 0, reducer, function (err, result) { });
async.reduceRight(numArray, 0, reducer, function (err, result) { });
async.foldr(numArray, 0, reducer, function (err, result) { });
async.detect(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err: Error,result:string) { });
async.detectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err,result) { });
async.detectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err,result) { });
async.sortBy(['file1', 'file2', 'file3'], function (file, callback) {
fs.stat(file, function (err, stats) {
callback(err, stats.mtime);
});
}, function (err, results) { });
async.some(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.someLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.any(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.every(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.everyLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.all(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.concat(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { });
async.concatSeries(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { });
// Control Flow //
async.series([
function (callback) {
callback(undefined, 'one');
},
function (callback) {
callback(undefined, 'two');
},
],
function (err, results) { });
async.series<string,Error>([
function (callback) {
callback(undefined, 'one');
},
function (callback) {
callback(undefined, 'two');
},
],
function (err, results) { });
async.series({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
}, 200);
},
two: function (callback) {
setTimeout(function () {
callback(undefined, 2);
}, 100);
},
},
function (err, results) { });
async.series<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
}, 200);
},
two: function (callback) {
setTimeout(function () {
callback(undefined, 2);
}, 100);
},
},
function (err, results) { });
async.times(5, function(n, next) {
next(undefined as any, n)
}, function(err, results) {
console.log(results)
})
async.timesSeries(5, function(n, next) {
next(undefined as any, n)
}, function(err, results) {
console.log(results)
})
async.parallel([
function (callback) {
setTimeout(function () {
callback(undefined, 'one');
}, 200);
},
function (callback) {
setTimeout(function () {
callback(undefined, 'two');
}, 100);
},
],
function (err, results) { });
async.parallel<string,Error>([
function (callback) {
setTimeout(function () {
callback(undefined, 'one');
}, 200);
},
function (callback) {
setTimeout(function () {
callback(undefined, 'two');
}, 100);
},
],
function (err, results) { });
async.parallel({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
}, 200);
},
two: function (callback) {
setTimeout(function () {
callback(undefined, 2);
}, 100);
},
},
function (err, results) { });
async.parallel<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
}, 200);
},
two: function (callback) {
setTimeout(function () {
callback(undefined, 2);
}, 100);
},
},
function (err, results) { });
async.parallelLimit({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
}, 200);
},
two: function (callback) {
setTimeout(function () {
callback(undefined, 2);
}, 100);
},
},
2,
function (err, results) { }
);
function whileFn(callback: any) {
count++;
setTimeout(callback, 1000);
}
function whileTest() { return count < 5; }
var count = 0;
async.whilst(whileTest, whileFn, function (err) { });
async.until(whileTest, whileFn, function (err) { });
async.doWhilst(whileFn, whileTest, function (err) { });
async.doUntil(whileFn, whileTest, function (err) { });
async.during(function (testCallback) { testCallback(new Error(), false); }, function (callback) { callback() }, function (error) { console.log(error) });
async.doDuring(function (callback) { callback() }, function (testCallback) { testCallback(new Error(), false); }, function (error) { console.log(error) });
async.forever(function (errBack) {
errBack(new Error("Not going on forever."));
},
function (error) {
console.log(error);
}
);
async.waterfall([
function (callback: any) {
callback(null, 'one', 'two');
},
function (arg1: any, arg2: any, callback: any) {
callback(null, 'three');
},
function (arg1: any, callback: any) {
callback(null, 'done');
}
], function (err, result) { });
var q = async.queue<any,Error>(function (task: any, callback: () => void) {
console.log('hello ' + task.name);
callback();
}, 2);
q.drain = function () {
console.log('all items have been processed');
}
q.push({ name: 'foo' });
q.push({ name: 'bar' }, function (err) {
console.log('finished processing bar');
});
q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) {
console.log('finished processing bar');
});
q.unshift({ name: 'foo' });
q.unshift({ name: 'bar' }, function (err) {
console.log('finished processing bar');
});
q.unshift([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) {
console.log('finished processing bar');
});
var qLength : number = q.length();
var qStarted : boolean = q.started;
var qPaused : boolean = q.paused;
var qProcessingCount : number = q.running();
var qIsIdle : boolean = q.idle();
q.saturated = function() {
console.log('queue is saturated.');
}
q.empty = function() {
console.log('queue is empty.');
}
q.drain = function() {
console.log('queue was drained.');
}
q.pause();
q.resume();
q.kill();
// tests for strongly typed tasks
var q2 = async.queue<string,Error>(function (task: string, callback: () => void) {
console.log('Task: ' + task);
callback();
}, 1);
q2.push('task1');
q2.push('task2', function (error) {
console.log('Finished tasks');
});
q2.push(['task3', 'task4', 'task5'], function (error) {
console.log('Finished tasks');
});
q2.unshift('task1');
q2.unshift('task2', function (error) {
console.log('Finished tasks');
});
q2.unshift(['task3', 'task4', 'task5'], function (error) {
console.log('Finished tasks');
});
var aq = async.queue<number, number, Error>(function (level: number, callback: (error : Error, newLevel: number) => void) {
console.log('hello ' + level);
callback(null, level+1);
});
aq.push(1, function (err : Error, newLevel : number) {
console.log('finished processing bar' + newLevel);
});
// create a cargo object with payload 2
var cargo = async.cargo(function (tasks, callback) {
for (var i = 0; i < tasks.length; i++) {
console.log('hello ' + tasks[i].name);
}
callback();
}, 2);
// add some items
cargo.push({ name: 'foo' }, function (err: Error) {
console.log('finished processing foo');
});
cargo.push({ name: 'bar' }, function (err: Error) {
console.log('finished processing bar');
});
cargo.push({ name: 'baz' }, function (err: Error) {
console.log('finished processing baz');
});
var filename = '';
async.auto({
get_data: function (callback: any) { },
make_folder: function (callback: any) { },
//arrays with different types are not accepted by TypeScript.
write_file: ['get_data', 'make_folder', <any>function (callback: any) {
callback(null, filename);
}],
//arrays with different types are not accepted by TypeScript.
email_link: ['write_file', <any>function (callback: any, results: any) { }]
});
async.retry(3, function (callback, results) { }, function (err, result) { });
async.retry({ times: 3, interval: 200 }, function (callback, results) { }, function (err, result) { });
async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } }, function (callback, results) { }, function (err, result) { });
async.parallel([
function (callback: ( err:Error, val:string ) => void ) { },
function (callback) { }
],
function (err:Error,results:Array<string>) {
async.series([
function (callback) { },
function email_link(callback) { }
]);
});
async.parallel([
async.apply(fs.writeFile, 'testfile1', 'test1'),
async.apply(fs.writeFile, 'testfile2', 'test2'),
]);
async.parallel([
function (callback) {
fs.writeFile('testfile1', 'test1', callback);
},
function (callback) {
fs.writeFile('testfile2', 'test2', callback);
},
]);
var call_order: string[] = [];
async.nextTick(function () {
call_order.push('two');
});
call_order.push('one');
var slow_fn = function (name: string, callback: any) {
callback(null, 123);
};
var fn = async.memoize(slow_fn);
fn('some name', function () {});
async.unmemoize(fn);
async.ensureAsync(function () { });
async.constant(42);
async.asyncify(function () { });
async.log(function (name: any, callback: any) {
setTimeout(function () {
callback(null, 'hello ' + name);
}, 0);
}, "world"
);
async.dir(function (name: string, callback: any) {
setTimeout(function () {
callback(null, { hello: name });
}, 1000);
}, "world");
// each
async.each<number,Error>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.each: ${val}`);
next();
}, 500);
}, function(err?: Error): void {
console.log("async.each: done.");
});
async.eachSeries<number, Error>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.eachSeries: ${val}`);
next();
}, 500);
}, function(err?: Error): void {
console.log("async.eachSeries: done.");
});
async.eachLimit<number, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.eachLimit: ${val}`);
next();
}, 500);
}, function(err?: Error): void {
console.log("async.eachLimit: done.");
});
// forEachOf/eachOf
async.eachOf<number, Error>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.forEachOf/eachOf: ${key} = ${val}`);
next();
}, 500);
}, function(err?: Error): void {
console.log("async.forEachOf/eachOf: done.");
});
async.forEachOfSeries<number, Error>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.forEachOfSeries: ${key} = ${val}`);
next();
}, 500);
}, function(err?: Error): void {
console.log("async.forEachOfSeries: done.");
});
async.forEachOfLimit<number, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.forEachOfLimit: ${key} = ${val}`);
next();
}, 500);
}, function(err?: Error): void {
console.log("async.forEachOfLimit: done.");
});
// map
async.map<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
console.log(`async.map: ${val}`);
next(undefined as any, val.toString());
}, 500);
}, function(err: Error, results: string[]): void {
console.log("async.map: done with results", results);
});
async.mapSeries<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
console.log(`async.mapSeries: ${val}`);
next(undefined as any, val.toString());
}, 500);
}, function(err: Error, results: string[]): void {
console.log("async.mapSeries: done with results", results);
});
async.mapLimit<number, string, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
console.log(`async.mapLimit: ${val}`);
next(undefined as any, val.toString());
}, 500);
}, function(err: Error, results: string[]): void {
console.log("async.mapLimit: done with results", results);
});
// mapValues
async.mapValues<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
console.log(`async.mapValues: ${key} = ${val}`);
next(undefined as any, val.toString());
}, 500);
}, function(err: Error, results: Dictionary<string>): void {
console.log("async.mapValues: done with results", results);
});
async.mapValuesSeries<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
console.log(`async.mapValuesSeries: ${key} = ${val}`);
next(undefined as any, val.toString());
}, 500);
}, function(err: Error, results: Dictionary<string>): void {
console.log("async.mapValuesSeries: done with results", results);
});
// filter/select/reject
async.filter<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.filter/select: ${val}`);
next(undefined as any, val % 2 === 0);
}, 500);
}, function(err: Error, results: number[]): void {
console.log("async.filter/select: done with results", results);
});
async.reject<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
setTimeout(function(): void {
console.log(`async.reject: ${val}`);
next(undefined as any, val % 2 === 0);
}, 500);
}, function(err: Error, results: number[]): void {
console.log("async.reject: done with results", results);
});
// concat
async.concat<string, string, Error>({
"a": "1",
"b": "2",
"c": "3"
}, function(item: string, next: AsyncResultCallback<string[], Error>): void {
console.log(`async.concat: ${item}`);
next(undefined as any, [item, item, item]);
}, function(err: Error, results: string[]) {
console.log("async.concat: done with results", results);
});
// detect/find
async.detect<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.detect/find: ${item}`);
next(undefined as any, item > 1);
}, function(err: Error, result: number) {
if (err) {
console.log(err);
} else {
console.log("async.detect/find: done with result", result);
}
});
// every/all
async.every<number,Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.every/all: ${item}`);
next(undefined as any, item > 0);
}, function(err: Error, result: boolean) {
console.log("async.every/all: done with result", result);
});
// some/any
async.some<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.some/any: ${item}`);
next(undefined as any, item > 2);
}, function(err: Error, result: boolean) {
console.log("async.some/any: done with result", result);
});
// timeout
function myFunction1(foo : any, callback: (err : Error, result : any) => void ) : void {
console.log(`async.timeout 1 ${foo}`);
return callback(null, foo);
}
var wrapped1 = async.timeout(myFunction1, 1000);
wrapped1({ bar: 'bar' }, function(err : Error, data : any) {
console.log(`async.timeout 1 end ${data}`);
});
function myFunction2(callback: (err : Error, result : any) => void ) : void {
console.log(`async.timeout 2`);
return callback(null, { bar: 'bar' });
}
var wrapped2 = async.timeout(myFunction2, 1000);
wrapped2( function(err : Error, data : any) {
console.log(`async.timeout 2 end ${data}`);
});
function myFunction3(callback: (err : Error, result : any) => void ) : void {
console.log(`async.timeout 3`);
return callback(null, { bar: 'bar' });
}
var wrapped3 = async.timeout(myFunction3, 1000, { bar: 'bar' });
wrapped3( function(err : Error, data : any) {
console.log(`async.timeout 3 end ${data}`);
});
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"test/index.ts",
"test/explicit.ts"
]
}
-1922
View File
File diff suppressed because it is too large Load Diff
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"api-docs.d.ts",
"atom-tests.ts"
]
}
-5
View File
@@ -1,5 +0,0 @@
{
"dependencies": {
"@types/auth0-js": "latest"
}
}
-5
View File
@@ -1,5 +0,0 @@
{
"dependencies": {
"@types/auth0-js": "latest"
}
}
-267
View File
@@ -1,267 +0,0 @@
// Type definitions for AutobahnJS v0.9.6
// Project: http://autobahn.ws/js/
// Definitions by: Elad Zelingher <https://github.com/darkl/>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="when" />
export = autobahn;
declare namespace autobahn {
export class Session {
id: number;
realm: string;
isOpen: boolean;
features: any;
caller_disclose_me: boolean;
publisher_disclose_me: boolean;
subscriptions: ISubscription[][];
registrations: IRegistration[];
constructor(transport: ITransport, defer: DeferFactory, challenge: OnChallengeHandler);
join(realm: string, authmethods: string[], authid: string): void;
leave(reason: string, message: string): void;
call<TResult>(procedure: string, args?: any[], kwargs?: any, options?: ICallOptions): When.Promise<TResult>;
publish(topic: string, args?: any[], kwargs?: any, options?: IPublishOptions): When.Promise<IPublication>;
subscribe(topic: string, handler: SubscribeHandler, options?: ISubscribeOptions): When.Promise<ISubscription>;
register(procedure: string, endpoint: RegisterEndpoint, options?: IRegisterOptions): When.Promise<IRegistration>;
unsubscribe(subscription: ISubscription): When.Promise<any>;
unregister(registration: IRegistration): When.Promise<any>;
prefix(prefix: string, uri: string): void;
resolve(curie: string): string;
onjoin: (roleFeatures: any) => void;
onleave: (reason: string, details: any) => void;
}
interface IInvocation {
caller?: number;
progress?: (args : any[], kwargs : any) => void;
procedure: string;
}
class Invocation implements IInvocation {
constructor(caller?: number, progress?: boolean, procedure?: string);
procedure: string;
}
interface IEvent {
publication: number;
publisher?: number;
topic: string;
}
class Event implements IEvent {
constructor(publication?: number, publisher?: string, topic?: string);
publication: number;
topic: string;
}
interface IResult {
args: any[];
kwargs: any;
}
class Result implements IResult {
constructor(args?: any[], kwargs?: any);
args: any[];
kwargs: any;
}
interface IError {
error: string;
args: any[];
kwargs: any;
}
class Error implements IError {
constructor(error?: string, args?: any[], kwargs?: any);
error: string;
args: any[];
kwargs: any;
}
type SubscribeHandler = (args?: any[], kwargs?: any, details?: IEvent) => void;
interface ISubscription {
topic: string;
handler: SubscribeHandler;
options: ISubscribeOptions;
session: Session;
id: number;
active: boolean;
unsubscribe(): When.Promise<any>;
}
class Subscription implements ISubscription {
constructor(topic? : string, handler?: SubscribeHandler, options?: ISubscribeOptions, session?: Session, id?: number);
handler: SubscribeHandler;
unsubscribe(): When.Promise<any>;
topic: string;
options: ISubscribeOptions;
session: Session;
id: number;
active: boolean;
}
type RegisterEndpoint = (args?: any[], kwargs?: any, details?: IInvocation) => void;
interface IRegistration {
procedure: string;
endpoint: RegisterEndpoint;
options: IRegisterOptions;
session: Session;
id: number;
active: boolean;
unregister(): When.Promise<any>;
}
class Registration implements IRegistration {
constructor(procedure?: string, endpoint?: RegisterEndpoint, options?: IRegisterOptions, session?: Session, id?: number);
endpoint: RegisterEndpoint;
unregister(): When.Promise<any>;
procedure: string;
options: IRegisterOptions;
session: Session;
id: number;
active: boolean;
}
interface IPublication {
id: number;
}
class Publication implements IPublication {
constructor(id: number);
id: number;
}
interface ICallOptions {
timeout?: number;
receive_progress?: boolean;
disclose_me?: boolean;
}
interface IPublishOptions {
acknowledge?: boolean;
exclude?: number[];
eligible?: number[];
disclose_me?: Boolean;
}
interface ISubscribeOptions {
match?: string;
}
interface IRegisterOptions {
disclose_caller?: boolean;
}
export class Connection {
constructor(options?: IConnectionOptions);
open(): void;
close(reason?: string, message?: string): void;
onopen: (session: Session, details: any) => void;
onclose: (reason: string, details: any) => boolean;
}
interface ITransportDefinition {
url?: string;
protocols?: string[];
type: string;
}
type DeferFactory = () => When.Promise<any>;
type OnChallengeHandler = (session: Session, method: string, extra: any) => When.Promise<string>;
interface IConnectionOptions {
use_es6_promises?: boolean;
// use explicit deferred factory, e.g. jQuery.Deferred or Q.defer
use_deferred?: DeferFactory;
transports?: ITransportDefinition[];
retry_if_unreachable?: boolean;
max_retries?: number;
initial_retry_delay?: number;
max_retry_delay?: number;
retry_delay_growth?: number;
retry_delay_jitter?: number;
url?: string;
protocols?: string[];
onchallenge?: OnChallengeHandler;
realm?: string;
authmethods?: string[];
authid?: string;
}
interface ICloseEventDetails {
wasClean: boolean;
reason: string;
code: number;
}
interface ITransport {
onopen: () => void;
onmessage: (message: any[]) => void;
onclose: (details: ICloseEventDetails) => void;
send(message: any[]): void;
close(errorCode: number, reason?: string): void;
}
interface ITransportFactory {
// constructor(options: any);
type: string;
create(): ITransport;
}
interface ITransports {
register(name: string, factory: any): void;
isRegistered(name: string): boolean;
get(name: string): any;
list(): string[];
}
interface ILog {
debug(...args: any[]): void;
}
interface IUtil {
assert(condition: boolean, message: string): void;
}
interface IAuthCra {
derive_key(secret: string, salt: string, iterations: number, keylen: number): string;
sign(key: string, challenge: string): string;
}
var util: IUtil;
var log: ILog;
var transports: ITransports;
var auth_cra: IAuthCra;
}
-32
View File
@@ -1,32 +0,0 @@
// Type definitions for autoprefixer 6.7
// Project: https://github.com/postcss/autoprefixer
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Plugin, Transformer as PostcssTransformer } from 'postcss';
declare namespace autoprefixer {
export interface Options {
browsers?: string[];
env?: string;
cascade?: boolean;
add?: boolean;
remove?: boolean;
supports?: boolean;
flexbox?: boolean | 'no-2009';
grid?: boolean;
stats?: any;
}
export interface Transformer extends PostcssTransformer {
info(): string;
}
export interface Autoprefixer extends Plugin<Options> {
(opts?: Options): Transformer;
}
}
declare const autoprefixer: autoprefixer.Autoprefixer;
export = autoprefixer;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-55
View File
@@ -1,55 +0,0 @@
var input = document.getElementById("myinput");
new Awesomplete(input, {list: "#mylist"});
new Awesomplete(input, {list: document.querySelector("#mylist")});
new Awesomplete(input, {
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
});
var awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
new Awesomplete(input, {
list: [
{ label: "Belarus", value: "BY" },
{ label: "China", value: "CN" },
{ label: "United States", value: "US" }
]
});
// Same with arrays:
new Awesomplete(input, {
list: [
[ "Belarus", "BY" ],
[ "China", "CN" ],
[ "United States", "US" ]
]
});
new Awesomplete('input[type="email"]', {
list: ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com", "google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", "live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"],
data: function (text: string, input: any) {
return input.slice(0, input.indexOf("@")) + "@" + text;
},
filter: Awesomplete.FILTER_STARTSWITH
});
new Awesomplete('input[data-multiple]', {
filter: function(text: string, input: any) {
return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]);
},
replace: function(text: string) {
var before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
});
var ajax = new XMLHttpRequest();
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
ajax.onload = function() {
var list = JSON.parse(ajax.responseText).map(function(i: any) { return i.name; });
new Awesomplete(document.querySelector("#ajax-example input"),{ list: list });
};
ajax.send();
-49
View File
@@ -1,49 +0,0 @@
// Type definitions for Awesomplete v1.1.0
// Project: https://leaverou.github.io/awesomplete/
// Definitions by: webbiesdk <https://github.com/webbiesdk/>, Ben Dixon <https://github.com/bmdixon/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Awesomplete {
constructor(input: Element | HTMLElement | string, o?: AwesompleteOptions);
static all: Array<any>;
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
create: (tag: string, o: any) => HTMLElement;
fire: (target: EventTarget, type: string, properties: any) => any;
siblingIndex: (el: Element) => number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
static SORT_BYLENGTH: (a: number | any[], b: number | any[]) => number;
static REPLACE: (text: any) => void;
next: () => void;
container: HTMLElement;
select: (selected?: HTMLElement, originalTarget?: HTMLElement) => void;
previous: () => void;
index: number;
opened: number;
list: string | string[] | Element | { label: string, value: any }[] | [string, string][];
input: HTMLElement | string;
goto: (i: number) => void;
ul: HTMLElement;
close: () => void;
evaluate: () => void;
selected: boolean;
open: () => void;
status: HTMLElement;
}
interface AwesompleteOptions {
list?: string | string[] | Element | { label: string, value: any }[] | [string, string][];
minChars?: Number;
maxItems?: Number;
autoFirst?: boolean;
data?: Function;
filter?: Function;
sort?: Function;
item?: Function;
replace?: Function;
}
-115
View File
@@ -1,115 +0,0 @@
/// <reference types="aws-lambda" />
var str: string = "any string";
var date: Date = new Date();
var anyObj: any = { abc: 123 };
var num: number = 5;
var error: Error = new Error();
var b: boolean = true;
var apiGwEvt: AWSLambda.APIGatewayEvent;
var clientCtx: AWSLambda.ClientContext;
var clientContextEnv: AWSLambda.ClientContextEnv;
var clientContextClient: AWSLambda.ClientContextClient;
var context: AWSLambda.Context;
var identity: AWSLambda.CognitoIdentity;
var proxyResult: AWSLambda.ProxyResult;
/* API Gateway Event */
str = apiGwEvt.body;
str = apiGwEvt.headers["example"];
str = apiGwEvt.httpMethod;
b = apiGwEvt.isBase64Encoded;
str = apiGwEvt.path;
str = apiGwEvt.pathParameters["example"];
str = apiGwEvt.queryStringParameters["example"];
str = apiGwEvt.stageVariables["example"];
str = apiGwEvt.requestContext.accountId;
str = apiGwEvt.requestContext.apiId;
str = apiGwEvt.requestContext.httpMethod;
str = apiGwEvt.requestContext.identity.accessKey;
str = apiGwEvt.requestContext.identity.accountId;
str = apiGwEvt.requestContext.identity.apiKey;
str = apiGwEvt.requestContext.identity.caller;
str = apiGwEvt.requestContext.identity.cognitoAuthenticationProvider;
str = apiGwEvt.requestContext.identity.cognitoAuthenticationType;
str = apiGwEvt.requestContext.identity.cognitoIdentityId;
str = apiGwEvt.requestContext.identity.cognitoIdentityPoolId;
str = apiGwEvt.requestContext.identity.sourceIp;
str = apiGwEvt.requestContext.identity.user;
str = apiGwEvt.requestContext.identity.userAgent;
str = apiGwEvt.requestContext.identity.userArn;
str = apiGwEvt.requestContext.stage;
str = apiGwEvt.requestContext.requestId;
str = apiGwEvt.requestContext.resourceId;
str = apiGwEvt.requestContext.resourcePath;
str = apiGwEvt.resource;
/* Lambda Proxy Result */
num = proxyResult.statusCode;
str = proxyResult.headers["example"];
str = proxyResult.body
/* Context */
b = context.callbackWaitsForEmptyEventLoop;
str = context.functionName;
str = context.functionVersion;
str = context.invokedFunctionArn;
num = context.memoryLimitInMB;
str = context.awsRequestId;
str = context.logGroupName;
str = context.logStreamName;
identity = context.identity;
clientCtx = context.clientContext;
/* CognitoIdentity */
str = identity.cognitoIdentityId;
str = identity.cognitoIdentityPoolId;
/* ClientContext */
clientContextClient = clientCtx.client;
anyObj = clientCtx.Custom;
clientContextEnv = clientCtx.env;
/* ClientContextEnv */
str = clientContextEnv.locale;
str = clientContextEnv.make;
str = clientContextEnv.model;
str = clientContextEnv.platform;
str = clientContextEnv.platformVersion;
/* ClientContextClient */
str = clientContextClient.appPackageName;
str = clientContextClient.appTitle;
str = clientContextClient.appVersionCode;
str = clientContextClient.appVersionName;
str = clientContextClient.installationId;
/* Callback */
function callback(cb: AWSLambda.Callback) {
cb();
cb(null);
cb(error);
cb(null, anyObj);
}
/* Proxy Callback */
function proxyCallback(cb: AWSLambda.ProxyCallback) {
cb();
cb(null);
cb(error);
cb(null, proxyResult);
}
/* Compatibility functions */
context.done();
context.done(error);
context.done(error, anyObj);
context.succeed(str);
context.succeed(anyObj);
context.succeed(str, anyObj);
context.fail(error);
context.fail(str);
/* Handler */
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {};
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {};
-126
View File
@@ -1,126 +0,0 @@
// Type definitions for AWS Lambda
// Project: http://docs.aws.amazon.com/lambda
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// API Gateway "event"
interface APIGatewayEvent {
body: string | null;
headers: { [name: string]: string };
httpMethod: string;
isBase64Encoded: boolean;
path: string;
pathParameters: { [name: string]: string } | null;
queryStringParameters: { [name: string]: string } | null;
stageVariables: { [name: string]: string } | null;
requestContext: {
accountId: string;
apiId: string;
httpMethod: string;
identity: {
accessKey: string | null;
accountId: string | null;
apiKey: string | null;
caller: string | null;
cognitoAuthenticationProvider: string | null;
cognitoAuthenticationType: string | null;
cognitoIdentityId: string | null;
cognitoIdentityPoolId: string | null;
sourceIp: string;
user: string | null;
userAgent: string | null;
userArn: string | null;
},
stage: string;
requestId: string;
resourceId: string;
resourcePath: string;
};
resource: string;
}
// Context
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
interface Context {
// Properties
callbackWaitsForEmptyEventLoop: boolean;
functionName: string;
functionVersion: string;
invokedFunctionArn: string;
memoryLimitInMB: number;
awsRequestId: string;
logGroupName: string;
logStreamName: string;
identity?: CognitoIdentity;
clientContext?: ClientContext;
// Functions
getRemainingTimeInMillis(): number;
// Functions for compatibility with earlier Node.js Runtime v0.10.42
// For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods
done(error?: Error, result?: any): void;
fail(error: Error): void;
fail(message: string): void;
succeed(message: string): void;
succeed(object: any): void;
succeed(message: string, object: any): void;
}
interface CognitoIdentity {
cognitoIdentityId: string;
cognitoIdentityPoolId: string;
}
interface ClientContext {
client: ClientContextClient;
Custom?: any;
env: ClientContextEnv;
}
interface ClientContextClient {
installationId: string;
appTitle: string;
appVersionName: string;
appVersionCode: string;
appPackageName: string;
}
interface ClientContextEnv {
platformVersion: string;
platform: string;
make: string;
model: string;
locale: string;
}
interface ProxyResult {
statusCode: number;
headers?: {
[header: string]: string;
},
body: string;
}
/**
* AWS Lambda handler function.
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
*
* @param event – event data.
* @param context – runtime information of the Lambda function that is executing.
* @param callback – optional callback to return information to the caller, otherwise return value is null.
*/
export type Handler = (event: any, context: Context, callback?: Callback) => void;
export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void;
/**
* Optional callback parameter.
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
*
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
*/
export type Callback = (error?: Error, result?: any) => void;
export type ProxyCallback = (error?: Error, result?: ProxyResult) => void;
export as namespace AWSLambda;
-422
View File
@@ -1,422 +0,0 @@
import AWS = require('aws-sdk');
var str: string;
var creds: AWS.Credentials;
creds = new AWS.Credentials(str, str);
creds = new AWS.Credentials(str, str, str);
str = creds.accessKeyId;
/*
* ECS
*/
var ecs:AWS.ECS
ecs = new AWS.ECS();
ecs = new AWS.ECS({apiVersion: '2012-11-05'});
ecs.describeClusters({
clusters: ['STRING_VALUE', 'STRING_VALUE']
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
ecs.describeTasks({
cluster: 'STRING_VALUE',
tasks: ['STRING_VALUE', 'STRING_VALUE']
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
/*
* SQS
*/
var sqs:AWS.SQS
//Default constructor
sqs = new AWS.SQS();
//Locking the API Version
sqs = new AWS.SQS({apiVersion: '2012-11-05'});
// Locking the API Version Globally
AWS.config.apiVersions = {
sqs: '2012-11-05',
// other service API versions
};
sqs.addPermission({
AWSAccountIds: [ /* required */
'STRING_VALUE',
/* more items */
],
Actions: [ /* required */
'STRING_VALUE',
/* more items */
],
Label: 'STRING_VALUE', /* required */
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.changeMessageVisibility({
QueueUrl: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE', /* required */
VisibilityTimeout: 0 /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.changeMessageVisibilityBatch({
Entries: [ /* required */
{
Id: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE', /* required */
VisibilityTimeout: 0
},
/* more items */
],
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.createQueue({
QueueName: 'STRING_VALUE', /* required */
Attributes: {
someKey: 'STRING_VALUE',
/* anotherKey: ... */
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.deleteMessage({
QueueUrl: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.deleteMessageBatch({
Entries: [ /* required */
{
Id: 'STRING_VALUE', /* required */
ReceiptHandle: 'STRING_VALUE' /* required */
},
/* more items */
],
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.deleteQueue({
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.getQueueAttributes({
QueueUrl: 'STRING_VALUE', /* required */
AttributeNames: [
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
/* more items */
]
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.getQueueUrl({
QueueName: 'STRING_VALUE', /* required */
QueueOwnerAWSAccountId: 'STRING_VALUE'
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.listDeadLetterSourceQueues({
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.listQueues({
QueueNamePrefix: 'STRING_VALUE'
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.purgeQueue({
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.receiveMessage({
QueueUrl: 'STRING_VALUE', /* required */
AttributeNames: [
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
/* more items */
],
MaxNumberOfMessages: 0,
MessageAttributeNames: [
'STRING_VALUE',
/* more items */
],
VisibilityTimeout: 0,
WaitTimeSeconds: 0
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.removePermission({
Label: 'STRING_VALUE', /* required */
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.sendMessage({
MessageBody: 'STRING_VALUE', /* required */
QueueUrl: 'STRING_VALUE', /* required */
DelaySeconds: 0,
MessageAttributes: {
someKey: {
DataType: 'STRING_VALUE', /* required */
BinaryListValues: [
new Buffer('...') || 'STRING_VALUE',
/* more items */
],
BinaryValue: new Buffer('...') || 'STRING_VALUE',
StringListValues: [
'STRING_VALUE',
/* more items */
],
StringValue: 'STRING_VALUE'
},
/* anotherKey: ... */
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.sendMessageBatch({
Entries: [ /* required */
{
Id: 'STRING_VALUE', /* required */
MessageBody: 'STRING_VALUE', /* required */
DelaySeconds: 0,
MessageAttributes: {
someKey: {
DataType: 'STRING_VALUE', /* required */
BinaryListValues: [
new Buffer('...') ,
/* more items */
],
BinaryValue: new Buffer('...'),
StringListValues: [
'STRING_VALUE',
/* more items */
],
StringValue: 'STRING_VALUE'
},
/* anotherKey: ... */
}
},
/* more items */
],
QueueUrl: 'STRING_VALUE' /* required */
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
sqs.setQueueAttributes({
Attributes: { /* required */
someKey: 'STRING_VALUE',
/* anotherKey: ... */
},
QueueUrl: 'STRING_VALUE' /* required */
}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var dynamoDBDocClient:AWS.DynamoDB.DocumentClient;
dynamoDBDocClient = new AWS.DynamoDB.DocumentClient();
dynamoDBDocClient = new AWS.DynamoDB.DocumentClient({});
dynamoDBDocClient.createSet([1, 2, 3], { validate: true });
dynamoDBDocClient.get(
{
TableName: 'TABLE_NAME',
Key: { userId: 'abc123', email: 'abc123@abc123.com' }
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}
);
dynamoDBDocClient.put(
{
TableName: 'TABLE_NAME',
Item: {
userId: 'abc123',
email: 'abc123@abc123.com',
firstName: 'Matt',
lastName: 'Forrester the ' + new Date().getTime()
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}
);
dynamoDBDocClient.delete(
{
TableName: 'TABLE_NAME',
Key: {
userId: 'abc123',
email: 'abc123@abc123.com'
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}
);
dynamoDBDocClient.update(
{
TableName: 'TABLE_NAME',
Key: {
userId: 'abc123',
email: 'abc123@abc123.com'
},
AttributeUpdates: {
thingsWithWheels: {
Action: 'PUT',
Value: dynamoDBDocClient.createSet(
[
'SkateBoard',
'Skates',
'Mountain Bike',
'Evolve Electric Skateboard'
],
{ validate: true }
)
},
age: {
Action: 'PUT',
Value: 35
}
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}
);
dynamoDBDocClient.scan(
{
TableName: 'TABLE_NAME',
KeyConditions: {
age: {
ComparisonOperator: 'EQ',
AttributeValueList: [35]
}
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}
);
dynamoDBDocClient.query(
{
TableName: 'TABLE_NAME',
KeyConditions: {
userId: {
ComparisonOperator: 'EQ',
AttributeValueList: ['abc123']
}
}
},
function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}
);
var kinesis = new AWS.Kinesis();
var putRecordParam = {
Data: new Buffer('...') || 'STRING_VALUE', /* required */
PartitionKey: 'STRING_VALUE', /* required */
StreamName: 'STRING_VALUE', /* required */
ExplicitHashKey: 'STRING_VALUE',
SequenceNumberForOrdering: 'STRING_VALUE'
};
kinesis.putRecord(putRecordParam, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var putRecordParams = {
Records: [ /* required */
{
Data: new Buffer('...') || 'STRING_VALUE', /* required */
PartitionKey: 'STRING_VALUE', /* required */
ExplicitHashKey: 'STRING_VALUE'
},
/* more items */
],
StreamName: 'STRING_VALUE' /* required */
};
kinesis.putRecords(putRecordParams, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var increaseStreamRetentionPeriodParams = {
RetentionPeriodHours: 0, /* required */
StreamName: 'STRING_VALUE' /* required */
};
kinesis.increaseStreamRetentionPeriod(increaseStreamRetentionPeriodParams, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
-2606
View File
File diff suppressed because it is too large Load Diff
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"aws-sdk-tests.ts"
]
}
-19
View File
@@ -1,19 +0,0 @@
// Type definitions for aws-serverless-express
// Project: https://github.com/awslabs/aws-serverless-express
// Definitions by: Ben Speakman <https://github.com/threesquared>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
import * as http from 'http';
import * as lambda from 'aws-lambda';
export function createServer(
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server,
serverListenCallback?: () => any
): http.Server;
export function proxy(
server: http.Server,
event: any,
context: lambda.Context
): void;
-22
View File
@@ -1,22 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"aws-serverless-express-tests.ts"
]
}
-90
View File
@@ -1,90 +0,0 @@
var context:any = document
var $fixture:any = {}
// axe.a11yCheck config
axe.a11yCheck(context, {}, (results) => {
// axe's results object
console.log(results.passes.length)
console.log(results.violations.length)
});
// axe.a11yCheck include/exclude
axe.a11yCheck({include: [['#id1'], ['#id2']]}, {}, (results) => {
console.log(results)
})
axe.a11yCheck({exclude: [$fixture[0]]}, {}, (results) => {
console.log(results)
})
var tagConfigRunOnly: axe.RunOnly = {
type: 'tag',
values: ['wcag2a']
}
var tagConfig = {
runOnly: tagConfigRunOnly
}
axe.a11yCheck(context, tagConfig, (results) => {
console.log(results)
})
var includeExcludeTagsRunOnly: axe.RunOnly = {
type: 'tags',
value: {
include: ['wcag2a', 'wcag2aa'],
exclude: ['experimental']
}
}
var includeExcludeTagsConfig = {
runOnly: includeExcludeTagsRunOnly
}
axe.a11yCheck(context, includeExcludeTagsConfig, (results) => {
console.log(results)
})
var someRulesConfig = {
rules: {
"color-contrast": {enabled: 'false'},
"heading-order": {enabled: 'true'}
}
}
axe.a11yCheck(context, someRulesConfig, (results) => {
console.log(results)
})
// axe.configure
var spec: axe.Spec = {
branding: {
brand: 'foo',
application: 'bar'
},
reporter: 'v1',
checks: [{
id: 'custom-check',
evaluate: function() {
return true
}
}],
rules: [{
id: 'custom-rule',
any: ['custom-check']
}]
}
axe.configure(spec)
axe.reset()
axe.getRules(['wcag2aa'])
typeof axe.getRules() === 'object'
// Plugins
var pluginSrc: axe.AxePlugin = {
id: 'doStuff',
run: (data:any, callback:Function) => {
callback()
},
commands: [{
id: 'run-doStuff',
callback: (data:any, callback:Function) => {
axe.plugins['doStuff'].run(data, callback)
}
}]
}
axe.registerPlugin(pluginSrc)
axe.cleanup()
-159
View File
@@ -1,159 +0,0 @@
// Type definitions for axe-core 2.0.5
// Project: https://github.com/dequelabs/axe-core
// Definitions by: Marcy Sutton <https://github.com/marcysutton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace axe {
export type ImpactValue = "minor" | "moderate" | "serious" | "critical";
export type TagValue = "wcag2a" | "wcag2aa" | "section508" | "best-practice";
export type ReporterVersion = "v1" | "v2";
export type RunOnlyType = "rule" | "rules" | "tag" | "tags";
export interface ElementContext {
node?: Object,
selector?: string,
include?: any[],
exclude?: any[]
}
export interface RunOnly {
type: RunOnlyType,
value?: {
include?: string[],
exclude?: string[]
}
values?: TagValue[]
}
export interface AxeResults {
url: string,
timestamp: string,
passes: Pass[],
violations: Violation[]
}
export interface Pass {
description: string,
help: string,
helpUrl: string,
id: string,
impact: ImpactValue,
tags: TagValue[],
nodes: NodeResult[]
}
export interface Violation {
description: string,
help: string,
helpUrl: string,
id: string,
impact: ImpactValue,
tags: TagValue[],
nodes: NodeResult[]
}
export interface NodeResult {
html: string,
impact: ImpactValue,
target: string[],
any: CheckResult[],
all: CheckResult[],
none: CheckResult[]
}
export interface CheckResult {
id: string,
impact: string,
message: string,
data: any,
relatedNodes?: RelatedNode[]
}
export interface RelatedNode {
target: string[],
html: string
}
export interface Spec {
branding?: {
brand: string,
application: string
},
reporter?: ReporterVersion,
checks?: Check[],
rules?: Rule[]
}
export interface Check {
id: string,
evaluate: Function,
after?: Function,
options?: any,
matches?: string,
enabled?: boolean
}
export interface Rule {
id: string,
selector?: string,
excludeHidden?: boolean,
enabled?: boolean,
pageLevel?: boolean,
any?: string[],
all?: string[],
none?: string[],
tags?: string[],
matches?: string
}
export interface AxePlugin {
id: string,
run(...args:any[]): any,
commands: {
id: string,
callback(...args:any[]): void
}[],
cleanup?(callback:Function): void
}
export let plugins: any
/**
* Starts analysis on the current document and its subframes
*
* @param {Object} context The `Context` specification object @see Context
* @param {Array} options Options passed into rules or checks, temporarily modifyint them.
* @param {Function} callback The function to invoke when analysis is complete.
* @returns {Object} results The aXe results object
*/
export function a11yCheck(context: ElementContext, options: {runOnly?: RunOnly, rules?: Object}, callback: (results:AxeResults) => void): AxeResults
/**
* Method for configuring the data format used by aXe. Helpful for adding new
* rules, which must be registered with the library to execute.
* @param {Spec} Spec Object with valid `branding`, `reporter`, `checks` and `rules` data
*/
export function configure(spec: Spec): void
/**
* Searches and returns rules that contain a tag in the list of tags.
* @param {Array} tags Optional array of tags
* @return {Array} Array of rules
*/
export function getRules(tags?: string[]): Object[]
/**
* Restores the default axe configuration
*/
export function reset(): void
/**
* Function to register a plugin configuration in document and its subframes
* @param {Object} plugin A plugin configuration object
*/
export function registerPlugin(plugin: AxePlugin): void
/**
* Function to clean up plugin configuration in document and its subframes
*/
export function cleanup(): void
}
// axe is also available as a module
declare module "axe-core" {
export = axe;
}
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"axe-core-tests.ts"
]
}
@@ -1,125 +0,0 @@
import express = require('express');
import mobileApps = require('azure-mobile-apps');
import logger = require('azure-mobile-apps/src/logger');
import queries = require('azure-mobile-apps/src/query');
var app = express(),
mobileApp = mobileApps();
// various configuration permutations
mobileApps({
debug: true,
data: {
provider: 'mssql',
server: '',
user: '',
database: '',
password: ''
},
webhook: { url: 'http://localhost/' }
});
mobileApps({
data: {
provider: 'memory'
}
})
// it would be nice to integrate with winston
mobileApps({ logging: { level: 'silly', transports: [{}] } })
// various custom middleware syntaxes
mobileApp.use(function (req: any, res: any, next: any) { next(); });
mobileApp.use([function () {}, function () {}]);
mobileApp.use(function () {}, function () {});
mobileApp.use(function () {}).use(function () {});
// basic syntax for tables and api
mobileApp.tables.add('todoitem');
mobileApp.tables.add('todoitem', { authorize: true });
mobileApp.tables.add('todoitem', mobileApps.table());
mobileApp.tables.import('tables');
mobileApp.api.add('api', { authorize: true, get: function () {}, delete: function () {} });
mobileApp.api.import('api');
// ensure the mobile app instance can be correctly mounted as an express router
app.use(mobileApp);
// Express.Table, instantiated from the mobile app
var table = mobileApp.table()
table.use(function (req: Express.Request, res: Express.Response, next: any) {
next(new Error());
});
table.use([function () {}, function () {}]);
table.read(function (context: Azure.MobileApps.Context) {
context.query.where({ p1: 'test' });
return context.execute()
.then(function (result: any) {
return result;
})
.catch(function (error: any) { })
.then(function () {});
});
table.insert(function (context: Azure.MobileApps.Context) {
context.query.id = 'anotherId';
context.query.single = true;
context.item.userId = context.user.id;
context.push.send('tag', {}, function (error, result) {});
context.push.gcm.send('tag', {}, function (error, result) {});
context.push.apns.send('tag', { payload: { } }, function (error, result) {});
context.push.wns.sendToastText01('tag', '', { headers: { } }, function (error, result) {});
context.next(new Error());
context.next('An error occurred');
});
table.read.use(function () {});
table.read.use([function () {}, function () {}]);
table.read.use(function () {}, function () {});
table.use(function () {}).use(function () {}).read(function () {}).use(function () {});
table.access = undefined;
table.access = 'authenticated';
table.read.access = 'anonymous';
table.update.access = 'disabled';
table.delete.access = 'authenticated';
table.insert.access = 'authenticated';
table.filters = [function (query, context) { }];
table.transforms = [function (item, context) { }];
table.hooks = [function (results, context) { }];
table.perUser = true;
table.recordsExpire = { milliseconds: 1, seconds: 1, minutes: 1, hours: 1, days: 1, weeks: 1, months: 1, years: 1 };
table.webhook = { url: 'http://localhost/' }
table.webhook = true;
// Express.Table, instantiated from the static require('azure-mobile-apps').table()
// This is going to be interesting if we ever support more than one provider
var table2 = mobileApps.table();
table2.read(function (context: Azure.MobileApps.Context) {});
// ApiDefinition, from the static require('azure-mobile-apps').api()
var api2 = mobileApps.api({
get: function (req, res, next) { }
});
api2.post = function (req, res, next) {};
// Logger
logger.silly('test', 'message');
logger.error('Something happened', new Error());
mobileApps.logger.debug('a debug message')
// Query
queries.create('table').where({ x: 10 }).select('col1,col2').includeDeleted().includeTotalCount();
mobileApps.query.create('table');
// Custom SQL query
mobileApp.api.add('query', { authorize: true, get: (req, res, next) => {
req.azureMobile.data.execute({
sql: "SELECT * FROM TODOITEM WHERE COMPLETE = :complete",
parameters: [
{ name: 'complete', value: 1 }
]
}).then(x => {});
}, delete: function () {} });
-326
View File
@@ -1,326 +0,0 @@
// Type definitions for azure-mobile-apps v2.1.7
// Project: https://github.com/Azure/azure-mobile-apps-node/
// Definitions by: Microsoft Azure <https://github.com/Azure/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="azure-sb" />
declare module "azure-mobile-apps" {
interface AzureMobileApps {
(configuration?: Azure.MobileApps.Configuration): Azure.MobileApps.Platforms.Express.MobileApp;
table(): Azure.MobileApps.Platforms.Express.Table;
api(definition?: Azure.MobileApps.ApiDefinition): Azure.MobileApps.ApiDefinition;
logger: Azure.MobileApps.Logger;
query: Azure.MobileApps.Query;
}
var out: AzureMobileApps;
export = out;
}
declare module "azure-mobile-apps/src/logger" {
var logger: Azure.MobileApps.Logger;
export = logger;
}
declare module "azure-mobile-apps/src/query" {
var query: Azure.MobileApps.Query;
export = query;
}
declare namespace Azure.MobileApps {
// the additional Platforms namespace is required to avoid collisions with the main Express namespace
export module Platforms {
export module Express {
interface MobileApp extends Middleware {
configuration: Configuration;
tables: Tables;
table(): Table;
api: Api;
use(...middleware: Middleware[]): MobileApp;
use(middleware: Middleware[]): MobileApp;
}
interface Api {
add(name: string, definition: ApiDefinition): void;
import(fileOrFolder: string): void;
}
interface Table extends TableDefinition {
use(...middleware: Middleware[]): Table;
use(middleware: Middleware[]): Table;
read: TableOperation;
update: TableOperation;
insert: TableOperation;
delete: TableOperation;
undelete: TableOperation;
}
interface TableOperation {
(operationHandler: (context: Context) => void): Table;
use(...middleware: Middleware[]): Table;
use(middleware: Middleware[]): Table;
access?: AccessType;
}
interface Tables {
configuration: Configuration;
add(name: string, definition?: Table | TableDefinition): void;
import(fileOrFolder: string): void;
initialize(): Thenable<any>;
}
}
}
export module Data {
interface Table {
read(query: QueryJs): Thenable<any[]>;
update(item: any, query: QueryJs): Thenable<any>;
insert(item: any): Thenable<any>;
delete(query: QueryJs, version: string): Thenable<any>;
undelete(query: QueryJs, version: string): Thenable<any>;
truncate(): Thenable<void>;
initialize(): Thenable<void>;
schema(): Thenable<Column[]>;
}
interface Column {
name: string;
type: string;
}
}
// auth
interface User {
id: string;
claims: any[];
token: string;
getIdentity(provider: string): Thenable<any>;
}
interface Auth {
validate(token: string): Thenable<User>;
decode(token: string): User;
sign(payload: any): string;
}
// configuration
interface Configuration {
platform?: string;
basePath?: string;
configFile?: string;
promiseConstructor?: (resolve: (result: any) => void, reject: (error: any) => void) => Thenable<any>;
apiRootPath?: string;
tableRootPath?: string;
notificationRootPath?: string;
swaggerPath?: string;
authStubRoute?: string;
debug?: boolean;
version?: string;
apiVersion?: string;
homePage?: boolean;
swagger?: boolean;
maxTop?: number;
pageSize?: number;
logging?: Configuration.Logging;
data?: Configuration.Data;
auth?: Configuration.Auth;
cors?: Configuration.Cors;
notifications?: Configuration.Notifications;
webhook?: Webhook;
}
export module Configuration {
// it would be nice to have the config for various providers in separate interfaces,
// but this is the simplest solution to support variations of the current setup
interface Data {
provider: string;
user?: string;
password?: string;
server?: string;
port?: number;
database?: string;
connectionTimeout?: string;
options?: { encrypt: boolean };
schema?: string;
dynamicSchema?: boolean;
filename?: string;
}
interface Auth {
secret: string;
validateTokens?: boolean;
}
interface Logging {
level?: string;
transports?: LoggingTransport[];
}
interface LoggingTransport { }
interface Cors {
exposeHeaders: string;
maxAge?: number;
hostnames: string[];
}
interface Notifications {
hubName: string;
connectionString?: string;
endpoint?: string;
sharedAccessKeyName?: string;
sharedAccessKeyValue?: string;
}
}
// query
interface Query {
create(tableName: string): QueryJs;
fromRequest(req: Express.Request): QueryJs;
toOData(query: QueryJs): OData;
}
interface QueryJs {
includeTotalCount(): QueryJs;
includeDeleted(): QueryJs;
orderBy(properties: string): QueryJs;
orderByDescending(properties: string): QueryJs;
select(properties: string): QueryJs;
skip(count: number): QueryJs;
take(count: number): QueryJs;
where(filter: any): QueryJs;
// these are properties added by the SDK
id?: string | number;
single?: boolean;
}
interface OData {
table: string;
filters?: string;
ordering?: string;
orderClauses?: string;
skip?: number;
take?: number;
selections?: string;
includeTotalCount?: boolean;
}
// general
var nh: Azure.ServiceBus.NotificationHubService;
interface Context {
query: QueryJs;
id: string | number;
item: any;
req: Express.Request;
res: Express.Response;
data: ContextData;
tables: (tableName: string) => Data.Table;
user: User;
push: typeof nh;
logger: Logger;
execute(): Thenable<any>;
next(error: string|Error): any;
}
interface ContextData {
(table: TableDefinition): Data.Table;
execute(q: SqlQueryDefinition): Thenable<any>;
}
interface SqlQueryDefinition {
sql: string;
parameters?: SqlParameterDefinition[];
}
interface SqlParameterDefinition {
name: string;
value: any;
}
interface TableDefinition {
access?: AccessType;
authorize?: boolean;
autoIncrement?: boolean;
columns?: any;
databaseTableName?: string;
dynamicSchema?: boolean;
maxTop?: number;
name?: string;
pageSize?: number;
schema?: string;
softDelete?: boolean;
userIdColumn?: string;
filters?: [(query: QueryJs, context: Context) => void | QueryJs];
transforms?: [(item: any, context: Context) => void | any];
hooks?: [(results: any, context: Context) => void];
perUser?: boolean;
recordsExpire?: Duration;
webhook?: Webhook | boolean;
}
type AccessType = 'anonymous' | 'authenticated' | 'disabled';
interface Duration {
milliseconds?: number;
seconds?: number;
minutes?: number;
hours?: number;
days?: number;
weeks?: number;
months?: number;
years?: number;
}
interface Webhook {
url: string;
}
interface ApiDefinition {
authorize?: boolean;
get?: Middleware | Middleware[];
post?: Middleware | Middleware[];
patch?: Middleware | Middleware[];
put?: Middleware | Middleware[];
delete?: Middleware | Middleware[];
}
interface Thenable<R> {
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
catch<U>(onRejected?: (error: any) => void): Thenable<U>;
}
interface Logger {
log(level: string, ...message: any[]): void;
silly(...message: any[]): void;
debug(...message: any[]): void;
verbose(...message: any[]): void;
info(...message: any[]): void;
warn(...message: any[]): void;
error(...message: any[]): void;
}
interface Middleware {
(req: Express.Request, res: Express.Response, next: NextMiddleware): void;
}
interface NextMiddleware {
(error?: any): void;
}
}
// additions to the Express modules
declare namespace Express {
interface Request {
azureMobile: Azure.MobileApps.Context
}
interface Response {
results?: any;
}
}
-22
View File
@@ -1,22 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"azure-mobile-apps-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-38
View File
@@ -1,38 +0,0 @@
// Type definitions for babel-code-frame 6.20
// Project: https://github.com/babel/babel/tree/master/packages
// Definitions by: Mohsen Azimi <https://github.com/mohsen1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface BabelCodeFrameOptions {
/** Syntax highlight the code as JavaScript for terminals. default: false*/
highlightCode?: boolean;
/** The number of lines to show above the error. default: 2 */
linesBelow?: number;
/** The number of lines to show below the error. default: 3 */
linesAbove?: number;
/**
* Forcibly syntax highlight the code as JavaScript (for non-terminals);
* overrides highlightCode.
* default: false
*/
forceColor?: boolean;
}
/**
* Generate errors that contain a code frame that point to source locations.
*
* @param rawLines Raw lines to frame
* @param lineNumber Line number (1 indexed)
* @param colNumber Column number
* @param options Additional options
*
* @returns Framed code
*/
declare function codeFrame(
rawLines: string,
lineNumber: number,
colNumber: number,
options?: BabelCodeFrameOptions
): string;
export = codeFrame;
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-1
View File
@@ -1 +0,0 @@
-7260
View File
File diff suppressed because it is too large Load Diff
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"babylonjs-tests.ts"
]
}
@@ -1,79 +0,0 @@
// borrowed from the Backbone.Associations tutorials
// separated out into modules to avoid namespace clashes
import * as Backbone from 'backbone';
namespace BackboneAssociationsTests {
namespace OneToOne {
class EmployeeWithManager extends Backbone.AssociatedModel {
constructor(options?) {
super(options);
this.relations = [
{
type: Backbone.One, //nature of the relationship
key: 'manager', // attribute of Employee
relatedModel: 'Employee' //AssociatedModel for attribute key
}
];
}
defaults() {
return {
age: 0,
fname: "",
lname: "",
manager: null
};
}
}
}
namespace OneToMany {
class Location extends Backbone.AssociatedModel {
defaults() {
return {
add1: "",
add2: null,
zip: "",
state: ""
};
}
}
class Locations extends Backbone.Collection<Location> {
comparator = (c: Backbone.Model) => {
return c.get("Number");
}
}
class Project extends Backbone.AssociatedModel {
constructor(options?) {
super(options);
this.relations = [
{
type: Backbone.Many, //nature of the relation
key: 'locations', //attribute of Project
collectionType: Locations, //Collection to be used.
relatedModel: Location //Optional
}
];
}
defaults() {
return {
name: "",
number: 0,
locations: []
}
}
}
function reverseAssociationTest() {
var local = new Location({ state: "Hertfordshire" });
var project = new Project({ name: "The Old Pond Project" });
local.set("oddRelationTo", project);
var parents = project.parents;
}
}
}
@@ -1,322 +0,0 @@
import * as Marionette from 'backbone.marionette';
import * as Backbone from 'backbone';
namespace MarionetteTests {
class DestroyWarn extends Marionette.Behavior {
// you can set default options
// just like you can in your Backbone Models
// they will be overriden if you pass in an option with the same key
defaults = {
"message": "you are destroying!"
};
// behaviors have events that are bound to the views DOM
events = {
"click @ui.destroy": "warnBeforeDestroy"
};
warnBeforeDestroy() {
alert(this.options.message);
// every Behavior has a hook into the
// view that it is attached to
this.view.destroy();
}
}
Marionette.Behaviors.getBehaviorClass = (options, key) => {
if (key === "DestroyWarn")
return DestroyWarn;
return undefined;
};
class MyRouter extends Marionette.AppRouter {
// "someMethod" must exist at controller.someMethod
appRoutes = {
"some/route": "someMethod"
};
/* standard routes can be mixed with appRoutes/Controllers above */
routes = {
"some/otherRoute": "someOtherMethod"
};
someOtherMethod() {
// do something here.
}
}
class MyApplication extends Marionette.Application {
initialize(options?: any) {
console.log("initializing application");
this.layoutView = new AppLayoutView();
}
layoutView: AppLayoutView;
mainRegion: Marionette.Region;
onStart() {
this.mainRegion = new Marionette.Region({ el: '#main' });
this.layoutView.addRegion('main', this.mainRegion);
this.layoutView.render();
this.layoutView.showChildView('main', new MyView(new MyModel));
let view: Backbone.View<Backbone.Model> = this.layoutView.getChildView('main');
let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions();
let prefix: string = this.layoutView.childViewEventPrefix;
let region: Marionette.Region = this.layoutView.removeRegion('main');
let layout: Marionette.LayoutView<Backbone.Model> = this.layoutView.destroy();
}
}
class AppLayoutView extends Marionette.LayoutView<Backbone.Model> {
constructor() {
super({ el: 'body' });
}
template() {
return "<div id='main'></div>";
}
initialize(options?: any) {
console.log("initializing layoutview");
}
}
class MyModel extends Backbone.Model {
constructor(options?: any) {
super(options);
}
getName(): string {
return this.get('name');
}
setName(value: string) {
this.set(value);
}
}
class MyBaseView extends Marionette.View<MyModel> {
constructor() {
super();
this.getOption<string>('foo');
this.triggers = {
'click .foo': 'bar'
};
}
}
class MyView extends Marionette.ItemView<MyModel> {
behaviors: any;
constructor(model: MyModel) {
super({ model: model });
this.ui = {
destroy: '.destroy'
};
this.behaviors = {
DestroyWarn: {
message: 'hello'
}
};
}
template() {
return '<h1>' + this.model.getName() + '</h1> <button class="destroy">Destroy Me</button>';
}
};
class MainRegion extends Marionette.Region {
constructor() {
super();
this.el = '#main';
}
}
class MyObject extends Marionette.Object {
name: string;
options: any;
constructor() {
super();
this.name = 'Adam';
this.options = {
name: 'Foo'
};
this.on("before:destroy", () => {
console.log("before:destroy");
});
}
onBeforeDestroy(arg: any) {
console.log("in onBeforeDestroy with arg " + arg);
}
}
class MyRegion extends Marionette.Region {
constructor() {
super();
this.el = '#main-nav';
}
}
class MyJQueryRegion extends Marionette.Region {
constructor() {
super();
this.el = $('#main-nav');
}
}
class MyHtmlElRegion extends Marionette.Region {
constructor() {
super();
this.el = document.querySelector("body");
}
}
class MyCollectionView extends Marionette.CollectionView<MyModel, MyView> {
constructor() {
super();
this.childView = MyView;
this.childEvents = {
render: function () {
console.log("a childView has been rendered");
}
};
this.childViewOptions = function (model: any, index: any): any {
// do some calculations based on the model
return {
foo: "bar",
childIndex: index
}
};
this.childViewOptions = {
foo: "bar"
};
this.childViewEventPrefix = "some:prefix";
this.on('some:prefix:render', function () {
});
}
}
export var app: MyApplication;
function ApplicationTests() {
app = new MyApplication();
app.start();
var view = new MyView(new MyModel());
app.mainRegion.show(view);
}
function ObjectTests() {
var obj = new MyObject();
console.log(obj.getOption('name'));
obj.destroy("goodbye");
}
function RegionManagerTests() {
var rm = new Marionette.RegionManager();
rm.addRegions({
contentRegion: {
el: '#content',
regionClass: MainRegion
},
navigationRegion: {
el: '#navigation',
regionClass: MainRegion,
// Options passed to instance of `MyOtherRegion` for
// the `navigationRegion` on `App`
navigationOption: 42,
anotherNavigationOption: 'foo'
},
footerRegion: {
regionClass: MainRegion,
someOption: 42,
someValue: 'value'
}
});
}
function RegionTests() {
var myView: Marionette.View<MyModel> = new MyView(new MyModel());
// render and display the view
app.mainRegion.show(myView);
// empties the current view
app.mainRegion.empty();
myView = new MyView(new MyModel());
app.mainRegion.show(myView, { preventDestroy: true, forceShow: true, triggerAttach: true, triggerBeforeAttach: false });
var hasView: boolean = app.mainRegion.hasView();
app.mainRegion.reset();
Marionette.Region.prototype.attachHtml = function (view: any): void {
this.$el.empty().append(view.el);
}
myView = new Marionette.View<MyModel>({
el: $("#existing-view-stuff")
});
app.mainRegion.attachView(myView);
app.mainRegion.on("empty", function (view: any, region: any, options: any) {
// manipulate the `view` or do something extra
// with the `region`
// you also have access to the `options` that were passed to the Region.show call
});
}
function CollectionViewTests() {
var cv = new MyCollectionView();
cv.collection.add(new MyModel());
app.mainRegion.attachView(cv);
cv.addEmptyView(new MyModel, MyView);
cv.proxyChildEvents(new MyView(new MyModel));
let children: Backbone.ChildViewContainer<Marionette.View<Backbone.Model>> = cv.destroyChildren();
let view: Marionette.CollectionView<Backbone.Model, Marionette.View<Backbone.Model>> = cv.destroy();
}
class MyController extends Marionette.Controller {
}
function AppRouterTests() {
var myController = new MyController();
var router = new MyRouter();
router.appRoute("/foo", "fooThat");
router.processAppRoutes(myController, {
"foo": "doFoo",
"bar/:id": "doBar"
});
}
}
-1517
View File
File diff suppressed because it is too large Load Diff
@@ -1,306 +0,0 @@
/// <reference types="jquery" />
import * as Backbone from 'backbone';
namespace BackbonePaginatorTests {
class TestModel extends Backbone.Model{};
var makeFetchOptions = <TCol extends Backbone.PageableCollection<TestModel>>() => {
return {
reset: true,
url: 'example.com',
beforeSend: (jqxhr: JQueryXHR) => {},
success: (model: TestModel, response: any, options: any) => {},
error: (collection: TCol, jqxhr: JQueryXHR, options: any) => {},
parse: '',
};
};
namespace InitializingWithNoOption {
class TestCollection extends Backbone.PageableCollection<TestModel> {
constructor(){
super();
}
}
var testCollection = new TestCollection();
}
namespace InitializingWithOptions {
class TestCollection extends Backbone.PageableCollection<TestModel> {
constructor(models?: TestModel[],
options?: Backbone.PageableInitialOptions){
super();
}
}
var testCollection1 = new TestCollection();
var testCollection2 = new TestCollection([
new TestModel(),
new TestModel()
]);
var testCollection3 = new TestCollection([], {});
var testCollection4 = new TestCollection([],{
comparator: ()=>1,
full: true,
state: {},
queryParam: {},
});
var testCollection5 = new TestCollection([],{
state: {
firstPage: 0,
lastPage: 0,
currentPage: 0,
pageSize: 1,
totalPages: 1,
totalRecords: 1,
sortKey: 'id',
order: 1,
},
queryParam: {
currentPage: 'current_page',
pageSize: 'page_size',
totalPages: 'total_pages',
totalRecords: 'total_records',
sortKey: 'sort_key',
order: 'order',
directions: '',
},
});
var testCollection6 = new TestCollection([
<TestModel>{},
<TestModel>{},
]);
}
namespace Fetching {
class TestCollection extends Backbone.PageableCollection<TestModel> {
constructor(models?: TestModel[],
options?: Backbone.PageableInitialOptions){
super();
}
}
var testCollection = new TestCollection();
var result:JQueryXHR = testCollection.fetch();
testCollection.fetch({});
testCollection.fetch(makeFetchOptions<TestCollection>());
}
namespace Paging {
class TestCollection extends Backbone.PageableCollection<TestModel> {
constructor(models?: TestModel[],
options?: Backbone.PageableInitialOptions){
super();
}
}
var options = makeFetchOptions<TestCollection>();
var testCollection = new TestCollection();
var result:JQueryXHR|TestCollection = testCollection.getFirstPage();
testCollection.getFirstPage(options);
// 'silent's type is boolean. (structural subtyping)
testCollection.getFirstPage({silent: 'aa'});
// 'url's type is string. (structural subtyping)
testCollection.getFirstPage({url: true});
result = testCollection.getLastPage();
testCollection.getLastPage(options);
// 'silent's type is boolean. (structural subtyping)
testCollection.getLastPage({silent: 'aa'});
// 'url's type is string. (structural subtyping)
testCollection.getLastPage({url: true});
result = testCollection.getNextPage();
testCollection.getNextPage(options);
// 'silent's type is boolean. (structural subtyping)
testCollection.getNextPage({silent: 'aa'});
// 'url's type is string. (structural subtyping)
testCollection.getNextPage({url: true});
result = testCollection.getPage(1);
testCollection.getPage("1", options);
// 'silent's type is boolean. (structural subtyping)
testCollection.getPage(1, {silent: 'aa'});
// 'url's type is string. (structural subtyping)
testCollection.getPage(1, {url: true});
result = testCollection.getPageByOffset(1);
testCollection.getPageByOffset(1, options);
// 'silent's type is boolean. (structural subtyping)
testCollection.getPageByOffset(1, {silent: 'aa'});
// 'url's type is string. (structural subtyping)
testCollection.getPageByOffset(1, {url: true});
result = testCollection.getPreviousPage();
testCollection.getPreviousPage(options);
// 'silent's type is boolean. (structural subtyping)
testCollection.getPreviousPage({silent: 'aa'});
// 'url's type is string. (structural subtyping)
testCollection.getPreviousPage({url: true});
var hasPage:boolean = testCollection.hasNextPage();
hasPage = testCollection.hasPreviousPage();
}
namespace Parse {
class TestCollection extends Backbone.PageableCollection<TestModel> {
constructor(models?: TestModel[],
options?: Backbone.PageableInitialOptions){
super();
}
}
var testCollection = new TestCollection();
var result:any[] = testCollection.parse({}, {});
var resultLinks:any = testCollection.parseLinks({}, {});
resultLinks = testCollection.parseLinks({}, { xhr: $.ajax({}) } );
result = testCollection.parseRecords({}, {});
var resultState: Backbone.PageableState = testCollection.parseState(
{},
{
currentPage: 'current_page',
pageSize: 'page_size',
totalPages: 'total_pages',
totalRecords: 'total_records',
sortKey: 'sort_key',
order: 'order',
directions: '',
},
{
firstPage: 0,
lastPage: 0,
currentPage: 0,
pageSize: 1,
totalPages: 1,
totalRecords: 1,
sortKey: 'id',
order: 1,
},
{});
}
namespace Setting {
class TestCollection extends Backbone.PageableCollection<TestModel> {
constructor(models?: TestModel[],
options?: Backbone.PageableInitialOptions){
super();
}
}
var testCollection = new TestCollection();
var options = makeFetchOptions<TestCollection>();
var result1:JQueryXHR|TestCollection
= testCollection.setPageSize(1, options);
var result2:TestCollection
= testCollection.setSorting('id', 1, options);
result1 = testCollection.switchMode(
'server',
{fetch: true, resetState: true}
);
}
namespace Syncing {
class TestCollection extends Backbone.PageableCollection<TestModel> {
constructor(models?: TestModel[],
options?: Backbone.PageableInitialOptions){
super();
}
}
var testCollection = new TestCollection();
var result:JQueryXHR = testCollection.sync('server', new TestModel(), {});
result = testCollection.sync('server', testCollection, {});
}
namespace Confllict {
var result:typeof Backbone.PageableCollection
= Backbone.PageableCollection.noConflict();
}
}

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