This commit is contained in:
Roman Reshetnikov
2016-11-18 17:31:37 +03:00
610 changed files with 182301 additions and 154165 deletions
+1
View File
@@ -35,3 +35,4 @@ node_modules
.sublimets
.settings/launch.json
yarn.lock
+4 -2
View File
@@ -401,6 +401,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii)
* [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000)
* [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped)
* [:link:](ejson/ejson.d.ts) [ejson](https://www.npmjs.com/package/ejson) by [Shantanu Bhadoria](https://github.com/shantanubhadoria)
* [:link:](elasticsearch/elasticsearch.d.ts) [elasticsearch](https://www.elastic.co) by [Casper Skydt](https://github.com/CasperSkydt/DefinitelyTyped), [Blake Smith](https://github.com/bfsmith/DefinitelyTyped)
* [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan)
* [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io), [Milan Burda](https://github.com/miniak)
@@ -1189,7 +1190,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](ng-stomp/ng-stomp.d.ts) [ngStomp](https://github.com/beevelop/ng-stomp) by [Lukasz Potapczuk](https://github.com/lpotapczuk)
* [:link:](ngstorage/ngstorage.d.ts) [ngstorage](https://github.com/gsklee/ngStorage) by [Jakub Pistek](https://github.com/kubiq)
* [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi)
* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider)
* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider), [Shantanu Bhadoria](https://github.com/shantanubhadoria)
* [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici)
* [:link:](node-imap/imap.d.ts) [node imap](https://github.com/mscdex/node-imap) by [Steve Fenton](https://github.com/Steve-Fenton)
* [:link:](oauth2-server/oauth2-server.d.ts) [Node OAuth2 Server](https://github.com/thomseddon/node-oauth2-server) by [Robbie Van Gorkom](https://github.com/vangorra)
@@ -1664,7 +1665,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](supertest/supertest.d.ts) [SuperTest](https://github.com/visionmedia/supertest) by [Alex Varju](https://github.com/varju)
* [:link:](supertest-as-promised/supertest-as-promised.d.ts) [SuperTest as Promised](https://github.com/WhoopInc/supertest-as-promised) by [Tanguy Krotoff](https://github.com/tkrotoff)
* [:link:](svg-injector/svg-injector.d.ts) [SVG Injector](https://github.com/iconic/SVGInjector) by [Patrick Westerhoff](https://github.com/poke)
* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact)
* [:link:](svg-pan-zoom/svg-pan-zoom-2.3.9.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact)
* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [César Vidril](https://github.com/Yimiprod)
* [:link:](svg-sprite/svg-sprite.d.ts) [svg-sprite](https://github.com/jkphl/svg-sprite) by [Qubo](https://github.com/tkqubo)
* [:link:](svgjs/svgjs.d.ts) [svg.js](http://www.svgjs.com) by [Sean Hess](https://seanhess.github.io)
* [:link:](svg2png/svg2png.d.ts) [svg2png node package](https://github.com/domenic/svg2png) by [hans windhoff](https://github.com/hansrwindhoff)
+4 -3
View File
@@ -8,10 +8,11 @@ interface HeadroomOptions {
tolerance?: any;
classes?: {
initial?: string;
pinned?: string;
unpinned?: string;
top?: string;
notBottom?:string;
notTop?: string;
pinned?: string;
top?: string;
unpinned?: string;
};
scroller?: Element;
onPin?: () => void;
+16 -7
View File
@@ -1,8 +1,17 @@
case 1. Add a new type definition.
- [ ] checked compilation succeeds with `--target es6` and `--noImplicitAny` options.
- [ ] has correct [naming convention](http://definitelytyped.org/guides/contributing.html#naming-the-file)
- [ ] has a [test file](http://definitelytyped.org/guides/contributing.html#tests) with the suffix of `-tests.ts` or `-tests.tsx`.
Please fill in this template.
case 2. Improvement to existing type definition.
- documentation or source code reference which provides context for the suggested changes. url http://api.jquery.com/html .
- it has been reviewed by a DefinitelyTyped member.
- [ ] Prefer to make your PR against the `types-2.0` branch.
- [ ] Test the change in your own code.
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request).
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes).
- [ ] Run `npm run lint -- package-name` if a `tslint.json` is present.
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.
- [ ] Run `tsc` without errors.
- [ ] Include the required [files](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) and header. Base these on the README, *not* on an existing project.
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.
+200 -14
View File
@@ -4,36 +4,222 @@
> The repository for *high quality* TypeScript type definitions.
For more information see the [definitelytyped.org](http://definitelytyped.org) website.
Also see the [definitelytyped.org](http://definitelytyped.org) website, although information in this README is more up-to-date.
## Usage
Include a line like this:
## What are declaration files?
```typescript
/// <reference path="jquery.d.ts" />
See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
## How do I get them?
### npm
This is the preferred method. This is only available for TypeScript 2.0+ users. For example:
```sh
npm install --save-dev @types/node
```
## Contributions
The types should then be automatically included by the compiler.
See more in the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
For an NPM package "foo", typings for it will be at "@types/foo".
If you can't find your package, look for it on [TypeSearch](https://microsoft.github.io/TypeSearch/).
If you still can't find it, check if it [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own typings.
This is usually provided in a `"types"` or `"typings"` field in the `package.json`,
or just look for any ".d.ts" files in the package and manually include them with a `/// <reference path="" />`.
### Other methods
These can be used by TypeScript 1.0.
* [Typings](https://github.com/typings/typings)
* [NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)
* Manually download from the `master` branch of this repository
You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
## How can I contribute?
DefinitelyTyped only works because of contributions by users like you!
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) on how to contribute to DefinitelyTyped.
### Test
## How to get the definitions
Before you share your improvement with the world, use it yourself.
* Directly from the GitHub repos
* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped)
* [Typings - TypeScript Definition Manager](https://github.com/typings/typings)
#### Test editing an exiting package
## List of definitions
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, or copy them from there and follow the steps below.
* See [CONTRIBUTORS.md](CONTRIBUTORS.md)
## Requested definitions
#### Test a new package
Add to your `tsconfig.json`:
```json
"baseUrl": "types",
"typeRoots": ["types"],
```
(You can also use `src/types`.)
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`.
### Make a pull request
Once you've tested your package, you can share it on DefinitelyTyped.
First, [fork](https://guides.github.com/activities/forking/) this repository.
Then inside your repository:
* `git checkout types-2.0`
New work should generally be done on the `types-2.0` branch.
If you want your changes to be available to `typings` users, then you may edit `master` instead.
#### Edit an existing package
* `cd 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.
* `npm install -g typescript@2.0` and run `tsc`.
When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors.
If it doesn't, you can do so yourself in the comment associated with the PR.
#### Create a new package
If you are the library author, or can make a pull request to the library, [bundle](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) types instead of publishing to DefinitelyTyped.
If you are adding typings for an NPM package, create a directory with the same name.
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
(You can use `npm info foo` to check for the existence of the `foo` package.)
Your package should have this structure:
| File | Purpose |
| --- | --- |
| index.d.ts | This contains the typings for the package. |
| foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. |
| tsconfig.json | This allows you to run `tsc` within the package. |
Generate these by running `npm run new-package -- new-package-name`.
You may edit the `tsconfig.json` to add new files 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/types-2.0/base64-js).
#### Common mistakes
* First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
* Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces.
* `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object.
* `interface IFoo {}`: Don't add `I` to the front of an interface name.
* `interface Foo { new(): Foo; }`:
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }
* `const Class: { new(): IClass; }`:
Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant.
* `namespace foo {}`:
Do not add a namespace just so that the `import * as foo` syntax will work.
If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax.
See more explanation [here](https://stackoverflow.com/questions/39415661/why-cant-i-import-a-class-or-function-with-import-as-x-from-y).
* `getMeAT<T>(): T`:
If a type parameter does not appear in the types of any parameters, you don't really have a generic function, you just have a disguised type assertion.
Prefer to use a real type assertion, e.g. `getMeAT() as number`.
Example where a type parameter is acceptable: `function id<T>(value: T): T;`.
Example where it is not acceptable: `function parseJson<T>(json: string): T;`.
Exception: `new Map<string, number>()` is OK.
#### Removing a package
When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion.
Make a PR doing the following:
* Delete the directory.
* Add a new entry to `notNeededPackages.json`.
- `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (May be identical to "typingsPackageName".)
- `typingsPackageName`: This is the name of the directory you just deleted.
- `sourceRepoURL`: This should point to the repository that contains the typings.
- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version.
* Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types.
To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
#### Lint
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "../tslint.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
{
"extends": "../tslint.json",
"rules": {
// This package uses the Function type, and it will take effort to fix.
"forbidden-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`.)
Only `.d.ts` files are linted.
Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint.
## FAQ
#### What exactly is the relationship between this repository and the `@types` packages on NPM?
The `types-2.0` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher).
This usually happens within an hour of changes being merged.
Changes to the `master` branch are also manually merged into the `types-2.0` branch, but this takes longer.
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
If the module you're referencing is an external module (uses `export`), use an import.
If the module you're referenceing 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/types-2.0/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.
#### I notice some `tsconfig.json` are missing `"noImplicitAny": true` or `"strictNullChecks": true`.
Then they are wrong. You can help by submitting a pull request to fix them.
#### Definitions in types-2.0 seem written differently than in master.
If you're targeting types-2.0, write it like the types-2.0 definitions.
If you're targeting master, we may change it to the new style when merging from master to types-2.0.
#### Can I request a definition?
Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
## License
This project is licensed under the MIT license.
+1 -1
View File
@@ -20,7 +20,7 @@ declare module "acl" {
type Callback = (err: Error) => any;
type AnyCallback = (err: Error, obj: any) => any;
type AllowedCallback = (err: Error, allowed: boolean) => any;
type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value;
type GetUserId = (req: http.IncomingMessage, res: http.ServerResponse) => Value;
interface AclStatic {
new (backend: Backend<any>, logger: Logger, options: Option): Acl;
+1 -1
View File
@@ -82,7 +82,7 @@ declare module "ajv" {
passContext?: boolean;
loopRequired?: number;
ownProperties?: boolean;
multipleOfPrecision?: boolean;
multipleOfPrecision?: boolean | number;
errorDataPath?: string,
messages?: boolean;
beautify?: boolean;
+3
View File
@@ -23,6 +23,9 @@ declare namespace AmCharts {
/** Set it to true if you want UTC time to be used instead of local time. */
var useUTC: boolean;
/** Object with themes */
var themes: any;
/** Clears all the charts on page, removes listeners and intervals. */
function clear();
+1
View File
@@ -20,6 +20,7 @@ declare namespace angular.dynamicLocale {
interface tmhDynamicLocaleProvider extends angular.IServiceProvider {
localeLocationPattern(location: string): tmhDynamicLocaleProvider;
localeLocationPattern(): string;
storageKey(storageKey: string): void;
useStorage(storageName: string): void;
useCookieStorage(): void;
}
+20 -2
View File
@@ -160,6 +160,7 @@ declare namespace angular.material {
hideDelay(delay: number): T;
position(position: string): T;
parent(parent?: string|Element|JQuery): T; // default: root node
toastClass(toastClass: string): T;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
@@ -338,6 +339,7 @@ declare namespace angular.material {
onRemoving?: Function;
onDomRemoved?: Function;
origin?: string|JQuery|Element;
onCloseSuccess?: ((panel: IPanelRef, closeReason: string) => any);
}
interface IPanelRef {
@@ -355,6 +357,9 @@ declare namespace angular.material {
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 {
@@ -370,8 +375,8 @@ declare namespace angular.material {
centerVertically(): IPanelPosition;
center(): IPanelPosition;
addPanelPosition(xPosition: string, yPosition: string): IPanelPosition;
withOffsetX(offsetX: string): IPanelPosition;
withOffsetY(offsetY: string): IPanelPosition;
withOffsetX(offsetX: string|((panel: IPanelPosition) => string)): IPanelPosition;
withOffsetY(offsetY: string|((panel: IPanelPosition) => string)): IPanelPosition;
}
interface IPanelAnimation {
@@ -404,5 +409,18 @@ declare namespace angular.material {
SCALE: string,
FADE: string,
};
interceptorTypes: {
CLOSE: string,
};
closeReasons: {
CLICK_OUTSIDE: string,
ESCAPE: string,
};
absPosition: {
TOP: string,
RIGHT: string,
BOTTOM: string,
LEFT: string,
};
}
}
+3 -3
View File
@@ -1829,8 +1829,8 @@ declare namespace protractor {
function wrapDriver(webdriver: webdriver.WebDriver, opt_baseUrl?: string, opt_rootElement?: string): Protractor;
}
interface cssSelectorHelper {
(cssLocator: string): protractor.ElementFinder;
interface selectorHelper {
(cssLocator: string | Function | HTMLElement | Document | Array<any>): protractor.ElementFinder;
}
interface cssArraySelectorHelper {
@@ -1841,7 +1841,7 @@ declare var browser: protractor.IBrowser;
declare var by: protractor.IProtractorLocatorStrategy;
declare var By: protractor.IProtractorLocatorStrategy;
declare var element: protractor.Element;
declare var $: cssSelectorHelper;
declare var $: selectorHelper;
declare var $$: cssArraySelectorHelper;
declare module 'protractor' {
@@ -1,5 +1,5 @@
/// <reference path='angular-signalr-hub.d.ts' />
/// <reference path='../angularjs/angular.d.ts' />
/// <reference path='angular-signalr-hub.d.ts' />
angular
.module('app', ['SignalR'])
+6
View File
@@ -3,8 +3,14 @@
// Definitions by: Adam Santaniello <https://github.com/AdamSantaniello>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path='../angularjs/angular.d.ts' />
/// <reference path='../signalr/signalr.d.ts' />
declare module "angular-signalr-hub" {
let _: string;
export = _;
}
declare namespace ngSignalr {
interface HubFactory {
/**
+3 -3
View File
@@ -2,9 +2,9 @@
/// <reference path='angular-touchspin.d.ts' />
angular
.module('touchspin-tests', ['lm.touchspin'])
.config(function(touchspinConfigProvider: angularTouchSpin.ITouchSpinConfigProvider) {
touchspinConfigProvider.defaults(<angularTouchSpin.ITouchSpinOptions>{
.module('touchspin-tests', ['nk.touchspin'])
.config(function(touchspinConfigProvider: angular.touchspin.ITouchSpinConfigProvider) {
touchspinConfigProvider.defaults(<angular.touchspin.ITouchSpinOptions>{
min: 0,
max: 0,
step: 0,
+1 -1
View File
@@ -11,7 +11,7 @@ declare module "angular-touchspin" {
export = _;
}
declare namespace angularTouchSpin {
declare namespace angular.touchspin {
interface ITouchSpinOptions {
min?: number;
max?: number;
@@ -0,0 +1,39 @@
/// <reference path="./angular-ui-router-default.d.ts" />
angular.module("test", [
"ui.router",
"ui.router.default"
])
.config(function($stateProvider: angular.ui.IStateProvider) {
$stateProvider
.state('concrete', {
// no abstract or default
})
.state('string', {
abstract: true,
default: 'concrete'
})
.state('func_str', {
abstract: true,
default: function($rootScope): string { return $rootScope.test; }
})
.state('func_promise', {
abstract: true,
default: function($q: ng.IQService): ng.IPromise<string> {
return $q.when("concrete");
}
})
.state('injection_str', {
abstract: true,
default: ["$rootScope", function($rootScope) {
return $rootScope.test;
}]
})
.state('injection_promise', {
abstract: true,
default: ["$q", function($q: ng.IQService) {
return $q.when("concrete");
}]
})
;
});
@@ -0,0 +1,17 @@
// Type definitions for angular-ui-router-default 0.5+
// Project: https://github.com/nonplus/angular-ui-router-default
// Definitions by: Stepan Riha <https://github.com/nonplus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
declare namespace angular.ui {
export type StateDefaultSpecifier = string
| ((...args: any[]) => string)
| ((...args: any[]) => ng.IPromise<string>)
| (string | ((...args: any[]) => string))[]
| (string | ((...args: any[]) => ng.IPromise<string>))[];
interface IState {
default?: StateDefaultSpecifier
}
}
@@ -0,0 +1,30 @@
/// <reference path="./angular-ui-router-uib-modal.d.ts" />
angular.module("test", [
"ui.bootstrap",
"ui.router",
"ui.router.default"
])
.config(function($stateProvider: angular.ui.IStateProvider) {
$stateProvider
.state('contacts', {
// no modal
resolve: {
a: function() {
return "a";
},
b: function() {
return ["a", "b"];
}
}
})
.state('contacts.contact', {
// boolean modal
modal: true
})
.state('contacts.contact.edit', {
// string[] modal
modal: ["a", "b"]
})
;
});
@@ -0,0 +1,12 @@
// Type definitions for angular-ui-uib-modal 0.11+ (ui.router module)
// Project: https://github.com/nonplus/angular-ui-router-uib-modal
// Definitions by: Stepan Riha <https://github.com/nonplus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
declare namespace angular.ui {
interface IState {
modal?: boolean | string[];
}
}
+28 -6
View File
@@ -1,10 +1,32 @@
/// <reference path="angular-sanitize.d.ts" />
var shouldBeString: string;
///////////////////////////////////////////////////////////////////////////////
// Variables
///////////////////////////////////////////////////////////////////////////////
let shouldBeString: string;
let testInputText: string = 'TEST';
declare var $sanitizeService: ng.sanitize.ISanitizeService;
shouldBeString = $sanitizeService(shouldBeString);
///////////////////////////////////////////////////////////////////////////////
// Test sanitize service
///////////////////////////////////////////////////////////////////////////////
declare let $sanitizeService: ng.sanitize.ISanitizeService;
shouldBeString = $sanitizeService(testInputText);
declare var $linky: ng.sanitize.filter.ILinky;
shouldBeString = $linky(shouldBeString);
shouldBeString = $linky(shouldBeString, shouldBeString);
///////////////////////////////////////////////////////////////////////////////
// Test `linky` filter
///////////////////////////////////////////////////////////////////////////////
declare let $linky: ng.sanitize.filter.ILinky;
// Should be string for simple text and target parameters
shouldBeString = $linky(testInputText, testInputText);
// Should be string for simple text, target and attributes parameters
let attributesAsFunction = () => {
};
shouldBeString = $linky(shouldBeString, testInputText, {
"attributeKey1": "attributeValue1",
"attributeKey2": "attributeValue2"
});
shouldBeString = $linky(shouldBeString, testInputText, (url: string) => {
return {"attributeKey1": "attributeValue1"}
});
+18 -5
View File
@@ -29,12 +29,25 @@ declare namespace angular.sanitize {
// see https://github.com/angular/angular.js/tree/v1.2.0/src/ngSanitize/filter
///////////////////////////////////////////////////////////////////////////
export module filter {
// Finds links in text input and turns them into html links.
// Supports http/https/ftp/mailto and plain email address links.
// see http://code.angularjs.org/1.2.0/docs/api/ngSanitize.filter:linky
/**
* Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and plain email address links.
* @param text Input text.
* @param target ILinkyTargetType Window (_blank|_self|_parent|_top) or named frame to open links in.
* @param attributes Add custom attributes to the link element.
* @return Html-linkified and sanitized text.
* see https://docs.angularjs.org/api/ngSanitize/filter/linky
*/
interface ILinky {
(text: string, target?: string): string;
(text: string, target: string, attributes?: { [attribute: string]: string } | ((url: string) => { [attribute: string]: string })): string;
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Extend angular $filter declarations to include filters from angular.sanitize module
///////////////////////////////////////////////////////////////////////////////
declare namespace angular {
interface IFilterService {
(name: 'linky'): angular.sanitize.filter.ILinky;
}
}
+41 -2
View File
@@ -192,8 +192,25 @@ mod.controller({
MyCtrl2: function() {},
MyCtrl3: ['$fooService', function($fooService: any) { }]
});
mod.directive('name', <any>function ($scope: ng.IScope) { })
mod.directive('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
return (scope, el, attrs) => {
let foo = 'none';
el.click(e => {
foo = e.type;
$rootScope.$apply();
});
scope.$watch(() => foo, () => el.text(foo));
};
});
mod.directive('myDirectiveB', ['$rootScope', function ($rootScope: ng.IRootScopeService) {
return {
link(scope, el, attrs) {
el.click(e => {
el.hide();
});
}
};
}]);
mod.directive({
myFooDir: () => ({
template: 'my-foo-dir.tpl.html'
@@ -279,8 +296,14 @@ namespace TestQ {
b: string;
c: boolean;
}
interface TValue {
e: number;
f: boolean;
}
var tResult: TResult;
var promiseTResult: angular.IPromise<TResult>;
var tValue: TValue;
var promiseTValue: angular.IPromise<TValue>;
var $q: angular.IQService;
var promiseAny: angular.IPromise<any>;
@@ -349,6 +372,22 @@ namespace TestQ {
let result: angular.IPromise<TResult>;
result = $q.when<TResult>(tResult);
result = $q.when<TResult>(promiseTResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
}
}
+4 -4
View File
@@ -1041,6 +1041,7 @@ declare namespace angular {
* @param value Value or a promise
*/
when<T>(value: IPromise<T>|T): IPromise<T>;
when<TResult, T>(value: IPromise<T>|T, successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*/
@@ -1769,7 +1770,7 @@ declare namespace angular {
///////////////////////////////////////////////////////////////////////////
interface IDirectiveFactory {
(...args: any[]): IDirective;
(...args: any[]): IDirective | IDirectiveLinkFn;
}
interface IDirectiveLinkFn {
@@ -1777,8 +1778,8 @@ declare namespace angular {
scope: IScope,
instanceElement: JQuery,
instanceAttributes: IAttributes,
controller: {},
transclude: ITranscludeFunction
controller?: IController | IController[] | {[key: string]: IController},
transclude?: ITranscludeFunction
): void;
}
@@ -1806,7 +1807,6 @@ declare namespace angular {
controller?: string | Injectable<IControllerConstructor>;
controllerAs?: string;
/**
* @deprecated
* Deprecation warning: although bindings for non-ES6 class controllers are currently bound to this before
* the controller constructor is called, this use is now deprecated. Please place initialization code that
* relies upon bindings inside a $onInit method on the controller, instead.
+1
View File
@@ -137,6 +137,7 @@ declare module "apn" {
}
export interface NotificationAlertOptions {
title?:string;
subtitle?:string;
body:string;
"title-loc-key"?:string;
"title-loc-args"?:string[];
+4 -4
View File
@@ -346,24 +346,24 @@ interface Client {
* Log an incoming http request to your server. The request data will be tracked during the response "finish" event if it is successful or the request "error"
* event if it fails. The request duration is automatically calculated as the timespan between when the trackRequest method was called, and when the response "finish"
* or request "error" events were fired.
* @param request The http.ServerRequest object to track
* @param request The http.IncomingMessage object to track
* @param response The http.ServerResponse object for this request
* @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty.
*/
trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
trackRequest(request: any /* http.IncomingMessage */, response: any /* http.ServerResponse */, properties?: {
[key: string]: string;
}): void;
/**
* Log an incoming http request to your server. The request data is tracked synchronously rather than waiting for the response "finish"" or request "error"" events.
* Use this if you need your request telemetry to respect custom app insights operation and user context (for example if you set any appInsights.client.context.tags).
* @param request The http.ServerRequest object to track
* @param request The http.IncomingMessage object to track
* @param response The http.ServerResponse object for this request
* @param ellapsedMilliseconds The duration for this request. Defaults to 0.
* @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty.
* @param error An error that was returned for this request if it was unsuccessful. Defaults to null.
*/
trackRequestSync(request: any /*http.ServerRequest */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
[key: string]: string;}, error?: any) : void;
/**
+435 -45
View File
@@ -1,4 +1,4 @@
// Type definitions for ArcGIS API for JavaScript v3.17
// Type definitions for ArcGIS API for JavaScript v3.18
// Project: http://js.arcgis.com
// Definitions by: Esri <http://www.esri.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -44,6 +44,7 @@ declare module "esri" {
import QueryTask = require("esri/tasks/QueryTask");
import TextSymbol = require("esri/symbols/TextSymbol");
import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask");
import WCSConnection = require("esri/layers/WCSConnection");
import WMSLayerInfo = require("esri/layers/WMSLayerInfo");
import WMTSLayerInfo = require("esri/layers/WMTSLayerInfo");
@@ -483,12 +484,14 @@ declare module "esri" {
featureLayers: FeatureLayer[];
/** Reference to the map object. */
map?: Map;
/** The point feature layer containing the origin points. */
originsLayer: FeatureLayer;
/** The point feature layers containing the origin points. */
originsLayers: FeatureLayer[];
/** The name of the output layer to be shown in the Result layer name input box. */
outputLayerName?: string;
/** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */
portalUrl?: string;
/** Indicates whether to display a drop down menu listing valid input analysis layers. */
showSelectAnalysisLayer?: boolean;
}
export interface CoordinatesLocationProviderOptions {
/** The attribute field in the graphic object that contains the longitude (X) values. */
@@ -563,12 +566,14 @@ declare module "esri" {
export interface CreateWatershedsOptions {
/** The URL to the GPServer used to execute an analysis job. */
analysisGpServer?: string;
/** The feature layer containing input points used for calculating watersheds. */
inputLayer: FeatureLayer;
/** The feature layers containing input points used for calculating watersheds. */
inputLayers: FeatureLayer[];
/** Reference to the map object. */
map?: Map;
/** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */
portalUrl?: string;
/** Indicates whether to display a drop down menu listing valid input analysis layers. */
showSelectAnalysisLayer?: boolean;
}
export interface CutOptions {
/** The feature(s) added to the feature layer by the cut operation. */
@@ -939,6 +944,10 @@ declare module "esri" {
outFields?: string[];
/** Displays or hides the attachment column. */
showAttachments?: boolean;
/** Displays or hides tooltips for column headers. */
showColumnHeaderTooltips?: boolean;
/** Shows or hides cyclical relationship. */
showCyclicalRelationships?: boolean;
/** Displays the data type of the field right under the field label. */
showDataTypes?: boolean;
/** Displays or hides total number of features and selected number of features in the grid header. */
@@ -947,6 +956,8 @@ declare module "esri" {
showGridHeader?: boolean;
/** Displays or hides 'Options' drop-down menu of the FeatureTable. */
showGridMenu?: boolean;
/** Displays or hides the option to show related records in a table if the layer has pre-established relationship. */
showRelatedRecords?: boolean;
/** Displays or hides the 'Statistics' option in column menus for numeric fields. */
showStatistics?: boolean;
/** Enables an interaction between the map and the feature table. */
@@ -1996,6 +2007,30 @@ declare module "esri" {
/** The URL to use for connecting to a socket. */
socketUrl?: string;
}
export interface StretchFilterOptions {
/** Indicates whether to perform dynamic range adjustment using the current pixel data. */
dra?: boolean;
/** An array of gamma values, for example [0.8, 0.8, 0.8]. */
gamma?: number[];
/** The maximum value of stretched pixels. */
max?: number;
/** Percent of pixels clipped on the right histogram tail, for example 0.25. */
maxPercent?: number;
/** The minimum value of stretched pixels. */
min?: number;
/** Percent of pixels clipped on the left histogram tail, for example 1.5. */
minPercent?: number;
/** The number of standard deviations for StandardDeviation stretch, for example 2.5. */
numberOfStandardDeviations?: number;
/** The output pixel type. */
outputPixelType?: string;
/** An array of arrays containing custom statistics objects. */
statistics?: any[][];
/** See the constants table for a list of possible stretchType values. */
stretchType?: number;
/** Indicates whether to perform non-linear gamma stretch. */
useGamma?: boolean;
}
export interface SummarizeNearbyOptions {
/** The URL to the GPServer used to execute an analysis job. */
analysisGpServer?: string;
@@ -2023,6 +2058,8 @@ declare module "esri" {
showCredits?: boolean;
/** When true, the help links will be shown. */
showHelp?: boolean;
/** Indicates whether to display a drop down menu listing valid input analysis layers. */
showSelectAnalysisLayer?: boolean;
/** When true, the select folder dropdown will be shown. */
showSelectFolder?: boolean;
/** An array of possible statistics attribute field names and summary types that you wish to calculate for all nearby features. */
@@ -2031,8 +2068,8 @@ declare module "esri" {
summaryLayer?: FeatureLayer;
/** An array of possible feature layers summarizing toward. */
summaryLayers: FeatureLayer[];
/** The point, line, or polygon feature layer from which distances will be measured to features in summarizeLayer. */
sumNearbyLayer: FeatureLayer;
/** The point, line, or polygon feature layers from which distances will be measured to features in summarizeLayer. */
sumNearbyLayers: FeatureLayer[];
/** If true. */
sumShape?: boolean;
/** Type of units shown as the defeault value in the Find nearest features using a option. */
@@ -2184,27 +2221,37 @@ declare module "esri" {
/** Region of preview scale thumbnails. */
region?: string;
}
export interface WCSConnectionOptions {
/** The coverage identifier, defaults to the first coverage. */
coverageId?: string;
/** The version of WCSLayer, can be: 1.0.01.1.01.1.11.1.22.0.1 */
version?: string;
}
export interface WCSLayerOptions {
/** The coverage identifier, defaults to the first coverage. */
coverageId?: string;
/** Sets the layer's draw mode. */
drawMode?: boolean;
/** Sets the context of the Canvas. */
drawType?: string;
/** A function that takes a pixelData object as input and processes it. */
pixelFilter?: Function;
/** The version of WCSLayer, can be: 1.0.01.1.01.1.11.1.22.0.1 */
version?: string;
/** A WCS Connection object. */
wcsConnection?: WCSConnection;
}
export interface WFSLayerOptions {
/** Full WFS body request sent to WFS server via POST method. */
getFeatureRequest?: string;
/** URL used when executing getFeature request. */
getFeatureUrl?: string;
/** Use this to append custom parameters to WFS requests. */
customParameters?: any;
/** The template that defines the content to display in the map info window when the user clicks on a feature. */
infoTemplate?: InfoTemplate;
/** For "ondemand" mode only. */
inverseFilter?: boolean;
/** When true, the XY coordinates should be swapped (this is required for some WFS vendors, versions, and WKIDS). */
inverseResponse?: boolean;
/** Specifies the maximum number of features to return in one response. */
maxFeatures?: number;
/** The query mode for the WFS layer. */
mode?: string;
/** For "ondemand" mode only. */
nsGeometryFieldName?: string;
/** The full layer name including the namespace as a prefix. */
nsLayerName?: string;
/** When true, more details will be printed to console when the first connection to a WFS server is established. */
showDetails?: boolean;
/** The simple layer name (excluding the namespace). */
name?: string;
/** URL to the WFS server. */
url: string;
/** OGC WFS version number. */
@@ -2235,6 +2282,10 @@ declare module "esri" {
title?: string;
}
export interface WMSLayerOptions {
/** The customLayerParameters object used for the WMS Layer. */
customLayerParameters?: any;
/** The customParameters object used for the WMS Layer. */
customParameters?: any;
/** Specify the map image format, valid options are png,jpg,bmp,gif,svg. */
format?: string;
/** An optional resourceInfo object. */
@@ -2267,6 +2318,10 @@ declare module "esri" {
title?: string;
}
export interface WMTSLayerOptions {
/** The customLayerParameters object used for the WMTS Layer. */
customLayerParameters?: any;
/** The customParameters object used for the WMTS Layer. */
customParameters?: any;
/** A WMTSLayerInfo object that when ResourceInfo options are not specified the map will display the first layer in the WMTS capabilities that matches the properties specified by WMTSLayerInfo. */
layerInfo?: WMTSLayerInfo;
/** When true, tile resampling is enabled. */
@@ -2783,7 +2838,7 @@ declare module "esri/TimeExtent" {
* Returns a new time extent indicating the intersection between "this" and the argument time extent.
* @param timeExtent The input time extent.
*/
intersection(timeExtent: number): TimeExtent;
intersection(timeExtent: TimeExtent): TimeExtent;
/**
* Returns a new time extent with the given offset from "this' time extent.
* @param offsetValue The length of time to offset from "this" time extent.
@@ -2946,7 +3001,7 @@ declare module "esri/arcgis/Portal" {
/** The prefix selected by the organization's administrator to be used with the customBaseURL. */
urlKey: string;
/** User information for the accessing user is returned only when a token is passed in. */
user: any;
user: PortalUser;
/** If true, only simple where clauses that are complaint with SQL92 can be used when querying layers and tables. */
useStandardizedQuery: boolean;
/**
@@ -3951,6 +4006,8 @@ declare module "esri/dijit/ElevationProfile" {
startup(): void;
/** Fires when the elevation profile is cleared. */
on(type: "clear-profile", listener: (event: { target: ElevationProfile }) => void): esri.Handle;
/** Fires after the profile is generated. */
on(type: "elevation-values", listener: (event: { data: any; target: ElevationProfile }) => void): esri.Handle;
/** Fires when the widget has fully loaded. */
on(type: "load", listener: (event: { target: ElevationProfile }) => void): esri.Handle;
/** Fires when the title of the elevation profile is changed */
@@ -3967,6 +4024,7 @@ declare module "esri/dijit/FeatureTable" {
import FeatureLayer = require("esri/layers/FeatureLayer");
import Map = require("esri/map");
import FeatureEditResult = require("esri/layers/FeatureEditResult");
import Graphic = require("esri/graphic");
/** Creates an instance of the FeatureTable widget within the provided DOM node. */
class FeatureTable {
@@ -4012,6 +4070,10 @@ declare module "esri/dijit/FeatureTable" {
selectedRows: any[];
/** Displays or hides the attachment column. */
showAttachments: boolean;
/** Displays or hides tooltips for column headers. */
showColumnHeaderTooltips: boolean;
/** Relies on showRelatedRecords property. */
showCyclicalRelationships: boolean;
/** Displays or hides the data type of the field right under the field label in the column header. */
showDataTypes: boolean;
/** Displays or hides total number of features and selected number of features in the grid header. */
@@ -4020,6 +4082,8 @@ declare module "esri/dijit/FeatureTable" {
showGridHeader: boolean;
/** Displays or hides 'Options' drop-down menu of the FeatureTable. */
showGridMenu: boolean;
/** Displays or hides the option to show related records in a table if the layer has pre-established relationship. */
showRelatedRecords: boolean;
/** Displays or hides the 'Statistics' option in column menus for numeric fields. */
showStatistics: boolean;
/** Enables an interaction between the map and the feature table. */
@@ -4032,35 +4096,55 @@ declare module "esri/dijit/FeatureTable" {
* @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into.
*/
constructor(params: esri.FeatureTableOptions, srcNodeRef: Node | string);
/** Removes all current selections including subsets from filterSelectedRecords(). */
/** Centers the map on combined extent of selected rows. */
centerOnSelection(): void;
/** Removes all filters and selections in the table. */
clearFilter(): void;
/** Removes all selections. */
clearSelection(): void;
/** Destroys the FeatureTable widget. */
destroy(): void;
/**
* Allows users to see the sub-set of currently selected records (uses dGrid.query).
* @param toggle When true only a subset of currently selected features will be displayed in the FeatureTable.
* Filters the table based on the provided row ids.
* @param ids Array of row ids.
*/
filterSelectedRecords(toggle: boolean): void;
filterRecordsByIds(ids: number[]): void;
/** Allows users to see the sub-set of records. */
filterSelectedRecords(): void;
/**
* Queries and gets selected features from the FeatureLayer instead of the store.
* @param id Array of row ids
* @param id Row id or an array of row ids
*/
getFeatureDataById(id: number[]): any;
getFeatureDataById(id: number | number[]): any;
/**
* Gets row object by the row ID.
* @param id row ID
*/
getRowDataById(id: number): any;
/** Refreshes the data in the grid. */
/** Refreshes the data in the table. */
refresh(): void;
/** Resizes the grid's container. */
resize(): void;
/**
* Allows users to select rows(s) based on row id(s).
* @param ids Row id or an array of row ids
* @param scrollToRow Indicates whether the table should scroll to selected rows.
*/
selectRows(ids: number | number[], scrollToRow?: boolean): void;
/**
* Sorts a given field in ascending or descending order.
* @param field Name of the field
* @param descending Defines whether the specified field will be sorted in ascending or descending order.
*/
sort(field: string, descending?: boolean): void;
/** Finalizes the creation of the widget. */
startup(): void;
/** This event fires in response to clearSelection() method. */
on(type: "clear-selection", listener: (event: { target: FeatureTable }) => void): esri.Handle;
/** Fires when the grid column is resized. */
on(type: "column-resize", listener: (event: { target: FeatureTable }) => void): esri.Handle;
on(type: "column-resize", listener: (event: { resizeEvent: any; target: FeatureTable }) => void): esri.Handle;
/** Fires when a column is hidden or shown via 'Options' drop-down menu. */
on(type: "column-state-change", listener: (event: { target: FeatureTable }) => void): esri.Handle;
on(type: "column-state-change", listener: (event: { stateChangeEvent: any; target: FeatureTable }) => void): esri.Handle;
/** Fires when grid editor field loses focus after being changed. */
on(type: "data-change", listener: (event: { target: FeatureTable }) => void): esri.Handle;
/** Fires when grid editor is hidden. */
@@ -4072,19 +4156,23 @@ declare module "esri/dijit/FeatureTable" {
/** Fires when an error occurs in the grid. */
on(type: "error", listener: (event: { target: FeatureTable }) => void): esri.Handle;
/** Fires when grid is filtered. */
on(type: "filter", listener: (event: { target: FeatureTable }) => void): esri.Handle;
on(type: "filter", listener: (event: { ids: number[]; target: FeatureTable }) => void): esri.Handle;
/** Fires when the FeatureTable is loaded. */
on(type: "load", listener: (event: { target: FeatureTable }) => void): esri.Handle;
/** Fires when the grid is refreshed. */
on(type: "refresh", listener: (event: { target: FeatureTable }) => void): esri.Handle;
/** Fires when a row is deselected. */
on(type: "row-deselect", listener: (event: { target: FeatureTable }) => void): esri.Handle;
on(type: "row-deselect", listener: (event: { event: any; target: FeatureTable }) => void): esri.Handle;
/** Fires when a row is selected. */
on(type: "row-select", listener: (event: { target: FeatureTable }) => void): esri.Handle;
on(type: "row-select", listener: (event: { event: any; target: FeatureTable }) => void): esri.Handle;
/** Fires when attachment is displayed in the table. */
on(type: "show-attachments", listener: (event: { attachments: any; dialog: any; featureId: number; target: FeatureTable }) => void): esri.Handle;
/** Fires when related records are displayed in the table. */
on(type: "show-related-records", listener: (event: { features: Graphic[]; relationship: any; row: any; target: FeatureTable }) => void): esri.Handle;
/** Fires when the statistics dialog box shows the calculated statistics on a column with numeric data. */
on(type: "show-statistics", listener: (event: { statistics: any; target: FeatureTable }) => void): esri.Handle;
/** Fires when a column is sorted. */
on(type: "sort", listener: (event: { target: FeatureTable }) => void): esri.Handle;
on(type: "sort", listener: (event: { sortEvent: any; target: FeatureTable }) => void): esri.Handle;
on(type: string, listener: (event: any) => void): esri.Handle;
}
export = FeatureTable;
@@ -4168,7 +4256,7 @@ declare module "esri/dijit/Geocoder" {
import GraphicsLayer = require("esri/layers/GraphicsLayer");
import Symbol = require("esri/symbols/Symbol");
/** Starting with version 3.13, the Search Widget supersedes the Geocoder Widget and is deprecated. */
/** The Geocoder widget was deprecated in version 3.13 and replaced by the Search widget. */
class Geocoder {
/** Currently selected locator object. */
activeGeocoder: any;
@@ -9403,6 +9491,8 @@ declare module "esri/layers/FeatureLayer" {
labelingInfo: LabelClass[];
/** Unique ID of the layer that the FeatureLayer was constructed against. */
layerId: number;
/** The maximum allowable offset, only applicable for layers that are not editable. */
maxAllowableOffset: number;
/** The maximum number of results that will be returned from a query. */
maxRecordCount: number;
/** Maximum visible scale for the layer. */
@@ -10914,7 +11004,7 @@ declare module "esri/layers/VectorTileLayer" {
import SpatialReference = require("esri/SpatialReference");
import TileInfo = require("esri/layers/TileInfo");
/** A VectorTileLayer accesses cached tiles of data and renders it in vector format. */
/** A VectorTileLayer renders cached tiles of data. */
class VectorTileLayer extends Layer {
/** The full extent of the layer. */
fullExtent: Extent;
@@ -10946,6 +11036,224 @@ declare module "esri/layers/VectorTileLayer" {
export = VectorTileLayer;
}
declare module "esri/layers/WCSConnection" {
import esri = require("esri");
import WCSCoverageDescription = require("esri/layers/WCSCoverageDescription");
import DimensionalDefinition = require("esri/layers/DimensionalDefinition");
/** (Currently in beta), a helper class to discover available coverages in an OGC Web Coverage Service. */
class WCSConnection {
/** Resamples pixel by bilinear interpolation. */
static INTERPOLATION_BILINEAR: any;
/** Resamples pixel by cubic convolution. */
static INTERPOLATION_CUBICCONVOLUTION: any;
/** Resamples pixel by nearest neighbor. */
static INTERPOLATION_NEARESTNEIGHBOR: any;
/** An array of coverages offered by the WCS server. */
coverages: WCSCoverageDescription[];
/** Multiple dimensional definitions are usually used to filter data. */
multidimensionalDefinition: DimensionalDefinition[];
/** The name of the WCS server. */
name: string;
/** Key-value pairs for URLs of different WCS operations: GetCapabilitiesDescribeCoverage */
onlineResources: any;
/** An array of string values indicating WCS 2.0.1 profiles. */
profiles: string[];
/** An array of supported formats by the server. */
supportedFormats: string[];
/** The interpolation method affects how the raster dataset is transformed when it undergoes warping or when it changes coordinate space. */
supportedInterpolations: number[];
/** An array of supported WCS versions by the server. */
supportedVersions: string[];
/** URL to a WCS Server endpoint. */
url: string;
/** The version of WCSLayer, can be: 1.0.01.1.01.1.11.1.22.0.1 */
version: string;
/**
* Creates a new WCSConnection.
* @param url URL to a WCS Server endpoint.
* @param options Optional parameters.
*/
constructor(url: string, options?: esri.WCSConnectionOptions);
/** Triggered when successfully retrieved list of coverages. */
on(type: "onConnected", listener: (event: { target: WCSConnection }) => void): esri.Handle;
/** Triggered when an error occurred. */
on(type: "onConnectionFailed", listener: (event: { error: Error; target: WCSConnection }) => void): esri.Handle;
on(type: string, listener: (event: any) => void): esri.Handle;
}
export = WCSConnection;
}
declare module "esri/layers/WCSCoverageDescription" {
import Extent = require("esri/geometry/Extent");
import Point = require("esri/geometry/Point");
import TimeInfo = require("esri/layers/TimeInfo");
/** (Currently in beta), the WCSCoverageDescription models the coverage properties offered by the WCS Server. */
class WCSCoverageDescription {
/** Resamples pixel by bilinear interpolation. */
static INTERPOLATION_BILINEAR: any;
/** Resamples pixel by cubic convolution. */
static INTERPOLATION_CUBICCONVOLUTION: any;
/** Resamples pixel by nearest neighbor. */
static INTERPOLATION_NEARESTNEIGHBOR: any;
/** An array of band names. */
bandInfo: string[];
/** Number of columns at the source resolution. */
columns: number;
/** The coverage description text. */
description: string;
/** Coverage extent in the native spatial reference. */
extent: Extent;
/** The coverage id. */
id: string;
/** Coverage extent in WGS84. */
lonLatEnvelope: Extent;
/** A parsed multidimensional object that describes variables and dimensions. */
multiDimensionalInfo: any;
/** A parsed coverage description object in a structure similar to WCS Coverage Description schema. */
nativeCoverageDescription: any;
/** Coverage's source resolution. */
resolution: Point;
/** Number of rows at the source resolution. */
rows: number;
/** Generalized from the following properties:SupportedFormats for WCS 1.0.0 and 1.1.xserviceParameters.supportedFormats for WCS 2.0.1. */
supportedFormats: string[];
/** The interpolation method affects how the raster dataset is transformed when it undergoes warping or when it changes coordinate space. */
supportedInterpolations: number[];
/** Temporal information for the layer, such as time extent. */
timeInfo: TimeInfo;
/** The current version of the coverage. */
version: string;
/**
* Creates a new WCSCoverageDescription.
* @param coverageDocument The coverage description XML.
* @param version The version of the coverage description document.
*/
constructor(coverageDocument: string, version: string);
}
export = WCSCoverageDescription;
}
declare module "esri/layers/WCSLayer" {
import esri = require("esri");
import WCSCoverageDescription = require("esri/layers/WCSCoverageDescription");
import Extent = require("esri/geometry/Extent");
import DimensionalDefinition = require("esri/layers/DimensionalDefinition");
import TimeInfo = require("esri/layers/TimeInfo");
import WCSConnection = require("esri/layers/WCSConnection");
import Point = require("esri/geometry/Point");
import Layer = require("esri/layers/layer");
/** (Currently in beta) The WCSLayer works with OGC Web Coverage Services. */
class WCSLayer {
/** Resamples pixel by bilinear interpolation. */
static INTERPOLATION_BILINEAR: any;
/** Resamples pixel by cubic convolution. */
static INTERPOLATION_CUBICCONVOLUTION: any;
/** Resamples pixel by nearest neighbor. */
static INTERPOLATION_NEARESTNEIGHBOR: any;
/** Zero-based array of current band selections. */
bandIds: number[];
/** A reference to a WCSCoverageDescription object. */
coverageDescription: WCSCoverageDescription;
/** The coverage identifier, defaults to the first coverage. */
coverageId: string;
/** The extent of the full coverage. */
extent: Extent;
/** Raster format of the layer. */
format: string;
/** Current interpolation method. */
interpolation: number;
/** When the layer is loaded, the value becomes "true", and layer properties can be accessed. */
loaded: boolean;
/** Multiple dimensional definitions are usually used to filter data. */
multidimensionalDefinition: DimensionalDefinition[];
/** Opacity or transparency of layer. */
opacity: number;
/** A function that takes a pixelData object as input and processes it. */
pixelFilter: Function;
/** The pixel type of the image service. */
pixelType: string;
/** The projected extent in the map's spatial reference. */
projectedFullExtent: Extent;
/** When true, the layer is suspended. */
suspended: boolean;
/** Temporal information for the layer, such as time extent. */
timeInfo: TimeInfo;
/** URL to a WCS Server endpoint. */
url: string;
/** The version of WCSLayer, can be: 1.0.01.1.01.1.11.1.22.0.1 */
version: string;
/** The visibility of the layer. */
visible: boolean;
/** A WCS Connection object. */
wcsConnection: WCSConnection;
/**
* Creates a new WCSLayer.
* @param url URL to a WCS Server endpoint.
* @param options Optional parameters.
*/
constructor(url: string, options?: esri.WCSLayerOptions);
/** Returns the context of the Canvas. */
getContext(): any;
/**
* Returns an array of graphics as a Promise.
* @param mapPoint The map point location in which to identify.
*/
identify(mapPoint: Point): any;
/** Resumes layer drawing. */
resume(): void;
/**
* Sets the opacity of the layer.
* @param opacity Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency.
*/
setOpacity(opacity: number): void;
/**
* Sets a pixelFilter on the layer.
* @param pixelFilter The function defining the PixelFilter to set on the layer.
* @param doNotRefresh When true the layer will not refresh the map image.
*/
setPixelFilter(pixelFilter: Function, doNotRefresh?: boolean): void;
/**
* Determines if the layer will update its content based on the map's current time extent.
* @param use Use true to update the layer's content based on the map's current time extent.
*/
setUseMapTime(use: boolean): void;
/**
* Sets the visibility of the layer.
* @param isVisible Indicate whether to set layer visibility.
*/
setVisibility(isVisible: boolean): void;
/** Suspends layer drawing. */
suspend(): void;
/** Fires when there is a problem retrieving a layer. */
on(type: "error", listener: (event: { error: Error; target: WCSLayer }) => void): esri.Handle;
/** Fires after layer properties for the layer are successfully populated. */
on(type: "load", listener: (event: { layer: Layer; target: WCSLayer }) => void): esri.Handle;
/** Fires when the layer opacity has been changed, and returns an object with the opacity value. */
on(type: "opacity-change", listener: (event: { opacity: number; target: WCSLayer }) => void): esri.Handle;
/** This event is fired when the layer's refreshInterval is modified. */
on(type: "refresh-interval-change", listener: (event: { target: WCSLayer }) => void): esri.Handle;
/** Fires when a layer resumes drawing. */
on(type: "resume", listener: (event: { target: WCSLayer }) => void): esri.Handle;
/** Fires when a layer's minScale and/or maxScale is changed. */
on(type: "scale-range-change", listener: (event: { target: WCSLayer }) => void): esri.Handle;
/** Fires when a layer's scale visibility changes. */
on(type: "scale-visibility-change", listener: (event: { target: WCSLayer }) => void): esri.Handle;
/** Fires when a layer suspends drawing */
on(type: "suspend", listener: (event: { target: WCSLayer }) => void): esri.Handle;
/** Fires when a layer has finished updating its content. */
on(type: "update-end", listener: (event: { error: Error; target: WCSLayer }) => void): esri.Handle;
/** Fires when a layer begins to update its content. */
on(type: "update-start", listener: (event: { target: WCSLayer }) => void): esri.Handle;
/** Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer. */
on(type: "visibility-change", listener: (event: { visible: boolean; target: WCSLayer }) => void): esri.Handle;
on(type: string, listener: (event: any) => void): esri.Handle;
}
export = WCSLayer;
}
declare module "esri/layers/WFSLayer" {
import esri = require("esri");
import GraphicsLayer = require("esri/layers/GraphicsLayer");
@@ -10957,6 +11265,8 @@ declare module "esri/layers/WFSLayer" {
/** (Currently in beta) A layer for OGC Web Feature Services (WFS). */
class WFSLayer extends GraphicsLayer {
/** Use this to append custom parameters to WFS requests. */
customParameters: any;
/** An array of fields in the layer. */
fields: Field[];
/** The full extent of the layer. */
@@ -10987,6 +11297,11 @@ declare module "esri/layers/WFSLayer" {
redraw(): void;
/** Refreshes the features in the WFS layer. */
refresh(): void;
/**
* Sets the custom parameters used on the WFS layer.
* @param customParameters The customParameters object used append WFS requests.
*/
setCustomParameters(customParameters: any): void;
/** Sets the default line symbol to be used if no renderer is specified. */
setLineSymbol(): void;
/** Sets the default point symbol to be used if no renderer is specified. */
@@ -11012,12 +11327,20 @@ declare module "esri/layers/WMSLayer" {
allExtents: Extent[];
/** Copyright of the WMS service. */
copyright: string;
/** Use this to append different custom parameters to WMS layer requests. */
customLayerParameters: any;
/** Use this to append custom parameters to all WMS requests. */
customParameters: any;
/** Description of the WMS service. */
description: string;
/** Extent of the WMS service. */
extent: Extent;
/** Feature info MIME type to request. */
featureInfoFormat: string;
/** The URL for the WMS GetFeatureInfo call. */
getFeatureInfoURL: string;
/** The URL for the WMS GetMap call. */
getMapUrl: string;
getMapURL: string;
/** The map image format. */
imageFormat: string;
/** List of layers in the WMS service. */
@@ -11034,12 +11357,22 @@ declare module "esri/layers/WMSLayer" {
title: string;
/** Version of the WMS service. */
version: string;
/** A list of layer names that represent the layers to include in the exported map. */
visibleLayers: string[];
/**
* Creates a new WMSLayer object.
* @param url URL to the OGC Web Map Service.
* @param options Optional parameters.
*/
constructor(url: string, options?: esri.WMSLayerOptions);
/** Returns the current map image format. */
getImageFormat(): string;
/**
* Sets the custom parameters used on the WMS layer.
* @param customParameters The customParameters object used append WMS requests.
* @param customLayerParameters The customLayerParameters object used append specific WMS layer requests.
*/
setCustomParameters(customParameters: any, customLayerParameters?: any): void;
/**
* Set the map image format; valid values are "png", "jpg", "pdf", "bmp", "gif" and "svg".
* @param format The image format.
@@ -11106,6 +11439,10 @@ declare module "esri/layers/WMTSLayer" {
class WMTSLayer extends TiledMapServiceLayer {
/** Copyright information for the service. */
copyright: string;
/** Use this to append different custom parameters to a WMTS tile request. */
customLayerParameters: any;
/** Use this to append custom parameters to all WMTS requests. */
customParameters: any;
/** The description of the active layer if specified in the capabilties file or the resource info. */
description: string;
/** The tile format. */
@@ -11137,6 +11474,12 @@ declare module "esri/layers/WMTSLayer" {
* @param WMTSLayerInfo The WMTSLayerInfo for the layer to make active.
*/
setActiveLayer(WMTSLayerInfo: WMTSLayerInfo): void;
/**
* Sets the custom parameters used on the WMTS layer.
* @param customParameters The customParameters object used append WMTS requests.
* @param customLayerParameters The customLayerParameters object used append specific WMTS layer requests.
*/
setCustomParameters(customParameters: any, customLayerParameters?: any): void;
}
export = WMTSLayer;
}
@@ -11315,6 +11658,47 @@ declare module "esri/layers/layer" {
export = Layer;
}
declare module "esri/layers/pixelfilters/StretchFilter" {
import esri = require("esri");
/** A stretch filter used to work with client -side pixel data to enhance raster/image appearances. */
class StretchFilter {
/** Indicates whether to perform dynamic range adjustment using the current pixel data. */
dra: boolean;
/** An array of gamma values, for example [0.8, 0.8, 0.8]. */
gamma: number[];
/** The maximum value of stretched pixels. */
max: number;
/** Percent of pixels clipped on the right histogram tail, for example 0.25. */
maxPercent: number;
/** The minimum value of stretched pixels. */
min: number;
/** Percent of pixels clipped on the left histogram tail, for example 1.5. */
minPercent: number;
/** The number of standard deviations for StandardDeviation stretch, for example 2.5. */
numberOfStandardDeviations: number;
/** The output pixel type. */
outputPixelType: string;
/** An array of arrays containing custom statistics objects. */
statistics: any[][];
/** Number indicating the various stretch types. */
stretchType: number;
/** Indicates whether to perform non-linear gamma stretch. */
useGamma: boolean;
/**
* Creates an instance of a StretchFilter.
* @param options Optional parameters.
*/
constructor(options?: esri.StretchFilterOptions);
/**
* It takes a pixelData object as input and processes it.
* @param pixelData The pixelData object used as filter input.
*/
filter(pixelData: any): void;
}
export = StretchFilter;
}
declare module "esri/map" {
import esri = require("esri");
import Attribution = require("esri/dijit/Attribution");
@@ -11779,8 +12163,8 @@ declare module "esri/opsdashboard/ExtensionBase" {
static POLYLINE: any;
/** Read-only: Indicates if the host application is the Windows Operations Dashboard. */
isNative: boolean;
/** Read Only: It will list all of the Portal helper services. */
portalHelperServices: string;
/** Read-only: It will list all of the Portal helper services. */
portalHelperServices: any;
/** Read-only: The URL to the ArcGIS.com site or in-house portal that you are currently signed in to. */
portalUrl: string;
/** Get the collection of data sources from the host application. */
@@ -11838,8 +12222,11 @@ declare module "esri/opsdashboard/ExtensionConfigurationBase" {
class ExtensionConfigurationBase extends ExtensionBase {
/** The object that will store the Widget/MapTool/FeatureAction configuration. */
config: any;
/** Indicates that the configuration is ready to be persisted or not. */
readyToPersistConfig: boolean;
/**
* Indicates if the configuration is ready to be persisted or not.
* @param ready Indicates that the configuration is ready to be persisted or not.
*/
readyToPersistConfig(ready: boolean): void;
}
export = ExtensionConfigurationBase;
}
@@ -14127,6 +14514,8 @@ declare module "esri/tasks/FeatureSet" {
features: Graphic[];
/** Set of name-value pairs for the attribute's field and alias names. */
fieldAliases: any;
/** The array of fields. */
fields: any[];
/** The geometry type of the FeatureSet. */
geometryType: string;
/** When a FeatureSet is used as input to Geoprocessor, the spatial reference is set to the map's spatial reference by default. */
@@ -14379,7 +14768,7 @@ declare module "esri/tasks/GeometryService" {
url: string;
/**
* Creates a new GeometryService object.
* @param url URL to the ArcGIS Server REST resource that represents a GeometryService, e.g., http://sampleserver6.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer.
* @param url URL to the ArcGIS Server REST resource that represents a GeometryService, https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer.
*/
constructor(url: string);
/**
@@ -15165,6 +15554,7 @@ declare module "esri/tasks/PrintParameters" {
declare module "esri/tasks/PrintTask" {
import esri = require("esri");
import PrintParameters = require("esri/tasks/PrintParameters");
import DataFile = require("esri/tasks/DataFile");
/** The PrintTask class generates a printer-ready version of the map using an Export Web Map Task available with ArGIS Server 10.1 and later. */
class PrintTask {
@@ -15184,7 +15574,7 @@ declare module "esri/tasks/PrintTask" {
*/
execute(printParameters: PrintParameters, callback?: Function, errback?: Function): any;
/** Fired when the print operation is complete. */
on(type: "complete", listener: (event: { url: string; target: PrintTask }) => void): esri.Handle;
on(type: "complete", listener: (event: { result: DataFile; target: PrintTask }) => void): esri.Handle;
/** Fired when an error occurs while executing the print task. */
on(type: "error", listener: (event: { error: Error; target: PrintTask }) => void): esri.Handle;
on(type: string, listener: (event: any) => void): esri.Handle;
+10 -1
View File
@@ -11,4 +11,13 @@ var readStream = FS.createReadStream('./archiver.d.ts');
archiver.pipe(writeStream);
archiver.append(readStream, {name: 'archiver.d.ts'});
archiver.finalize();
archiver.finalize();
archiver.directory('./path', './someOtherPath');
archiver.directory('./path', { name: "testName"} );
archiver.directory('./', "", {});
archiver.directory('./', {name: 'test'}, {});
archiver.bulk({ mappaing: {} });
+5
View File
@@ -25,6 +25,11 @@ declare module "archiver" {
interface Archiver extends STREAM.Transform {
pipe(writeStream: FS.WriteStream): void;
append(source: FS.ReadStream | 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;
}
+10 -11
View File
@@ -1,10 +1,15 @@
// Type definitions for assert and power-assert
// Project: https://github.com/Jxck/assert
// Project: https://github.com/twada/power-assert
// Type definitions for assert
// Project: https://github.com/defunctzombie/commonjs-assert
// Definitions by: vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// copy from assert external module in node.d.ts
// Definitions for commonjs-assert match that of node.js' assert module,
// but commonjs-assert is intended to be used as an independent module,
// for instance when making a stand-alone site or app that doesn't have
// access to node modules. For that reason, these definitions define a
// "assert" module. This will conflict with node.d.ts and other assert
// modules such as "power-assert", but a project should realistically
// only be using one of these at a time.
declare function assert(value:any, message?:string):void;
declare namespace assert {
@@ -52,12 +57,6 @@ declare namespace assert {
export function ifError(value:any):void;
}
// duplicate to node.d.ts
// declare module "assert" {
// export = assert;
// }
// move to power-assert.d.ts. do not use this definition file.
declare module "power-assert" {
declare module "assert" {
export = assert;
}
+64
View File
@@ -0,0 +1,64 @@
/// <reference path="async-polling.d.ts" />
import * as AsyncPolling from "async-polling";
// Tests based on examples in https://github.com/cGuille/async-polling#readme
AsyncPolling(end => {
end();
}, 3000).run();
function someAsynchroneProcess(callback: (error?: Error, response?: any) => any): any {
callback();
}
let polling = AsyncPolling(end => {
someAsynchroneProcess(function (error, response) {
if (error) {
end(error);
return;
}
end(null, response);
});
}, 3000);
polling.on("error", (error: Error) => {});
polling.on("result", (result: any) => {});
polling.run();
polling.stop();
AsyncPolling(function(end) {
this.stop();
end();
}, 3000).run();
let i = 0;
polling = AsyncPolling(function(end) {
++i;
if (i === 3) {
return end(new Error("i is " + i));
}
if (i >= 5) {
this.stop();
return end(null, `#${i} stop`);
}
end(null, `#${i} wait a second...`);
}, 1000);
const eventNames: AsyncPolling.EventName[] = ["run", "start", "end", "schedule", "stop"];
eventNames.forEach(eventName => {
polling.on(eventName, () => {
console.log("lifecycle:", eventName);
});
});
polling.on("result", (result: any) => {
console.log("result:", result);
});
polling.on("error", (error: Error) => {
console.error("error:", error);
});
polling.run();
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for AsyncPolling
// Project: https://github.com/cGuille/async-polling
// Definitions by: Zlatko Andonovski <https://github.com/Goldsmith42/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "async-polling" {
module AsyncPolling {
export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop";
}
function AsyncPolling<Result>(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): {
run: () => any;
stop: () => any;
on: (eventName: AsyncPolling.EventName, listener: Function) => any;
}
export = AsyncPolling;
}
+390 -34
View File
@@ -1,23 +1,25 @@
/// <reference path="async.d.ts" />
var fs, path;
/// <reference path="../node/node.d.ts" />
import * as fs from "fs";
// var fs = require("fs");
function callback() {}
function funcStringCbErrBoolean(v:string, cb:(err:Error,res:boolean) => void) {}
async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err, results) { });
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'], path.exists, function (results) { });
async.filterSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.filterLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
async.select(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.selectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.selectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
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'], path.exists, function (results) { });
async.rejectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.rejectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
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 () { },
@@ -41,9 +43,9 @@ var openFilesObj = {
file2: "fileTwo"
}
var saveFile = function () { }
async.each(openFiles, saveFile, function (err) { });
async.eachSeries(openFiles, saveFile, function (err) { });
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, requestApi;
async.eachLimit(documents, 20, requestApi, function (err) { });
@@ -73,9 +75,9 @@ 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'], path.exists, function (result) { });
async.detectSeries(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.detectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.detect(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err,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) {
@@ -83,13 +85,13 @@ async.sortBy(['file1', 'file2', 'file3'], function (file, callback) {
});
}, function (err, results) { });
async.some(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.someLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.any(['file1', 'file2', 'file3'], path.exists, function (result) { });
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'], path.exists, function (result) { });
async.everyLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.all(['file1', 'file2', 'file3'], path.exists, function (result) { });
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) { });
@@ -107,7 +109,7 @@ async.series([
],
function (err, results) { });
async.series<string>([
async.series<string,Error>([
function (callback) {
callback(null, 'one');
},
@@ -131,7 +133,7 @@ async.series({
},
function (err, results) { });
async.series<number>({
async.series<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(null, 1);
@@ -171,7 +173,7 @@ async.parallel([
],
function (err, results) { });
async.parallel<string>([
async.parallel<string,Error>([
function (callback) {
setTimeout(function () {
callback(null, 'one');
@@ -200,7 +202,7 @@ async.parallel({
},
function (err, results) { });
async.parallel<number>({
async.parallel<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(null, 1);
@@ -266,7 +268,7 @@ async.waterfall([
], function (err, result) { });
var q = async.queue<any>(function (task: any, callback) {
var q = async.queue<any,Error>(function (task: any, callback) {
console.log('hello ' + task.name);
callback();
}, 2);
@@ -319,7 +321,7 @@ q.resume();
q.kill();
// tests for strongly typed tasks
var q2 = async.queue<string>(function (task: string, callback) {
var q2 = async.queue<string,Error>(function (task: string, callback) {
console.log('Task: ' + task);
callback();
}, 1);
@@ -382,10 +384,10 @@ async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } }
async.parallel([
function (callback) { },
function (callback: ( err:Error, val:string ) => void ) { },
function (callback) { }
],
function (results) {
function (err:Error,results:Array<string>) {
async.series([
function (callback) { },
function email_link(callback) { }
@@ -435,3 +437,357 @@ async.dir(function (name, callback) {
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(null, 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(null, 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(null, 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(null, val.toString());
}, 500);
}, function(err: Error, results: 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(null, val.toString());
}, 500);
}, function(err: Error, results: 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(null, 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(null, 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(null, [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(null, 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(null, 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(null, item > 2);
}, function(err: Error, result: boolean) {
console.log("async.some/any: done with result", result);
});
+120 -100
View File
@@ -1,24 +1,26 @@
// 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>
// 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>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Dictionary<T> { [key: string]: T; }
interface ErrorCallback { (err?: Error): void; }
interface AsyncResultCallback<T> { (err: Error, result: T): void; }
interface AsyncResultArrayCallback<T> { (err: Error, results: T[]): void; }
interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): void; }
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> { (callback: (err?: Error, result?: T) => void): void; }
interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
interface AsyncForEachOfIterator<T> { (item: T, key: number|string, callback: ErrorCallback): void; }
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncResultCallback<R>): void; }
interface AsyncBooleanIterator<T> { (item: T, callback: (err: string, truthValue: boolean) => void): 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> { (task: T, callback: ErrorCallback): void; }
interface AsyncVoidFunction { (callback: ErrorCallback): void; }
interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
interface AsyncVoidFunction<E> { (callback: ErrorCallback<E>): void; }
interface AsyncQueue<T> {
length(): number;
@@ -26,10 +28,10 @@ interface AsyncQueue<T> {
running(): number;
idle(): boolean;
concurrency: number;
push(task: T, callback?: ErrorCallback): void;
push(task: T[], callback?: ErrorCallback): void;
unshift(task: T, callback?: ErrorCallback): void;
unshift(task: T[], callback?: ErrorCallback): void;
push<E>(task: T, callback?: ErrorCallback<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;
@@ -51,8 +53,8 @@ interface AsyncPriorityQueue<T> {
concurrency: number;
started: boolean;
paused: boolean;
push(task: T, priority: number, callback?: AsyncResultArrayCallback<T>): void;
push(task: T[], priority: number, callback?: AsyncResultArrayCallback<T>): void;
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;
@@ -88,104 +90,122 @@ interface AsyncCargo {
interface Async {
// Collections
each<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOf<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfSeries<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfLimit<T>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapValuesLimit<T, R>(obj: {[name: string]: T}, limit: number, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapValues<T, R>(obj: {[name: string]: T}, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
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: AsyncResultCallback<R[], E>): void;
mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultCallback<R[], E>): void;
mapValuesSeries: typeof async.mapValues;
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
select<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
filterSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
selectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
filterLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
selectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
reject<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
rejectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
rejectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
inject<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
foldl<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
reduceRight<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
foldr<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
detect<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
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;
detectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
findSeries: typeof async.detectSeries;
detectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
findSeries: typeof async.detect;
findLimit: typeof async.detectLimit;
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback?: AsyncResultArrayCallback<T>): any;
some<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
someLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
anyLimit: typeof async.someLimit;
someSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
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;
any<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
every<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
everyLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
all<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
concat<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): any;
concatSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): any;
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>(tasks: AsyncFunction<T>[], callback?: AsyncResultArrayCallback<T>): void;
series<T>(tasks: Dictionary<AsyncFunction<T>>, callback?: AsyncResultObjectCallback<T>): void;
parallel<T>(tasks: Array<AsyncFunction<T>>, callback?: AsyncResultArrayCallback<T>): void;
parallel<T>(tasks: Dictionary<AsyncFunction<T>>, callback?: AsyncResultObjectCallback<T>): void;
parallelLimit<T>(tasks: Array<AsyncFunction<T>>, limit: number, callback?: AsyncResultArrayCallback<T>): void;
parallelLimit<T>(tasks: Dictionary<AsyncFunction<T>>, limit: number, callback?: AsyncResultObjectCallback<T>): void;
whilst(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void;
doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void;
doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
during(test: (testCallback : (error: Error, truth: boolean) => void) => void, fn: AsyncVoidFunction, callback: (err: any) => void): void;
doDuring(fn: AsyncVoidFunction, test: (testCallback: (error: Error, truth: boolean) => void) => void, callback: (err: any) => void): void;
forever(next: (errCallback : (err: Error) => void) => void, errBack: (err: Error) => void) : void;
waterfall(tasks: Function[], callback?: (err: Error, results?: any) => void): void;
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>(worker: AsyncWorker<T>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo;
auto(tasks: any, concurrency?: number, callback?: (error: Error, results: any) => void): void;
autoInject(tasks: any, callback?: (error: Error, results: any) => void): void;
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: (error: Error, results: any) => void): void;
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: (error: Error, results: any) => void): void;
retryable<T>(opts: number | {times: number, interval: number}, task: AsyncFunction<T>): AsyncFunction<T>;
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
queue<T, E>(worker: AsyncWorker<T, 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;
allLimit<T>(arr: T[], limit: number, iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any;
everySeries<T>(arr: T[], iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any
allSeries: typeof async.everySeries;
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)[];
reflect<T>(fn: AsyncFunction<T>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T>(tasks: AsyncFunction<T>[]): ((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>(fn: AsyncFunction<T>, milliseconds: number, info: any): AsyncFunction<T>;
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;
times<T> (n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesSeries<T>(n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesLimit<T>(n: number, limit: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): 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;
transform<T, R>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
race<T>(tasks: (AsyncFunction<T>)[], callback: AsyncResultCallback<T>) : void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
+1 -1
View File
@@ -211,7 +211,7 @@ declare namespace autobahn {
retry_delay_jitter?: number;
url?: string;
protocols?: string[];
onchallenge?: (session: Session, method: string, extra: any) => OnChallengeHandler;
onchallenge?: OnChallengeHandler;
realm?: string;
authmethods?: string[];
authid?: string;
File diff suppressed because it is too large Load Diff
+559
View File
@@ -0,0 +1,559 @@
// Type definitions for automapper-ts
// Project: https://github.com/loedeman/AutoMapper
// Definitions by: Bert Loedeman <https://github.com/loedeman>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module AutoMapperJs {
/**
* AutoMapper implementation, for both creating maps and performing maps. Comparable usage and functionality to the original
* .NET AutoMapper library is the pursuit of this implementation.
*/
class AutoMapper {
/**
* Initializes the mapper with the supplied configuration.
* @param {(config: IConfiguration) => void} Configuration function to call.
*/
initialize(configFunction: (config: IConfiguration) => void): void;
/**
* Create a createMap curry function which expects only a destination key.
* @param {string} sourceKey The map source key.
* @returns {(destinationKey: string) => ICreateMapFluentFunctions}
*/
createMap(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any)) => ICreateMapFluentFunctions;
/**
* Create a mapping profile.
* @param {string} sourceKey The map source key.
* @param {string} destinationKey The map destination key.
* @returns {Core.ICreateMapFluentFunctions}
*/
createMap(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): ICreateMapFluentFunctions;
/**
* Create a map curry function which expects a destination key and a source object.
* @param sourceKey Source key, for instance the source type name.
* @returns {(destinationKey: string, sourceObject: any) => any}
*/
map(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any), sourceObject: any) => any;
/**
* Create a map curry function which expects only a source object.
* @param sourceKey Source key, for instance the source type name.
* @param destinationKey Destination key, for instance the destination type name.
* @returns {(sourceObject: any) => any}
*/
map(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): (sourceObject: any) => any;
/**
* Execute a mapping from the source object to a new destination object with explicit mapping configuration and supplied mapping options (using createMap).
* @param sourceKey Source key, for instance the source type name.
* @param destinationKey Destination key, for instance the destination type name.
* @param sourceObject The source object to map.
* @returns {any} Destination object.
*/
map(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any): any;
/**
* Create a mapAsync curry function which expects a destination key, a source object and a callback function.
* @param sourceKey Source key, for instance the source type name.
* @returns {(destinationKey: string, sourceObject: any, callback: IMapCallback) => void}
*/
mapAsync(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any), sourceObject: any, callback: IMapCallback) => void;
/**
* Create a map curry function which expects only a source object and a callback function.
* @param sourceKey Source key, for instance the source type name.
* @param destinationKey Destination key, for instance the destination type name.
* @param sourceObject The source object to map.
* @returns {(callback: IMapCallback) => void}
*/
mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any): (callback: IMapCallback) => void;
/**
* Create a map curry function which expects only a source object and a callback function.
* @param sourceKey Source key, for instance the source type name.
* @param destinationKey Destination key, for instance the destination type name.
* @returns {(sourceObject: any, callback: IMapCallback) => void}
*/
mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): (sourceObject: any, callback: IMapCallback) => void;
/**
* Execute an asynchronous mapping from the source object to a new destination object with explicit mapping configuration and supplied mapping options (using createMap).
* @param sourceKey Source key, for instance the source type name.
* @param destinationKey Destination key, for instance the destination type name.
* @param sourceObject The source object to map.
* @param {IMapCallback} callback The callback to call when asynchronous mapping is complete.
*/
mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any, callback: IMapCallback): void;
/**
* Validates mapping configuration by dry-running. Since JS does not
* fully support typing, it only checks if properties match on both
* sides. The function needs IMapping.sourceTypeClass and
* IMapping.destinationTypeClass to function.
* @param {boolean} strictMode Whether or not to fail when properties
* sourceTypeClass or destinationTypeClass
* are unavailable.
*/
assertConfigurationIsValid(strictMode?: boolean): void;
}
class AsyncAutoMapper {
/* For Test Purposes Only */
}
/**
* Converts source type to destination type instead of normal member mapping
*/
class TypeConverter implements ITypeConverter {
/**
* Performs conversion from source to destination type.
* @param {IResolutionContext} resolutionContext Resolution context.
* @returns {any} Destination object.
*/
convert(resolutionContext: IResolutionContext): any;
}
export class Profile implements IProfile {
/** Profile name */
public profileName: string;
/** Naming convention for source members */
public sourceMemberNamingConvention: INamingConvention;
/** Naming convention for destination members */
public destinationMemberNamingConvention: INamingConvention;
/**
* Create a createMap curry function which expects only a destination key.
* @param {string} sourceKey The map source key.
* @returns {(destinationKey: string) => ICreateMapFluentFunctions}
*/
protected createMap(sourceKey: string): (destinationKey: string) => ICreateMapFluentFunctions;
/**
* Create a mapping profile.
* @param {string} sourceKey The map source key.
* @param {string} destinationKey The map destination key.
* @returns {Core.ICreateMapFluentFunctions}
*/
protected createMap(sourceKey: string, destinationKey: string): ICreateMapFluentFunctions;
/**
* Implement this method in a derived class and call the CreateMap method to associate that map with this profile.
* Avoid calling the AutoMapper class / automapper instance from this method.
*/
public configure(): void;
}
/**
* Defines the PascalCase naming convention strategy.
*/
class PascalCaseNamingConvention implements INamingConvention {
/** Regular expression on how to tokenize a member. */
splittingExpression: RegExp;
/** Character to separate on. */
separatorCharacter: string;
/**
* Transformation function called when this convention is the destination naming convention.
* @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts.
* @returns {string} Destination property name
*/
transformPropertyName(sourcePropertyNameParts: string[]): string;
}
/**
* Defines the camelCase naming convention strategy.
*/
class CamelCaseNamingConvention implements INamingConvention {
/** Regular expression on how to tokenize a member. */
splittingExpression: RegExp;
/** Character to separate on. */
separatorCharacter: string;
/**
* Transformation function called when this convention is the destination naming convention.
* @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts.
* @returns {string} Destination property name
*/
transformPropertyName(sourcePropertyNameParts: string[]): string;
}
interface IProperty {
name: string;
metadata: IPropertyMetadata;
level: number;
sourceMapping: boolean;
ignore: boolean;
async: boolean;
children?: IProperty[];
destinations?: IProperty[];
conversionValuesAndFunctions: any[];
conditionFunction?: (sourceObject: any) => boolean;
}
interface IPropertyMetadata {
mapping: IMapping;
root: IProperty;
parent: IProperty;
destinations: {[name: string]: IPropertyDestinationMetadata};
destinationCount: number;
}
interface IPropertyDestinationMetadata {
source: IProperty;
destination: IProperty;
}
interface IMemberMappingMetaData {
destination: string;
source: string;
sourceMapping: boolean;
ignore: boolean;
async: boolean;
condition: (sourceObject: any) => boolean;
}
/**
* Member mapping properties.
*/
interface IForMemberMapping {
/** The source member property name. */
sourceProperty: string;
/** The destination member property name parts for nested property support (e.g. 'type.name'). */
destinationProperty: string;
/** Source or destination mapping. */
sourceMapping: boolean;
/** All mapping values and/or functions resulting from stacked for(Source)Member calls. */
mappingValuesAndFunctions: Array<any>;
/** Whether or not this destination property must be ignored. */
ignore: boolean;
/** Whether or not this member mapping has an asynchronous mapping function. */
async: boolean;
/**
* The object will only be mapped when the condition is met.
* @param {any} sourceObject The source object to check.
* @returns {boolean}
*/
conditionFunction: (sourceObject: any) => boolean;
}
/**
* Interface for returning an object with available 'sub' functions to enable method chaining (e.g. automapper.createMap().forMember().forMember() ...)
*/
interface ICreateMapFluentFunctions {
/**
* Customize configuration for an individual destination member.
* @param sourceProperty The destination member property name.
* @param valueOrFunction The value or function to use for this individual member.
* @returns {IAutoMapperCreateMapChainingFunctions}
*/
forMember: (sourceProperty: string, valueOrFunction: any |
((opts: IMemberConfigurationOptions) => any) |
((opts: IMemberConfigurationOptions, cb: IMemberCallback) => void)) => ICreateMapFluentFunctions;
/**
* Customize configuration for an individual source member.
* @param sourceProperty The source member property name.
* @param sourceMemberConfigFunction The function to use for this individual member.
* @returns {IAutoMapperCreateMapChainingFunctions}
*/
forSourceMember: (sourceProperty: string,
sourceMemberConfigFunction: ((opts: ISourceMemberConfigurationOptions) => any) |
((opts: ISourceMemberConfigurationOptions, cb: IMemberCallback) => void)
) => ICreateMapFluentFunctions;
/**
* Customize configuration for all destination members.
* @param func The function to use for this individual member.
* @returns {IAutoMapperCreateMapChainingFunctions}
*/
forAllMembers: (func: (destinationObject: any, destinationPropertyName: string, value: any) => void) => ICreateMapFluentFunctions;
/**
* Ignore all members not specified explicitly.
*/
ignoreAllNonExisting: () => ICreateMapFluentFunctions;
/**
* Skip normal member mapping and convert using a custom type converter (instantiated during mapping).
* @param typeConverterClassOrFunction The converter class or function to use when converting.
*/
convertUsing: (typeConverterClassOrFunction: ((resolutionContext: IResolutionContext) => any) |
((resolutionContext: IResolutionContext, callback: IMapCallback) => void) |
ITypeConverter |
(new() => ITypeConverter)
) => void;
/**
* Specify to which class type AutoMapper should convert. When specified, AutoMapper will create an instance of the given type, instead of returning a new object literal.
* @param typeClass The destination type class.
* @returns {IAutoMapperCreateMapChainingFunctions}
*/
convertToType: (typeClass: new () => any) => ICreateMapFluentFunctions;
/**
* Specify which profile should be used when mapping.
* @param {string} profileName The profile name.
* @returns {IAutoMapperCreateMapChainingFunctions}
*/
withProfile: (profileName: string) => void;
}
/**
* The mapping configuration for the current mapping keys/types.
*/
interface IMapping {
/** The mapping source key. */
sourceKey: string;
/** The mapping destination key. */
destinationKey: string;
/** The mappings for forAllMembers functions. */
forAllMemberMappings: Array<(destinationObject: any, destinationPropertyName: string, value: any) => void>;
properties: IProperty[];
/**
* Skip normal member mapping and convert using a type converter.
* @param resolutionContext Context information regarding resolution of a destination value
* @returns {any} Destination object.
*/
typeConverterFunction: ((resolutionContext: IResolutionContext) => any) |
((resolutionContext: IResolutionContext, callback: IMapCallback) => void);
/** The source type class to convert from. */
sourceTypeClass: any;
/** The destination type class to convert to. */
destinationTypeClass: any;
/** The profile used when mapping. */
profile?: IProfile;
/** Whether or not to ignore all properties not specified using createMap. */
ignoreAllNonExisting?: boolean;
/** Whether or not an mapping has to be asynchronous. */
async: boolean;
/*
* PERFORMANCE ENHANCEMENTS
*/
/**
* Item mapping function to use.
*/
mapItemFunction: IMapItemFunction | IAsyncMapItemFunction;
}
// export interface IMappingMapOptimized extends IMapping {
// final: boolean;
// forMemberMappingsArray: Array<IForMemberMapping>;
// }
/**
* Context information regarding resolution of a destination value
*/
export interface IResolutionContext {
/** Source value */
sourceValue: any;
/** Destination value */
destinationValue: any;
/** Source property name */
sourcePropertyName?: string;
/** Destination property name */
destinationPropertyName?: string;
/** Index of current collection mapping */
arrayIndex?: number;
}
/**
* Configuration options for forMember mapping function.
*/
interface IMemberConfigurationOptions {
/**
* Map from a custom source property name.
* @param sourcePropertyName The source property to map.
*/
mapFrom: (sourcePropertyName: string) => void;
/**
* When this configuration function is used, the (destination) property is ignored
* when mapping.
*/
ignore?: () => void;
/**
* If specified, the property will only be mapped when the condition is fulfilled.
*/
condition: (predicate: ((sourceObject: any) => boolean)) => void;
/** The source object to map. */
sourceObject: any;
/** The source property to map. */
sourcePropertyName: string;
/**
* The intermediate destination property value, used for stacking multiple for(Source)Member calls
* while elaborating the intermediate result.
*/
intermediatePropertyValue: any;
}
/**
* Configuration options for forSourceMember mapping function.
*/
interface ISourceMemberConfigurationOptions {
/**
* When this configuration function is used, the source property is ignored
* when mapping.
*/
ignore: () => void;
}
/**
* Member callback interface
*/
interface IMemberCallback {
/**
* Callback function to call when the async operation is executed.
* @param {any} callbackValue Callback value to be used as output for the for(Source)Member call.
*/
(callbackValue: any): void;
}
/**
* Member callback interface
*/
interface IMapCallback {
/**
* Callback function to call when the async operation is executed.
* @param {any} result Callback value to be used as output for the mapAsync call.
*/
(result: any): void;
}
/**
* Converts source type to destination type instead of normal member mapping
*/
export interface ITypeConverter {
/**
* Performs conversion from source to destination type.
* @param {IResolutionContext} resolutionContext Resolution context.
* @returns {any} Destination object.
*/
convert: (resolutionContext: IResolutionContext) => any;
}
/**
* Defines a naming convention strategy.
*/
export interface INamingConvention {
/** Regular expression on how to tokenize a member. */
splittingExpression: RegExp;
/** Character to separate on. */
separatorCharacter: string;
/**
* Transformation function called when this convention is the destination naming convention.
* @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts.
* @returns {string} Destination property name
*/
transformPropertyName: (sourcePropertyNameParts: string[]) => string;
}
/**
* Configuration for profile-specific maps.
*/
export interface IConfiguration {
/**
* Add an existing profile
* @param profile {IProfile} Profile to add.
*/
addProfile(profile: IProfile): void;
/**
* Create a createMap curry function which expects only a destination key.
* @param {string} sourceKey The map source key.
* @returns {(destinationKey: string) => IAutoMapperCreateMapChainingFunctions}
*/
createMap?(sourceKey: string): (destinationKey: string) => ICreateMapFluentFunctions;
/**
* Create a mapping profile.
* @param {string} sourceKey The map source key.
* @param {string} destinationKey The map destination key.
* @returns {Core.IAutoMapperCreateMapChainingFunctions}
*/
createMap?(sourceKey: string, destinationKey: string): ICreateMapFluentFunctions;
}
/**
* Provides a named configuration for maps. Naming conventions become scoped per profile.
*/
export interface IProfile {
/** Profile name */
profileName: string;
/** Naming convention for source members */
sourceMemberNamingConvention: INamingConvention;
/** Naming convention for destination members */
destinationMemberNamingConvention: INamingConvention;
/**
* Implement this method in a derived class and call the CreateMap method to associate that map with this profile.
* Avoid calling the AutoMapper class / automapper instance from this method.
*/
configure: () => void;
}
export interface IMapItemFunction {
(mapping: IMapping, sourceObject: any, destinationObject: any): any;
}
export interface IAsyncMapItemFunction {
(mapping: IMapping, sourceObject: any, destinationObject: any, callback: IMapCallback): void;
}
interface ICreateMapParameters {
mapping: IMapping;
destinationProperty: string;
conversionValueOrFunction: any;
sourceMapping: boolean;
fluentFunctions: ICreateMapFluentFunctions;
}
interface IGetOrCreatePropertyParameters {
propertyNameParts: string[];
mapping: IMapping;
parent?: IProperty;
propertyArray: IProperty[];
destination?: string;
sourceMapping: boolean;
}
interface ICreatePropertyParameters {
name: string;
mapping: IMapping;
parent: IProperty;
propertyArray: IProperty[];
sourceMapping: boolean;
}
}
declare var automapper: AutoMapperJs.AutoMapper;
+57
View File
@@ -0,0 +1,57 @@
/// <reference path="awesomplete.d.ts" />
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
@@ -0,0 +1,49 @@
// 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;
}
+17 -7
View File
@@ -2,13 +2,13 @@
import lambda = require('aws-lambda');
var str: string;
var date: Date;
var anyObj: any;
var num: number;
var str: string = "any string";
var date: Date = new Date();
var anyObj: any = { abc: 123 };
var num: number = 5;
var identity: lambda.CognitoIdentity;
var error: Error;
var b: boolean;
var error: Error = new Error();
var b: boolean = true;
var clientCtx: lambda.ClientContext;
/* Context */
@@ -37,4 +37,14 @@ function callback(cb: lambda.Callback) {
cb(null);
cb(error);
cb(null, anyObj);
}
}
/* 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);
+3 -1
View File
@@ -23,7 +23,9 @@ declare module "aws-lambda" {
getRemainingTimeInMillis(): number;
// Functions for compatibility with earlier Node.js Runtime v0.10.42
log(message: string, object: any): void;
// 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;
+60 -3
View File
@@ -22,6 +22,27 @@ declare module "aws-sdk" {
constructor(profile: string);
}
export module CognitoIdentity {
export interface CognitoIdentityCredentialsParams {
IdentityPoolId?: string;
AccountId?: string;
Logins?: {[k: string]: any};
RoleArn?: string;
RoleSessionName?: string;
WebIdentityToken?: string;
ProviderId?: string;
Policy?: string;
DurationSeconds?: number;
IdentityId?: string;
}
}
export class CognitoIdentityCredentials extends Credentials {
constructor(params: CognitoIdentity.CognitoIdentityCredentialsParams);
}
export interface Logger {
write?: (chunk: any, encoding?: string, callback?: () => void) => void;
log?: (...messages: any[]) => void;
@@ -361,7 +382,8 @@ declare module "aws-sdk" {
endpoint: Endpoint;
getObject(params: s3.GetObjectRequest, callback?: (err: Error, data: any) => void): any;
putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void;
putObject(params: s3.PutObjectRequest, callback?: (err: Error, data: any) => void): any;
copyObject(params: s3.CopyObjectRequest, callback?: (err: Error, data: any) => void): any;
deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void;
headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void;
getSignedUrl(operation: string, params: any): string;
@@ -506,7 +528,8 @@ declare module "aws-sdk" {
interface UpdateParam extends _DDBDC_Writer {
Key: _DDBDC_Keys;
AttributeUpdates: {
UpdateExpression?: string;
AttributeUpdates?: {
[someKey: string]: {
Action: "PUT" | "ADD" | "DELETE";
Value: any
@@ -637,7 +660,7 @@ declare module "aws-sdk" {
export interface DescribeStackResourcesParams {
StackName?: string; // must specify either StackName or PhysicalResourceId
LogicalResourceId?: string;
LogicalResourceId?: string;
PhysicalResourceId?: string; // must specify either StackName or PhysicalResourceId
}
@@ -2241,6 +2264,40 @@ declare module "aws-sdk" {
WebsiteRedirectLocation?: string;
}
export interface CopyObjectRequest {
Bucket: string;
CopySource: string;
Key: string;
ACL?: string;
CacheControl?: string;
ContentDisposition?: string;
ContentEncoding?: string;
ContentLanguage?: string;
ContentType?: string;
CopySourceIfMatch?: string;
CopySourceIfModifiedSince?: any;
CopySourceIfNoneMatch?: string;
CopySourceIfUnmodifiedSince?: any;
CopySourceSSECustomerAlgorithm?: string;
CopySourceSSECustomerKey?: any;
CopySourceSSECustomerKeyMD5?: string;
Expires?: any;
GrantFullControl?: string;
GrantRead?: string;
GrantReadACP?: string;
GrantWriteACP?: string;
Metadata?: { [key: string]: string; };
MetadataDirective?: string;
RequestPayer?: string;
SSECustomerAlgorithm?: string;
SSECustomerKey?: any;
SSECustomerKeyMD5?: string;
SSEKMSKeyId?: string;
ServerSideEncryption?: string;
StorageClass?: string;
WebsiteRedirectLocation?: string;
}
export interface GetObjectRequest {
Bucket: string;
IfMatch?: string;
@@ -0,0 +1,29 @@
/// <reference path="./aws-serverless-express.d.ts" />
/// <reference path="../express/express.d.ts"/>
import * as awsServerlessExpress from 'aws-serverless-express';
import * as express from 'express';
const app = express();
const server = awsServerlessExpress.createServer(app, () => {});
const mockEvent = {
key: 'value'
};
const mockContext = {
callbackWaitsForEmptyEventLoop: true,
functionName: 'testFunction',
functionVersion: '1',
invokedFunctionArn: 'arn',
memoryLimitInMB: 128,
awsRequestId: 'id',
logGroupName: 'group',
logStreamName: 'stream',
getRemainingTimeInMillis: () => 2000,
done: () => false,
fail: (error: any) => false,
succeed: (message: string) => false
};
awsServerlessExpress.proxy(server, mockEvent, mockContext);
+24
View File
@@ -0,0 +1,24 @@
// 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 path="../node/node.d.ts"/>
/// <reference path="../aws-lambda/aws-lambda.d.ts"/>
declare module 'aws-serverless-express' {
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;
}
+4
View File
@@ -69,6 +69,10 @@ axios.post("http://example.com/", {
]
});
var config: Axios.AxiosXHRConfigBase<any> = {headers: {}};
config.headers['X-Custom-Header'] = 'baz';
axios.post("http://example.com/", config);
var getRepoIssue = axios.get<Issue>("https://api.github.com/repos/mzabriskie/axios/issues/1");
var axiosInstance = axios.create({
+1 -1
View File
@@ -39,7 +39,7 @@ declare namespace Axios {
/**
* custom headers to be sent
*/
headers?: Object;
headers?: {[key: string]: any};
/**
* URL parameters to be sent with the request
+1 -1
View File
@@ -346,7 +346,7 @@ declare module "babel-traverse" {
getData(key: string, def?: any): any;
buildCodeFrameError(msg: string, Error: Error): Error;
buildCodeFrameError<TError extends Error>(msg: string, Error?: new (msg: string) => TError): TError;
traverse(visitor: Visitor, state?: any): void;
+38 -30
View File
@@ -329,32 +329,32 @@ var CORE_PARSER_TESTS: ParserTest[] = [
}
},
// {
// description: "Comment with non-default character",
// input: 'a,b,c\n!Comment goes here\nd,e,f',
// config: { comments: '!' },
// expected: {
// data: [['a', 'b', 'c'], ['d', 'e', 'f']],
// errors: []
// }
// description: "Comment with non-default character",
// input: 'a,b,c\n!Comment goes here\nd,e,f',
// config: { comments: '!' },
// expected: {
// data: [['a', 'b', 'c'], ['d', 'e', 'f']],
// errors: []
// }
// },
// {
// description: "Bad comments value specified",
// notes: "Should silently disable comment parsing",
// input: 'a,b,c\n5comment\nd,e,f',
// config: { comments: 5 },
// expected: {
// data: [['a', 'b', 'c'], ['5comment'], ['d', 'e', 'f']],
// errors: []
// }
// description: "Bad comments value specified",
// notes: "Should silently disable comment parsing",
// input: 'a,b,c\n5comment\nd,e,f',
// config: { comments: 5 },
// expected: {
// data: [['a', 'b', 'c'], ['5comment'], ['d', 'e', 'f']],
// errors: []
// }
// },
// {
// description: "Multi-character comment string",
// input: 'a,b,c\n=N(Comment)\nd,e,f',
// config: { comments: "=N(" },
// expected: {
// data: [['a', 'b', 'c'], ['d', 'e', 'f']],
// errors: []
// }
// description: "Multi-character comment string",
// input: 'a,b,c\n=N(Comment)\nd,e,f',
// config: { comments: "=N(" },
// expected: {
// data: [['a', 'b', 'c'], ['d', 'e', 'f']],
// errors: []
// }
// },
{
description: "Input with only a commented line",
@@ -419,13 +419,13 @@ var CORE_PARSER_TESTS: ParserTest[] = [
}
},
// {
// description: "Fast mode with comments",
// input: '// Commented line\na,b,c',
// config: { fastMode: true, comments: "//" },
// expected: {
// data: [['a', 'b', 'c']],
// errors: []
// }
// description: "Fast mode with comments",
// input: '// Commented line\na,b,c',
// config: { fastMode: true, comments: "//" },
// expected: {
// data: [['a', 'b', 'c']],
// errors: []
// }
// },
{
description: "Fast mode with preview",
@@ -1091,7 +1091,7 @@ function compare(actualData: any[], actualErrors: any[], expected: ParserTestExp
}
}
if (passed) // final check will catch any other differences
if (passed) // final check will catch any other differences
passed = JSON.stringify(actual) == JSON.stringify(expected);
// We pass back an object right now, even though it only contains
@@ -1228,3 +1228,11 @@ var parser = new Baby.Parser({})
parser.getCharIndex();
parser.abort();
parser.parse("");
/**
* Parse Files
*/
Baby.parseFiles('example.csv')
Baby.parseFiles('example.csv', {encoding: 'utf-8'})
Baby.parseFiles(['example1.csv', 'example2.txt'])
Baby.parseFiles(['example1.csv', 'example2.txt'], {encoding: 'utf-8'})
+10
View File
@@ -9,6 +9,11 @@ declare namespace BabyParse {
* Parse a csv string or a csv file
*/
parse(csvString: string, config?: ParseConfig): ParseResult;
/**
* Parse single file or multiple files
*/
parseFiles(input: string | string[] | FileObject | FileObject[], config?: ParseConfig): ParseResult;
/**
* Unparses javascript data objects and returns a csv string
@@ -86,6 +91,11 @@ declare namespace BabyParse {
data: string | Array<any>;
}
interface FileObject {
file: string
config?: ParseConfig
}
interface ParseError {
type: string; // A generalization of the error
code: string; // Standardized error code
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="./bases.d.ts" />
import * as bases from 'bases';
let bs16String: string = bases.toBase(200, 16); // => 'c8'
let bs62String: string = bases.toBase(99999, 62); // => 'q0T'
let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba'
let frombs16Int: number = bases.fromBase('c8', 16); // => 200
let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999
let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for bases 0.2.1
// Project: https://github.com/aseemk/bases.js
// Definitions by: Hari Krishna <https://github.com/harikv>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "bases" {
export function toAlphabet(num: number, alphabet: string): string;
export function fromAlphabet(str: string, alphabet: string): number;
export function toBase(num: number, base: number): string;
export function fromBase(str: string, base:number): number;
export let KNOWN_ALPHABETS: any;
export let NUMERALS: string;
export let LETTERS_LOWERCASE: string;
export let LETTERS_UPPERCASE: string;
}
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="bit-array.d.ts" />
import BitArray = require("bit-array");
const a = new BitArray(32);
a.set(0, true);
a.set(31, true);
a.toString(); // "10000000000000000000000000000001"
a.get(1); // false
a.get(31); // true
+1
View File
@@ -0,0 +1 @@
--noImplicitAny --module commonjs
+105
View File
@@ -0,0 +1,105 @@
// Type definitions for bit-array v0.2.2
// Project: https://github.com/bramstein/bit-array
// Definitions by: Mudkip <https://github.com/mudkipme>
// Definitions: https://github.com/mudkipme/DefinitelyTyped
declare module "bit-array" {
class BitArray {
/**
* Creates a new empty BitArray with the given length or initialises the BitArray with the given hex representation.
*/
constructor(size: number, hex?: string);
/**
* Returns the total number of bits in this BitArray.
*/
size(): number;
/**
* Sets the bit at index to a value (boolean.)
*/
set(index: number, value: boolean): BitArray;
/**
* Toggles the bit at index. If the bit is on, it is turned off. Likewise, if the bit is off it is turned on.
*/
toggle(index: number): BitArray;
/**
* Returns the value of the bit at index (boolean.)
*/
get(index: number): boolean;
/**
* Resets the BitArray so that it is empty and can be re-used.
*/
reset(): BitArray;
/**
* Returns a copy of this BitArray.
*/
copy(): BitArray;
/**
* Returns true if this BitArray equals another. Two BitArrays are considered
* equal if both have the same length and bit pattern.
*/
equals(x: BitArray): boolean;
/**
* Returns the JSON representation of this BitArray.
*/
toJSON(): string;
/**
* Returns a string representation of the BitArray with bits
* in mathemetical order.
*/
toBinaryString(): string;
/**
* Returns a hexadecimal string representation of the BitArray
* with bits in logical order.
*/
toHexString(): string;
/**
* Returns a string representation of the BitArray with bits
* in logical order.
*/
toString(): string;
/**
* Convert the BitArray to an Array of boolean values (slow).
*/
toArray(): boolean[];
/**
* Returns the total number of bits set to one in this BitArray.
*/
count(): number;
/**
* Inverts this BitArray.
*/
not(): BitArray;
/**
* Bitwise OR on the values of this BitArray using BitArray x.
*/
or(x: BitArray): BitArray;
/**
* Bitwise AND on the values of this BitArray using BitArray x.
*/
and(x: BitArray): BitArray;
/**
* Bitwise XOR on the values of this BitArray using BitArray x.
*/
xor(x: BitArray): BitArray;
}
export = BitArray;
}
+23
View File
@@ -338,6 +338,29 @@ fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{
class CustomError extends Error {
public customField: number;
}
fooProm = fooProm.catch(CustomError, reason => {
let a: number = reason.customField
})
}
{
class CustomErrorWithConstructor extends Error {
constructor(public arg1: boolean, public arg2: number) {
super();
};
}
fooProm = fooProm.catch(CustomErrorWithConstructor, reason => {
let a: boolean = reason.arg1;
let b: number = reason.arg2;
})
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
barProm = fooProm.error((reason: any) => {
return bar;
});
+16 -4
View File
@@ -71,14 +71,19 @@ class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R> {
*/
catch(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
@@ -317,6 +322,13 @@ class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R> {
*/
cancel(): void;
/**
* Basically sugar for doing: somePromise.catch(function(){});
*
* Which is needed in case error handlers are attached asynchronously to the promise later, which would otherwise result in premature unhandled rejection reporting.
*/
suppressUnhandledRejections(): void;
/**
* Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise.
*
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="bonjour.d.ts" />
import * as bonjour from 'bonjour';
var bonjourOptions: bonjour.BonjourOptions;
var bonjourInstance: bonjour.Bonjour;
var serviceOptions: bonjour.ServiceOptions;
var service: bonjour.Service;
var browserOptions: bonjour.BrowserOptions;
var browser: bonjour.Browser;
bonjourOptions = { interface: '192.168.1.1', port: 5353 };
bonjourInstance = new bonjour.Bonjour(bonjourOptions);
serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 };
service = bonjourInstance.publish(serviceOptions);
browserOptions = { protocol: 'tcp', type: 'http' };
browser = bonjour.find(browserOptions);
+71
View File
@@ -0,0 +1,71 @@
// Type definitions for bonjour v3.5.0
// Project: https://github.com/watson/bonjour
// Definitions by: Quentin Lampin <https://github.com/quentin-ol/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "bonjour" {
export interface BonjourOptions {
multicast?: boolean;
interface?: string;
port?: number;
ip?: string;
ttl?: number;
loopback?: boolean;
reuseAddr?: boolean;
}
export interface BrowserOptions {
type?: string;
subtypes?: string[];
protocol?: string;
txt?: Object;
}
export interface ServiceOptions {
name: string;
host?: string;
port: number;
type: string;
subtypes?: string[];
protocol?: 'udp'|'tcp';
txt?: Object;
}
export interface Service {
name: string;
type: string;
subtypes: string[];
protocol: string;
host: string;
port: number;
fqdn: string;
rawTxt: Object;
txt: Object;
published: boolean;
stop: (cb: ()=>any) => void;
start: () => void;
}
export class Bonjour {
constructor(opts: BonjourOptions);
publish(options: ServiceOptions):Service;
unpublishAll(cb: ()=>any): void;
find(options:BrowserOptions, onUp: ()=>any): Browser;
findOne(options:any, cb: (service: Service)=>any): Browser;
destroy():void;
}
export class Browser {
services: Service[];
start():void;
update():void;
stop():void;
}
export function find(options: BrowserOptions, onUp?: ()=>any): Browser;
export function findOne(options: BrowserOptions): Browser;
}
+6
View File
@@ -71,6 +71,12 @@ class Tag extends bookshelf.Model<Tag> {
get tableName() { return 'tags'; }
}
User.where<User>('id', 1).fetch({withRelated: ['posts.tags']}).then(function(user) {
console.log(user.related('posts').toJSON());
}).catch(function(err) {
console.error(err);
});
new User().where('id', 1).fetch({withRelated: ['posts.tags']})
.then(user => {
const posts = user.related<Post>('posts');
+2
View File
@@ -93,6 +93,8 @@ declare module 'bookshelf' {
static fetchAll<T extends Model<any>>() : Promise<Collection<T>>;
/** @deprecated should use `new` objects instead. */
static forge<T>(attributes? : any, options? : ModelOptions) : T;
static where<T>(properties: { [key: string]: any }): T;
static where<T>(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T;
belongsTo<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
belongsToMany<R extends Model<any>>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection<R>;
+1
View File
@@ -40,6 +40,7 @@ interface BootboxConfirmOptions extends BootboxDialogOptions {
interface BootboxPromptOptions extends BootboxBaseOptions {
title: string;
value?: string;
inputType?: string;
callback: (result: string) => any;
buttons?: BootboxConfirmPromptButtonMap;
}
+1
View File
@@ -36,6 +36,7 @@ interface DatepickerOptions {
multidateSeparator?: string;
orientation?: string;
assumeNearbyYear?: any;
viewMode?: string;
}
interface DatepickerCustomFormatOptions {
+5 -2
View File
@@ -36,7 +36,10 @@ interface NotifySettings {
from?: string;
align?: string;
};
offset?: number;
offset?: number | {
x?: number;
y?: number;
};
spacing?: number;
z_index?: number;
delay?: number;
@@ -59,4 +62,4 @@ interface NotifyReturn {
$ele: JQueryStatic;
close: () => void;
update: (command: string, update: any) => void;
}
}
@@ -0,0 +1,43 @@
// Bootstrap Select Test
// ================================================================================
/// <reference path="bootstrap-select.d.ts" />
/// <reference path="../jquery/jquery.d.ts"/>
$(".selectpicker").selectpicker({
actionsBox: true,
container: "body",
countSelectedText: "counts > #",
deselectAllText: "test",
dropdownAlignRight: true,
dropupAuto: true,
header: "test",
hideDisabled: true,
iconBase: "fa",
liveSearch: true,
liveSearchNormalize: true,
liveSearchPlaceholder: "test",
liveSearchStyle: "contains",
maxOptions: 10,
maxOptionsText: "test",
mobile: true,
multipleSeparator: ", ",
noneSelectedText: "test",
selectAllText: "test",
selectedTextFormat: "values",
selectOnTab: true,
showContent: true,
showIcon: true,
showSubtext: true,
showTick: true,
size: "auto",
style: "test",
tickIcon: "test",
title: "test",
width: "auto"
})
$(".selectpicker").selectpicker("val", "foo")
$(".selectpicker").selectpicker("val", ["foo", "bar"])
$(".selectpicker").selectpicker("selectAll")
$(".selectpicker").selectpicker("setStyle", "btn-large", "add")
+44
View File
@@ -0,0 +1,44 @@
// Type definitions for bootstrap-select v1.11.2
// Project: https://silviomoreto.github.io/bootstrap-select/
// Definitions by: Karol Janyst <https://github.com/LKay>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface BootstrapSelectOptions {
actionsBox?: boolean
container?: string | boolean
countSelectedText?: string | Function
deselectAllText?: string
dropdownAlignRight?: string | boolean
dropupAuto?: boolean
header?: string
hideDisabled?: boolean
iconBase?: string
liveSearch?: boolean
liveSearchNormalize?: boolean
liveSearchPlaceholder?: string
liveSearchStyle?: string
maxOptions?: number | boolean
maxOptionsText?: string | Array<any> | Function
mobile?: boolean
multipleSeparator?: string
noneSelectedText?: string
selectAllText?: string
selectedTextFormat?: string
selectOnTab?: boolean
showContent?: boolean
showIcon?: boolean
showSubtext?: boolean
showTick?: boolean
size?: string | number | boolean
style?: string
tickIcon?: string
title?: string
width?: string | boolean
}
interface JQuery {
selectpicker(opts?: BootstrapSelectOptions): void
selectpicker(method: string, ...args: Array<string | Array<string>>): void
}
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for Bootstrap Table v1.11.0
// Project: http://bootstrap-table.wenzhixin.net.cn/
// Definitions by: Talat Baig <https://github.com/talatbaig/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
interface JQuery {
bootstrapTable(options?: any): JQuery;
}
declare var bootstrapTable: JQueryStatic;
+11 -3
View File
@@ -50,10 +50,18 @@ braintree.client.create({
selector: '#card-number'
},
cvv: {
selector: '#cvv'
selector: '#cvv',
type: 'password'
},
expirationDate: {
selector: '#expiration-date'
expirationMonth: {
selector: '#expiration-month',
select: {
options: ["01 - Jan", "02 - Feb", "03 - Mar", "04 - Apr", "05 - May", "06 - Jun", "07 - Jul", "08 - Aug", "09 - Sep", "10 - Oct", "11 - Nov", "12 - Dec"]
}
},
expirationYear: {
selector: '#expiration-year',
select: true
}
}
}, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) {
+7 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Braintree-web v3.0.2
// Type definitions for Braintree-web v3.5.0
// Project: https://github.com/braintree/braintree-web
// Definitions by: Guy Shahine <https://github.com/chlela>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -540,12 +540,17 @@ declare namespace BraintreeWeb {
* @typedef {object} field
* @property {string} selector A CSS selector to find the container where the hosted field will be inserted.
* @property {string} [placeholder] Will be used as the `placeholder` attribute of the input. If `placeholder` is not natively supported by the browser, it will be polyfilled.
* @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field. Note: Input formatting does not work properly on Android and iOS, so input formatting is automatically disabled on those browsers.
* @property {string} [type] Will be used as the `type` attribute of the input. To mask `cvv` input, for instance, `type: "password"` can be used.
* @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field.
* @property {object|boolean} [select] If truthy, this field becomes a `<select>` dropdown list. This can only be used for `expirationMonth` and `expirationYear` fields.
* @property {string[]} [select.options] An array of 12 strings, one per month. This can only be used for the `expirationMonth` field. For example, the array can look like `['01 - January', '02 - February', ...]`.
*/
interface HostedFieldsField {
selector: string;
placeholder?: string;
type?: string;
formatInput?: boolean;
select?: boolean | { options: string[] };
}
/**
+2 -2
View File
@@ -288,11 +288,11 @@ declare module "browser-sync" {
middleware?: MiddlewareHandler;
ws: boolean;
reqHeaders: (config: any) => Hash<any>;
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
proxyRes: (res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any;
}
interface MiddlewareHandler {
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
(req: http.IncomingMessage, res: http.ServerResponse, next: Function): any;
}
interface PerRouteMiddleware {
+1 -1
View File
@@ -104,7 +104,7 @@ declare module 'bufferstream/postbuffer' {
http client buffer
*/
constructor(req: http.ServerRequest);
constructor(req: http.IncomingMessage);
/*
set a callback to get all post data from a http server request
*/
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for bull 0.7.0
// Type definitions for bull 1.0.0
// Project: https://github.com/OptimalBits/bull
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -24,7 +24,7 @@ declare module "bull" {
export interface Job {
id: string
jobId: string
/**
* The custom data passed when the job was created
+41
View File
@@ -0,0 +1,41 @@
/// <reference path="bunyan-config.d.ts"/>
import * as bunyan from "bunyan";
import bunyanConfig = require("bunyan-config");
var jsonConfig = {
name: "myLogger",
streams: [{
stream: "stdout"
}, {
stream: { name: "stderr" }
}, {
type: "raw",
stream: {
name: "bunyan-logstash",
params: {
host: "localhost",
port: 5005
}
}
}, {
type: "raw",
stream: {
name: "bunyan-redis",
params: {
host: "localhost",
port: 6379
}
}
}], serializers: {
req: "bunyan:stdSerializers.req",
fromNodeModules: "someNodeModule",
fromNodeModulesWithProps: "someNodeModule:a.b.c",
custom: "./lib/customSerializers:custom",
another: "./lib/anotherSerializer",
absolutePath: "/path/to/serializer:xyz"
}
};
var config = bunyanConfig(jsonConfig);
var logger = require("bunyan").createLogger(bunyanConfig);
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for bunyan-config 0.2.0
// Project: https://github.com/LSEducation/bunyan-config
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bunyan/bunyan.d.ts"/>
declare module "bunyan-config" {
import * as bunyan from "bunyan";
/**
* Configuration.
* @interface
*/
interface Configuration {
name: string;
streams?: bunyan.Stream[];
level?: string | number;
stream?: NodeJS.WritableStream;
serializers?: {};
src?: boolean;
}
/**
* Constructor.
* @param {Configuration} [jsonConfig] A JSON configuration.
* @return {LoggerOptions} A logger options.
*/
function bunyanConfig(jsonConfig?: Configuration): bunyan.LoggerOptions;
export = bunyanConfig;
}
+13
View File
@@ -56,7 +56,20 @@ var options:bunyan.LoggerOptions = {
var log = bunyan.createLogger(options);
var customSerializer = function(anything: any) {
return { obj: anything};
};
log.addSerializers({anything: customSerializer});
log.addSerializers(bunyan.stdSerializers);
log.addSerializers(
{
err: bunyan.stdSerializers.err,
req: bunyan.stdSerializers.req,
res: bunyan.stdSerializers.res
}
);
var child = log.child({name: 'child'});
child.reopenFileStreams();
log.addStream({path: '/dev/null'});
+14 -4
View File
@@ -11,7 +11,7 @@ declare module "bunyan" {
class Logger extends EventEmitter {
constructor(options:LoggerOptions);
addStream(stream:Stream):void;
addSerializers(serializers:Serializers):void;
addSerializers(serializers:Serializers | StdSerializers):void;
child(options:LoggerOptions, simple?:boolean):Logger;
child(obj:Object, simple?:boolean):Logger;
reopenFileStreams():void;
@@ -21,7 +21,7 @@ declare module "bunyan" {
levels(name: number | string, value: number | string):void;
fields:any;
src:boolean;
src:boolean;
trace(error:Error, format?:any, ...params:any[]):void;
trace(buffer:Buffer, format?:any, ...params:any[]):void;
@@ -58,8 +58,18 @@ declare module "bunyan" {
src?: boolean;
}
interface Serializer {
(input:any): any;
}
interface Serializers {
[key:string]: (input:any) => string;
[key:string]: Serializer;
}
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
}
interface Stream {
@@ -72,7 +82,7 @@ declare module "bunyan" {
count?: number;
}
export var stdSerializers:Serializers;
export var stdSerializers: StdSerializers;
export var TRACE:number;
export var DEBUG:number;
+1 -1
View File
@@ -5,7 +5,7 @@ import * as Busboy from 'busboy';
import * as http from 'http';
import * as util from 'util';
function serverFn(req: http.ServerRequest, res: http.ServerResponse) {
function serverFn(req: http.IncomingMessage, res: http.ServerResponse) {
if (req.method === 'POST') {
var busboy = new Busboy({ headers: req.headers });
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
+43
View File
@@ -0,0 +1,43 @@
/// <reference path="./bwip-js.d.ts" />
/// <reference path="../node/node.d.ts" />
'use strict';
import * as bwipjs from 'bwip-js';
import * as http from 'http';
import * as fs from 'fs';
bwipjs.loadFont('Inconsolata', 108,
fs.readFileSync('fonts/Inconsolata.otf', 'binary'));
http.createServer(function(req, res) {
// If the url does not begin /?bcid= then 404. Otherwise, we end up
// returning 400 on requests like favicon.ico.
if (req.url.indexOf('/?bcid=') != 0) {
res.writeHead(404, { 'Content-Type':'text/plain' });
res.end('BWIPJS: Unknown request format.', 'utf8');
} else {
bwipjs(req, res);
}
}).listen(3030);
bwipjs.toBuffer({
bcid: 'code128', // Barcode type
text: '0123456789', // Text to encode
scale: 3, // 3x scaling factor
height: 10, // Bar height, in millimeters
includetext: true, // Show human-readable text
textxalign: 'center', // Always good to set this
textfont: 'Inconsolata', // Use your custom font
textsize: 13 // Font size, in points
}, function (err:string|Error, png: Buffer) {
if (err) {
console.log(err);
} else {
// `png` is a Buffer
// png.length : PNG file length
// png.readUInt32BE(16) : PNG image width
// png.readUInt32BE(20) : PNG image height
}
});
+86
View File
@@ -0,0 +1,86 @@
// Type definitions for bwip-js 1.1.1
// Project: https://github.com/metafloor/bwip-js
// Definitions by: TANAKA Koichi <https://github.com/MugeSo/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'bwip-js' {
import {IncomingMessage as Request, ServerResponse as Response} from 'http';
module BwipJs {
export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void;
export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void;
interface ToBufferOptions {
bcid: string;
text: string;
parse?: boolean;
parsefunc?: boolean;
height?: number;
width?: number;
scaleX?: number;
scaleY?: number;
scale?: number;
rotate?: 'N'|'R'|'L'|'I';
paddingwidth?: number;
paddingheight?: number;
monochrome?: boolean;
alttext?: boolean;
includetext?: boolean;
textfont?: string;
textsize?: number;
textgaps?: number;
textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify';
textyalign?:'below'|'center'|'above';
textxoffset?: number;
textyoffset?: number;
showborder?: boolean;
borderwidth?: number;
borderleft?: number;
borderright?: number;
bordertop?: number;
boraderbottom?: number;
barcolor?: string;
backgroundcolor?: string;
bordercolor?: string;
textcolor?: string;
addontextxoffset?: number;
addontextyoffset?: number;
addontextfont?: string;
addontextsize?: number;
guardwhitespace?: boolean;
guardwidth?: number;
guardheight?: number;
guardleftpos?: number;
guardrightpos?: number;
guardleftypos?: number;
guardrightypos?: number;
sizelimit?: number;
includecheck?: boolean;
includecheckintext?: boolean;
inkspread?: number;
inkspreadh?: number;
inkspreadv?: number;
}
}
function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void;
export = BwipJs;
}
+4 -3
View File
@@ -7,8 +7,9 @@
import fs = require( 'fs' );
import byline = require( 'byline' );
//TODO can this be typed in an ambient way?
//var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
var stream = byline();
var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
var stream = byline.createStream( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
@@ -44,4 +45,4 @@ var output = fs.createWriteStream('nolines.txt');
var lineStream:byline.LineStream = new LineStream();
input.pipe(lineStream);
lineStream.pipe(output);
lineStream.pipe(output);
+21 -25
View File
@@ -8,31 +8,27 @@
declare module "byline" {
import stream = require("stream");
export interface LineStreamOptions extends stream.TransformOptions {
keepEmptyLines?: boolean;
function bl(): bl.LineStream;
function bl(stream: NodeJS.ReadableStream, options?: bl.LineStreamOptions): bl.LineStream;
namespace bl {
export interface LineStreamOptions extends stream.TransformOptions {
keepEmptyLines?: boolean;
}
export interface LineStream extends stream.Transform {
}
export interface LineStreamCreatable extends LineStream {
new (options?: LineStreamOptions): LineStream
}
export function createStream(): LineStream;
export function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream;
export var LineStream: LineStreamCreatable;
}
export interface LineStream extends stream.Transform {
}
export interface LineStreamCreatable extends LineStream {
new (options?:LineStreamOptions):LineStream
}
//TODO is it possible to declare static factory functions without name (directly on the module)
//
// JS:
// // convinience API
// module.exports = function(readStream, options) {
// return module.exports.createStream(readStream, options);
// };
//
// TS:
// ():LineStream; // same as createStream():LineStream
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
export function createStream():LineStream;
export function createStream(stream:NodeJS.ReadableStream, options?:LineStreamOptions):LineStream;
export var LineStream:LineStreamCreatable;
export = bl;
}
Vendored
+4 -4
View File
@@ -385,10 +385,10 @@ declare namespace c3 {
* - d is the data where mouse cursor moves out. In this callback, this will be the Chart object.
*/
onmouseout?: (d: any, element?: any) => void;
// onselected?: any;
// onunselected?: any;
// ondragstart?: any;
// ondragend?: any;
onselected?: (d: any, element?: any) => void;
onunselected?: (d: any, element?: any) => void;
}
interface Axis {
+68 -43
View File
@@ -7,19 +7,20 @@
declare class CamlBuilder {
constructor();
/** Generate CAML Query, starting from <Where> tag */
public Where(): CamlBuilder.IFieldExpression;
Where(): CamlBuilder.IFieldExpression;
/** Generate <View> tag for SP.CamlQuery
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
Specifying view fields is a good practice, as it decreases traffic between server and client. */
public View(viewFields?: string[]): CamlBuilder.IView;
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
Specifying view fields is a good practice, as it decreases traffic between server and client. */
View(viewFields?: string[]): CamlBuilder.IView;
/** Generate <ViewFields> tag for SPServices */
public ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
/** Use for:
1. SPServices CAMLQuery attribute
2. Creating partial expressions
3. In conjunction with Any & All clauses
*/
1. SPServices CAMLQuery attribute
2. Creating partial expressions
3. In conjunction with Any & All clauses
*/
static Expression(): CamlBuilder.IFieldExpression;
static FromXml(xml: string): CamlBuilder.IRawQuery;
}
declare namespace CamlBuilder {
interface IView extends IJoinable, IFinalizable {
@@ -29,24 +30,24 @@ declare namespace CamlBuilder {
}
interface IJoinable {
/** Join the list you're querying with another list.
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
InnerJoin(lookupFieldInternalName: string, alias: string): IJoin;
/** Join the list you're querying with another list.
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
LeftJoin(lookupFieldInternalName: string, alias: string): IJoin;
}
interface IJoin extends IJoinable {
/** Select projected field for using in the main Query body
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
}
interface IProjectableView extends IView {
/** Select projected field for using in the main Query body
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
}
enum ViewScope {
@@ -57,7 +58,7 @@ declare namespace CamlBuilder {
/** */
FilesOnly = 2,
}
interface IQuery {
interface IQuery extends IGroupable {
Where(): IFieldExpression;
}
interface IFinalizableToString {
@@ -70,21 +71,21 @@ declare namespace CamlBuilder {
}
interface ISortable extends IFinalizable {
/** Adds OrderBy clause to the query
@param fieldInternalName Internal field of the first field by that the data will be sorted (ascending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
@param fieldInternalName Internal field of the first field by that the data will be sorted (ascending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
*/
OrderBy(fieldInternalName: string, override?: boolean, useIndexForOrderBy?: boolean): ISortedQuery;
/** Adds OrderBy clause to the query (using descending order for the first field).
@param fieldInternalName Internal field of the first field by that the data will be sorted (descending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
@param fieldInternalName Internal field of the first field by that the data will be sorted (descending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
*/
OrderByDesc(fieldInternalName: string, override?: boolean, useIndexForOrderBy?: boolean): ISortedQuery;
}
interface IGroupable extends ISortable {
/** Adds GroupBy clause to the query.
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
GroupBy(fieldInternalName: any): IGroupedQuery;
}
interface IExpression extends IGroupable {
@@ -134,17 +135,19 @@ declare namespace CamlBuilder {
DateField(internalName: string): IDateTimeFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is DateTime */
DateTimeField(internalName: string): IDateTimeFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is ModStat (moderation status) */
ModStatField(internalName: string): IModStatFieldExpression;
/** Used in queries for retrieving recurring calendar events.
NOTICE: DateRangesOverlap with overlapType other than Now cannot be used with SP.CamlQuery, because it doesn't support
CalendarDate and ExpandRecurrence query options. Lists.asmx, however, supports them, so you can still use DateRangesOverlap
with SPServices.
@param overlapType Defines type of overlap: return all events for a day, for a week, for a month or for a year
@param calendarDate Defines date that will be used for determining events for which exactly day/week/month/year will be returned.
This value is ignored for overlapType=Now, but for the other overlap types it is mandatory.
@param eventDateField Internal name of "Start Time" field (default: "EventDate" - all OOTB Calendar lists use this name)
@param endDateField Internal name of "End Time" field (default: "EndDate" - all OOTB Calendar lists use this name)
@param recurrenceIDField Internal name of "Recurrence ID" field (default: "RecurrenceID" - all OOTB Calendar lists use this name)
*/
NOTICE: DateRangesOverlap with overlapType other than Now cannot be used with SP.CamlQuery, because it doesn't support
CalendarDate and ExpandRecurrence query options. Lists.asmx, however, supports them, so you can still use DateRangesOverlap
with SPServices.
@param overlapType Defines type of overlap: return all events for a day, for a week, for a month or for a year
@param calendarDate Defines date that will be used for determining events for which exactly day/week/month/year will be returned.
This value is ignored for overlapType=Now, but for the other overlap types it is mandatory.
@param eventDateField Internal name of "Start Time" field (default: "EventDate" - all OOTB Calendar lists use this name)
@param endDateField Internal name of "End Time" field (default: "EndDate" - all OOTB Calendar lists use this name)
@param recurrenceIDField Internal name of "Recurrence ID" field (default: "RecurrenceID" - all OOTB Calendar lists use this name)
*/
DateRangesOverlap(overlapType: DateRangesOverlapType, calendarDate: string, eventDateField?: string, endDateField?: string, recurrenceIDField?: string): IExpression;
}
interface IBooleanFieldExpression {
@@ -201,25 +204,25 @@ declare namespace CamlBuilder {
/** Checks whether the value of the field is equal to one of the specified values */
In(arrayOfValues: Date[]): IExpression;
/** Checks whether the value of the field is equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
EqualTo(value: string): IExpression;
/** Checks whether the value of the field is not equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
NotEqualTo(value: string): IExpression;
/** Checks whether the value of the field is greater than the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
GreaterThan(value: string): IExpression;
/** Checks whether the value of the field is less than the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
LessThan(value: string): IExpression;
/** Checks whether the value of the field is greater than or equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
GreaterThanOrEqualTo(value: string): IExpression;
/** Checks whether the value of the field is less than or equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
LessThanOrEqualTo(value: string): IExpression;
/** Checks whether the value of the field is equal to one of the specified values.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
In(arrayOfValues: string[]): IExpression;
}
interface ITextFieldExpression {
@@ -322,6 +325,27 @@ declare namespace CamlBuilder {
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
NotEqualTo(value: any): IExpression;
}
interface IModStatFieldExpression {
/** Represents moderation status ID. */
ModStatId(): INumberFieldExpression;
/** Checks whether the value of the field is Approved - same as ModStatId.EqualTo(0) */
IsApproved(): IExpression;
/** Checks whether the value of the field is Rejected - same as ModStatId.EqualTo(1) */
IsRejected(): IExpression;
/** Checks whether the value of the field is Pending - same as ModStatId.EqualTo(2) */
IsPending(): IExpression;
/** Represents moderation status as localized text. In most cases it is better to use ModStatId in the queries instead of ValueAsText. */
ValueAsText(): ITextFieldExpression;
}
interface IRawQuery {
/** Change Where clause */
ReplaceWhere(): IFieldExpression;
ModifyWhere(): IRawQueryModify;
}
interface IRawQueryModify {
AppendOr(): IFieldExpression;
AppendAnd(): IFieldExpression;
}
enum DateRangesOverlapType {
/** Returns events for today */
Now = 0,
@@ -330,7 +354,7 @@ declare namespace CamlBuilder {
/** Returns events for one week, specified by CalendarDate in QueryOptions */
Week = 2,
/** Returns events for one month, specified by CalendarDate in QueryOptions.
Caution: usually also returns few days from previous and next months */
Caution: usually also returns few days from previous and next months */
Month = 3,
/** Returns events for one year, specified by CalendarDate in QueryOptions */
Year = 4,
@@ -340,6 +364,7 @@ declare namespace CamlBuilder {
static createViewFields(viewFields: string[]): IFinalizableToString;
static createWhere(): IFieldExpression;
static createExpression(): IFieldExpression;
static createRawQuery(xml: string): IRawQuery;
}
class CamlValues {
/** Dynamic value that represents Id of the current user */
+4 -2
View File
@@ -8,10 +8,12 @@ import {
} from 'canvas-gauges';
let linearOptions: LinearGaugeOptions = {
renderTo: document.createElement('canvas')
renderTo: document.createElement('canvas'),
fontNumbersStyle: 'italic'
};
let radialOptions: RadialGaugeOptions = {
renderTo: 'gauge-id'
renderTo: 'gauge-id',
fontNumbersWeight: 'bold'
};
new LinearGauge(linearOptions);
+17 -2
View File
@@ -1,9 +1,13 @@
// Type definitions for canvas-gauges
// Type definitions for canvas-gauges v2.0.8
// Project: https://github.com/Mikhus/canvas-gauges
// Definitions by: Mikhus <https://github.com/Mikhus>
// Definitions: https://github.com/Mikhus/DefinitelyTyped
declare namespace CanvasGauges {
export type FontStyle = 'normal' | 'italic' | 'oblique';
export type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' |
'100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
export type RenderTarget = string|HTMLElement;
export interface AnimationRule {
@@ -30,6 +34,7 @@ declare namespace CanvasGauges {
minorTicks?: number,
strokeTicks?: boolean,
animatedValue?: boolean,
animateOnInit?: boolean,
title?: string|boolean,
borders?: boolean,
valueInt?: number,
@@ -73,11 +78,13 @@ declare namespace CanvasGauges {
borderInnerWidth?: number,
borderShadowWidth?: number,
valueBox?: boolean,
valueBoxWidth?: number,
valueBoxStroke?: number,
valueText?: string,
valueTextShadow?: boolean,
valueBoxBorderRadius?: number,
highlights?: Highlight[],
highlightsWidth?: number,
fontNumbers?: string,
fontTitle?: string,
fontUnits?: string,
@@ -85,7 +92,15 @@ declare namespace CanvasGauges {
fontTitleSize?: number,
fontValueSize?: number,
fontUnitsSize?: number,
fontNumbersSize?: number
fontNumbersSize?: number,
fontTitleStyle?: FontStyle,
fontValueStyle?: FontStyle,
fontUnitsStyle?: FontStyle,
fontNumbersStyle?: FontStyle,
fontTitleWeight?: FontWeight,
fontValueWeight?: FontWeight,
fontUnitsWeight?: FontWeight,
fontNumbersWeight?: FontWeight
}
export interface RadialGaugeOptions extends GenericOptions {
+30 -14
View File
@@ -376,7 +376,7 @@ declare namespace CanvasJS {
dataSeriesIndex: number;
}
interface ChartAxisXOptions {
interface ChartAxisOptions {
/**
* Sets the Axis Title.
* Default: null
@@ -472,18 +472,6 @@ declare namespace CanvasJS {
*/
valueFormatString?: string;
/**
* Sets the minimum value of Axis. Values smaller than minimum are clipped.
* Default: Automatically Calculated based on the data
* Example: 100, 350..
*/
minimum?: number;
/**
* Sets the maximum value permitted on Axis. Values greater than maximum are clipped.
* Default: Automatically Calculated based on the data
* Example: 100, 350..
*/
maximum?: number;
/**
* Sets the distance between Tick Marks, Grid Lines and Interlaced Colors.
* Default: Automatically Calculated
* Example: 50, 75..
@@ -638,13 +626,41 @@ declare namespace CanvasJS {
labelFontStyle?: string;
}
interface ChartAxisYOptions extends ChartAxisXOptions {
interface ChartAxisXOptions extends ChartAxisOptions {
/**
* Sets the minimum value of Axis. Values smaller than minimum are clipped.
* Default: Automatically Calculated based on the data
* Example: 100, 350..
*/
minimum?: number | Date;
/**
* Sets the maximum value permitted on Axis. Values greater than maximum are clipped.
* Default: Automatically Calculated based on the data
* Example: 100, 350..
*/
maximum?: number | Date;
}
interface ChartAxisYOptions extends ChartAxisOptions {
/**
* When includeZero is set to true, axisY sets the range in such a way that Zero is a part of it. It is set to true by default. But, whenever y values are very big and difference among dataPoints are hard to judge, setting includeZero to false makes axisY to set a range that makes the differences prominently visible.
* Default: true
* Example: true, false
*/
includeZero?: boolean;
/**
* Sets the minimum value of Axis. Values smaller than minimum are clipped.
* Default: Automatically Calculated based on the data
* Example: 100, 350..
*/
minimum?: number;
/**
* Sets the maximum value permitted on Axis. Values greater than maximum are clipped.
* Default: Automatically Calculated based on the data
* Example: 100, 350..
*/
maximum?: number;
}
interface ChartToolTipOptions {
+495
View File
@@ -0,0 +1,495 @@
// Type definitions for Cash
// Project: https://github.com/kenwheeler/cash
// Definitions by: Ashok Vishwakarma <https://github.com/akvlko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* OffsetType
* return type for cash.offset(), cash.position()
*/
interface OffsetType {
top: number;
left: number;
}
/**
* CashStatic
* Static declaration for CashJs accessible directly using Cash object or $
*/
interface CashStatic {
/**
* isArray
* Check if the argument is an array.
* @type method
* @argument any
* @return boolean
*/
isArray(n: any): boolean;
/**
* isFunction
* Check if the argument is a function.
* @type method
* @argument any
* @return boolean
*/
isFunction(n: any): boolean;
/**
* isNumeric
* Check if the argument is numeric.
* @type method
* @type method
* @argument any
* @return boolean
*/
isNumeric(n: any): boolean;
/**
* isString
* Check if the argument is a string.
* @type method
* @argument str any
* @return boolean
*/
isString(str: any): boolean;
/**
* extend
* Extends target object with properties from the source object. If no target is provided, cash itself will be extended.
* @type method
* @argument target any, source any
*/
extend(target: any, source: any): any;
/**
* matches
* Checks a selector against an element, returning a boolean value for match.
* @type method
* @argument element Cash, selector string
* @return boolean
*/
matches(element: Cash, selector: string): boolean;
/**
* parseHTML
* Returns a collection from an HTML string.
* @type method
* @argument htmlString string
* @return Cash
*/
parseHTML(htmlString: string): Cash;
/**
* each
* Iterates through a collection and calls the callback method on each.
* @type method
* @argument collection Array, callback Function
* @return Array
*/
each(collection: Array<any>, callback: Function): Array<any>;
/**
* fn: use to extend cash for plugin development
* @type property
*/
fn: any;
/**
* selector declaration for Cash to use $(<argument>)
*/
(selector: string, context?: Element|Cash): Cash;
(element: Element): Cash;
(elementArray: Element[]): Cash;
}
/**
* Cash
* Interface for CashJs
* Refer https://github.com/kenwheeler/cash for documentation and uses of the methods and properties
*/
interface Cash {
/**
* add
* Returns a new collection with the element(s) added to the end.
*/
add(selector: string|Cash|Element, context?: Element): Cash;
/**
* addClass
* Adds the className argument to collection elements.
*/
addClass(c: string): Cash;
/**
* after
* Inserts content or elements after the collection.
*/
after(selector: Element|String): Cash;
/**
* append
* Appends the target element to the each element in the collection.
*/
append(content: string|Element|Cash): Cash;
/**
* appendTo
* Adds the elements in a collection to the target element(s).
*/
appendTo(parent: string|Element|Cash): Cash;
/**
* attr
* Without attrValue, returns the attribute value of the first element in the collection.
* With attrValue, sets the attribute value of each element of the collection.
*/
attr(name: string): any;
attr(name: string, value: string): Cash;
/**
* before
* Inserts content or elements before the collection.
*/
before(selector: string|Element): Cash;
/**
* children
* Without a selector specified, returns a collection of child elements.
* With a selector, returns child elements that match the selector.
*/
children(selector?: string): Cash;
/**
* closest
* Returns the closest matching selector up the DOM tree.
*/
closest(selector?: string): Cash;
/**
* clone
* Returns a clone of the collection.
*/
clone(): Cash;
/**
* css
* Returns a CSS property value when just property is supplied.
* Sets a CSS property when property and value are supplied, and set multiple properties when an object is supplied.
* Properties will be autoprefixed if needed for the user's browser.
*/
css(prop: any): any;
css(prop: string, value: any): Cash;
/**
* data
* Link some data (string, object, array, etc.) to an element when both key and value are supplied.
* If only a key is supplied, returns the linked data and falls back to data attribute value if no data is already linked.
* Multiple data can be set when an object is supplied.
*/
data(name: any): any;
data(name: string, value: any): Cash;
/**
* each
* Iterates over a collection with callback(value, index, array).
*/
each(callback: Function): Cash;
/**
* empty
* Empties an elements interior markup.
*/
empty(): Cash;
/**
* eq
* Returns a collection with the element at index.
*/
eq(index: number): Cash;
/**
* extend
* Adds properties to the cash collection prototype.
*/
extend(target: any): any;
/**
* filter
* Returns the collection that results from applying the filter method.
*/
filter(selector: Function): Cash;
/**
* find
* Returns selector match descendants from the first element in the collection.
*/
find(selector: string): Cash;
/**
* first
* Returns the first element in the collection.
*/
first(): Cash;
/**
* get
* Returns the element at the index.
*/
get(index: number): HTMLElement;
/**
* has
* Returns boolean result of the selector argument against the collection.
*/
has(selector: string): boolean;
/**
* hasClass
* Returns the boolean result of checking if the first element in the collection has the className attribute.
*/
hasClass(c: string): boolean;
/**
* height
* Returns the height of the element.
*/
height(): number;
/**
* html
* Returns the HTML text of the first element in the collection, sets the HTML if provided.
*/
html(): string;
html(content: string): Cash;
/**
* index
* Returns the index of the element in its parent if an element or selector isn't provided.
* Returns index within element or selector if it is.
*/
index(elem?: Element): number;
/**
* innerHeight
* Returns the height of the element + padding.
*/
innerHeight(): number;
/**
* innerWidth
* Returns the width of the element + padding.
*/
innerWidth(): number;
/**
* insertAfter
* Inserts collection after specified element.
*/
insertAfter(selector: string|Element|Cash): Cash;
/**
* insertBefore
* Inserts collection before specified element.
*/
insertBefore(selector: string|Element|Cash): Cash;
/**
* is
* Returns whether the provided selector, element or collection matches any element in the collection.
*/
is(selector: string|Element|Cash): boolean;
/**
* last
* Returns last element in the collection.
*/
last(): Cash;
/**
* next
* Returns next sibling.
*/
next(): Cash;
/**
* not
* Filters collection by false match on selector.
*/
not(selector: string|Element|Cash): Cash;
/**
* off
* Removes event listener from collection elements.
*/
off(eventName: string, callback: Function): Cash;
/**
* offset
* Get the coordinates of the first element in a collection relative to the document.
*/
offset(): OffsetType;
/**
* offsetParent
* Get the first element's ancestor that's positioned.
*/
offsetParent(): OffsetType;
/**
* on
* Adds event listener to collection elements. Event is delegated if delegate is supplied.
*/
on(eventName: string|Array<string>, delegate: any, callback?: Function, runOnce?: boolean): Cash;
/**
* one
* Adds event listener to collection elements that only triggers once for each element.
* Event is delegated if delegate is supplied.
*/
one(eventName: string|Array<string>, delegate: any, callback?: Function, runOnce?: boolean): Cash;
/**
* outerHeight
* Returns the outer height of the element. Includes margins if margin is set to true.
*/
outerHeight(flag?: boolean): number;
/**
* outerWidth
* Returns the outer width of the element. Includes margins if margin is set to true.
*/
outerWidth(flag?: boolean): number;
/**
* parent
* Returns parent element.
*/
parent(): Cash;
/**
* parents
* Returns collection of elements who are parents of element. Optionally filtering by selector.
*/
parents(selector?: string): Cash;
/**
* position
* Get the coordinates of the first element in a collection relative to its offsetParent.
*/
position(): OffsetType;
/**
* prepend
* Prepends element to the each element in collection.
*/
prepend(content: string): Cash;
/**
* prependTo
* Prepends elements in a collection to the target element(s).
*/
prependTo(parent: string|Element|Cash): Cash;
/**
* prev
* Returns the previous adjacent element.
*/
prev(): Cash;
/**
* prop
* Returns a property value when just property is supplied.
* Sets a property when property and value are supplied, and sets multiple properties when an object is supplied.
*/
prop(name: string): any;
prop(name: string, value: string): Cash;
/**
* ready
* Calls callback method on DOMContentLoaded.
*/
ready(fn: Function): void;
/**
* remove
* Removes collection elements from the DOM.
*/
remove(): Cash;
/**
* removeAttr
* Removes attribute from collection elements.
*/
removeAttr(name: string): Cash;
/**
* removeClass
* Removes className from collection elements.
* Accepts space-separated classNames for removing multiple classes.
* Providing no arguments will remove all classes.
*/
removeClass(c?: string): Cash;
/**
* removeData
* Removes linked data and data-attributes from collection elements.
*/
removeData(key: string): Cash;
/**
* removeProp
* Removes property from collection elements.
*/
removeProp(name: string): Cash;
/**
* serialize
* When called on a form, serializes and returns form data.
*/
serialize(): string;
/**
* siblings
* Returns a collection of sibling elements.
*/
siblings(): Cash;
/**
* text
* Returns the inner text of the first element in the collection, sets the text if textContent is provided.
*/
text(): string;
text(content?: string): Cash;
/**
* toggleClass
* Adds or removes className from collection elements based on if the element already has the class.
* Accepts space-separated classNames for toggling multiple classes, and an optional force boolean to ensure classes are added (true) or removed (false).
*/
toggleClass(c: string, state?: boolean): Cash;
/**
* trigger
* Triggers supplied event on elements in collection. Data can be passed along as the second parameter.
*/
trigger(eventName: string, data?: any): Cash;
/**
* val
* Returns an inputs value. If value is supplied, sets all inputs in collection's value to the value argument.
*/
val(): any;
val(value?: string): Cash;
/**
* width
* Returns the width of the element.
*/
width(): number;
}
declare module "cash" {
export = CashStatic;
}
declare var cash: CashStatic;
@@ -6,6 +6,6 @@ import * as util from 'util';
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
client.execute(query, ['guy'], function(err, result) {
client.execute(query, ['guy'], function(err: any, result: any) {
console.log('got user profile with email ' + result.rows[0].email);
});
});
+1 -2
View File
@@ -135,7 +135,7 @@ declare module "cassandra-driver" {
var LocalTime: LocalTimeStatic;
var Long: _Long;
var ResultSet: ResultSetStatic;
var ResultStream: ResultStreamStatic;
// var ResultStream: ResultStreamStatic;
var Row: RowStatic;
var TimeUuid: TimeUuidStatic;
var Tuple: TupleStatic;
@@ -366,7 +366,6 @@ declare module "cassandra-driver" {
buffer: Buffer;
paused: boolean;
_read(): void;
_valve(readNext: Function): void;
add(chunk: Buffer): void;
}
+8 -2
View File
@@ -5,13 +5,19 @@
declare namespace Chance {
interface Seeded {
seed: number;
}
type SeededChance = Chance & Seeded;
interface ChanceStatic {
(): Chance
(seed: number): Chance
(seed: number): SeededChance
(generator: () => any): Chance
new(): Chance;
new(seed: number): Chance;
new(seed: number): SeededChance;
new(generator: () => any): Chance;
}
+8 -6
View File
@@ -345,6 +345,7 @@ interface ChartXAxe {
stacked?: boolean;
categoryPercentage?: number;
barPercentage?: number;
barThickness?: number;
gridLines?: GridLineOptions;
position?: string;
ticks?: TickOptions;
@@ -379,7 +380,7 @@ interface TimeScale extends ChartScales {
parser?: string | ((arg: any) => any);
round?: string;
tooltipFormat?: string;
unit?: TimeUnit;
unit?: string | TimeUnit;
unitStepSize?: number;
}
@@ -390,11 +391,12 @@ interface RadialLinearScale {
ticks?: TickOptions;
}
declare var Chart: {
new (context: CanvasRenderingContext2D, options: ChartConfiguration): {};
declare class Chart {
constructor (context: CanvasRenderingContext2D, options: ChartConfiguration);
config: ChartConfiguration;
destroy: () => {};
update: (duration: any, lazy: any) => {};
render: (duration: any, lazy: any) => {};
update: (duration?: any, lazy?: any) => {};
render: (duration?: any, lazy?: any) => {};
stop: () => {};
resize: () => {};
clear: () => {};
@@ -407,4 +409,4 @@ declare var Chart: {
defaults: {
global: ChartOptions;
}
};
}
+63
View File
@@ -0,0 +1,63 @@
/// <reference path="cheap-ruler.d.ts"/>
import * as cheapRuler from 'cheap-ruler'
// -- Fixtures --
const bbox = [30.5, 50.5, 31, 51]
const point1 = [30.5, 50.5]
const point2 = [30.51, 50.49]
const unit = 'miles'
const lineString = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[-77.031669, 38.878605],
[-77.029609, 38.881946],
[-77.020339, 38.884084],
[-77.025661, 38.885821],
[-77.021884, 38.889563],
[-77.019824, 38.892368]
]
}
}
const line = lineString.geometry.coordinates
const polygon = [[
[-67.031, 50.458], [-67.031, 50.534], [-66.929, 50.534],
[-66.929, 50.458], [-67.031, 50.458]
]]
const points = [
[-67.031, 50.458], [-67.031, 50.534],
[-66.929, 50.534], [-66.929, 50.458]
]
// -- Test initiators --
cheapRuler(35.05)
cheapRuler(35.05, 'miles')
cheapRuler(35.05, unit)
cheapRuler.fromTile(1567, 12)
cheapRuler.fromTile(1567, 12, 'miles')
cheapRuler.fromTile(1567, 12, unit)
// -- Test units --
cheapRuler.units
cheapRuler.units.miles
cheapRuler.units.kilometers
50 * cheapRuler.units.yards / cheapRuler.units.meters
// -- Test cheapRuler --
const ruler = cheapRuler(35.05)
ruler.distance(point1, point2)
ruler.bearing(point1, point2)
ruler.destination(point1, 0.1, 90)
ruler.lineDistance(points)
ruler.area(polygon)
ruler.along(line, 2.5)
ruler.pointOnLine(line, point1).point
ruler.lineSlice(point1, point2, line)
ruler.lineSliceAlong(10, 20, line)
ruler.bufferPoint(point1, 0.01)
ruler.bufferBBox(bbox, 0.2)
ruler.insideBBox(point1, bbox)
+216
View File
@@ -0,0 +1,216 @@
// Type definitions for cheap-ruler 2.4.1
// Project: https://github.com/mapbox/cheap-ruler
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "cheap-ruler" {
type BBox = [number, number, number, number] | number[]
type Point = [number, number] | number[]
type Line = Array<Point>
type Points = Array<Point>
type Polygon = Array<Array<Point>>
interface TemplateUnits {
kilometers: number
miles: number
nauticalmiles: number
meters: number
metres: number
yards: number
feet: number
inches: number
}
interface InterfacePointOnLine {
point: Point
index: number
t: number
}
class CheapRuler {
/**
* Given two points of the form [longitude, latitude], returns the distance.
*
* @param {Point} a point [longitude, latitude]
* @param {Point} b point [longitude, latitude]
* @returns {number} distance
* @example
* var distance = ruler.distance([30.5, 50.5], [30.51, 50.49]);
* //=distance
*/
distance(a: Point, b: Point): number;
/**
* Returns the bearing between two points in angles.
*
* @param {Point} a point [longitude, latitude]
* @param {Point} b point [longitude, latitude]
* @returns {number} bearing
* @example
* var bearing = ruler.bearing([30.5, 50.5], [30.51, 50.49]);
* //=bearing
*/
bearing(a: Point, b: Point): number;
/**
* Returns a new point given distance and bearing from the starting point.
*
* @param {Point} p point [longitude, latitude]
* @param {number} dist distance
* @param {number} bearing
* @returns {Point} point [longitude, latitude]
* @example
* var point = ruler.destination([30.5, 50.5], 0.1, 90);
* //=point
*/
destination(p: Point, dist: number, bearing: number): Point;
/**
* Given a line (an array of points), returns the total line distance.
*
* @param {Points} points [longitude, latitude]
* @returns {number} total line distance
* @example
* var length = ruler.lineDistance([
* [-67.031, 50.458], [-67.031, 50.534],
* [-66.929, 50.534], [-66.929, 50.458]
* ]);
* //=length
*/
lineDistance(points: Points): number;
/**
* Given a polygon (an array of rings, where each ring is an array of points), returns the area.
*
* @param {Polygon} polygon
* @returns {number} area value in the specified units (square kilometers by default)
* @example
* var area = ruler.area([[
* [-67.031, 50.458], [-67.031, 50.534], [-66.929, 50.534],
* [-66.929, 50.458], [-67.031, 50.458]
* ]]);
* //=area
*/
area(polygon: Polygon): number;
/**
* Returns the point at a specified distance along the line.
*
* @param {Line} line
* @param {number} dist distance
* @returns {Point} point [longitude, latitude]
* @example
* var point = ruler.along(line, 2.5);
* //=point
*/
along(line: Line, dist: number): Point
/**
* Returns an object of the form {point, index} where point is closest point on the line from the given point, and index is the start index of the segment with the closest point.
*
* @pointOnLine
* @param {Line} line
* @param {Point} p point [longitude, latitude]
* @returns {Object} {point, index}
* @example
* var point = ruler.pointOnLine(line, [-67.04, 50.5]).point;
* //=point
*/
pointOnLine(line: Line, p: Point): InterfacePointOnLine
/**
* Returns a part of the given line between the start and the stop points (or their closest points on the line).
*
* @param {Point} start point [longitude, latitude]
* @param {Point} stop point [longitude, latitude]
* @param {Line} line
* @returns {Line} line part of a line
* @example
* var line2 = ruler.lineSlice([-67.04, 50.5], [-67.05, 50.56], line1);
* //=line2
*/
lineSlice(start: Point, stop: Point, line: Line): Line
/**
* Returns a part of the given line between the start and the stop points indicated by distance along the line.
*
* @param {number} start distance
* @param {number} stop distance
* @param {Line} line
* @returns {Line} line part of a line
* @example
* var line2 = ruler.lineSliceAlong(10, 20, line1);
* //=line2
*/
lineSliceAlong(start: number, stop: number, line: Line): Line
/**
* Given a point, returns a bounding box object ([w, s, e, n]) created from the given point buffered by a given distance.
*
* @param {Point} p point [longitude, latitude]
* @param {number} buffer
* @returns {BBox} box object ([w, s, e, n])
* @example
* var bbox = ruler.bufferPoint([30.5, 50.5], 0.01);
* //=bbox
*/
bufferPoint(p: Point, buffer: number): BBox
/**
* Given a bounding box, returns the box buffered by a given distance.
*
* @param {BBox} box object ([w, s, e, n])
* @param {number} buffer
* @returns {BBox} box object ([w, s, e, n])
* @example
* var bbox = ruler.bufferBBox([30.5, 50.5, 31, 51], 0.2);
* //=bbox
*/
bufferBBox(bbox: BBox, buffer: number): BBox
/**
* Returns true if the given point is inside in the given bounding box, otherwise false.
*
* @param {Point} p point [longitude, latitude]
* @param {Point} box object ([w, s, e, n])
* @returns {boolean}
* @example
* var inside = ruler.insideBBox([30.5, 50.5], [30, 50, 31, 51]);
* //=inside
*/
insideBBox(p: Point, bbox: BBox): boolean
}
/**
* A collection of very fast approximations to common geodesic measurements. Useful for performance-sensitive code that measures things on a city scale.
*
* @param {number} lat latitude
* @param {string} [units='kilometers']
* @returns {CheapRuler}
* @example
* var ruler = cheapRuler(35.05, 'miles');
* //=ruler
*/
function cheapRuler(lat: number, units?: string): CheapRuler;
namespace cheapRuler {
/**
* Multipliers for converting between units.
*
* @example
* // convert 50 meters to yards
* 50 * cheapRuler.units.yards / cheapRuler.units.meters;
*/
const units: TemplateUnits
/**
* Creates a ruler object from tile coordinates (y and z). Convenient in tile-reduce scripts.
*
* @param {number} y
* @param {number} z
* @param {string} [units='kilometers']
* @returns {CheapRuler}
* @example
* var ruler = cheapRuler.fromTile(1567, 12);
* //=ruler
*/
function fromTile(y: number, z: number, units?: string): CheapRuler;
}
export = cheapRuler
}
+6
View File
@@ -20,6 +20,12 @@ cheerio(html);
cheerio('ul', html);
cheerio('li', 'ul', html);
const $fromElement = cheerio.load($("ul").get(0));
if ($fromElement("ul > li").length !== 3) {
throw new Error("Expecting 3 elements when passing `CheerioElement` to `load()`");
}
$ = cheerio.load(html, {
normalizeWhitespace: true,
xmlMode: true
+1
View File
@@ -259,6 +259,7 @@ interface CheerioElement {
interface CheerioAPI extends CheerioSelector {
load(html: string, options?: CheerioOptionsInterface): CheerioStatic;
load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic;
}
declare var cheerio:CheerioAPI;
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="chunked-dc.d.ts" />
// Chunker
let chunker = new Chunker(1337, Uint8Array.of(1,2,3), 2);
for (let chunk of chunker) {
// Do smoething with chunk
}
while (chunker.hasNext) {
let chunk = chunker.next().value;
}
// Unchunker
let unchunker = new Unchunker();
unchunker.onMessage = (message: Uint8Array, context: any[]) => {
// Do something with the received message
};
let chunk = Uint8Array.of(1,2).buffer;
unchunker.add(chunk);
unchunker.gc(1024);
+55
View File
@@ -0,0 +1,55 @@
// Type definitions for chunked-dc v0.1.2
// Project: https://github.com/saltyrtc/chunked-dc-js
// Definitions by: Danilo Bargen <https://github.com/dbrgn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Interfaces
declare namespace chunkedDc {
/** common.ts **/
interface CommonStatic {
HEADER_LENGTH: number;
}
/** chunker.ts **/
interface Chunker extends IterableIterator<Uint8Array> {
hasNext: boolean;
next(): IteratorResult<Uint8Array>;
[Symbol.iterator](): IterableIterator<Uint8Array>;
}
interface ChunkerStatic {
new(id: number, message: Uint8Array, chunkSize: number): Chunker
}
/** unchunker.ts **/
type MessageListener = (message: Uint8Array, context?: any) => void;
interface Unchunker {
onMessage: MessageListener;
add(chunk: ArrayBuffer, context?: any): void;
gc(maxAge: number): number;
}
interface UnchunkerStatic {
new(): Unchunker
}
/** main.ts **/
interface Standalone {
Chunker: ChunkerStatic,
Unchunker: UnchunkerStatic,
}
}
// Entry point for the packed ES5 version:
declare var chunkedDc: chunkedDc.Standalone;
// Entry point for the ES2015 version:
declare var Chunker: chunkedDc.ChunkerStatic;
declare var Unchunker: chunkedDc.UnchunkerStatic;
+1
View File
@@ -0,0 +1 @@
--target es2015 --noImplicitAny
+63
View File
@@ -37,6 +37,23 @@ function test_CKEDITOR() {
CKEDITOR.replaceAll((textarea, config) => false);
}
function test_config() {
var config1: CKEDITOR.config = {
toolbar: 'basic',
};
var config2: CKEDITOR.config = {
toolbar: [
[ 'mode', 'document', 'doctools' ],
[ 'clipboard', 'undo' ],
'/',
[ 'find', 'selection', 'spellchecker' ],
[ 'basicstyles', 'cleanup' ],
'/',
[ 'list', 'indent', 'blocks', 'align', 'bidi' ],
],
};
}
function test_dom_comment() {
var type = CKEDITOR.NODE_COMMENT;
var nativeNode = document.createComment('Example');
@@ -300,3 +317,49 @@ function test_adding_widget() {
});
}
}
function test_focusManager() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea);
var element = CKEDITOR.document.getById('myElement');
instance.focusManager.focus();
instance.focusManager.focus(element);
instance.focusManager.lock();
instance.focusManager.unlock();
instance.focusManager.blur();
instance.focusManager.blur(true);
instance.focusManager.add(element, true);
instance.focusManager.remove(element);
var focusManager = new CKEDITOR.focusManager(instance);
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
var bool: boolean = focusManager.hasFocus;
}
function test_basicWriter() {
var writer = new CKEDITOR.htmlParser.basicWriter();
writer.openTag('p', {});
writer.attribute('class', 'MyClass');
writer.openTagClose('p', false);
writer.text('Hello');
writer.closeTag('p');
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
}
function test_htmlWriter() {
var writer = new CKEDITOR.htmlWriter();
writer.openTag('p', {});
writer.attribute('class', 'MyClass');
writer.openTagClose('p', false);
writer.text('Hello');
writer.closeTag('p');
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
writer.indentationChars = '\t';
writer.lineBreakChars = '\r\n';
writer.selfClosingEnd = '>';
writer.indentation();
writer.lineBreak();
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
}
+33 -2
View File
@@ -544,8 +544,19 @@ declare namespace CKEDITOR {
}
interface focusManager {
class focusManager {
// Properties
currentActive: dom.domObject;
hasFocus: boolean;
// Methods
constructor(editor: editor);
focus(currentActive?: dom.element): void;
lock(): void;
unlock(): void;
blur(noDelay?: boolean): void;
add(element: dom.element, isCapture: boolean): void;
remove(element: dom.element): void;
}
interface keystrokeHandler {
@@ -796,7 +807,7 @@ declare namespace CKEDITOR {
templates_files?: Object;
templates_replaceContent?: boolean;
title?: string | boolean;
toolbar?: string | (string[])[];
toolbar?: string | (string | string[])[];
toolbarCanCollapse?: boolean;
toolbarGroupCycling?: boolean;
toolbarGroups?: toolbarGroups[];
@@ -1259,6 +1270,16 @@ declare namespace CKEDITOR {
toHtml(data: string, fixForBody?: string): void;
}
class htmlDataProcessor {
dataFilter: htmlParser.filter;
htmlFilter: htmlParser.filter;
writer: htmlParser.basicWriter;
constructor(editor: editor);
toDataFormat(html: string, options?: Object): string;
toHtml(data: string, options?: Object): string;
}
class event {
constructor();
@@ -1792,6 +1813,16 @@ declare namespace CKEDITOR {
}
class htmlWriter extends htmlParser.basicWriter {
indentationChars: string;
lineBreakChars: string;
selfClosingEnd: string;
indentation(): void;
lineBreak(): void;
setRules(tagName: string, rules: Object): void;
}
namespace tools {
var callFunction: Function;
+6
View File
@@ -0,0 +1,6 @@
/// <reference path="clipboard-js.d.ts" />
clipboard.copy("Hello World");
clipboard.copy(document.body).then(() => console.log("success"));
clipboard.paste().then(val => console.log(val));
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for clipboard-js 0.3.1
// Project: https://github.com/lgarron/clipboard.js
// Definitions by: Mark Wong Siang Kai <https://github.com/markwongsk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace clipboard {
interface IClipboardJsStatic {
copy(val: string | Element): Promise<void>;
paste(): Promise<string>;
}
}
declare var clipboard: clipboard.IClipboardJsStatic;
declare module 'clipboard-js' {
export = clipboard;
}

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