mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 17:51:46 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -1127,6 +1127,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](mongoose-auto-increment/mongoose-auto-increment.d.ts) [mongoose-auto-increment](https://github.com/codetunnel/mongoose-auto-increment) by [Aya Morisawa](https://github.com/AyaMorisawa)
|
||||
* [:link:](mongoose-deep-populate/mongoose-deep-populate.d.ts) [mongoose-deep-populate](https://github.com/buunguyen/mongoose-deep-populate) by [Aya Morisawa](https://github.com/AyaMorisawa)
|
||||
* [:link:](mongoose-mock/mongoose-mock.d.ts) [mongoose-mock](https://github.com/JohanObrink/mongoose-mock) by [jt000](https://github.com/jt000)
|
||||
* [:link:](mongoose-promise/mongoose-promise.d.ts) [mongoose-promise](http://mongoosejs.com/docs/api.html#promise-js) by [simonxca](https://github.com/simonxca)
|
||||
* [:link:](morgan/morgan.d.ts) [morgan](https://github.com/expressjs/morgan) by [James Roland Cabresos](https://github.com/staticfunction)
|
||||
* [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode)
|
||||
* [:link:](mousetrap/mousetrap.d.ts) [Mousetrap 1.5.x](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz)
|
||||
|
||||
@@ -14,6 +14,11 @@ declare namespace angular.environment {
|
||||
* loads the correct environment variables.
|
||||
*/
|
||||
check: () => void;
|
||||
/**
|
||||
* Retrieves the correct version of a
|
||||
* variable for the current environment.
|
||||
*/
|
||||
read: (key: string) => any;
|
||||
}
|
||||
interface Service {
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,11 @@ myApp.config((
|
||||
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => {
|
||||
$scope['openBottomSheet'] = () => {
|
||||
$mdBottomSheet.show({
|
||||
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>'
|
||||
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>',
|
||||
clickOutsideToClose: true,
|
||||
disableBackdrop: true,
|
||||
disableParentScroll: false,
|
||||
parent: () => {}
|
||||
});
|
||||
};
|
||||
$scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide');
|
||||
@@ -115,6 +119,14 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
|
||||
$scope['close'] = () => $mdSidenav(componentId).close();
|
||||
$scope['isOpen'] = $mdSidenav(componentId).isOpen();
|
||||
$scope['isLockedOpen'] = $mdSidenav(componentId).isLockedOpen();
|
||||
|
||||
$scope['asyncLookup'] = $mdSidenav(componentId, true).then((instance) => {
|
||||
instance.toggle();
|
||||
instance.open();
|
||||
instance.close();
|
||||
instance.isOpen();
|
||||
instance.isLockedOpen();
|
||||
});
|
||||
});
|
||||
|
||||
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
|
||||
|
||||
+7
-5
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module)
|
||||
// Type definitions for Angular Material 1.1.0-rc5+ (angular.material module)
|
||||
// Project: https://github.com/angular/material
|
||||
// Definitions by: Alex Staroselsky <https://github.com/AlStar01>, Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -19,11 +19,12 @@ declare namespace angular.material {
|
||||
preserveScope?: boolean; // default: false
|
||||
controller?: string|Function;
|
||||
locals?: {[index: string]: any};
|
||||
targetEvent?: MouseEvent;
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
clickOutsideToClose?: boolean;
|
||||
disableBackdrop?: boolean;
|
||||
escapeToClose?: boolean;
|
||||
resolve?: {[index: string]: angular.IPromise<any>};
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
parent?: Function|string|Object; // default: root node
|
||||
disableParentScroll?: boolean; // default: true
|
||||
}
|
||||
|
||||
@@ -134,6 +135,7 @@ declare namespace angular.material {
|
||||
}
|
||||
|
||||
interface ISidenavService {
|
||||
(component: string, enableWait: boolean): angular.IPromise<ISidenavObject>;
|
||||
(component: string): ISidenavObject;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
@@ -1715,6 +1715,12 @@ declare namespace angular {
|
||||
* Whether transclusion is enabled. Enabled by default.
|
||||
*/
|
||||
transclude?: boolean | string | {[slot: string]: string};
|
||||
/**
|
||||
* Requires the controllers of other directives and binds them to this component's controller.
|
||||
* The object keys specify the property names under which the required controllers (object values) will be bound.
|
||||
* Note that the required controllers will not be available during the instantiation of the controller,
|
||||
* but they are guaranteed to be available just before the $onInit method is executed!
|
||||
*/
|
||||
require?: {[controller: string]: string};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="app-root-path.d.ts" />
|
||||
import * as root from 'app-root-path';
|
||||
|
||||
let resolvedPath: string;
|
||||
resolvedPath = root.resolve('../dir');
|
||||
resolvedPath = root.path;
|
||||
resolvedPath = root.toString();
|
||||
let resolvedModule: any = root.require('app-root-path');
|
||||
root.setPath('C:\\app-root');
|
||||
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for app-root-path 1.2.1
|
||||
// Project: https://github.com/inxilpro/node-app-root-path
|
||||
// Definitions by: Shant Marouti <https://github.com/shantmarouti>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'app-root-path' {
|
||||
interface RootPath {
|
||||
|
||||
/**
|
||||
* Application root directory absolute path
|
||||
* @type {string}
|
||||
*/
|
||||
path: string;
|
||||
|
||||
/**
|
||||
* Resolves relative path from root to absolute path
|
||||
* @param {string} pathToModule
|
||||
* @returns {string}
|
||||
*/
|
||||
resolve(pathToModule: string): string;
|
||||
|
||||
/**
|
||||
* Resolve module by relative addressing from root
|
||||
* @param {string} pathToModule
|
||||
* @returns {*}
|
||||
*/
|
||||
require(pathToModule: string): any;
|
||||
|
||||
/**
|
||||
* Explicitly set root path
|
||||
* @param {string} explicitlySetPath
|
||||
*/
|
||||
setPath(explicitlySetPath: string): void;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
var RootPath: RootPath;
|
||||
export = RootPath;
|
||||
}
|
||||
+7
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ApplicationInsights-JS v0.22.14
|
||||
// Type definitions for ApplicationInsights-JS v0.23.2
|
||||
// Project: https://github.com/Microsoft/ApplicationInsights-JS
|
||||
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -788,3 +788,9 @@ declare module Microsoft.ApplicationInsights {
|
||||
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'applicationinsights-js' {
|
||||
export = appInsights;
|
||||
}
|
||||
|
||||
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
@@ -488,3 +488,25 @@ function test_formatter_PatternFormat() {
|
||||
|
||||
table.draw(view, { allowHtml: true, showRowNumber: true, width: '100%', height: '100%' });
|
||||
}
|
||||
|
||||
function test_ChartsLoad() {
|
||||
google.charts.load('current', {packages: ['corechart', 'table', 'sankey']});
|
||||
|
||||
function drawChart() {
|
||||
// Define the chart to be drawn.
|
||||
var data = new google.visualization.DataTable();
|
||||
data.addColumn('string', 'Element');
|
||||
data.addColumn('number', 'Percentage');
|
||||
data.addRows([
|
||||
['Nitrogen', 0.78],
|
||||
['Oxygen', 0.21],
|
||||
['Other', 0.01]
|
||||
]);
|
||||
|
||||
// Instantiate and draw the chart.
|
||||
var chart = new google.visualization.PieChart(document.getElementById('myPieChart'));
|
||||
chart.draw(data, null);
|
||||
}
|
||||
|
||||
google.charts.setOnLoadCallback(drawChart);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,12 @@ declare namespace google {
|
||||
function setOnLoadCallback(handler: Function): void;
|
||||
function setOnLoadCallback(handler: () => void): void;
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/basic_load_libs
|
||||
namespace charts {
|
||||
function load(version: string, packages: Object): void;
|
||||
function setOnLoadCallback(handler: Function): void;
|
||||
}
|
||||
|
||||
//https://developers.google.com/chart/interactive/docs/reference
|
||||
namespace visualization {
|
||||
|
||||
@@ -141,6 +147,7 @@ declare namespace google {
|
||||
id?: string;
|
||||
role?: string;
|
||||
pattern?: string;
|
||||
p?: any;
|
||||
}
|
||||
|
||||
export interface DataObject {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
///<reference path="gulp-insert.d.ts" />
|
||||
///<reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import * as gulp from 'gulp';
|
||||
import * as insert from 'gulp-insert';
|
||||
|
||||
gulp.task('gulp-insert-tests', () => {
|
||||
return gulp.src('*.js')
|
||||
.pipe(insert.prepend('/* Inserted using gulp-insert prepend method */\n'))
|
||||
.pipe(insert.prepend('\n/* Inserted using gulp-insert append method */'))
|
||||
.pipe(insert.wrap(
|
||||
'/* Inserted using gulp-insert wrap method */\n',
|
||||
'\n/* Inserted using gulp-insert wrap method */'
|
||||
))
|
||||
.pipe(insert.transform((contents, file) => {
|
||||
var comment = '/* Local file: ' + file.path + ' */\n';
|
||||
return comment + contents;
|
||||
}))
|
||||
.pipe(gulp.dest('gulp-insert'));
|
||||
});
|
||||
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// Type definitions for gulp-insert 0.5.0
|
||||
// Project: https://github.com/rschmukler/gulp-insert
|
||||
// Definitions by: Shant Marouti <https://github.com/shantmarouti>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
/// <reference path="../vinyl/vinyl.d.ts"/>
|
||||
|
||||
declare module 'gulp-insert' {
|
||||
|
||||
import File = require('vinyl');
|
||||
|
||||
interface Transformer {
|
||||
(contents: string, file: File): string
|
||||
}
|
||||
|
||||
namespace Insert {
|
||||
|
||||
/**
|
||||
* Prepends a string onto the contents
|
||||
* @param {string} content
|
||||
* @returns {NodeJS.ReadWriteStream}
|
||||
*/
|
||||
function prepend(content: string): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Appends a string onto the contents
|
||||
* @param {string} content
|
||||
* @returns {NodeJS.ReadWriteStream}
|
||||
*/
|
||||
function append(content: string): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Wraps the contents with two strings
|
||||
* @param {string} prepend
|
||||
* @param {string} append
|
||||
* @returns {NodeJS.ReadWriteStream}
|
||||
*/
|
||||
function wrap(prepend: string, append: string): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Calls a function with the contents of the file
|
||||
* @param {Transformer} transformer
|
||||
* @returns {NodeJS.ReadWriteStream}
|
||||
*/
|
||||
function transform(transformer: Transformer): NodeJS.ReadWriteStream;
|
||||
|
||||
}
|
||||
|
||||
module Insert { }
|
||||
export = Insert;
|
||||
}
|
||||
@@ -33,4 +33,10 @@ myScroll1.scrollToElement(document.getElementById('selectedElement'), 250);
|
||||
myScroll2.on('scrollStart', function () { console.log('scroll started'); });
|
||||
|
||||
var myScroll9 = new IScroll(document.getElementById('wrapper'));
|
||||
var myScroll10 = new IScroll(document.getElementById('wrapper'), { scrollbarClass: 'myScrollbar' });
|
||||
var myScroll10 = new IScroll(document.getElementById('wrapper'), { scrollbarClass: 'myScrollbar' });
|
||||
|
||||
var myScroll11 = new IScroll(document.getElementById('wrapper'), { preventDefaultException: [ /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ ] });
|
||||
var myScroll12 = new IScroll(document.getElementById('wrapper'), { preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ } });
|
||||
|
||||
var myScroll13 = new IScroll(document.getElementById('wrapper'), { bounceEasing: 'circular' });
|
||||
var myScroll14 = new IScroll(document.getElementById('wrapper'), { bounceEasing: { style: 'cubic-bezier(0,0,1,1)', fn: function (k) { return k; } } });
|
||||
|
||||
Vendored
+2
-2
@@ -51,10 +51,10 @@ interface IScrollOptions {
|
||||
bounceTime?: number;
|
||||
|
||||
///String or function
|
||||
bounceEasing?: any;
|
||||
bounceEasing?: string|{ style: string, fn: (k: any) => any };
|
||||
|
||||
preventDefault?: boolean;
|
||||
preventDefaultException?: boolean;
|
||||
preventDefaultException?: Array<RegExp>|Object;
|
||||
|
||||
HWCompositing?: boolean;
|
||||
|
||||
|
||||
Vendored
+6
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for jsonwebtoken 6.2.0
|
||||
// Type definitions for jsonwebtoken 7.1.6
|
||||
// Project: https://github.com/auth0/node-jsonwebtoken
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>, Daniel Heim <https://github.com/danielheim>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -49,14 +49,17 @@ declare module "jsonwebtoken" {
|
||||
jwtid?: string;
|
||||
noTimestamp?: boolean;
|
||||
header?: Object;
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
export interface VerifyOptions {
|
||||
algorithms?: string[];
|
||||
audience?: string;
|
||||
issuer?: string;
|
||||
audience?: string | string[];
|
||||
clockTolerance?: number;
|
||||
issuer?: string | string[];
|
||||
ignoreExpiration?: boolean;
|
||||
ignoreNotBefore?: boolean;
|
||||
jwtId?: string;
|
||||
subject?: string;
|
||||
/**
|
||||
*@deprecated
|
||||
|
||||
@@ -28,6 +28,12 @@ karma.runner.run({port: 9876}, (exitCode: number) => {
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
karma.stopper.stop({port: 9876}, function(exitCode) {
|
||||
if (exitCode === 0) {
|
||||
console.log('Server stop as initiated')
|
||||
}
|
||||
process.exit(exitCode)
|
||||
});
|
||||
|
||||
//var Server = require('karma').Server; => cannot use this syntax otherwise Server is of type any
|
||||
var server = new karma.Server({logLevel: 'debug', port: 9876}, function(exitCode: number) {
|
||||
@@ -48,7 +54,7 @@ server.on('run_complete', (browsers, results) => {
|
||||
results.error = false;
|
||||
results.exitCode = 0;
|
||||
results.failed = 9;
|
||||
results.success = 10;
|
||||
results.success = 10;
|
||||
});
|
||||
|
||||
//var runner = require('karma').runner; => cannot use this syntax otherwise runner is of type any
|
||||
|
||||
Vendored
+11
-1
@@ -27,6 +27,7 @@ declare module 'karma' {
|
||||
server: DeprecatedServer;
|
||||
Server: Server;
|
||||
runner: Runner;
|
||||
stopper: Stopper;
|
||||
launcher: Launcher;
|
||||
VERSION: string;
|
||||
}
|
||||
@@ -56,6 +57,15 @@ declare module 'karma' {
|
||||
run(options?: ConfigOptions | ConfigFile, callback?: ServerCallback): void;
|
||||
}
|
||||
|
||||
|
||||
interface Stopper {
|
||||
/**
|
||||
* This function will signal a running server to stop. The equivalent of karma stop.
|
||||
*/
|
||||
stop(options?: ConfigOptions, callback?: ServerCallback): void;
|
||||
}
|
||||
|
||||
|
||||
interface TestResults {
|
||||
disconnected: boolean;
|
||||
error: boolean;
|
||||
@@ -81,7 +91,7 @@ declare module 'karma' {
|
||||
refreshFiles(): Promise<any>;
|
||||
|
||||
on(event: string, listener: Function): this;
|
||||
|
||||
|
||||
/**
|
||||
* Listen to the 'run_complete' event.
|
||||
*/
|
||||
|
||||
@@ -7700,8 +7700,13 @@ namespace TestRound {
|
||||
// _.sum
|
||||
namespace TestSum {
|
||||
let array: number[];
|
||||
let objectArray: { 'age': number }[];
|
||||
|
||||
let list: _.List<number>;
|
||||
let objectList: _.List<{ 'age': number }>;
|
||||
|
||||
let dictionary: _.Dictionary<number>;
|
||||
let objectDictionary: _.Dictionary<{ 'age': number }>;
|
||||
|
||||
let listIterator: (value: number, index: number, collection: _.List<number>) => number;
|
||||
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => number;
|
||||
@@ -7713,36 +7718,36 @@ namespace TestSum {
|
||||
result = _.sum<number>(array);
|
||||
result = _.sum<number>(array, listIterator);
|
||||
result = _.sum<number>(array, listIterator, any);
|
||||
result = _.sum<number>(array, '');
|
||||
result = _.sum(objectArray, 'age');
|
||||
|
||||
|
||||
result = _.sum(list);
|
||||
result = _.sum<number>(list);
|
||||
result = _.sum<number>(list, listIterator);
|
||||
result = _.sum<number>(list, listIterator, any);
|
||||
result = _.sum<number>(list, '');
|
||||
result = _.sum(objectList, 'age');
|
||||
|
||||
result = _.sum(dictionary);
|
||||
result = _.sum<number>(dictionary);
|
||||
result = _.sum<number>(dictionary, dictionaryIterator);
|
||||
result = _.sum<number>(dictionary, dictionaryIterator, any);
|
||||
result = _.sum<number>(dictionary, '');
|
||||
result = _.sum(objectDictionary, 'age');
|
||||
|
||||
result = _(array).sum();
|
||||
result = _(array).sum(listIterator);
|
||||
result = _(array).sum(listIterator, any);
|
||||
result = _(array).sum('');
|
||||
result = _(objectArray).sum('age');
|
||||
|
||||
|
||||
result = _(list).sum();
|
||||
result = _(list).sum<number>(listIterator);
|
||||
result = _(list).sum<number>(listIterator, any);
|
||||
result = _(list).sum('');
|
||||
result = _(objectList).sum('age');
|
||||
|
||||
result = _(dictionary).sum();
|
||||
result = _(dictionary).sum<number>(dictionaryIterator);
|
||||
result = _(dictionary).sum<number>(dictionaryIterator, any);
|
||||
result = _(dictionary).sum('');
|
||||
result = _(objectDictionary).sum('age');
|
||||
}
|
||||
|
||||
{
|
||||
@@ -7751,18 +7756,18 @@ namespace TestSum {
|
||||
result = _(array).chain().sum();
|
||||
result = _(array).chain().sum(listIterator);
|
||||
result = _(array).chain().sum(listIterator, any);
|
||||
result = _(array).chain().sum('');
|
||||
result = _(objectArray).chain().sum('');
|
||||
|
||||
|
||||
result = _(list).chain().sum();
|
||||
result = _(list).chain().sum<number>(listIterator);
|
||||
result = _(list).chain().sum<number>(listIterator, any);
|
||||
result = _(list).chain().sum('');
|
||||
result = _(objectList).chain().sum('age');
|
||||
|
||||
result = _(dictionary).chain().sum();
|
||||
result = _(dictionary).chain().sum<number>(dictionaryIterator);
|
||||
result = _(dictionary).chain().sum<number>(dictionaryIterator, any);
|
||||
result = _(dictionary).chain().sum('');
|
||||
result = _(objectDictionary).chain().sum('age');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -12065,8 +12065,8 @@ declare module _ {
|
||||
/**
|
||||
* @see _.sum
|
||||
*/
|
||||
sum<T>(
|
||||
collection: List<number>|Dictionary<number>,
|
||||
sum(
|
||||
collection: List<{}>|Dictionary<{}>,
|
||||
iteratee: string
|
||||
): number;
|
||||
|
||||
|
||||
+17
-25
@@ -7896,49 +7896,41 @@ namespace TestSum {
|
||||
// _.sumBy
|
||||
namespace TestSumBy {
|
||||
let array: number[];
|
||||
let objectArray: { 'age': number }[];
|
||||
|
||||
let list: _.List<number>;
|
||||
let dictionary: _.Dictionary<number>;
|
||||
let objectList: _.List<{ 'age': number }>;
|
||||
|
||||
let listIterator: (value: number, index: number, collection: _.List<number>) => number;
|
||||
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => number;
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = _.sumBy<number>(array);
|
||||
result = _.sumBy<number>(array, listIterator);
|
||||
result = _.sumBy<number>(array, '');
|
||||
result = _.sumBy(array);
|
||||
result = _.sumBy(array, listIterator);
|
||||
result = _.sumBy(objectArray, 'age');
|
||||
result = _.sumBy(objectArray, { 'age': 30 });
|
||||
|
||||
|
||||
result = _.sumBy<number>(list);
|
||||
result = _.sumBy<number>(list, listIterator);
|
||||
result = _.sumBy<number>(list, '');
|
||||
|
||||
result = _.sumBy<number>(dictionary);
|
||||
result = _.sumBy<number>(dictionary, dictionaryIterator);
|
||||
result = _.sumBy<number>(dictionary, '');
|
||||
result = _.sumBy(list);
|
||||
result = _.sumBy(list, listIterator);
|
||||
result = _.sumBy(objectList, 'age');
|
||||
result = _.sumBy(objectList, { 'age': 30 });
|
||||
|
||||
result = _(array).sumBy(listIterator);
|
||||
result = _(array).sumBy('');
|
||||
result = _(objectArray).sumBy('age');
|
||||
|
||||
result = _(list).sumBy<number>(listIterator);
|
||||
result = _(list).sumBy('');
|
||||
|
||||
result = _(dictionary).sumBy<number>(dictionaryIterator);
|
||||
result = _(dictionary).sumBy('');
|
||||
result = _(list).sumBy(listIterator);
|
||||
result = _(objectList).sumBy('age');
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<number>;
|
||||
|
||||
result = _(array).chain().sumBy(listIterator);
|
||||
result = _(array).chain().sumBy('');
|
||||
result = _(objectArray).chain().sumBy('age');
|
||||
|
||||
result = _(list).chain().sumBy<number>(listIterator);
|
||||
result = _(list).chain().sumBy('');
|
||||
|
||||
result = _(dictionary).chain().sumBy<number>(dictionaryIterator);
|
||||
result = _(dictionary).chain().sumBy('');
|
||||
result = _(list).chain().sumBy(listIterator);
|
||||
result = _(objectList).chain().sumBy('age');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+22
-20
@@ -13475,31 +13475,28 @@ declare module _ {
|
||||
iteratee: ListIterator<T, number>
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sumBy
|
||||
**/
|
||||
sumBy<T>(
|
||||
collection: Dictionary<T>,
|
||||
iteratee: DictionaryIterator<T, number>
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy<T>(
|
||||
collection: List<number>|Dictionary<number>,
|
||||
sumBy(
|
||||
collection: List<{}>,
|
||||
iteratee: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy<T>(collection: List<T>|Dictionary<T>): number;
|
||||
sumBy(
|
||||
collection: List<number>
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy(collection: List<number>|Dictionary<number>): number;
|
||||
sumBy(
|
||||
collection: List<{}>,
|
||||
iteratee: Dictionary<{}>
|
||||
): number;
|
||||
}
|
||||
|
||||
interface LoDashImplicitArrayWrapper<T> {
|
||||
@@ -13518,15 +13515,15 @@ declare module _ {
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy(): number;
|
||||
sumBy(iteratee: Dictionary<{}>): number;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.sumBy
|
||||
**/
|
||||
sumBy<TValue>(
|
||||
iteratee: ListIterator<TValue, number>|DictionaryIterator<TValue, number>
|
||||
*/
|
||||
sumBy(
|
||||
iteratee: ListIterator<{}, number>
|
||||
): number;
|
||||
|
||||
/**
|
||||
@@ -13537,7 +13534,7 @@ declare module _ {
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy(): number;
|
||||
sumBy(iteratee: Dictionary<{}>): number;
|
||||
}
|
||||
|
||||
interface LoDashExplicitArrayWrapper<T> {
|
||||
@@ -13557,14 +13554,19 @@ declare module _ {
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy(): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy(iteratee: Dictionary<{}>): LoDashExplicitWrapper<number>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy<TValue>(
|
||||
iteratee: ListIterator<TValue, number>|DictionaryIterator<TValue, number>
|
||||
sumBy(
|
||||
iteratee: ListIterator<{}, number>
|
||||
): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
@@ -13575,7 +13577,7 @@ declare module _ {
|
||||
/**
|
||||
* @see _.sumBy
|
||||
*/
|
||||
sumBy(): LoDashExplicitWrapper<number>;
|
||||
sumBy(iteratee: Dictionary<{}>): LoDashExplicitWrapper<number>;
|
||||
}
|
||||
|
||||
/**********
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import mailparser_mod = require("mailparser");
|
||||
import MailParser = mailparser_mod.MailParser;
|
||||
import ParsedMail = mailparser_mod.ParsedMail;
|
||||
|
||||
import Attachment = mailparser_mod.Attachment;
|
||||
|
||||
|
||||
var mailparser = new MailParser();
|
||||
@@ -61,7 +61,7 @@ var mp = new MailParser({
|
||||
streamAttachments: true
|
||||
})
|
||||
|
||||
mp.on("attachment", function(attachment, mail){
|
||||
mp.on("attachment", function(attachment : Attachment, mail : ParsedMail){
|
||||
var output = fs.createWriteStream(attachment.generatedFileName);
|
||||
attachment.stream.pipe(output);
|
||||
});
|
||||
|
||||
Vendored
+3
@@ -8,6 +8,8 @@
|
||||
|
||||
|
||||
declare module 'mailparser' {
|
||||
import StreamModule = require("stream");
|
||||
import Stream = StreamModule.Stream;
|
||||
import WritableStream = NodeJS.WritableStream;
|
||||
import EventEmitter = NodeJS.EventEmitter;
|
||||
|
||||
@@ -36,6 +38,7 @@ declare module 'mailparser' {
|
||||
generatedFileName: string; // e.g. 'image.png'
|
||||
checksum: string; // the md5 hash of the file, e.g. 'e4cef4c6e26037bcf8166905207ea09b'
|
||||
content: Buffer; // possibly a SlowBuffer
|
||||
stream: Stream; // a stream to read the attachment if streamAttachments is set to true
|
||||
}
|
||||
|
||||
// emitted with the 'end' event
|
||||
|
||||
@@ -680,7 +680,7 @@ const FlatButtonExampleComplex = () => (
|
||||
</FlatButton>
|
||||
|
||||
<FlatButton
|
||||
label="Label before"
|
||||
label={<span>Label before</span>}
|
||||
labelPosition="before"
|
||||
primary={true}
|
||||
style={styles.button}
|
||||
@@ -741,7 +741,7 @@ const RaisedButtonExampleComplex = () => (
|
||||
<input type="file" style={styles.exampleImageInput} />
|
||||
</RaisedButton>
|
||||
<RaisedButton
|
||||
label="Label before"
|
||||
label={<span>Label before</span>}
|
||||
labelPosition="before"
|
||||
primary={true}
|
||||
icon={<ActionAndroid />}
|
||||
|
||||
Vendored
+2
-2
@@ -662,7 +662,7 @@ declare namespace __MaterialUI {
|
||||
hoverColor?: string;
|
||||
href?: string;
|
||||
icon?: React.ReactNode;
|
||||
label?: string;
|
||||
label?: React.ReactNode;
|
||||
labelPosition?: "before" | "after";
|
||||
labelStyle?: React.CSSProperties;
|
||||
linkButton?: boolean;
|
||||
@@ -688,7 +688,7 @@ declare namespace __MaterialUI {
|
||||
fullWidth?: boolean;
|
||||
href?: string;
|
||||
icon?: React.ReactNode;
|
||||
label?: string;
|
||||
label?: React.ReactNode;
|
||||
labelColor?: string;
|
||||
labelPosition?: "before" | "after";
|
||||
labelStyle?: React.CSSProperties;
|
||||
|
||||
Vendored
+23
-55
@@ -29,10 +29,6 @@ interface MochaSetupOptions {
|
||||
grep?: any;
|
||||
}
|
||||
|
||||
interface MochaDone {
|
||||
(error?: Error): void;
|
||||
}
|
||||
|
||||
declare var mocha: Mocha;
|
||||
declare var describe: Mocha.IContextDefinition;
|
||||
declare var xdescribe: Mocha.IContextDefinition;
|
||||
@@ -46,55 +42,29 @@ declare var xit: Mocha.ITestDefinition;
|
||||
declare var test: Mocha.ITestDefinition;
|
||||
declare var specify: Mocha.ITestDefinition;
|
||||
|
||||
declare function before(action: () => void): void;
|
||||
interface MochaDone {
|
||||
(error?: any): any;
|
||||
}
|
||||
|
||||
declare function before(action: (done: MochaDone) => void): void;
|
||||
interface ActionFunction {
|
||||
(done: MochaDone): any | PromiseLike<any>
|
||||
}
|
||||
|
||||
declare function before(description: string, action: () => void): void;
|
||||
|
||||
declare function before(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function setup(action: () => void): void;
|
||||
|
||||
declare function setup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
declare function after(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(description: string, action: () => void): void;
|
||||
|
||||
declare function after(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function teardown(action: () => void): void;
|
||||
|
||||
declare function teardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
declare function beforeEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(description: string, action: () => void): void;
|
||||
|
||||
declare function beforeEach(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteSetup(action: () => void): void;
|
||||
|
||||
declare function suiteSetup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
declare function afterEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(description: string, action: () => void): void;
|
||||
|
||||
declare function afterEach(description: string, action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteTeardown(action: () => void): void;
|
||||
|
||||
declare function suiteTeardown(action: (done: MochaDone) => void): void;
|
||||
declare function setup(action: ActionFunction): void;
|
||||
declare function teardown(action: ActionFunction): void;
|
||||
declare function suiteSetup(action: ActionFunction): void;
|
||||
declare function suiteTeardown(action: ActionFunction): void;
|
||||
declare function before(action: ActionFunction): void;
|
||||
declare function before(description: string, action: ActionFunction): void;
|
||||
declare function after(action: ActionFunction): void;
|
||||
declare function after(description: string, action: ActionFunction): void;
|
||||
declare function beforeEach(action: ActionFunction): void;
|
||||
declare function beforeEach(description: string, action: ActionFunction): void;
|
||||
declare function afterEach(action: ActionFunction): void;
|
||||
declare function afterEach(description: string, action: ActionFunction): void;
|
||||
|
||||
declare class Mocha {
|
||||
currentTest: Mocha.ITestDefinition;
|
||||
constructor(options?: {
|
||||
grep?: RegExp;
|
||||
ui?: string;
|
||||
@@ -176,13 +146,11 @@ declare namespace Mocha {
|
||||
}
|
||||
|
||||
interface ITestDefinition {
|
||||
(expectation: string, assertion?: () => void): ITest;
|
||||
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
only(expectation: string, assertion?: () => void): ITest;
|
||||
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
(expectation: string, assertion?: ActionFunction): ITest;
|
||||
only(expectation: string, assertion?: ActionFunction): ITest;
|
||||
skip(expectation: string, assertion?: ActionFunction): void;
|
||||
timeout(ms: number): void;
|
||||
state: "failed" | "passed";
|
||||
}
|
||||
|
||||
export module reporters {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path="mongoose-promise.d.ts" />
|
||||
|
||||
var cb = function () {};
|
||||
|
||||
var mongopromise: MongoosePromise<number>;
|
||||
mongopromise.addBack(function (err, arg) {
|
||||
err.stack;
|
||||
arg.toFixed();
|
||||
}).addBack(function (err, arg1, arg2) {
|
||||
err.stack;
|
||||
arg1.toFixed();
|
||||
arg2.toFixed();
|
||||
});
|
||||
mongopromise.addCallback(function (arg) {
|
||||
arg.toFixed();
|
||||
}).addCallback(function (arg1, arg2) {
|
||||
arg1.toFixed();
|
||||
arg2.toFixed();
|
||||
});
|
||||
mongopromise.addErrback(function (err) {
|
||||
err.stack;
|
||||
}).addErrback(cb);
|
||||
mongopromise.catch(function (err) {
|
||||
err.stack;
|
||||
}).catch(cb);
|
||||
mongopromise.end();
|
||||
mongopromise.error(999).error([]);
|
||||
mongopromise.on('init', cb).on('init', cb);
|
||||
mongopromise.reject({}).reject('').reject(new Error('hi'));
|
||||
mongopromise.resolve(new Error('hi'), {}).resolve();
|
||||
mongopromise.then(function (arg) {
|
||||
arg.toFixed();
|
||||
return 9;
|
||||
}, function (err) {
|
||||
err.stack;
|
||||
return 9;
|
||||
}).then(function (arg1, arg2) {
|
||||
arg1.toFixed();
|
||||
arg2.toFixed();
|
||||
});
|
||||
mongopromise.complete();
|
||||
/* static properties */
|
||||
MongoosePromise.ES6(function (complete, error) {
|
||||
complete.apply(this);
|
||||
error.apply(this);
|
||||
});
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
// Type definitions for Mongoose-Promise 4.5.4
|
||||
// Project: http://mongoosejs.com/
|
||||
// Definitions by: simonxca <https://github.com/simonxca/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/*
|
||||
* These are the default promises included in the Mongoose v4.x
|
||||
* definitions. They will be deprecated beginning Mongoose V5.x
|
||||
* in favor of native ES6 Promises.
|
||||
*
|
||||
* You can switch the promise library that mongoose uses by:
|
||||
*
|
||||
* 1. Including this somewhere in your code:
|
||||
* mongoose.Promise = YOUR_PROMISE;
|
||||
*
|
||||
* 2. Including this somewhere in your main .d.ts file:
|
||||
* type MongoosePromise<T> = YOUR_PROMISE<T>;
|
||||
*/
|
||||
|
||||
/*
|
||||
* http://mongoosejs.com/docs/api.html#promise-js
|
||||
*
|
||||
* Callback signatures are from the mPromise type definitions.
|
||||
*/
|
||||
interface MongoosePromise<T> {
|
||||
/**
|
||||
* Promise constructor.
|
||||
* Promises are returned from executed queries.
|
||||
* @param fn a function which will be called when the promise
|
||||
* is resolved that accepts fn(err, ...){} as signature
|
||||
* @event err Emits when the promise is rejected
|
||||
* @event complete Emits when the promise is fulfilled
|
||||
* @deprecated Mongoose 5.0 will use native promises by default (or bluebird, if native
|
||||
* promises are not present) but still support plugging in your own ES6-compatible
|
||||
* promises library. Mongoose 5.0 will not support mpromise.
|
||||
*/
|
||||
new(fn?: (err: any, arg: T) => void): MongoosePromise<T>;
|
||||
new(fn?: (err: any, ...args: T[]) => void): MongoosePromise<T>;
|
||||
}
|
||||
|
||||
declare class MongoosePromise<T> {
|
||||
/**
|
||||
* Adds a single function as a listener to both err and complete.
|
||||
* It will be executed with traditional node.js argument position when the promise is resolved.
|
||||
* @deprecated Use onResolve instead.
|
||||
*/
|
||||
addBack(listener: (err: any, arg: T) => void): this;
|
||||
addBack(listener: (err: any, ...args: T[]) => void): this;
|
||||
|
||||
/**
|
||||
* Adds a listener to the complete (success) event.
|
||||
* @deprecated Adds a listener to the complete (success) event.
|
||||
*/
|
||||
addCallback(listener: (arg: T) => void): this;
|
||||
addCallback(listener: (...args: T[]) => void): this;
|
||||
|
||||
/**
|
||||
* Adds a listener to the err (rejected) event.
|
||||
* @deprecated Use onReject instead.
|
||||
*/
|
||||
addErrback(listener: (err: any) => void): this;
|
||||
|
||||
/** ES6-style .catch() shorthand */
|
||||
catch<TRes>(onReject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
|
||||
/**
|
||||
* Signifies that this promise was the last in a chain of then()s: if a handler passed
|
||||
* to the call to then which produced this promise throws, the exception will go uncaught.
|
||||
*/
|
||||
end(): void;
|
||||
|
||||
/**
|
||||
* Rejects this promise with err.
|
||||
* If the promise has already been fulfilled or rejected, not action is taken.
|
||||
* Differs from #reject by first casting err to an Error if it is not instanceof Error.
|
||||
*/
|
||||
error(err: any): this;
|
||||
|
||||
/**
|
||||
* Adds listener to the event.
|
||||
* If event is either the success or failure event and the event has already been emitted,
|
||||
* thelistener is called immediately and passed the results of the original emitted event.
|
||||
*/
|
||||
on(event: string, listener: Function): this;
|
||||
|
||||
/**
|
||||
* Rejects this promise with reason.
|
||||
* If the promise has already been fulfilled or rejected, not action is taken.
|
||||
*/
|
||||
reject(reason: Object | string | Error): this;
|
||||
|
||||
/**
|
||||
* Resolves this promise to a rejected state if err is passed or a fulfilled state if no err is passed.
|
||||
* If the promise has already been fulfilled or rejected, not action is taken.
|
||||
* err will be cast to an Error if not already instanceof Error.
|
||||
* NOTE: overrides mpromise#resolve to provide error casting.
|
||||
* @param err error or null
|
||||
* @param val value to fulfill the promise with
|
||||
*/
|
||||
resolve(err?: any, val?: Object): this;
|
||||
|
||||
/**
|
||||
* Creates a new promise and returns it. If onFulfill or onReject are passed, they are added as
|
||||
* SUCCESS/ERROR callbacks to this promise after the nextTick.
|
||||
* Conforms to promises/A+ specification.
|
||||
*/
|
||||
then<TRes>(onFulFill: (arg: T) => void | TRes | PromiseLike<TRes>,
|
||||
onReject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
then<TRes>(onFulfill: (...args: T[]) => void | TRes | PromiseLike<TRes>,
|
||||
onReject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
|
||||
/**
|
||||
* Fulfills this promise with passed arguments. Alias of mpromise#fulfill.
|
||||
* @deprecated Use fulfill instead.
|
||||
*/
|
||||
complete(args: T): this;
|
||||
complete(...args: T[]): this;
|
||||
|
||||
/** Fulfills this promise with passed arguments. */
|
||||
fulfill(...args: T[]): this;
|
||||
fulfill(arg: T): this;
|
||||
|
||||
/** ES6-style promise constructor wrapper around mpromise. */
|
||||
static ES6<TRes>(resolver: (
|
||||
complete: (...args: TRes[]) => void | TRes | PromiseLike<TRes>,
|
||||
error: (e: any) => void | TRes | PromiseLike<TRes>
|
||||
) => void): MongoosePromise<TRes>;
|
||||
}
|
||||
+23
-16
@@ -1,5 +1,4 @@
|
||||
/// <reference path="mongoose.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
import * as mongoose from 'mongoose';
|
||||
var fs = require('fs');
|
||||
@@ -28,7 +27,7 @@ mongoose.connect(connectUri, {
|
||||
autoIndex: true
|
||||
},
|
||||
mongos: true
|
||||
}).then(cb).onReject;
|
||||
}).then(cb).fulfill();
|
||||
mongoose.connect(connectUri, function (error) {
|
||||
error.stack;
|
||||
});
|
||||
@@ -102,9 +101,15 @@ coll1.getIndexes();
|
||||
coll1.collectionName;
|
||||
coll1.conn;
|
||||
coll1.name;
|
||||
coll1.insureIndex();
|
||||
coll1.ensureIndex();
|
||||
coll1.find({});
|
||||
coll1.insert({}, {}, {});
|
||||
coll1.insert({}, {});
|
||||
|
||||
var coll2 = new mongoose.Collection('', new mongoose.Connection(null));
|
||||
coll2.$format(999).toLowerCase();
|
||||
/* inherited properties */
|
||||
coll2.initializeOrderedBulkOp;
|
||||
coll2.indexExists;
|
||||
|
||||
/*
|
||||
* section connection.js
|
||||
@@ -862,10 +867,10 @@ schemaembedded.sparse(true);
|
||||
*/
|
||||
var aggregate: mongoose.Aggregate<Object[]>;
|
||||
aggregate = mongoose.model('ex').aggregate({ $match: { age: { $gte: 21 }}});
|
||||
aggregate = new mongoose.Aggregate();
|
||||
aggregate = new mongoose.Aggregate({ $project: { a: 1, b: 1 } });
|
||||
aggregate = new mongoose.Aggregate({ $project: { a: 1, b: 1 } }, { $skip: 5 });
|
||||
aggregate = new mongoose.Aggregate([{ $project: { a: 1, b: 1 } }, { $skip: 5 }]);
|
||||
aggregate = new mongoose.Aggregate<Object[]>();
|
||||
aggregate = new mongoose.Aggregate<Object[]>({ $project: { a: 1, b: 1 } });
|
||||
aggregate = new mongoose.Aggregate<Object[]>({ $project: { a: 1, b: 1 } }, { $skip: 5 });
|
||||
aggregate = new mongoose.Aggregate<Object[]>([{ $project: { a: 1, b: 1 } }, { $skip: 5 }]);
|
||||
aggregate.addCursorFlag('flag', true).addCursorFlag('', false);
|
||||
aggregate.allowDiskUse(true).allowDiskUse(false, []);
|
||||
aggregate.append({ $project: { field: 1 }}, { $limit: 2 });
|
||||
@@ -1012,6 +1017,7 @@ mongoose.model('')
|
||||
return (mongoose.model('')).findOne({}).exec();
|
||||
}).then(function (arg) {
|
||||
arg.save;
|
||||
return 1;
|
||||
}).catch(function (err) {
|
||||
return 1;
|
||||
}).then(function (arg) {
|
||||
@@ -1054,6 +1060,9 @@ mongoose.Promise = Promise;
|
||||
mongoose.Promise.race;
|
||||
mongoose.Promise.all;
|
||||
|
||||
mongoose.model('').findOne()
|
||||
.exec().addErrback(cb);
|
||||
|
||||
/*
|
||||
* section model.js
|
||||
* http://mongoosejs.com/docs/api.html#model-js
|
||||
@@ -1097,10 +1106,8 @@ MongoModel.create({
|
||||
type: 'jelly bean'
|
||||
}, {
|
||||
type: 'snickers'
|
||||
}, cb).then(function (a, b, c) {
|
||||
}, cb).then(function (a) {
|
||||
a.save();
|
||||
b.save();
|
||||
c.save();
|
||||
})
|
||||
MongoModel.create([{ type: 'jelly bean' }, {
|
||||
type: 'snickers'
|
||||
@@ -1125,8 +1132,6 @@ MongoModel.find({ name: /john/i }, 'name friends', function (err, docs) { })
|
||||
MongoModel.find({ name: /john/i }, null, { skip: 10 })
|
||||
MongoModel.find({ name: /john/i }, null, { skip: 10 }, function (err, docs) {});
|
||||
MongoModel.find({ name: /john/i }, null, { skip: 10 }).exec(function (err, docs) {});
|
||||
MongoModel.find({ name: /john/i }, null, { skip: 10 }).exec()
|
||||
.addBack(function (err, docs) {});
|
||||
MongoModel.findById(999, function (err, adventure) {});
|
||||
MongoModel.findById(999).exec(cb);
|
||||
MongoModel.findById(999, 'name length', function (err, adventure) {
|
||||
@@ -1192,11 +1197,11 @@ MongoModel.mapReduce({
|
||||
reduce: cb
|
||||
}, function (err, results) {
|
||||
console.log(results)
|
||||
}).then(function (model, stats) {
|
||||
}).then(function (model) {
|
||||
return model.find().where('value').gt(10).exec();
|
||||
}).then(function (docs) {
|
||||
console.log(docs);
|
||||
}).then(null, cb).end();
|
||||
}).then(null, cb);
|
||||
MongoModel.findById(999, function (err, user) {
|
||||
var opts = [
|
||||
{ path: 'company', match: { x: 1 }, select: 'name' }
|
||||
@@ -1210,7 +1215,7 @@ MongoModel.findById(999, function (err, user) {
|
||||
MongoModel.find(999, function (err, users) {
|
||||
var opts = [{ path: 'company', match: { x: 1 }, select: 'name' }]
|
||||
var promise = MongoModel.populate(users, opts);
|
||||
promise.then(console.log).end();
|
||||
promise.then(console.log);
|
||||
});
|
||||
MongoModel.populate({
|
||||
name: 'Indiana Jones',
|
||||
@@ -1233,6 +1238,8 @@ MongoModel.where('age').gte(21).lte(65).where('name', /^b/i);
|
||||
new (mongoModel.base.model(''))();
|
||||
mongoModel.baseModelName.toLowerCase();
|
||||
mongoModel.collection.$format(99);
|
||||
mongoModel.collection.initializeOrderedBulkOp;
|
||||
mongoModel.collection.findOne;
|
||||
mongoModel.db.openSet('');
|
||||
mongoModel.discriminators;
|
||||
mongoModel.modelName.toLowerCase();
|
||||
|
||||
Vendored
+58
-171
@@ -6,6 +6,7 @@
|
||||
///<reference path="../mongodb/mongodb.d.ts" />
|
||||
///<reference path="../mpromise/mpromise.d.ts" />
|
||||
///<reference path="../node/node.d.ts" />
|
||||
///<reference path="../mongoose-promise/mongoose-promise.d.ts" />
|
||||
|
||||
/*
|
||||
* Guidelines for maintaining these definitions:
|
||||
@@ -76,7 +77,6 @@ To find a section, CTRL+F and type "section ___.js"
|
||||
declare module "mongoose" {
|
||||
import events = require('events');
|
||||
import mongodb = require('mongodb');
|
||||
import mPromise = require('mpromise');
|
||||
import stream = require('stream');
|
||||
|
||||
/*
|
||||
@@ -127,7 +127,7 @@ declare module "mongoose" {
|
||||
/* Class constructors */
|
||||
static Aggregate: typeof _mongoose.Aggregate;
|
||||
static CastError: typeof _mongoose.CastError;
|
||||
static Collection: typeof _mongoose.Collection;
|
||||
static Collection: _mongoose.Collection;
|
||||
static Connection: typeof _mongoose.Connection;
|
||||
static Document: typeof _mongoose.Document;
|
||||
static DocumentProvider: any;
|
||||
@@ -138,20 +138,15 @@ declare module "mongoose" {
|
||||
new(...args: any[]): typeof mongoose;
|
||||
}
|
||||
/**
|
||||
* To use your own promise library:
|
||||
* mongoose.Promise = bluebird;
|
||||
* mongoose.Promise = q;
|
||||
* To assign your own promise library:
|
||||
*
|
||||
* Note: you will lose type-checking and code completion
|
||||
* provided by mongoose's built-in promises.
|
||||
* 1. Include this somewhere in your code:
|
||||
* mongoose.Promise = YOUR_PROMISE;
|
||||
*
|
||||
* To use, either:
|
||||
* - Access its methods using []
|
||||
* query.exec()['reduce']().then() // the rest works normally
|
||||
* - Cast to <any>
|
||||
* (<any>Model).find().exec().reduce().then()
|
||||
* 2. Include this somewhere in your main .d.ts file:
|
||||
* type MongoosePromise<T> = YOUR_PROMISE<T>;
|
||||
*/
|
||||
static Promise: typeof _mongoose.Promise | any;
|
||||
static Promise: any;
|
||||
static PromiseProvider: any;
|
||||
static Query: typeof _mongoose.ModelQuery;
|
||||
static Schema: typeof _mongoose.Schema;
|
||||
@@ -261,7 +256,7 @@ declare module "mongoose" {
|
||||
type model<T> = _mongoose.Model<T>;
|
||||
type Model<T> = _mongoose.ModelConstructor<T>;
|
||||
type Mongoose = typeof mongoose;
|
||||
interface Promise<T> extends _mongoose.Promise<T> {}
|
||||
interface Promise<T> extends MongoosePromise<T> {}
|
||||
interface Query<T> extends _mongoose.Query<T> {}
|
||||
interface QueryCursor<T> extends _mongoose.QueryCursor<T> {}
|
||||
interface QueryStream extends _mongoose.QueryStream {}
|
||||
@@ -310,13 +305,13 @@ declare module "mongoose" {
|
||||
* and .disconnect().then() are viable.
|
||||
*/
|
||||
static then<TRes>(onFulfill?: () => void | TRes | PromiseLike<TRes>,
|
||||
onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
|
||||
onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
|
||||
/**
|
||||
* Ability to use mongoose object as a pseudo-promise so .connect().then()
|
||||
* and .disconnect().then() are viable.
|
||||
*/
|
||||
static catch<TRes>(onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
|
||||
static catch<TRes>(onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
}
|
||||
|
||||
class CastError extends _mongoose.Error {
|
||||
@@ -427,7 +422,7 @@ declare module "mongoose" {
|
||||
callback?: (err: any) => void): any;
|
||||
|
||||
/** Closes the connection */
|
||||
close(callback?: (err: any) => void): Promise<void>;
|
||||
close(callback?: (err: any) => void): MongoosePromise<void>;
|
||||
|
||||
/**
|
||||
* Retrieves a collection, creating it if not cached.
|
||||
@@ -513,7 +508,14 @@ declare module "mongoose" {
|
||||
* section drivers/node-mongodb-native/collection.js
|
||||
* http://mongoosejs.com/docs/api.html#drivers-node-mongodb-native-collection-js
|
||||
*/
|
||||
class Collection extends CollectionBase {
|
||||
interface Collection extends CollectionBase {
|
||||
/**
|
||||
* Collection constructor
|
||||
* @param name name of the collection
|
||||
* @param conn A MongooseConnection instance
|
||||
* @param opts optional collection options
|
||||
*/
|
||||
new(name: string, conn: Connection, opts?: Object): Collection;
|
||||
/** Formatter for debug print args */
|
||||
$format(arg: any): string;
|
||||
/** Debug print helper */
|
||||
@@ -598,7 +600,7 @@ declare module "mongoose" {
|
||||
constructor(query: Query<T>, options: Object): QueryCursor<T>;
|
||||
|
||||
/** Marks this cursor as closed. Will stop streaming and subsequent calls to next() will error. */
|
||||
close(callback?: (error: any, result: any) => void): Promise<any>;
|
||||
close(callback?: (error: any, result: any) => void): MongoosePromise<any>;
|
||||
|
||||
/**
|
||||
* Execute fn for every document in the cursor. If fn returns a promise,
|
||||
@@ -606,13 +608,13 @@ declare module "mongoose" {
|
||||
* Returns a promise that resolves when done.
|
||||
* @param callback executed when all docs have been processed
|
||||
*/
|
||||
eachAsync(fn: (doc: Model<T>) => any, callback?: (err: any) => void): Promise<Model<T>>;
|
||||
eachAsync(fn: (doc: Model<T>) => any, callback?: (err: any) => void): MongoosePromise<Model<T>>;
|
||||
|
||||
/**
|
||||
* Get the next document from this cursor. Will return null when there are
|
||||
* no documents left.
|
||||
*/
|
||||
next(callback?: (err: any) => void): Promise<any>;
|
||||
next(callback?: (err: any) => void): MongoosePromise<any>;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -869,7 +871,7 @@ declare module "mongoose" {
|
||||
* Useful for ES2015 integration.
|
||||
* @returns promise that resolves to the document when population is done
|
||||
*/
|
||||
execPopulate(): Promise<this>;
|
||||
execPopulate(): MongoosePromise<this>;
|
||||
|
||||
/**
|
||||
* Returns the value of a path.
|
||||
@@ -988,8 +990,8 @@ declare module "mongoose" {
|
||||
* @param optional options internal options
|
||||
* @param callback callback called after validation completes, passing an error if one occurred
|
||||
*/
|
||||
validate(callback?: (err: any) => void): Promise<void>;
|
||||
validate(optional: Object, callback?: (err: any) => void): Promise<void>;
|
||||
validate(callback?: (err: any) => void): MongoosePromise<void>;
|
||||
validate(optional: Object, callback?: (err: any) => void): MongoosePromise<void>;
|
||||
|
||||
/**
|
||||
* Executes registered validation rules (skipping asynchronous validators) for this document.
|
||||
@@ -1308,7 +1310,7 @@ declare module "mongoose" {
|
||||
* resolved with either the doc(s) or rejected with the error.
|
||||
* Like .then(), but only takes a rejection handler.
|
||||
*/
|
||||
catch<TRes>(reject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
|
||||
catch<TRes>(reject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
|
||||
/**
|
||||
* DEPRECATED Alias for circle
|
||||
@@ -1361,8 +1363,8 @@ declare module "mongoose" {
|
||||
equals(val: Object): this;
|
||||
|
||||
/** Executes the query */
|
||||
exec(callback?: (err: any, res: T) => void): Promise<T>;
|
||||
exec(operation: string | Function, callback?: (err: any, res: T) => void): Promise<T>;
|
||||
exec(callback?: (err: any, res: T) => void): MongoosePromise<T>;
|
||||
exec(operation: string | Function, callback?: (err: any, res: T) => void): MongoosePromise<T>;
|
||||
|
||||
/** Specifies an $exists condition */
|
||||
exists(val?: boolean): this;
|
||||
@@ -1653,7 +1655,7 @@ declare module "mongoose" {
|
||||
|
||||
/** Executes this query and returns a promise */
|
||||
then<TRes>(resolve?: (res: T) => void | TRes | PromiseLike<TRes>,
|
||||
reject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
|
||||
reject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
|
||||
/**
|
||||
* Converts this query to a customized, reusable query
|
||||
@@ -1996,10 +1998,10 @@ declare module "mongoose" {
|
||||
|
||||
// If cursor option is on, could return an object
|
||||
/** Executes the aggregate pipeline on the currently bound Model. */
|
||||
exec(callback?: (err: any, result: T) => void): Promise<T> | any;
|
||||
exec(callback?: (err: any, result: T) => void): MongoosePromise<T> | any;
|
||||
|
||||
/** Execute the aggregation with explain */
|
||||
explain(callback?: (err: any, result: T) => void): Promise<T>;
|
||||
explain(callback?: (err: any, result: T) => void): MongoosePromise<T>;
|
||||
|
||||
/**
|
||||
* Appends a new custom $group operator to this aggregate pipeline.
|
||||
@@ -2074,7 +2076,7 @@ declare module "mongoose" {
|
||||
|
||||
/** Provides promise for aggregate. */
|
||||
then<TRes>(resolve?: (val: T) => void | TRes | PromiseLike<TRes>,
|
||||
reject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>
|
||||
reject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>
|
||||
|
||||
/**
|
||||
* Appends new custom $unwind operator(s) to this aggregate pipeline.
|
||||
@@ -2142,115 +2144,6 @@ declare module "mongoose" {
|
||||
type?: string): this;
|
||||
}
|
||||
|
||||
/*
|
||||
* section promise.js
|
||||
* http://mongoosejs.com/docs/api.html#promise-js
|
||||
*
|
||||
* Callback signatures are from the mPromise type definitions
|
||||
*/
|
||||
class Promise<T> extends mPromise<T, any> {
|
||||
/**
|
||||
* Promise constructor.
|
||||
* Promises are returned from executed queries.
|
||||
* @param fn a function which will be called when the promise
|
||||
* is resolved that accepts fn(err, ...){} as signature
|
||||
* @event err Emits when the promise is rejected
|
||||
* @event complete Emits when the promise is fulfilled
|
||||
* @deprecated Mongoose 5.0 will use native promises by default (or bluebird, if native
|
||||
* promises are not present) but still support plugging in your own ES6-compatible
|
||||
* promises library. Mongoose 5.0 will not support mpromise.
|
||||
*/
|
||||
constructor(fn?: (err: any, arg: T) => void);
|
||||
constructor(fn?: (err: any, ...args: T[]) => void);
|
||||
|
||||
/**
|
||||
* Adds a single function as a listener to both err and complete.
|
||||
* It will be executed with traditional node.js argument position when the promise is resolved.
|
||||
* @deprecated Use onResolve instead.
|
||||
*/
|
||||
addBack(listener: (err: any, arg: T) => void): this;
|
||||
addBack(listener: (err: any, ...args: T[]) => void): this;
|
||||
|
||||
/**
|
||||
* Adds a listener to the complete (success) event.
|
||||
* @deprecated Adds a listener to the complete (success) event.
|
||||
*/
|
||||
addCallback(listener: (arg: T) => void): this;
|
||||
addCallback(listener: (...args: T[]) => void): this;
|
||||
|
||||
/**
|
||||
* Adds a listener to the err (rejected) event.
|
||||
* @deprecated Use onReject instead.
|
||||
*/
|
||||
addErrback(listener: (err: any) => void): this;
|
||||
|
||||
/** ES6-style .catch() shorthand */
|
||||
catch<TRes>(onReject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
|
||||
|
||||
/**
|
||||
* Signifies that this promise was the last in a chain of then()s: if a handler passed
|
||||
* to the call to then which produced this promise throws, the exception will go uncaught.
|
||||
*/
|
||||
end(): void;
|
||||
|
||||
/**
|
||||
* Rejects this promise with err.
|
||||
* If the promise has already been fulfilled or rejected, not action is taken.
|
||||
* Differs from #reject by first casting err to an Error if it is not instanceof Error.
|
||||
*/
|
||||
error(err: any): this;
|
||||
|
||||
/**
|
||||
* Adds listener to the event.
|
||||
* If event is either the success or failure event and the event has already been emitted,
|
||||
* thelistener is called immediately and passed the results of the original emitted event.
|
||||
*/
|
||||
on(event: string, listener: Function): this;
|
||||
|
||||
/**
|
||||
* Rejects this promise with reason.
|
||||
* If the promise has already been fulfilled or rejected, not action is taken.
|
||||
*/
|
||||
reject(reason: Object | string | NativeError): this;
|
||||
|
||||
/**
|
||||
* Resolves this promise to a rejected state if err is passed or a fulfilled state if no err is passed.
|
||||
* If the promise has already been fulfilled or rejected, not action is taken.
|
||||
* err will be cast to an Error if not already instanceof Error.
|
||||
* NOTE: overrides mpromise#resolve to provide error casting.
|
||||
* @param err error or null
|
||||
* @param val value to fulfill the promise with
|
||||
*/
|
||||
resolve(err?: any, val?: Object): this;
|
||||
|
||||
/**
|
||||
* Creates a new promise and returns it. If onFulfill or onReject are passed, they are added as
|
||||
* SUCCESS/ERROR callbacks to this promise after the nextTick.
|
||||
* Conforms to promises/A+ specification.
|
||||
*/
|
||||
then<TRes>(onFulFill: (arg: T) => void | TRes | PromiseLike<TRes>,
|
||||
onReject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
|
||||
then<TRes>(onFulfill: (...args: T[]) => void | TRes | PromiseLike<TRes>,
|
||||
onReject?: (err: any) => void | TRes | PromiseLike<TRes>): Promise<TRes>;
|
||||
|
||||
/**
|
||||
* Fulfills this promise with passed arguments. Alias of mpromise#fulfill.
|
||||
* @deprecated Use fulfill instead.
|
||||
*/
|
||||
complete(args: T): this;
|
||||
complete(...args: T[]): this;
|
||||
|
||||
/** Fulfills this promise with passed arguments. */
|
||||
fulfill(...args: T[]): this;
|
||||
fulfill(arg: T): this;
|
||||
|
||||
/** ES6-style promise constructor wrapper around mpromise. */
|
||||
static ES6<TRes>(resolver: (
|
||||
complete: (...args: TRes[]) => void | TRes | PromiseLike<TRes>,
|
||||
error: (e: any) => void | TRes | PromiseLike<TRes>
|
||||
) => void): Promise<TRes>;
|
||||
}
|
||||
|
||||
/*
|
||||
* section model.js
|
||||
* http://mongoosejs.com/docs/api.html#model-js
|
||||
@@ -2310,7 +2203,7 @@ declare module "mongoose" {
|
||||
* @param ... aggregation pipeline operator(s) or operator array
|
||||
*/
|
||||
aggregate(...aggregations: Object[]): Aggregate<Object[]>;
|
||||
aggregate(...aggregationsWithCallback: Object[]): Promise<Object[]>;
|
||||
aggregate(...aggregationsWithCallback: Object[]): MongoosePromise<Object[]>;
|
||||
|
||||
/** Counts number of matching documents in a database collection. */
|
||||
count(conditions: Object, callback?: (err: any, count: number) => void): Query<number>;
|
||||
@@ -2320,9 +2213,9 @@ declare module "mongoose" {
|
||||
* does new MyModel(doc).save() for every doc in docs.
|
||||
* Triggers the save() hook.
|
||||
*/
|
||||
create(docs: any[], callback?: (err: any, res: Model<T>[]) => void): Promise<Model<T>[]>;
|
||||
create(...docs: Object[]): Promise<Model<T>>;
|
||||
create(...docsWithCallback: Object[]): Promise<Model<T>>;
|
||||
create(docs: any[], callback?: (err: any, res: Model<T>[]) => void): MongoosePromise<Model<T>[]>;
|
||||
create(...docs: Object[]): MongoosePromise<Model<T>>;
|
||||
create(...docsWithCallback: Object[]): MongoosePromise<Model<T>>;
|
||||
|
||||
/**
|
||||
* Adds a discriminator type.
|
||||
@@ -2341,8 +2234,8 @@ declare module "mongoose" {
|
||||
* @param options internal options
|
||||
* @param cb optional callback
|
||||
*/
|
||||
ensureIndexes(callback?: (err: any) => void): Promise<void>;
|
||||
ensureIndexes(options: Object, callback?: (err: any) => void): Promise<void>;
|
||||
ensureIndexes(callback?: (err: any) => void): MongoosePromise<void>;
|
||||
ensureIndexes(options: Object, callback?: (err: any) => void): MongoosePromise<void>;
|
||||
|
||||
/**
|
||||
* Finds documents.
|
||||
@@ -2477,9 +2370,9 @@ declare module "mongoose" {
|
||||
* document.
|
||||
* This function does not trigger save middleware.
|
||||
*/
|
||||
insertMany(docs: any[], callback?: (error: any, docs: Model<T>[]) => void): Promise<Model<T>[]>;
|
||||
insertMany(doc: any, callback?: (error: any, doc: Model<T>) => void): Promise<Model<T>>;
|
||||
insertMany(...docsWithCallback: Object[]): Promise<Model<T>>;
|
||||
insertMany(docs: any[], callback?: (error: any, docs: Model<T>[]) => void): MongoosePromise<Model<T>[]>;
|
||||
insertMany(doc: any, callback?: (error: any, doc: Model<T>) => void): MongoosePromise<Model<T>>;
|
||||
insertMany(...docsWithCallback: Object[]): MongoosePromise<Model<T>>;
|
||||
|
||||
/**
|
||||
* Executes a mapReduce command.
|
||||
@@ -2489,7 +2382,7 @@ declare module "mongoose" {
|
||||
mapReduce<Key, Value>(
|
||||
o: ModelMapReduceOption<Model<T>, Key, Value>,
|
||||
callback?: (err: any, res: any) => void
|
||||
): Promise<any>;
|
||||
): MongoosePromise<any>;
|
||||
|
||||
/**
|
||||
* Populates document references.
|
||||
@@ -2498,9 +2391,9 @@ declare module "mongoose" {
|
||||
* @param callback Optional callback, executed upon completion. Receives err and the doc(s).
|
||||
*/
|
||||
populate(docs: Object[], options: ModelPopulateOptions | ModelPopulateOptions[],
|
||||
callback?: (err: any, res: Model<T>[]) => void): Promise<Model<T>[]>;
|
||||
callback?: (err: any, res: Model<T>[]) => void): MongoosePromise<Model<T>[]>;
|
||||
populate<T>(docs: Object, options: ModelPopulateOptions | ModelPopulateOptions[],
|
||||
callback?: (err: any, res: Model<T>) => void): Promise<Model<T>>;
|
||||
callback?: (err: any, res: Model<T>) => void): MongoosePromise<Model<T>>;
|
||||
|
||||
/** Removes documents from the collection. */
|
||||
remove(conditions: Object, callback?: (err: any) => void): Query<void>;
|
||||
@@ -2532,7 +2425,7 @@ declare module "mongoose" {
|
||||
* Removes this document from the db.
|
||||
* @param fn optional callback
|
||||
*/
|
||||
remove(fn?: (err: any, product: Model<T>) => void): Promise<Model<T>>;
|
||||
remove(fn?: (err: any, product: Model<T>) => void): MongoosePromise<Model<T>>;
|
||||
|
||||
/**
|
||||
* Saves this document.
|
||||
@@ -2541,7 +2434,7 @@ declare module "mongoose" {
|
||||
* @param options.validateBeforeSave set to false to save without validating.
|
||||
* @param fn optional callback
|
||||
*/
|
||||
save(fn?: (err: any, product: Model<T>, numAffected: number) => void): Promise<Model<T>>;
|
||||
save(fn?: (err: any, product: Model<T>, numAffected: number) => void): MongoosePromise<Model<T>>;
|
||||
|
||||
/** Base Mongoose instance the model uses. */
|
||||
base: typeof mongoose;
|
||||
@@ -2683,26 +2576,20 @@ declare module "mongoose" {
|
||||
* section collection.js
|
||||
* http://mongoosejs.com/docs/api.html#collection-js
|
||||
*/
|
||||
abstract class CollectionBase {
|
||||
/**
|
||||
* Abstract Collection constructor
|
||||
* This is the base class that drivers inherit from and implement.
|
||||
* @param name name of the collection
|
||||
* @param conn A MongooseConnection instance
|
||||
* @param opts optional collection options
|
||||
interface CollectionBase extends mongodb.Collection {
|
||||
/*
|
||||
* Abstract methods. Some of these are already defined on the
|
||||
* mongodb.Collection interface so they've been commented out.
|
||||
*/
|
||||
constructor(name: string, conn: Connection, opts: Object);
|
||||
|
||||
/* abstract methods */
|
||||
insureIndex(...args: any[]): any;
|
||||
find(...args: any[]): any;
|
||||
ensureIndex(...args: any[]): any;
|
||||
//find(...args: any[]): any;
|
||||
findAndModify(...args: any[]): any;
|
||||
findOne(...args: any[]): any;
|
||||
//findOne(...args: any[]): any;
|
||||
getIndexes(...args: any[]): any;
|
||||
insert(...args: any[]): any;
|
||||
mapReduce(...args: any[]): any;
|
||||
save(...args: any[]): any;
|
||||
update(...args: any[]): any;
|
||||
//insert(...args: any[]): any;
|
||||
//mapReduce(...args: any[]): any;
|
||||
//save(...args: any[]): any;
|
||||
//update(...args: any[]): any;
|
||||
|
||||
/** The collection name */
|
||||
collectionName: string;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/// <reference path="nes.d.ts" />
|
||||
|
||||
import Hapi = require('hapi');
|
||||
import Nes = require('nes');
|
||||
|
||||
let server: Hapi.Server = new Hapi.Server();
|
||||
server.connection({port: 8080});
|
||||
|
||||
server.register(Nes, (regErr: any) => {
|
||||
if(regErr) {
|
||||
console.log('register err');
|
||||
console.log(regErr);
|
||||
} else {
|
||||
let wsServer: Nes.Server = server as Nes.Server;
|
||||
wsServer.subscription('/item/{id}');
|
||||
wsServer.route( {
|
||||
method: 'GET',
|
||||
path: '/test',
|
||||
config: {
|
||||
handler: (request: Hapi.Request, reply: Hapi.IReply) => {
|
||||
reply({test: 'passes'});
|
||||
}
|
||||
}
|
||||
});
|
||||
wsServer.start((err: any) => {
|
||||
if(err) {
|
||||
console.log('start err');
|
||||
console.log(err);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
wsServer.publish('/item/5', { id: 5, status: 'complete' });
|
||||
wsServer.publish('/item/6', { id: 6, status: 'initial' });
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let wsClient: Nes.Client = new Nes.Client('ws://localhost:8080');
|
||||
wsClient.connect((err: any) => {
|
||||
if(err) {
|
||||
console.log('start err');
|
||||
console.log(err);
|
||||
} else {
|
||||
wsClient.subscribe('/item/5', (update) => {
|
||||
wsClient.request('/test', (reqErr: any, payload: any, statusCode: number) => {
|
||||
if(reqErr) {
|
||||
console.log('request err');
|
||||
console.log(reqErr);
|
||||
} else {
|
||||
console.log(update);
|
||||
console.log(payload);
|
||||
if(payload.test === 'passes') {
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
})
|
||||
}, (subErr) => {
|
||||
if(subErr) {
|
||||
console.log('subscribe err');
|
||||
console.log(subErr);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
// Type definitions for nes 6.2.1
|
||||
// Project: https://github.com/hapijs/nes
|
||||
// Definitions by: Ivo Stratev <https://github.com/NoHomey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../hapi/hapi.d.ts" />
|
||||
|
||||
declare module 'nes' {
|
||||
import Hapi = require('hapi');
|
||||
|
||||
export interface SocketAuthObject {
|
||||
isAuthenticated: boolean;
|
||||
credentials: any;
|
||||
artifacts: any;
|
||||
}
|
||||
|
||||
export class Socket {
|
||||
id: any;
|
||||
app: Object;
|
||||
auth: SocketAuthObject;
|
||||
disconect(callback?: () => void): void;
|
||||
send(message: any, callback?: (err?: any) => void): void;
|
||||
publish(path: string, message: any, callback?: (err?: any) => void): void;
|
||||
revoke(path: string, message: any, callback?: (err?: any) => void): void;
|
||||
}
|
||||
|
||||
export interface ServerBroadcastOptions {
|
||||
user: any
|
||||
}
|
||||
|
||||
export interface ServerSubscriptionOptionsFilterOptions {
|
||||
socket: Socket;
|
||||
credentials?: any;
|
||||
params?: any;
|
||||
}
|
||||
|
||||
export interface ServerSubscriptionOptionsAuthOptions {
|
||||
mode?: 'required' | 'optional';
|
||||
scope?: string | string[];
|
||||
entity?: 'user' | 'app' | 'any';
|
||||
index?: boolean;
|
||||
}
|
||||
|
||||
export type ServerOnSubscribeWithParams = (socket: Socket, path: string, params: any, next: (err?: any) => void) => void;
|
||||
export type ServerOnSubscribeWithoutParams = (socket: Socket, path: string, next: (err?: any) => void) => void;
|
||||
export type ServerOnSubscribe = ServerOnSubscribeWithParams | ServerOnSubscribeWithoutParams;
|
||||
|
||||
export type ServerOnUnSubscribeWithParams = (socket: Socket, path: string, params: any, next: () => void) => void;
|
||||
export type ServerOnUnSubscribeWithoutParams = (socket: Socket, path: string, next: () => void) => void;
|
||||
export type ServerOnUnSubscribe = ServerOnUnSubscribeWithParams | ServerOnUnSubscribeWithoutParams;
|
||||
|
||||
export interface ServerSubscriptionOptions {
|
||||
filter?: (path: string, message: any, options: ServerSubscriptionOptionsFilterOptions, next: (isMatch: boolean, override: any) => void) => void;
|
||||
auth?: boolean | ServerSubscriptionOptionsAuthOptions;
|
||||
onSubscribe?: ServerOnSubscribe;
|
||||
onUnsubscribe?: ServerOnUnSubscribe;
|
||||
}
|
||||
|
||||
export interface ServerPublishOptions {
|
||||
internal?: any;
|
||||
user?: any;
|
||||
}
|
||||
|
||||
export interface ServerEachSokcetOptions {
|
||||
subscription?: string;
|
||||
user?: any;
|
||||
}
|
||||
|
||||
export class Server extends Hapi.Server {
|
||||
broadcast(message: any, options?: ServerBroadcastOptions): void;
|
||||
subscription(path: string, options?: ServerSubscriptionOptions): void;
|
||||
publish(path: string, message: any, options?: ServerPublishOptions): void;
|
||||
eachSocket(each: (socket: Socket) => void, options?: ServerEachSokcetOptions): void;
|
||||
}
|
||||
|
||||
export class Request extends Hapi.Request {
|
||||
socket: Socket;
|
||||
}
|
||||
|
||||
export interface ClientOptions {
|
||||
ws?: any;
|
||||
timeout?: number | boolean;
|
||||
}
|
||||
|
||||
export interface ClientConnnectOptions {
|
||||
auth?: any;
|
||||
delay?: number;
|
||||
maxDelay?: number;
|
||||
retries?: number;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export interface ClientRequestOptions {
|
||||
path: string;
|
||||
method?: string;
|
||||
headers?: Object;
|
||||
payload?: any;
|
||||
}
|
||||
|
||||
export interface ClientSubscribeFlags {
|
||||
revoked?: boolean;
|
||||
}
|
||||
|
||||
export class Client {
|
||||
constructor(url: string, options?: ClientOptions);
|
||||
onError: (err: any) => void;
|
||||
onConnect: () => void;
|
||||
onDisconnect: () => void;
|
||||
onUpdate: (message: any) => void;
|
||||
connect(options: ClientConnnectOptions, callback: (err?: any) => void): void;
|
||||
connect(callback: (err?: any) => void): void;
|
||||
disconnect(): void;
|
||||
id: any;
|
||||
request(options: string | ClientRequestOptions, callback: (err: any, payload: any, statusCode?: number, headers?: Object) => void): void;
|
||||
message(message: any, callback: (err: any, message: any) => void): void;
|
||||
subscribe(path: string, handler: (message: any, flags: ClientSubscribeFlags) => void, callback: (err?: any) => void): void;
|
||||
unsubscribe(path: string, handler: (message: any, flags: ClientSubscribeFlags) => void, callback: (err?: any) => void): void;
|
||||
subscriptions(): string[];
|
||||
overrideReconnectionAuth(auth: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'nes/client' {
|
||||
export {
|
||||
Client,
|
||||
ClientConnnectOptions,
|
||||
ClientRequestOptions,
|
||||
ClientSubscribeFlags
|
||||
} from 'nes';
|
||||
}
|
||||
Vendored
+2
-2
@@ -1032,10 +1032,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net = require("net");
|
||||
import dgram = require("dgram");
|
||||
import querystring = require('querystring');
|
||||
import readline = require('readline');
|
||||
import string_decoder = require('string_decoder');
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -122,6 +123,18 @@ namespace http_tests {
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
var StringDecoder = string_decoder.StringDecoder;
|
||||
var buffer = new Buffer('test');
|
||||
var decoder = new StringDecoder('utf8');
|
||||
var part: string = decoder.write(new Buffer('test'));
|
||||
var end: string = decoder.end();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Dgram tests : http://nodejs.org/api/dgram.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
Vendored
+2
-2
@@ -943,10 +943,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import * as querystring from "querystring";
|
||||
import * as path from "path";
|
||||
import * as readline from "readline";
|
||||
import * as childProcess from "child_process";
|
||||
import * as string_decoder from "string_decoder";
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -404,6 +405,18 @@ rl.question("do you like typescript?", function(answer: string) {
|
||||
rl.close();
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
var StringDecoder = string_decoder.StringDecoder;
|
||||
var buffer = new Buffer('test');
|
||||
var decoder = new StringDecoder('utf8');
|
||||
var part: string = decoder.write(new Buffer('test'));
|
||||
var end: string = decoder.end();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Vendored
+2
-2
@@ -1480,10 +1480,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ import * as childProcess from "child_process";
|
||||
import * as cluster from "cluster";
|
||||
import * as os from "os";
|
||||
import * as vm from "vm";
|
||||
import * as string_decoder from "string_decoder";
|
||||
|
||||
// Specifically test buffer module regression.
|
||||
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
|
||||
|
||||
@@ -699,6 +701,18 @@ namespace readline_tests {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
const StringDecoder = string_decoder.StringDecoder;
|
||||
const buffer = new Buffer('test');
|
||||
const decoder = new StringDecoder('utf8');
|
||||
const part: string = decoder.write(new Buffer('test'));
|
||||
const end: string = decoder.end();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Vendored
+2
-2
@@ -1779,10 +1779,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ import * as childProcess from "child_process";
|
||||
import * as cluster from "cluster";
|
||||
import * as os from "os";
|
||||
import * as vm from "vm";
|
||||
import * as string_decoder from "string_decoder";
|
||||
import * as stream from "stream";
|
||||
|
||||
// Specifically test buffer module regression.
|
||||
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
|
||||
|
||||
@@ -288,6 +291,70 @@ function stream_readable_pipe_test() {
|
||||
r.close();
|
||||
}
|
||||
|
||||
// Simplified constructors
|
||||
function simplified_stream_ctor_test() {
|
||||
new stream.Readable({
|
||||
read: function (size) {
|
||||
size.toFixed();
|
||||
}
|
||||
});
|
||||
|
||||
new stream.Writable({
|
||||
write: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb()
|
||||
},
|
||||
writev: function (chunks, cb) {
|
||||
chunks[0].chunk.slice(0);
|
||||
chunks[0].encoding.charAt(0);
|
||||
cb();
|
||||
}
|
||||
});
|
||||
|
||||
new stream.Duplex({
|
||||
read: function (size) {
|
||||
size.toFixed();
|
||||
},
|
||||
write: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb()
|
||||
},
|
||||
writev: function (chunks, cb) {
|
||||
chunks[0].chunk.slice(0);
|
||||
chunks[0].encoding.charAt(0);
|
||||
cb();
|
||||
},
|
||||
readableObjectMode: true,
|
||||
writableObjectMode: true
|
||||
});
|
||||
|
||||
new stream.Transform({
|
||||
transform: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb();
|
||||
},
|
||||
flush: function (cb) {
|
||||
cb()
|
||||
},
|
||||
read: function (size) {
|
||||
size.toFixed();
|
||||
},
|
||||
write: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb()
|
||||
},
|
||||
writev: function (chunks, cb) {
|
||||
chunks[0].chunk.slice(0);
|
||||
chunks[0].encoding.charAt(0);
|
||||
cb();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Crypto tests : http://nodejs.org/api/crypto.html
|
||||
////////////////////////////////////////////////////
|
||||
@@ -723,6 +790,21 @@ namespace readline_tests {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
const StringDecoder = string_decoder.StringDecoder;
|
||||
const buffer = new Buffer('test');
|
||||
const decoder1 = new StringDecoder();
|
||||
const decoder2 = new StringDecoder('utf8');
|
||||
const part1: string = decoder1.write(new Buffer('test'));
|
||||
const end1: string = decoder1.end();
|
||||
const part2: string = decoder2.write(new Buffer('test'));
|
||||
const end2: string = decoder1.end(new Buffer('test'));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Vendored
+141
-129
@@ -21,10 +21,10 @@ interface ErrorConstructor {
|
||||
// compat for TypeScript 1.8
|
||||
// if you use with --target es3 or --target es5 and use below definitions,
|
||||
// use the lib.es6.d.ts that is bundled with TypeScript 1.8.
|
||||
interface MapConstructor {}
|
||||
interface WeakMapConstructor {}
|
||||
interface SetConstructor {}
|
||||
interface WeakSetConstructor {}
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
@@ -49,7 +49,7 @@ interface NodeRequireFunction {
|
||||
}
|
||||
|
||||
interface NodeRequire extends NodeRequireFunction {
|
||||
resolve(id:string): string;
|
||||
resolve(id: string): string;
|
||||
cache: any;
|
||||
extensions: any;
|
||||
main: any;
|
||||
@@ -85,7 +85,7 @@ declare var SlowBuffer: {
|
||||
|
||||
// Buffer class
|
||||
type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "binary" | "hex";
|
||||
interface Buffer extends NodeBuffer {}
|
||||
interface Buffer extends NodeBuffer { }
|
||||
|
||||
/**
|
||||
* Raw data is stored in instances of the Buffer class.
|
||||
@@ -149,7 +149,7 @@ declare var Buffer: {
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?:number): Buffer;
|
||||
from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
@@ -209,20 +209,20 @@ declare var Buffer: {
|
||||
* If parameter is omitted, buffer will be filled with zeros.
|
||||
* @param encoding encoding used for call to buf.fill while initalizing
|
||||
*/
|
||||
alloc(size: number, fill?: string|Buffer|number, encoding?: string): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
allocUnsafe(size: number): Buffer;
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
allocUnsafeSlow(size: number): Buffer;
|
||||
};
|
||||
|
||||
@@ -255,7 +255,7 @@ declare namespace NodeJS {
|
||||
|
||||
export interface ReadableStream extends EventEmitter {
|
||||
readable: boolean;
|
||||
read(size?: number): string|Buffer;
|
||||
read(size?: number): string | Buffer;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
@@ -268,7 +268,7 @@ declare namespace NodeJS {
|
||||
|
||||
export interface WritableStream extends EventEmitter {
|
||||
writable: boolean;
|
||||
write(buffer: Buffer|string, cb?: Function): boolean;
|
||||
write(buffer: Buffer | string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
@@ -276,7 +276,7 @@ declare namespace NodeJS {
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream {}
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
|
||||
export interface Events extends EventEmitter { }
|
||||
|
||||
@@ -356,7 +356,7 @@ declare namespace NodeJS {
|
||||
visibility: string;
|
||||
};
|
||||
};
|
||||
kill(pid:number, signal?: string|number): void;
|
||||
kill(pid: number, signal?: string | number): void;
|
||||
pid: number;
|
||||
title: string;
|
||||
arch: string;
|
||||
@@ -365,7 +365,7 @@ declare namespace NodeJS {
|
||||
nextTick(callback: Function): void;
|
||||
umask(mask?: number): number;
|
||||
uptime(): number;
|
||||
hrtime(time?:number[]): number[];
|
||||
hrtime(time?: number[]): number[];
|
||||
domain: Domain;
|
||||
|
||||
// Worker
|
||||
@@ -441,8 +441,8 @@ declare namespace NodeJS {
|
||||
}
|
||||
|
||||
export interface Timer {
|
||||
ref() : void;
|
||||
unref() : void;
|
||||
ref(): void;
|
||||
unref(): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ declare module "http" {
|
||||
path?: string;
|
||||
headers?: { [key: string]: any };
|
||||
auth?: string;
|
||||
agent?: Agent|boolean;
|
||||
agent?: Agent | boolean;
|
||||
}
|
||||
|
||||
export interface Server extends events.EventEmitter, net.Server {
|
||||
@@ -599,6 +599,7 @@ declare module "http" {
|
||||
statusMessage: string;
|
||||
headersSent: boolean;
|
||||
setHeader(name: string, value: string | string[]): void;
|
||||
setTimeout(msecs: number, callback: Function): ServerResponse;
|
||||
sendDate: boolean;
|
||||
getHeader(name: string): string;
|
||||
removeHeader(name: string): void;
|
||||
@@ -710,7 +711,7 @@ declare module "http" {
|
||||
[errorCode: number]: string;
|
||||
[errorCode: string]: string;
|
||||
};
|
||||
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
|
||||
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) => void): Server;
|
||||
export function createClient(port?: number, host?: string): any;
|
||||
export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
@@ -794,19 +795,19 @@ declare module "zlib" {
|
||||
export function createInflateRaw(options?: ZlibOptions): InflateRaw;
|
||||
export function createUnzip(options?: ZlibOptions): Unzip;
|
||||
|
||||
export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function deflate(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function deflateSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function gzip(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function gzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function gunzip(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function gunzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function inflate(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function inflateSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function unzip(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function unzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
|
||||
// Constants
|
||||
@@ -877,7 +878,7 @@ declare module "os" {
|
||||
export function totalmem(): number;
|
||||
export function freemem(): number;
|
||||
export function cpus(): CpuInfo[];
|
||||
export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]};
|
||||
export function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] };
|
||||
export var EOL: string;
|
||||
}
|
||||
|
||||
@@ -923,8 +924,8 @@ declare module "https" {
|
||||
};
|
||||
export interface Server extends tls.Server { }
|
||||
export function createServer(options: ServerOptions, requestListener?: Function): Server;
|
||||
export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
||||
export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
||||
export var globalAgent: Agent;
|
||||
}
|
||||
|
||||
@@ -978,7 +979,7 @@ declare module "readline" {
|
||||
pause(): ReadLine;
|
||||
resume(): ReadLine;
|
||||
close(): void;
|
||||
write(data: string|Buffer, key?: Key): void;
|
||||
write(data: string | Buffer, key?: Key): void;
|
||||
}
|
||||
|
||||
export interface Completer {
|
||||
@@ -1003,7 +1004,7 @@ declare module "readline" {
|
||||
export function createInterface(options: ReadLineOptions): ReadLine;
|
||||
|
||||
export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void;
|
||||
export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void;
|
||||
export function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void;
|
||||
export function clearLine(stream: NodeJS.WritableStream, dir: number): void;
|
||||
export function clearScreenDown(stream: NodeJS.WritableStream): void;
|
||||
}
|
||||
@@ -1045,7 +1046,7 @@ declare module "child_process" {
|
||||
import * as stream from "stream";
|
||||
|
||||
export interface ChildProcess extends events.EventEmitter {
|
||||
stdin: stream.Writable;
|
||||
stdin: stream.Writable;
|
||||
stdout: stream.Readable;
|
||||
stderr: stream.Readable;
|
||||
stdio: [stream.Writable, stream.Readable, stream.Readable];
|
||||
@@ -1055,6 +1056,7 @@ declare module "child_process" {
|
||||
connected: boolean;
|
||||
disconnect(): void;
|
||||
unref(): void;
|
||||
ref(): void;
|
||||
}
|
||||
|
||||
export interface SpawnOptions {
|
||||
@@ -1084,11 +1086,11 @@ declare module "child_process" {
|
||||
export interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function exec(command: string, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function exec(command: string, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
// usage. child_process.exec("tsc", {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function exec(command: string, options: ExecOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptions, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
export interface ExecFileOptions {
|
||||
cwd?: string;
|
||||
@@ -1105,16 +1107,16 @@ declare module "child_process" {
|
||||
export interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function execFile(file: string, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
// usage. child_process.execFile("file.sh", {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
// usage. child_process.execFile("file.sh", ["foo"], {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
export interface ForkOptions {
|
||||
cwd?: string;
|
||||
@@ -1230,24 +1232,24 @@ declare module "url" {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
|
||||
export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url;
|
||||
export function format(url: Url): string;
|
||||
export function resolve(from: string, to: string): string;
|
||||
}
|
||||
|
||||
declare module "dns" {
|
||||
export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string;
|
||||
export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string;
|
||||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[];
|
||||
export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) => void): string;
|
||||
export function lookup(domain: string, callback: (err: Error, address: string, family: number) => void): string;
|
||||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
|
||||
}
|
||||
|
||||
declare module "net" {
|
||||
@@ -1322,12 +1324,12 @@ declare module "net" {
|
||||
maxConnections: number;
|
||||
connections: number;
|
||||
}
|
||||
export function createServer(connectionListener?: (socket: Socket) =>void ): Server;
|
||||
export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server;
|
||||
export function connect(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function createServer(connectionListener?: (socket: Socket) => void): Server;
|
||||
export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) => void): Server;
|
||||
export function connect(options: { port: number, host?: string, localAddress?: string, localPort?: string, family?: number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function connect(port: number, host?: string, connectionListener?: Function): Socket;
|
||||
export function connect(path: string, connectionListener?: Function): Socket;
|
||||
export function createConnection(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function createConnection(options: { port: number, host?: string, localAddress?: string, localPort?: string, family?: number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
|
||||
export function createConnection(path: string, connectionListener?: Function): Socket;
|
||||
export function isIP(input: string): number;
|
||||
@@ -1456,7 +1458,7 @@ declare module "fs" {
|
||||
export function readlink(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
||||
export function readlinkSync(path: string | Buffer): string;
|
||||
export function realpath(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpath(path: string | Buffer, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpathSync(path: string | Buffer, cache?: { [path: string]: string }): string;
|
||||
/*
|
||||
* Asynchronous unlink - deletes the file specified in {path}
|
||||
@@ -1629,8 +1631,8 @@ declare module "fs" {
|
||||
export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void;
|
||||
export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void;
|
||||
export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function watch(filename: string, encoding: string, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function watch(filename: string, options: { persistent?: boolean; recursive?: boolean; encoding?: string }, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function watch(filename: string, encoding: string, listener?: (event: string, filename: string | Buffer) => any): FSWatcher;
|
||||
export function watch(filename: string, options: { persistent?: boolean; recursive?: boolean; encoding?: string }, listener?: (event: string, filename: string | Buffer) => any): FSWatcher;
|
||||
export function exists(path: string | Buffer, callback?: (exists: boolean) => void): void;
|
||||
export function existsSync(path: string | Buffer): boolean;
|
||||
/** Constant for fs.access(). File is visible to the calling process. */
|
||||
@@ -1645,7 +1647,7 @@ declare module "fs" {
|
||||
export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
/** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */
|
||||
export function accessSync(path: string | Buffer, mode ?: number): void;
|
||||
export function accessSync(path: string | Buffer, mode?: number): void;
|
||||
export function createReadStream(path: string | Buffer, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
@@ -1779,43 +1781,43 @@ declare module "path" {
|
||||
export function format(pathObject: ParsedPath): string;
|
||||
|
||||
export module posix {
|
||||
export function normalize(p: string): string;
|
||||
export function join(...paths: any[]): string;
|
||||
export function resolve(...pathSegments: any[]): string;
|
||||
export function isAbsolute(p: string): boolean;
|
||||
export function relative(from: string, to: string): string;
|
||||
export function dirname(p: string): string;
|
||||
export function basename(p: string, ext?: string): string;
|
||||
export function extname(p: string): string;
|
||||
export var sep: string;
|
||||
export var delimiter: string;
|
||||
export function parse(p: string): ParsedPath;
|
||||
export function format(pP: ParsedPath): string;
|
||||
export function normalize(p: string): string;
|
||||
export function join(...paths: any[]): string;
|
||||
export function resolve(...pathSegments: any[]): string;
|
||||
export function isAbsolute(p: string): boolean;
|
||||
export function relative(from: string, to: string): string;
|
||||
export function dirname(p: string): string;
|
||||
export function basename(p: string, ext?: string): string;
|
||||
export function extname(p: string): string;
|
||||
export var sep: string;
|
||||
export var delimiter: string;
|
||||
export function parse(p: string): ParsedPath;
|
||||
export function format(pP: ParsedPath): string;
|
||||
}
|
||||
|
||||
export module win32 {
|
||||
export function normalize(p: string): string;
|
||||
export function join(...paths: any[]): string;
|
||||
export function resolve(...pathSegments: any[]): string;
|
||||
export function isAbsolute(p: string): boolean;
|
||||
export function relative(from: string, to: string): string;
|
||||
export function dirname(p: string): string;
|
||||
export function basename(p: string, ext?: string): string;
|
||||
export function extname(p: string): string;
|
||||
export var sep: string;
|
||||
export var delimiter: string;
|
||||
export function parse(p: string): ParsedPath;
|
||||
export function format(pP: ParsedPath): string;
|
||||
export function normalize(p: string): string;
|
||||
export function join(...paths: any[]): string;
|
||||
export function resolve(...pathSegments: any[]): string;
|
||||
export function isAbsolute(p: string): boolean;
|
||||
export function relative(from: string, to: string): string;
|
||||
export function dirname(p: string): string;
|
||||
export function basename(p: string, ext?: string): string;
|
||||
export function extname(p: string): string;
|
||||
export var sep: string;
|
||||
export var delimiter: string;
|
||||
export function parse(p: string): ParsedPath;
|
||||
export function format(pP: ParsedPath): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(buffer?: Buffer): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1826,7 +1828,7 @@ declare module "tls" {
|
||||
|
||||
var CLIENT_RENEG_LIMIT: number;
|
||||
var CLIENT_RENEG_WINDOW: number;
|
||||
|
||||
|
||||
export interface Certificate {
|
||||
/**
|
||||
* Country code.
|
||||
@@ -1868,7 +1870,7 @@ declare module "tls" {
|
||||
export class TLSSocket extends stream.Duplex {
|
||||
/**
|
||||
* Returns the bound address, the address family name and port of the underlying socket as reported by
|
||||
* the operating system.
|
||||
* the operating system.
|
||||
* @returns {any} - An object with three properties, e.g. { port: 12346, family: 'IPv4', address: '127.0.0.1' }.
|
||||
*/
|
||||
address(): { port: number; family: string; address: string };
|
||||
@@ -1945,7 +1947,7 @@ declare module "tls" {
|
||||
remotePort: number;
|
||||
/**
|
||||
* Initiate TLS renegotiation process.
|
||||
*
|
||||
*
|
||||
* NOTE: Can be used to request peer's certificate after the secure connection has been established.
|
||||
* ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.
|
||||
* @param {TlsOptions} options - The options may contain the following fields: rejectUnauthorized,
|
||||
@@ -1966,7 +1968,7 @@ declare module "tls" {
|
||||
*/
|
||||
setMaxSendFragment(size: number): boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface TlsOptions {
|
||||
host?: string;
|
||||
port?: number;
|
||||
@@ -2047,10 +2049,10 @@ declare module "tls" {
|
||||
context: any;
|
||||
}
|
||||
|
||||
export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server;
|
||||
export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream;
|
||||
export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
||||
export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
||||
export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) => void): Server;
|
||||
export function connect(options: TlsOptions, secureConnectionListener?: () => void): ClearTextStream;
|
||||
export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream;
|
||||
export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream;
|
||||
export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
||||
export function createSecureContext(details: SecureContextOptions): SecureContext;
|
||||
}
|
||||
@@ -2086,9 +2088,9 @@ declare module "crypto" {
|
||||
export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
|
||||
export interface Cipher extends NodeJS.ReadWriteStream {
|
||||
update(data: Buffer): Buffer;
|
||||
update(data: string, input_encoding: "utf8"|"ascii"|"binary"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "binary"|"base64"|"hex"): string;
|
||||
update(data: string, input_encoding: "utf8"|"ascii"|"binary", output_encoding: "binary"|"base64"|"hex"): string;
|
||||
update(data: string, input_encoding: "utf8" | "ascii" | "binary"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "binary" | "base64" | "hex"): string;
|
||||
update(data: string, input_encoding: "utf8" | "ascii" | "binary", output_encoding: "binary" | "base64" | "hex"): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
@@ -2098,9 +2100,9 @@ declare module "crypto" {
|
||||
export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
|
||||
export interface Decipher extends NodeJS.ReadWriteStream {
|
||||
update(data: Buffer): Buffer;
|
||||
update(data: string, input_encoding: "binary"|"base64"|"hex"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "utf8"|"ascii"|"binary"): string;
|
||||
update(data: string, input_encoding: "binary"|"base64"|"hex", output_encoding: "utf8"|"ascii"|"binary"): string;
|
||||
update(data: string, input_encoding: "binary" | "base64" | "hex"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "utf8" | "ascii" | "binary"): string;
|
||||
update(data: string, input_encoding: "binary" | "base64" | "hex", output_encoding: "utf8" | "ascii" | "binary"): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
@@ -2129,14 +2131,14 @@ declare module "crypto" {
|
||||
setPrivateKey(public_key: string, encoding?: string): void;
|
||||
}
|
||||
export function getDiffieHellman(group_name: string): DiffieHellman;
|
||||
export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer;
|
||||
export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer;
|
||||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number): Buffer;
|
||||
export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string): Buffer;
|
||||
export function randomBytes(size: number): Buffer;
|
||||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
||||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export function pseudoRandomBytes(size: number): Buffer;
|
||||
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
||||
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export interface RsaPublicKey {
|
||||
key: string;
|
||||
padding?: any;
|
||||
@@ -2146,8 +2148,8 @@ declare module "crypto" {
|
||||
passphrase?: string,
|
||||
padding?: any;
|
||||
}
|
||||
export function publicEncrypt(public_key: string|RsaPublicKey, buffer: Buffer): Buffer
|
||||
export function privateDecrypt(private_key: string|RsaPrivateKey, buffer: Buffer): Buffer
|
||||
export function publicEncrypt(public_key: string | RsaPublicKey, buffer: Buffer): Buffer
|
||||
export function privateDecrypt(private_key: string | RsaPrivateKey, buffer: Buffer): Buffer
|
||||
}
|
||||
|
||||
declare module "stream" {
|
||||
@@ -2161,6 +2163,7 @@ declare module "stream" {
|
||||
highWaterMark?: number;
|
||||
encoding?: string;
|
||||
objectMode?: boolean;
|
||||
read?: (size?: number) => any;
|
||||
}
|
||||
|
||||
export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
|
||||
@@ -2182,6 +2185,8 @@ declare module "stream" {
|
||||
highWaterMark?: number;
|
||||
decodeStrings?: boolean;
|
||||
objectMode?: boolean;
|
||||
write?: (chunk: string|Buffer, encoding: string, callback: Function) => any;
|
||||
writev?: (chunks: {chunk: string|Buffer, encoding: string}[], callback: Function) => any;
|
||||
}
|
||||
|
||||
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
||||
@@ -2197,6 +2202,8 @@ declare module "stream" {
|
||||
|
||||
export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
||||
allowHalfOpen?: boolean;
|
||||
readableObjectMode?: boolean;
|
||||
writableObjectMode?: boolean;
|
||||
}
|
||||
|
||||
// Note: Duplex extends both Readable and Writable.
|
||||
@@ -2211,7 +2218,10 @@ declare module "stream" {
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface TransformOptions extends ReadableOptions, WritableOptions {}
|
||||
export interface TransformOptions extends ReadableOptions, WritableOptions {
|
||||
transform?: (chunk: string|Buffer, encoding: string, callback: Function) => any;
|
||||
flush?: (callback: Function) => any;
|
||||
}
|
||||
|
||||
// Note: Transform lacks the _read and _write methods of Readable/Writable.
|
||||
export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream {
|
||||
@@ -2236,7 +2246,7 @@ declare module "stream" {
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export class PassThrough extends Transform {}
|
||||
export class PassThrough extends Transform { }
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
@@ -2260,11 +2270,11 @@ declare module "util" {
|
||||
export function isDate(object: any): boolean;
|
||||
export function isError(object: any): boolean;
|
||||
export function inherits(constructor: any, superConstructor: any): void;
|
||||
export function debuglog(key:string): (msg:string,...param: any[])=>void;
|
||||
export function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
}
|
||||
|
||||
declare module "assert" {
|
||||
function internal (value: any, message?: string): void;
|
||||
function internal(value: any, message?: string): void;
|
||||
namespace internal {
|
||||
export class AssertionError implements Error {
|
||||
name: string;
|
||||
@@ -2274,8 +2284,10 @@ declare module "assert" {
|
||||
operator: string;
|
||||
generatedMessage: boolean;
|
||||
|
||||
constructor(options?: {message?: string; actual?: any; expected?: any;
|
||||
operator?: string; stackStartFunction?: Function});
|
||||
constructor(options?: {
|
||||
message?: string; actual?: any; expected?: any;
|
||||
operator?: string; stackStartFunction?: Function
|
||||
});
|
||||
}
|
||||
|
||||
export function fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="nodemailer.d.ts" />
|
||||
|
||||
import nodemailer = require('nodemailer');
|
||||
import * as nodemailer from 'nodemailer'
|
||||
|
||||
// create reusable transporter object using SMTP transport
|
||||
var transporter: nodemailer.Transporter = nodemailer.createTransport({
|
||||
@@ -38,3 +38,8 @@ var mailOptions: nodemailer.SendMailOptions = {
|
||||
transporter.sendMail(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => {
|
||||
// nothing
|
||||
});
|
||||
|
||||
// promise send mail without callback
|
||||
transporter
|
||||
.sendMail(mailOptions)
|
||||
.then(info => info.messageId)
|
||||
Vendored
+8
-2
@@ -29,9 +29,15 @@ declare module "nodemailer" {
|
||||
*/
|
||||
export interface Transporter {
|
||||
/**
|
||||
* Send a mail
|
||||
* Send a mail with callback
|
||||
*/
|
||||
sendMail(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void;
|
||||
sendMail(mail: SendMailOptions, callback: (error: Error, info: SentMessageInfo) => void): void;
|
||||
|
||||
/**
|
||||
* Send a mail
|
||||
* return Promise
|
||||
*/
|
||||
sendMail(mail: SendMailOptions): Promise<SentMessageInfo>;
|
||||
|
||||
/**
|
||||
* Attach a plugin. 'compile' and 'stream' plugins can be attached with use(plugin) method
|
||||
|
||||
@@ -0,0 +1,714 @@
|
||||
/// <reference path="openlayers-3.14.2.d.ts" />
|
||||
|
||||
// Basic type variables for test functions
|
||||
var anyValue: any;
|
||||
var voidValue: void;
|
||||
var numberValue: number;
|
||||
var booleanValue: boolean;
|
||||
var stringValue: string;
|
||||
var stringArray: Array<string>;
|
||||
var jsonValue: JSON;
|
||||
var voidOrBooleanValue: void | boolean;
|
||||
var domEventTarget: EventTarget;
|
||||
var fn: Function;
|
||||
var object: Object;
|
||||
|
||||
// Callback predefinitions for OpenLayers
|
||||
var preRenderFunction: ol.PreRenderFunction;
|
||||
var transformFunction: ol.TransformFunction;
|
||||
var coordinateFormatType: ol.CoordinateFormatType;
|
||||
var featureStyleFunction: ol.FeatureStyleFunction;
|
||||
var featureLoader: ol.FeatureLoader;
|
||||
var easingFunction: (t: number) => number;
|
||||
var drawGeometryFunction: ol.interaction.DrawGeometryFunctionType;
|
||||
|
||||
// Type variables for OpenLayers
|
||||
var attribution: ol.Attribution;
|
||||
var boundingCoordinates: Array<ol.Coordinate>;
|
||||
var circle: ol.geom.Circle;
|
||||
var color: ol.Color;
|
||||
var coordinate: ol.Coordinate;
|
||||
var coordinatesArray: Array<ol.Coordinate>;
|
||||
var coordinatesArrayDim2: Array<Array<ol.Coordinate>>;
|
||||
var extent: ol.Extent;
|
||||
var olEvent: ol.events.Event;
|
||||
var eventKey: ol.events.Key;
|
||||
var eventKeyArray: Array<ol.events.Key>;
|
||||
var eventKeyMixed: ol.events.Key | Array<ol.events.Key>;
|
||||
var eventTarget: ol.events.EventTarget;
|
||||
var feature: ol.Feature;
|
||||
var featureArray: Array<ol.Feature>;
|
||||
var featureCollection: ol.Collection<ol.Feature>;
|
||||
var featureFormat: ol.format.Feature;
|
||||
var featureUrlFunction: ol.FeatureUrlFunction;
|
||||
var graticule: ol.Graticule;
|
||||
var geometriesArray: Array<ol.geom.Geometry>;
|
||||
var geometry: ol.geom.Geometry;
|
||||
var geometryCollection: ol.geom.GeometryCollection;
|
||||
var geometryLayout: ol.geom.GeometryLayout;
|
||||
var geometryType: ol.geom.GeometryType;
|
||||
var linearRing: ol.geom.LinearRing;
|
||||
var lineString: ol.geom.LineString;
|
||||
var loadingStrategy: ol.LoadingStrategy;
|
||||
var logoOptions: olx.LogoOptions;
|
||||
var mapBrowserEvent: ol.MapBrowserEvent;
|
||||
var multiLineString: ol.geom.MultiLineString;
|
||||
var multiPoint: ol.geom.MultiPoint;
|
||||
var multiPolygon: ol.geom.MultiPolygon;
|
||||
var point: ol.geom.Point;
|
||||
var polygon: ol.geom.Polygon;
|
||||
var projection: ol.proj.Projection;
|
||||
var projectionLike: ol.proj.ProjectionLike;
|
||||
var simpleGeometry: ol.geom.SimpleGeometry;
|
||||
var size: ol.Size;
|
||||
var style: ol.style.Style;
|
||||
var styleArray: Array<ol.style.Style>;
|
||||
var styleFunction: ol.style.StyleFunction;
|
||||
var tilegrid: ol.tilegrid.TileGrid;
|
||||
var transformFn: ol.TransformFunction;
|
||||
var vectorSource: ol.source.Vector;
|
||||
var units: ol.proj.Units;
|
||||
|
||||
//
|
||||
// ol.Attribution
|
||||
//
|
||||
|
||||
var attribution: ol.Attribution = new ol.Attribution({
|
||||
html: stringValue,
|
||||
});
|
||||
|
||||
//
|
||||
// ol.color
|
||||
//
|
||||
color = ol.color.asArray(color);
|
||||
color = ol.color.asArray(stringValue);
|
||||
stringValue = ol.color.asString(color);
|
||||
stringValue = ol.color.asString(stringValue);
|
||||
|
||||
//
|
||||
// ol.extent
|
||||
//
|
||||
transformFunction = function (input: number[]) {
|
||||
var returnData: number[];
|
||||
return returnData;
|
||||
};
|
||||
transformFunction = function (input: number[], output: number[]) {
|
||||
var returnData: number[];
|
||||
return returnData;
|
||||
};
|
||||
transformFunction = function (input: number[], output: number[], dimension: number) {
|
||||
var returnData: number[];
|
||||
return returnData;
|
||||
}
|
||||
extent = ol.extent.applyTransform(extent, transformFunction);
|
||||
ol.extent.applyTransform(extent, transformFunction, extent);
|
||||
extent = ol.extent.boundingExtent(boundingCoordinates)
|
||||
extent = ol.extent.buffer(extent, numberValue);
|
||||
ol.extent.buffer(extent, numberValue, extent);
|
||||
booleanValue = ol.extent.containsCoordinate(extent, coordinate);
|
||||
booleanValue = ol.extent.containsExtent(extent, extent);
|
||||
booleanValue = ol.extent.containsXY(extent, numberValue, numberValue);
|
||||
extent = ol.extent.createEmpty();
|
||||
booleanValue = ol.extent.equals(extent, extent);
|
||||
extent = ol.extent.extend(extent, extent);
|
||||
coordinate = ol.extent.getBottomLeft(extent);
|
||||
coordinate = ol.extent.getBottomRight(extent);
|
||||
coordinate = ol.extent.getCenter(extent);
|
||||
numberValue = ol.extent.getHeight(extent);
|
||||
extent = ol.extent.getIntersection(extent, extent);
|
||||
ol.extent.getIntersection(extent, extent, extent);
|
||||
size = ol.extent.getSize(extent);
|
||||
coordinate = ol.extent.getTopLeft(extent);
|
||||
coordinate = ol.extent.getTopRight(extent);
|
||||
numberValue = ol.extent.getWidth(extent);
|
||||
booleanValue = ol.extent.intersects(extent, extent);
|
||||
booleanValue = ol.extent.isEmpty(extent);
|
||||
|
||||
//
|
||||
// ol.featureloader
|
||||
//
|
||||
featureLoader = ol.featureloader.xhr(stringValue, featureFormat);
|
||||
|
||||
//
|
||||
// ol.loadingstrategy
|
||||
//
|
||||
loadingStrategy = ol.loadingstrategy.all;
|
||||
loadingStrategy = ol.loadingstrategy.bbox;
|
||||
loadingStrategy = ol.loadingstrategy.tile(tilegrid);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Circle
|
||||
//
|
||||
booleanValue = circle.intersectsExtent(extent);
|
||||
circle = circle.transform(projectionLike, projectionLike);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Geometry
|
||||
//
|
||||
var geometryResult: ol.geom.Geometry;
|
||||
coordinate = geometryResult.getClosestPoint(coordinate);
|
||||
geometryResult.getClosestPoint(coordinate, coordinate);
|
||||
extent = geometryResult.getExtent();
|
||||
geometryResult.getExtent(extent);
|
||||
geometryResult.transform(projectionLike, projectionLike);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.GeometryCollection
|
||||
//
|
||||
geometryCollection = new ol.geom.GeometryCollection(geometriesArray)
|
||||
geometryCollection = new ol.geom.GeometryCollection();
|
||||
voidValue = geometryCollection.applyTransform(transformFn);
|
||||
geometryCollection = geometryCollection.clone();
|
||||
geometriesArray = geometryCollection.getGeometries();
|
||||
geometryType = geometryCollection.getType();
|
||||
booleanValue = geometryCollection.intersectsExtent(extent);
|
||||
voidValue = geometryCollection.setGeometries(geometriesArray);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.LinearRing
|
||||
//
|
||||
linearRing = new ol.geom.LinearRing(coordinatesArray);
|
||||
linearRing = new ol.geom.LinearRing(coordinatesArray, geometryLayout);
|
||||
linearRing = linearRing.clone();
|
||||
numberValue = linearRing.getArea();
|
||||
coordinatesArray = linearRing.getCoordinates();
|
||||
geometryType = linearRing.getType();
|
||||
voidValue = linearRing.setCoordinates(coordinatesArray);
|
||||
voidValue = linearRing.setCoordinates(coordinatesArray, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.LineString
|
||||
//
|
||||
lineString = new ol.geom.LineString(coordinatesArray);
|
||||
lineString = new ol.geom.LineString(coordinatesArray, geometryLayout);
|
||||
voidValue = lineString.appendCoordinate(coordinate);
|
||||
lineString = lineString.clone();
|
||||
coordinate = lineString.getCoordinateAtM(numberValue);
|
||||
coordinate = lineString.getCoordinateAtM(numberValue, booleanValue);
|
||||
coordinatesArray = lineString.getCoordinates();
|
||||
numberValue = lineString.getLength();
|
||||
geometryType = lineString.getType();
|
||||
booleanValue = lineString.intersectsExtent(extent);
|
||||
voidValue = lineString.setCoordinates(coordinatesArray);
|
||||
voidValue = lineString.setCoordinates(coordinatesArray, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.MultiLineString
|
||||
//
|
||||
var lineStringsArray: Array<ol.geom.LineString>;
|
||||
|
||||
multiLineString = new ol.geom.MultiLineString(coordinatesArrayDim2);
|
||||
multiLineString = new ol.geom.MultiLineString(coordinatesArrayDim2, geometryLayout);
|
||||
voidValue = multiLineString.appendLineString(lineString);
|
||||
multiLineString = multiLineString.clone();
|
||||
coordinate = multiLineString.getCoordinateAtM(numberValue);
|
||||
coordinate = multiLineString.getCoordinateAtM(numberValue, booleanValue);
|
||||
coordinate = multiLineString.getCoordinateAtM(numberValue, booleanValue, booleanValue);
|
||||
coordinatesArrayDim2 = multiLineString.getCoordinates();
|
||||
lineString = multiLineString.getLineString(numberValue);
|
||||
lineStringsArray = multiLineString.getLineStrings();
|
||||
geometryType = multiLineString.getType();
|
||||
booleanValue = multiLineString.intersectsExtent(extent);
|
||||
voidValue = multiLineString.setCoordinates(coordinatesArrayDim2);
|
||||
voidValue = multiLineString.setCoordinates(coordinatesArrayDim2, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.MultiPoint
|
||||
//
|
||||
var pointsArray: Array<ol.geom.Point>;
|
||||
|
||||
multiPoint = new ol.geom.MultiPoint(coordinatesArray);
|
||||
multiPoint = new ol.geom.MultiPoint(coordinatesArray, geometryLayout);
|
||||
voidValue = multiPoint.appendPoint(point);
|
||||
multiPoint = multiPoint.clone();
|
||||
coordinatesArray = multiPoint.getCoordinates();
|
||||
point = multiPoint.getPoint(numberValue);
|
||||
pointsArray = multiPoint.getPoints();
|
||||
geometryType = multiPoint.getType();
|
||||
booleanValue = multiPoint.intersectsExtent(extent);
|
||||
voidValue = multiPoint.setCoordinates(coordinatesArray);
|
||||
voidValue = multiPoint.setCoordinates(coordinatesArray, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.MultiPolygon
|
||||
//
|
||||
var coordinatesArrayDim3: Array<Array<Array<ol.Coordinate>>>;
|
||||
var polygonsArray: Array<ol.geom.Polygon>;
|
||||
|
||||
multiPolygon = new ol.geom.MultiPolygon(coordinatesArrayDim3);
|
||||
multiPolygon = new ol.geom.MultiPolygon(coordinatesArrayDim3, geometryLayout);
|
||||
voidValue = multiPolygon.appendPolygon(polygon);
|
||||
multiPolygon = multiPolygon.clone();
|
||||
numberValue = multiPolygon.getArea();
|
||||
coordinatesArrayDim3 = multiPolygon.getCoordinates();
|
||||
coordinatesArrayDim3 = multiPolygon.getCoordinates(booleanValue);
|
||||
multiPoint = multiPolygon.getInteriorPoints();
|
||||
polygon = multiPolygon.getPolygon(numberValue);
|
||||
polygonsArray = multiPolygon.getPolygons();
|
||||
geometryType = multiPolygon.getType();
|
||||
booleanValue = multiPolygon.intersectsExtent(extent);
|
||||
voidValue = multiPolygon.setCoordinates(coordinatesArrayDim3);
|
||||
voidValue = multiPolygon.setCoordinates(coordinatesArrayDim3, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Point
|
||||
//
|
||||
point = new ol.geom.Point(coordinate);
|
||||
point = new ol.geom.Point(coordinate, geometryLayout);
|
||||
point = point.clone();
|
||||
coordinate = point.getCoordinates();
|
||||
geometryType = point.getType();
|
||||
booleanValue = point.intersectsExtent(extent);
|
||||
voidValue = point.setCoordinates(coordinate);
|
||||
voidValue = point.setCoordinates(coordinate, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Polygon
|
||||
//
|
||||
var localSphere: ol.Sphere;
|
||||
var linearRingsArray: Array<ol.geom.LinearRing>;
|
||||
|
||||
polygon = new ol.geom.Polygon(coordinatesArrayDim2);
|
||||
polygon = new ol.geom.Polygon(coordinatesArrayDim2, geometryLayout);
|
||||
polygon = ol.geom.Polygon.circular(localSphere, coordinate, numberValue);
|
||||
polygon = ol.geom.Polygon.circular(localSphere, coordinate, numberValue, numberValue);
|
||||
polygon = ol.geom.Polygon.fromCircle(circle);
|
||||
polygon = ol.geom.Polygon.fromCircle(circle, numberValue);
|
||||
polygon = ol.geom.Polygon.fromCircle(circle, numberValue, numberValue);
|
||||
polygon = ol.geom.Polygon.fromExtent(extent);
|
||||
voidValue = polygon.appendLinearRing(linearRing);
|
||||
polygon = polygon.clone();
|
||||
numberValue = polygon.getArea();
|
||||
coordinatesArrayDim2 = polygon.getCoordinates();
|
||||
coordinatesArrayDim2 = polygon.getCoordinates(booleanValue);
|
||||
point = polygon.getInteriorPoint();
|
||||
linearRing = polygon.getLinearRing(numberValue);
|
||||
numberValue = polygon.getLinearRingCount();
|
||||
linearRingsArray = polygon.getLinearRings();
|
||||
geometryType = polygon.getType();
|
||||
booleanValue = polygon.intersectsExtent(extent);
|
||||
voidValue = polygon.setCoordinates([[coordinate]]);
|
||||
voidValue = polygon.setCoordinates([[coordinate]], geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.SimpleGeometry
|
||||
//
|
||||
simpleGeometry.applyTransform(transformFn);
|
||||
coordinate = simpleGeometry.getFirstCoordinate();
|
||||
coordinate = simpleGeometry.getLastCoordinate();
|
||||
geometryLayout = simpleGeometry.getLayout();
|
||||
voidValue = simpleGeometry.translate(numberValue, numberValue);
|
||||
|
||||
//
|
||||
// ol.source
|
||||
//
|
||||
var featureCallback: (f: ol.Feature) => any;
|
||||
vectorSource = new ol.source.Vector({
|
||||
attributions: [attribution],
|
||||
features: featureCollection,
|
||||
format: featureFormat,
|
||||
loader: featureLoader,
|
||||
logo: logoOptions,
|
||||
strategy: loadingStrategy,
|
||||
url: stringValue,
|
||||
useSpatialIndex: booleanValue,
|
||||
wrapX: booleanValue
|
||||
});
|
||||
vectorSource = new ol.source.Vector({
|
||||
features: featureArray
|
||||
});
|
||||
vectorSource = new ol.source.Vector({
|
||||
url: featureUrlFunction,
|
||||
loader: featureLoader
|
||||
});
|
||||
voidValue = vectorSource.addFeature(feature);
|
||||
voidValue = vectorSource.addFeatures(featureArray);
|
||||
voidValue = vectorSource.clear();
|
||||
voidValue = vectorSource.clear(booleanValue);
|
||||
anyValue = vectorSource.forEachFeature(featureCallback);
|
||||
anyValue = vectorSource.forEachFeature(featureCallback, object);
|
||||
anyValue = vectorSource.forEachFeatureInExtent(extent, featureCallback, object);
|
||||
anyValue = vectorSource.forEachFeatureIntersectingExtent(extent, featureCallback, object);
|
||||
feature = vectorSource.getClosestFeatureToCoordinate(coordinate);
|
||||
extent = vectorSource.getExtent();
|
||||
feature = vectorSource.getFeatureById(stringValue);
|
||||
feature = vectorSource.getFeatureById(numberValue);
|
||||
featureArray = vectorSource.getFeatures();
|
||||
featureArray = vectorSource.getFeaturesAtCoordinate(coordinate);
|
||||
featureCollection = vectorSource.getFeaturesCollection();
|
||||
featureArray = vectorSource.getFeaturesInExtent(extent);
|
||||
voidValue = vectorSource.removeFeature(feature);
|
||||
|
||||
//
|
||||
// ol.Feature
|
||||
//
|
||||
feature = new ol.Feature();
|
||||
feature = new ol.Feature(geometry);
|
||||
feature = new ol.Feature({
|
||||
geometry: geometry,
|
||||
a: numberValue,
|
||||
b: stringValue,
|
||||
c: null,
|
||||
d: object
|
||||
});
|
||||
feature = feature.clone();
|
||||
geometry = feature.getGeometry();
|
||||
stringValue = feature.getGeometryName();
|
||||
var featureGetId: string | number = feature.getId();
|
||||
var featureGetStyle: ol.style.Style | Array<ol.style.Style> | ol.FeatureStyleFunction = feature.getStyle();
|
||||
featureStyleFunction = feature.getStyleFunction();
|
||||
voidValue = feature.setGeometry(geometry);
|
||||
voidValue = feature.setGeometryName(stringValue);
|
||||
voidValue = feature.setId(stringValue);
|
||||
voidValue = feature.setId(numberValue);
|
||||
voidValue = feature.setStyle(style);
|
||||
voidValue = feature.setStyle(styleArray);
|
||||
voidValue = feature.setStyle(featureStyleFunction);
|
||||
voidValue = feature.setProperties(object);
|
||||
|
||||
//
|
||||
// ol.View
|
||||
//
|
||||
|
||||
var view: ol.View = new ol.View({
|
||||
center: [0, 0],
|
||||
zoom: numberValue,
|
||||
});
|
||||
|
||||
//
|
||||
// ol.layer.Tile
|
||||
//
|
||||
var tileLayer: ol.layer.Tile = new ol.layer.Tile({
|
||||
source: new ol.source.MapQuest({ layer: 'osm' })
|
||||
});
|
||||
|
||||
//
|
||||
// ol.Object
|
||||
//
|
||||
var olObject: ol.Object = new ol.Object({
|
||||
a: numberValue,
|
||||
b: stringValue,
|
||||
c: booleanValue,
|
||||
d: voidValue,
|
||||
e: object,
|
||||
f: fn
|
||||
});
|
||||
anyValue = olObject.get(stringValue);
|
||||
stringArray = olObject.getKeys();
|
||||
object = olObject.getProperties();
|
||||
voidValue = olObject.set(stringValue, anyValue);
|
||||
voidValue = olObject.set(stringValue, anyValue, booleanValue);
|
||||
voidValue = olObject.setProperties(object, booleanValue);
|
||||
voidValue = olObject.unset(stringValue, booleanValue);
|
||||
|
||||
//
|
||||
// ol.Observable
|
||||
//
|
||||
ol.Observable.unByKey(eventKey);
|
||||
var observable: ol.Observable = new ol.Observable();
|
||||
voidValue = observable.changed();
|
||||
voidOrBooleanValue = observable.dispatchEvent({type: stringValue});
|
||||
voidOrBooleanValue = observable.dispatchEvent({type: stringValue, target: domEventTarget});
|
||||
voidOrBooleanValue = observable.dispatchEvent({type: stringValue, target: eventTarget});
|
||||
voidOrBooleanValue = observable.dispatchEvent({type: stringValue, a: numberValue, b: stringValue, c: booleanValue, d: null, e: {}});
|
||||
voidOrBooleanValue = observable.dispatchEvent(olEvent);
|
||||
voidOrBooleanValue = observable.dispatchEvent(stringValue);
|
||||
numberValue = observable.getRevision();
|
||||
eventKeyMixed = observable.on(stringValue, fn);
|
||||
eventKeyMixed = observable.on([stringValue, stringValue], fn, {});
|
||||
eventKeyMixed = observable.once(stringValue, fn);
|
||||
eventKeyMixed = observable.once([stringValue, stringValue], fn, {});
|
||||
voidValue = observable.un(stringValue, fn);
|
||||
voidValue = observable.un([stringValue, stringValue], fn, {});
|
||||
voidValue = observable.unByKey(eventKey);
|
||||
voidValue = observable.unByKey(eventKeyArray);
|
||||
|
||||
//
|
||||
// ol.proj
|
||||
//
|
||||
var getPointResolutionFn: (n: number, c: ol.Coordinate) => number;
|
||||
projection = new ol.proj.Projection({
|
||||
code:stringValue,
|
||||
});
|
||||
stringValue = projection.getCode();
|
||||
extent = projection.getExtent();
|
||||
numberValue = projection.getMetersPerUnit();
|
||||
numberValue = projection.getPointResolution(numberValue, coordinate);
|
||||
units = projection.getUnits();
|
||||
extent = projection.getWorldExtent();
|
||||
booleanValue = projection.isGlobal();
|
||||
voidValue = projection.setExtent(extent);
|
||||
voidValue = projection.setGetPointResolution(getPointResolutionFn);
|
||||
voidValue = projection.setGlobal(booleanValue);
|
||||
voidValue = projection.setWorldExtent(extent);
|
||||
|
||||
//
|
||||
// ol.Map
|
||||
//
|
||||
|
||||
var map: ol.Map = new ol.Map({
|
||||
view: view,
|
||||
layers: [tileLayer],
|
||||
target: stringValue
|
||||
});
|
||||
voidValue = map.beforeRender(preRenderFunction);
|
||||
|
||||
//
|
||||
// ol.source.ImageWMS
|
||||
//
|
||||
var imageWMS: ol.source.ImageWMS = new ol.source.ImageWMS({
|
||||
serverType: stringValue,
|
||||
url:stringValue
|
||||
});
|
||||
|
||||
//
|
||||
// ol.source.Source
|
||||
//
|
||||
const source = imageWMS as ol.source.Source;
|
||||
projection = source.getProjection();
|
||||
|
||||
//
|
||||
// ol.source.TileWMS
|
||||
//
|
||||
var tileWMS: ol.source.TileWMS = new ol.source.TileWMS({
|
||||
params: {},
|
||||
serverType: stringValue,
|
||||
url:stringValue
|
||||
});
|
||||
|
||||
voidValue = tileWMS.updateParams(tileWMS.getParams());
|
||||
stringValue = tileWMS.getGetFeatureInfoUrl([0, 0], 1, "EPSG:4326", {});
|
||||
|
||||
//
|
||||
// ol.source.WMTS
|
||||
//
|
||||
var wmts: ol.source.WMTS = new ol.source.WMTS({
|
||||
tileGrid: new ol.tilegrid.WMTS({}),
|
||||
layer: "",
|
||||
style: "",
|
||||
matrixSet: "",
|
||||
wrapX: true
|
||||
});
|
||||
|
||||
//
|
||||
// ol.animation
|
||||
//
|
||||
var bounceOptions: olx.animation.BounceOptions;
|
||||
bounceOptions.duration = numberValue;
|
||||
bounceOptions.start = numberValue;
|
||||
bounceOptions.resolution = numberValue;
|
||||
bounceOptions.easing = easingFunction;
|
||||
preRenderFunction = ol.animation.bounce(bounceOptions);
|
||||
|
||||
var panOptions: olx.animation.PanOptions;
|
||||
panOptions.duration = numberValue;
|
||||
panOptions.start = numberValue;
|
||||
panOptions.source = coordinate;
|
||||
panOptions.easing = easingFunction;
|
||||
preRenderFunction = ol.animation.pan(panOptions);
|
||||
|
||||
var rotateOptions: olx.animation.RotateOptions;
|
||||
rotateOptions.duration = numberValue;
|
||||
rotateOptions.start = numberValue;
|
||||
rotateOptions.anchor = coordinate;
|
||||
rotateOptions.rotation = numberValue;
|
||||
rotateOptions.easing = easingFunction;
|
||||
preRenderFunction = ol.animation.rotate(rotateOptions);
|
||||
|
||||
var zoomOptions: olx.animation.ZoomOptions;
|
||||
zoomOptions.duration = numberValue;
|
||||
zoomOptions.start = numberValue;
|
||||
zoomOptions.resolution = numberValue;
|
||||
zoomOptions.easing = easingFunction;
|
||||
preRenderFunction = ol.animation.zoom(zoomOptions);
|
||||
voidValue = map.beforeRender(preRenderFunction);
|
||||
|
||||
//
|
||||
// ol.coordinate
|
||||
//
|
||||
coordinate = ol.coordinate.add(coordinate, coordinate);
|
||||
coordinateFormatType = ol.coordinate.createStringXY();
|
||||
coordinateFormatType = ol.coordinate.createStringXY(numberValue);
|
||||
stringValue = ol.coordinate.format(coordinate, stringValue);
|
||||
stringValue = ol.coordinate.format(coordinate, stringValue, numberValue);
|
||||
coordinate = ol.coordinate.rotate(coordinate, numberValue);
|
||||
stringValue = ol.coordinate.toStringHDMS();
|
||||
stringValue = ol.coordinate.toStringHDMS(coordinate);
|
||||
stringValue = ol.coordinate.toStringXY();
|
||||
stringValue = ol.coordinate.toStringXY(coordinate);
|
||||
stringValue = ol.coordinate.toStringXY(coordinate, numberValue);
|
||||
|
||||
//
|
||||
// ol.easing
|
||||
//
|
||||
easingFunction = ol.easing.easeIn;
|
||||
easingFunction = ol.easing.easeOut;
|
||||
easingFunction = ol.easing.inAndOut;
|
||||
easingFunction = ol.easing.linear;
|
||||
easingFunction = ol.easing.upAndDown;
|
||||
|
||||
//
|
||||
// ol.Geolocation
|
||||
//
|
||||
var geolocation: ol.Geolocation = new ol.Geolocation({
|
||||
projection: projection
|
||||
});
|
||||
coordinate = geolocation.getPosition();
|
||||
|
||||
//
|
||||
// ol.Graticule
|
||||
//
|
||||
|
||||
graticule = new ol.Graticule();
|
||||
graticule = new ol.Graticule({
|
||||
map: map,
|
||||
});
|
||||
var graticuleMap: ol.Map = graticule.getMap();
|
||||
var graticuleMeridians: Array<ol.geom.LineString> = graticule.getMeridians();
|
||||
var graticuleParallels: Array<ol.geom.LineString> = graticule.getParallels();
|
||||
voidValue = graticule.setMap(graticuleMap);
|
||||
|
||||
//
|
||||
// ol.DeviceOrientation
|
||||
//
|
||||
|
||||
var deviceOrientation: ol.DeviceOrientation = new ol.DeviceOrientation({
|
||||
tracking: true,
|
||||
});
|
||||
numberValue = deviceOrientation.getHeading();
|
||||
|
||||
//
|
||||
// ol.Overlay
|
||||
//
|
||||
|
||||
var popup: ol.Overlay = new ol.Overlay({
|
||||
element: document.getElementById('popup')
|
||||
});
|
||||
voidValue = map.addOverlay(popup);
|
||||
var popupElement: Element = popup.getElement();
|
||||
var popupMap: ol.Map = popup.getMap();
|
||||
var popupOffset: Array<number> = popup.getOffset();
|
||||
coordinate = popup.getPosition();
|
||||
var popupPositioning: ol.OverlayPositioning = popup.getPositioning();
|
||||
voidValue = popup.setElement(popupElement);
|
||||
voidValue = popup.setMap(popupMap);
|
||||
voidValue = popup.setOffset(popupOffset);
|
||||
voidValue = popup.setPosition(coordinate);
|
||||
voidValue = popup.setPositioning(popupPositioning);
|
||||
|
||||
|
||||
//
|
||||
// ol.format.GeoJSON
|
||||
//
|
||||
|
||||
var geojsonOptions: olx.format.GeoJSONOptions;
|
||||
geojsonOptions.defaultDataProjection = "EPSG";
|
||||
geojsonOptions.defaultDataProjection = projection;
|
||||
geojsonOptions.geometryName = "geom";
|
||||
|
||||
var geojsonFormat: ol.format.GeoJSON;
|
||||
geojsonFormat = new ol.format.GeoJSON();
|
||||
geojsonFormat = new ol.format.GeoJSON(geojsonOptions);
|
||||
|
||||
// Test options
|
||||
var readOptions: olx.format.ReadOptions;
|
||||
readOptions.dataProjection = "EPSG";
|
||||
readOptions.dataProjection = projection;
|
||||
readOptions.featureProjection = "EPSG";
|
||||
readOptions.featureProjection = projection;
|
||||
|
||||
var writeOptions: olx.format.WriteOptions;
|
||||
writeOptions.dataProjection = "EPSG";
|
||||
writeOptions.dataProjection = projection;
|
||||
writeOptions.featureProjection = "EPSG";
|
||||
writeOptions.featureProjection = projection;
|
||||
writeOptions.rightHanded = false;
|
||||
|
||||
// Test functions
|
||||
feature = geojsonFormat.readFeature("json");
|
||||
feature = geojsonFormat.readFeature("json", readOptions);
|
||||
featureArray = geojsonFormat.readFeatures("json");
|
||||
featureArray = geojsonFormat.readFeatures("json", readOptions);
|
||||
geometry = geojsonFormat.readGeometry("geometry");
|
||||
geometry = geojsonFormat.readGeometry("geometry", readOptions);
|
||||
stringValue = geojsonFormat.writeFeature(feature);
|
||||
stringValue = geojsonFormat.writeFeature(feature, writeOptions);
|
||||
stringValue = geojsonFormat.writeFeatures(featureArray);
|
||||
stringValue = geojsonFormat.writeFeatures(featureArray, writeOptions);
|
||||
stringValue = geojsonFormat.writeGeometry(geometry);
|
||||
stringValue = geojsonFormat.writeGeometry(geometry, writeOptions);
|
||||
jsonValue = geojsonFormat.writeFeatureObject(feature);
|
||||
jsonValue = geojsonFormat.writeFeatureObject(feature, writeOptions);
|
||||
jsonValue = geojsonFormat.writeFeaturesObject(featureArray);
|
||||
jsonValue = geojsonFormat.writeFeaturesObject(featureArray, writeOptions);
|
||||
jsonValue = geojsonFormat.writeGeometryObject(geometry);
|
||||
jsonValue = geojsonFormat.writeGeometryObject(geometry, writeOptions);
|
||||
|
||||
//
|
||||
// ol.interactions
|
||||
//
|
||||
var modify: ol.interaction.Modify = new ol.interaction.Modify({
|
||||
features: new ol.Collection<ol.Feature>(featureArray)
|
||||
});
|
||||
|
||||
var draw: ol.interaction.Draw = new ol.interaction.Draw({
|
||||
type: "Point",
|
||||
clickTolerance: numberValue,
|
||||
features: new ol.Collection([]),
|
||||
source: vectorSource,
|
||||
snapTolerance: numberValue,
|
||||
maxPoints: numberValue,
|
||||
minPoints: numberValue,
|
||||
style: style,
|
||||
geometryFunction: drawGeometryFunction,
|
||||
geometryName: stringValue,
|
||||
condition: ol.events.condition.never,
|
||||
freehandCondition: ol.events.condition.never,
|
||||
wrapX: booleanValue
|
||||
});
|
||||
draw = new ol.interaction.Draw({
|
||||
type: "Point",
|
||||
style: styleArray
|
||||
});
|
||||
draw = new ol.interaction.Draw({
|
||||
type: "Point",
|
||||
style: styleFunction
|
||||
});
|
||||
|
||||
var dragbox: ol.interaction.DragBox = new ol.interaction.DragBox({
|
||||
className: stringValue,
|
||||
condition: ol.events.condition.always,
|
||||
boxEndCondition: function (mapBrowserEvent: ol.MapBrowserEvent, startPixel: ol.Pixel, endPixel: ol.Pixel) {
|
||||
var width: number = endPixel[0] - startPixel[0];
|
||||
var height: number = endPixel[1] - startPixel[1];
|
||||
return booleanValue;
|
||||
}
|
||||
});
|
||||
polygon = dragbox.getGeometry();
|
||||
|
||||
var interaction: ol.interaction.Interaction = new ol.interaction.Interaction({
|
||||
handleEvent: function (e: ol.MapBrowserEvent) {
|
||||
return booleanValue;
|
||||
}
|
||||
});
|
||||
booleanValue = interaction.handleEvent(mapBrowserEvent);
|
||||
booleanValue = interaction.getActive();
|
||||
map = interaction.getMap();
|
||||
voidValue = interaction.setActive(true);
|
||||
|
||||
|
||||
|
||||
const select: ol.interaction.Select = new ol.interaction.Select({
|
||||
layers: (layer: ol.layer.Layer) => true,
|
||||
});
|
||||
Vendored
+4873
File diff suppressed because it is too large
Load Diff
Vendored
+20
@@ -1079,6 +1079,25 @@ declare namespace olx {
|
||||
rightHanded?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
namespace control {
|
||||
interface ControlOptions {
|
||||
/**
|
||||
* The element is the control's container element. This only needs to be specified if you're developing a custom control.
|
||||
*/
|
||||
element?: Element;
|
||||
|
||||
/**
|
||||
* Function called when the control should be re-rendered. This is called in a requestAnimationFrame callback.
|
||||
*/
|
||||
render?: any;
|
||||
|
||||
/**
|
||||
* Specify a target if you want the control to be rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: Element | string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2395,6 +2414,7 @@ declare namespace ol {
|
||||
}
|
||||
|
||||
class Control {
|
||||
constructor(options: olx.control.ControlOptions);
|
||||
}
|
||||
|
||||
class FullScreen {
|
||||
|
||||
Vendored
+2
-2
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Denis Cappellin <http://github.com/cappellin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Pako {
|
||||
declare namespace pako {
|
||||
|
||||
/**
|
||||
* Compress data with deflate algorithm and options.
|
||||
@@ -59,5 +59,5 @@ declare namespace Pako {
|
||||
}
|
||||
|
||||
declare module 'pako' {
|
||||
export = Pako;
|
||||
export = pako;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -8,6 +8,7 @@
|
||||
declare namespace Express {
|
||||
export interface Request {
|
||||
authInfo?: any;
|
||||
user?: any;
|
||||
|
||||
// These declarations are merged into express's Request type
|
||||
login(user: any, done: (err: any) => void): void;
|
||||
@@ -89,4 +90,3 @@ declare module 'passport' {
|
||||
}[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
@@ -387,3 +387,7 @@ declare namespace ProtoBuf {
|
||||
declare module "protobufjs" {
|
||||
export = ProtoBuf;
|
||||
}
|
||||
|
||||
declare module "protobufjs/dist/protobuf-light" {
|
||||
export = ProtoBuf;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
/// <reference path="./rails-actioncable.d.ts" />
|
||||
|
||||
interface HelloChannel extends ActionCable.Channel {
|
||||
hello(world: string, name?: string): void;
|
||||
}
|
||||
|
||||
App = {};
|
||||
App.cable = ActionCable.createConsumer();
|
||||
App.cable.subscriptions.create("NetworkChannel", {});
|
||||
const helloChannel = App.cable.subscriptions.create('NetworkChannel', {
|
||||
connected(): void {
|
||||
console.log('connected');
|
||||
},
|
||||
disconnected(): void {
|
||||
console.log('disconnected');
|
||||
},
|
||||
received(obj: Object): void {
|
||||
console.log(obj);
|
||||
},
|
||||
hello(world: string, name: string = 'John Doe'): void {
|
||||
console.log(`Hello, ${world}! name[${name}]`);
|
||||
}
|
||||
}) as HelloChannel;
|
||||
|
||||
helloChannel.hello('World');
|
||||
|
||||
+15
-6
@@ -8,24 +8,33 @@ declare module ActionCable {
|
||||
unsubscribe(): void;
|
||||
perform(action: string, data: {}): void;
|
||||
}
|
||||
|
||||
interface Subscriptions {
|
||||
create(chan_name: string, obj: {}): Channel;
|
||||
create(chan_name: string, obj: CreateMixin): Channel;
|
||||
}
|
||||
|
||||
interface Cable {
|
||||
subscriptions: Subscriptions;
|
||||
}
|
||||
|
||||
interface CreateMixin {
|
||||
connected(): void;
|
||||
disconnected(): void;
|
||||
received(obj: Object): void;
|
||||
[key: string]: Function;
|
||||
}
|
||||
|
||||
function createConsumer(): Cable;
|
||||
function createConsumer(url: string): Cable;
|
||||
}
|
||||
|
||||
declare interface AppInterface {
|
||||
cable?: ActionCable.Cable;
|
||||
network?: ActionCable.Channel;
|
||||
network?: ActionCable.Channel;
|
||||
}
|
||||
|
||||
declare var App: AppInterface;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
declare module 'actioncable' {
|
||||
export = ActionCable;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
/// <reference path="react-big-calendar.d.ts"/>
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="../react/react-dom.d.ts"/>
|
||||
/// <reference path="../moment/moment.d.ts"/>
|
||||
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
import * as ReactDOMServer from "react-dom/server";
|
||||
import BigCalendar from 'react-big-calendar';
|
||||
|
||||
// Init localizer
|
||||
BigCalendar.momentLocalizer(moment);
|
||||
|
||||
// Testing examples from demos page
|
||||
// http://intljusticemission.github.io/react-big-calendar/examples/index.html
|
||||
|
||||
// Basic Example Test
|
||||
const BasicExample = React.createClass({
|
||||
render() {
|
||||
return (
|
||||
<BigCalendar
|
||||
{...this.props}
|
||||
events={getEvents()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
});
|
||||
ReactDOM.render(<BasicExample />, document.body);
|
||||
const basicExampleHtml = ReactDOMServer.renderToString(<BasicExample />);
|
||||
console.log('Test Results -> BasicExample', basicExampleHtml);
|
||||
|
||||
// Full API Example Test - based on API Documentation
|
||||
// http://intljusticemission.github.io/react-big-calendar/examples/index.html#api
|
||||
const FullAPIExample = React.createClass({
|
||||
render() {
|
||||
return (
|
||||
<BigCalendar
|
||||
{...this.props}
|
||||
date={new Date()}
|
||||
view={'string'}
|
||||
events={getEvents()}
|
||||
onNavigate={() => { } }
|
||||
onView={() => { } }
|
||||
onSelectSlot={(slotInfo) => {
|
||||
const start = slotInfo.start;
|
||||
const end = slotInfo.end;
|
||||
const slots = slotInfo.slots;
|
||||
} }
|
||||
onSelectEvent={(event) => { } }
|
||||
onSelecting={(slotInfo) => {
|
||||
const start = slotInfo.start;
|
||||
const end = slotInfo.end;
|
||||
return true;
|
||||
} }
|
||||
views={{}}
|
||||
toolbar={true}
|
||||
popup={true}
|
||||
popupOffset={20}
|
||||
selectable={true}
|
||||
step={20}
|
||||
rtl={true}
|
||||
eventPropGetter={(event, start, end, isSelected) => { } }
|
||||
titleAccessor={'string'}
|
||||
allDayAccessor={true}
|
||||
startAccessor={new Date()}
|
||||
endAccessor={new Date()}
|
||||
min={new Date()}
|
||||
max={new Date()}
|
||||
scrollToTime={new Date()}
|
||||
formats={{}}
|
||||
components={{}}
|
||||
messages={{}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
});
|
||||
ReactDOM.render(<FullAPIExample />, document.body);
|
||||
const fullApiExampleHtml = ReactDOMServer.renderToString(<FullAPIExample />);
|
||||
console.log('Test Results -> FullAPIExample', fullApiExampleHtml);
|
||||
|
||||
// Test fixtures
|
||||
function getEvents(): Object[] {
|
||||
return [
|
||||
{
|
||||
'title': 'All Day Event',
|
||||
'allDay': true,
|
||||
'start': new Date(2015, 3, 0),
|
||||
'end': new Date(2015, 3, 0)
|
||||
},
|
||||
{
|
||||
'title': 'Long Event',
|
||||
'start': new Date(2015, 3, 7),
|
||||
'end': new Date(2015, 3, 10)
|
||||
},
|
||||
|
||||
{
|
||||
'title': 'DTS STARTS',
|
||||
'start': new Date(2016, 2, 13, 0, 0, 0),
|
||||
'end': new Date(2016, 2, 20, 0, 0, 0)
|
||||
},
|
||||
|
||||
{
|
||||
'title': 'DTS ENDS',
|
||||
'start': new Date(2016, 10, 6, 0, 0, 0),
|
||||
'end': new Date(2016, 10, 13, 0, 0, 0)
|
||||
},
|
||||
|
||||
{
|
||||
'title': 'Some Event',
|
||||
'start': new Date(2015, 3, 9, 0, 0, 0),
|
||||
'end': new Date(2015, 3, 9, 0, 0, 0)
|
||||
},
|
||||
{
|
||||
'title': 'Conference',
|
||||
'start': new Date(2015, 3, 11),
|
||||
'end': new Date(2015, 3, 13),
|
||||
desc: 'Big conference for important people'
|
||||
},
|
||||
{
|
||||
'title': 'Meeting',
|
||||
'start': new Date(2015, 3, 12, 10, 30, 0, 0),
|
||||
'end': new Date(2015, 3, 12, 12, 30, 0, 0),
|
||||
desc: 'Pre-meeting meeting, to prepare for the meeting'
|
||||
},
|
||||
{
|
||||
'title': 'Lunch',
|
||||
'start': new Date(2015, 3, 12, 12, 0, 0, 0),
|
||||
'end': new Date(2015, 3, 12, 13, 0, 0, 0),
|
||||
desc: 'Power lunch'
|
||||
},
|
||||
{
|
||||
'title': 'Meeting',
|
||||
'start': new Date(2015, 3, 12, 14, 0, 0, 0),
|
||||
'end': new Date(2015, 3, 12, 15, 0, 0, 0)
|
||||
},
|
||||
{
|
||||
'title': 'Happy Hour',
|
||||
'start': new Date(2015, 3, 12, 17, 0, 0, 0),
|
||||
'end': new Date(2015, 3, 12, 17, 30, 0, 0),
|
||||
desc: 'Most important meal of the day'
|
||||
},
|
||||
{
|
||||
'title': 'Dinner',
|
||||
'start': new Date(2015, 3, 12, 20, 0, 0, 0),
|
||||
'end': new Date(2015, 3, 12, 21, 0, 0, 0)
|
||||
},
|
||||
{
|
||||
'title': 'Birthday Party',
|
||||
'start': new Date(2015, 3, 13, 7, 0, 0),
|
||||
'end': new Date(2015, 3, 13, 10, 30, 0)
|
||||
}
|
||||
];
|
||||
};
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// Type definitions for react-big-calendar v0.10.X
|
||||
// Project: https://github.com/intljusticemission/react-big-calendar
|
||||
// Definitions by: Piotr Witek <http://piotrwitek.github.io>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
|
||||
declare module 'react-big-calendar' {
|
||||
import * as React from 'react';
|
||||
|
||||
type stringOrDate = string | Date;
|
||||
|
||||
interface BigCalendarProps extends React.Props<BigCalendar> {
|
||||
date?: stringOrDate;
|
||||
view?: string;
|
||||
events?: Object[];
|
||||
onNavigate?: Function;
|
||||
onView?: Function;
|
||||
onSelectSlot?: (slotInfo: { start: stringOrDate, end: stringOrDate, slots: Date[] | string[] }) => void;
|
||||
onSelectEvent?: (event: Object) => void;
|
||||
onSelecting?: (slotInfo: { start: stringOrDate, end: stringOrDate }) => boolean;
|
||||
views?: Object;
|
||||
toolbar?: boolean;
|
||||
popup?: boolean;
|
||||
popupOffset?: number | { x: number, y: number };
|
||||
selectable?: boolean;
|
||||
step?: number;
|
||||
rtl?: boolean;
|
||||
eventPropGetter?: (event: Object, start: stringOrDate, end: stringOrDate, isSelected: boolean) => void;
|
||||
titleAccessor?: string;
|
||||
allDayAccessor?: boolean;
|
||||
startAccessor?: stringOrDate;
|
||||
endAccessor?: stringOrDate;
|
||||
min?: stringOrDate;
|
||||
max?: stringOrDate;
|
||||
scrollToTime?: stringOrDate;
|
||||
formats?: Object;
|
||||
components?: Object;
|
||||
messages?: Object;
|
||||
}
|
||||
|
||||
export class BigCalendar extends React.Component<BigCalendarProps, {}> {
|
||||
/**
|
||||
* Setup the localizer by providing the moment Object
|
||||
*/
|
||||
static momentLocalizer(momentInstance: Object): void;
|
||||
/**
|
||||
* Setup the localizer by providing the globalize Object
|
||||
*/
|
||||
static globalizeLocalizer(globalizeInstance: Object): void;
|
||||
}
|
||||
|
||||
export default BigCalendar;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/// <reference path="react-jsonschema-form.d.ts" />
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
import * as React from "react";
|
||||
import Form from "react-jsonschema-form";
|
||||
|
||||
// example taken from the react-jsonschema-form playground:
|
||||
// https://github.com/mozilla-services/react-jsonschema-form/blob/fedd830294417969d88e38fb9f6b3a85e6ad105e/playground/samples/simple.js
|
||||
|
||||
const schema = {
|
||||
"title": "A registration form",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"firstName",
|
||||
"lastName"
|
||||
],
|
||||
"properties": {
|
||||
"firstName": {
|
||||
"type": "string",
|
||||
"title": "First name"
|
||||
},
|
||||
"lastName": {
|
||||
"type": "string",
|
||||
"title": "Last name"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"title": "Age"
|
||||
},
|
||||
"bio": {
|
||||
"type": "string",
|
||||
"title": "Bio"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"title": "Password",
|
||||
"minLength": 3
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const uiSchema = {
|
||||
age: {
|
||||
"ui:widget": "updown"
|
||||
},
|
||||
bio: {
|
||||
"ui:widget": "textarea"
|
||||
},
|
||||
password: {
|
||||
"ui:widget": "password",
|
||||
"ui:help": "Hint: Make it strong!"
|
||||
},
|
||||
date: {
|
||||
"ui:widget": "alt-datetime"
|
||||
}
|
||||
};
|
||||
|
||||
interface IExampleState {
|
||||
formData: any;
|
||||
}
|
||||
|
||||
export class Example extends React.Component<any, IExampleState> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state.formData = {
|
||||
firstName: "Chuck",
|
||||
lastName: "Norris",
|
||||
age: 75,
|
||||
bio: "Roundhouse kicking asses since 1940",
|
||||
password: "noneed"
|
||||
};
|
||||
}
|
||||
|
||||
public render() {
|
||||
return (
|
||||
<div className="react-jsonschema-form-example">
|
||||
{ <Form schema={schema}
|
||||
uiSchema={uiSchema}
|
||||
formData={this.state}
|
||||
onChange={(formData) => this.setState({formData})} /> }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Type definitions for react-jsonschema-form 0.30.1
|
||||
// Project: https://github.com/mozilla-services/react-jsonschema-form
|
||||
// Definitions by: Dan Fox <https://github.com/iamdanfox>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
declare module "react-jsonschema-form" {
|
||||
import * as React from "react";
|
||||
|
||||
export interface FormProps {
|
||||
schema: {};
|
||||
uiSchema?: {};
|
||||
formData?: any;
|
||||
widgets?: {};
|
||||
fields?: {};
|
||||
validate?: (formData: any, errors: any) => any;
|
||||
onChange?: (e: IChangeEvent) => any;
|
||||
onError?: (e: any) => any;
|
||||
onSubmit?: (e: any) => any;
|
||||
liveValidate?: boolean;
|
||||
safeRenderCompletion?: boolean;
|
||||
}
|
||||
|
||||
export interface IChangeEvent {
|
||||
edit: boolean;
|
||||
formData: any;
|
||||
errors: any[];
|
||||
errorSchema: any;
|
||||
idSchema: any;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export default class Form extends React.Component<FormProps, any> {}
|
||||
}
|
||||
Vendored
+41
-1
@@ -1741,6 +1741,41 @@ declare namespace __React {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/activityindicator.html#props
|
||||
*/
|
||||
export interface ActivityIndicatorProperties extends React.Props<ActivityIndicatorStatic> {
|
||||
|
||||
/**
|
||||
* Whether to show the indicator (true, the default) or hide it (false).
|
||||
*/
|
||||
animating?: boolean
|
||||
|
||||
/**
|
||||
* The foreground color of the spinner (default is gray).
|
||||
*/
|
||||
color?: string
|
||||
|
||||
/**
|
||||
* Whether the indicator should hide when not animating (true by default).
|
||||
*/
|
||||
hidesWhenStopped?: boolean
|
||||
|
||||
/**
|
||||
* Size of the indicator.
|
||||
* Small has a height of 20, large has a height of 36.
|
||||
*
|
||||
* enum('small', 'large')
|
||||
*/
|
||||
size?: 'small' | 'large'
|
||||
|
||||
style?: ViewStyle
|
||||
}
|
||||
|
||||
export interface ActivityIndicatorStatic extends React.ComponentClass<ActivityIndicatorProperties> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props
|
||||
*/
|
||||
@@ -1772,11 +1807,14 @@ declare namespace __React {
|
||||
*
|
||||
* enum('small', 'large')
|
||||
*/
|
||||
size?: string
|
||||
size?: 'small' | 'large'
|
||||
|
||||
style?: ViewStyle
|
||||
}
|
||||
|
||||
/**
|
||||
* @Deprecated since version 0.28.0
|
||||
*/
|
||||
export interface ActivityIndicatorIOSStatic extends React.ComponentClass<ActivityIndicatorIOSProperties> {
|
||||
}
|
||||
|
||||
@@ -5585,6 +5623,8 @@ declare namespace __React {
|
||||
|
||||
// export var AppRegistry: AppRegistryStatic;
|
||||
|
||||
export var ActivityIndicator: ActivityIndicatorStatic
|
||||
export type ActivityIndicator = ActivityIndicatorStatic
|
||||
|
||||
export var ActivityIndicatorIOS: ActivityIndicatorIOSStatic
|
||||
export type ActivityIndicatorIOS = ActivityIndicatorIOSStatic
|
||||
|
||||
@@ -58,6 +58,36 @@ class CounterContainer extends Component<any, any> {
|
||||
|
||||
}
|
||||
|
||||
// Ensure connect's first two arguments can be replaced by wrapper functions
|
||||
interface ICounterStateProps {
|
||||
value: number
|
||||
}
|
||||
interface ICounterDispatchProps {
|
||||
onIncrement: () => void
|
||||
}
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
() => mapStateToProps,
|
||||
() => mapDispatchToProps
|
||||
)(Counter);
|
||||
// only first argument
|
||||
connect<ICounterStateProps, {}, {}>(
|
||||
() => mapStateToProps
|
||||
)(Counter);
|
||||
// wrap only one argument
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
mapStateToProps,
|
||||
() => mapDispatchToProps
|
||||
)(Counter);
|
||||
// with extra arguments
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
() => mapStateToProps,
|
||||
() => mapDispatchToProps,
|
||||
(s: ICounterStateProps, d: ICounterDispatchProps) =>
|
||||
objectAssign({}, s, d),
|
||||
{ pure: true }
|
||||
)(Counter);
|
||||
|
||||
|
||||
class App extends Component<any, any> {
|
||||
render(): JSX.Element {
|
||||
// ...
|
||||
|
||||
Vendored
+6
-4
@@ -45,17 +45,19 @@ declare module "react-redux" {
|
||||
export function connect(): InferableComponentDecorator;
|
||||
|
||||
export function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
mapStateToProps: MapStateToProps<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps?: MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject
|
||||
mapStateToProps: FuncOrSelf<MapStateToProps<TStateProps, TOwnProps>>,
|
||||
mapDispatchToProps?: FuncOrSelf<MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject>
|
||||
): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
export function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
mapStateToProps: MapStateToProps<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject,
|
||||
mapStateToProps: FuncOrSelf<MapStateToProps<TStateProps, TOwnProps>>,
|
||||
mapDispatchToProps: FuncOrSelf<MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject>,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps>,
|
||||
options?: Options
|
||||
): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
type FuncOrSelf<T> = T | (() => T);
|
||||
|
||||
interface MapStateToProps<TStateProps, TOwnProps> {
|
||||
(state: any, ownProps?: TOwnProps): TStateProps;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/// <reference path="../lodash/lodash.d.ts" />
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="../react/react-dom.d.ts" />
|
||||
/// <reference path="./react-select.d.ts" />
|
||||
|
||||
import * as _ from "lodash";
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
|
||||
@@ -61,6 +63,30 @@ const CustomValue = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
const filterOptions = (options: Array<Option>, filter: string, values: Array<Option>) => {
|
||||
// Filter already selected values
|
||||
let filteredOptions = options.filter(option => {
|
||||
return !(_.includes(values, option));
|
||||
});
|
||||
|
||||
// Filter by label
|
||||
if (filter !== undefined && filter != null && filter.length > 0) {
|
||||
filteredOptions = filteredOptions.filter(option => {
|
||||
return RegExp(filter, 'ig').test(option.label);
|
||||
});
|
||||
}
|
||||
|
||||
// Append Addition option
|
||||
if (filteredOptions.length == 0) {
|
||||
filteredOptions.push({
|
||||
label: `Create: ${filter}`,
|
||||
value: filter
|
||||
});
|
||||
}
|
||||
|
||||
return filteredOptions;
|
||||
};
|
||||
|
||||
class SelectTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
@@ -89,6 +115,7 @@ class SelectTest extends React.Component<React.Props<{}>, {}> {
|
||||
autosize: true,
|
||||
clearable: true,
|
||||
escapeClearsValue: true,
|
||||
filterOptions: filterOptions,
|
||||
ignoreAccents: true,
|
||||
joinValues: false,
|
||||
matchPos: "any",
|
||||
|
||||
Vendored
+1
-1
@@ -134,7 +134,7 @@ declare namespace ReactSelect {
|
||||
/**
|
||||
* method to filter the options array
|
||||
*/
|
||||
filterOptions?: (options: Array<Option>, filter: string, currentValues: (string | number)[]) => Array<Option>;
|
||||
filterOptions?: (options: Array<Option>, filter: string, currentValues: Array<Option>) => Array<Option>;
|
||||
/**
|
||||
* whether to strip diacritics when filtering
|
||||
* @default true
|
||||
|
||||
Vendored
+1
@@ -2500,6 +2500,7 @@ declare namespace JSX {
|
||||
image: React.SVGProps;
|
||||
line: React.SVGProps;
|
||||
linearGradient: React.SVGProps;
|
||||
marker: React.SVGProps;
|
||||
mask: React.SVGProps;
|
||||
path: React.SVGProps;
|
||||
pattern: React.SVGProps;
|
||||
|
||||
Vendored
+10
-1
@@ -119,7 +119,7 @@ declare namespace rosie {
|
||||
* @param {*=} value
|
||||
* @return {Factory}
|
||||
*/
|
||||
option(name: string, dependenciesOrValue: any | string[], value?: any): IFactory;
|
||||
option(name: string, dependenciesOrValue?: any | string[], value?: any): IFactory;
|
||||
|
||||
/**
|
||||
* Defines an attribute that, by default, simply has an auto-incrementing
|
||||
@@ -191,6 +191,15 @@ declare namespace rosie {
|
||||
|
||||
buildList(size: number, attributes: Object, options: Object): Object[];
|
||||
|
||||
/**
|
||||
* Extends a given factory by copying over its attributes, options,
|
||||
* callbacks, and constructor. This can be useful when you want to make
|
||||
* different types which all share certain attributes.
|
||||
*
|
||||
* @param {string|Factory} name The factory to extend.
|
||||
* @return {Factory}
|
||||
*/
|
||||
extend(name: String | IFactory): IFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="scanf.d.ts" />
|
||||
|
||||
import scanf = require("scanf");
|
||||
|
||||
console.log(scanf.sscanf("3", "%d"));
|
||||
Vendored
+200
@@ -0,0 +1,200 @@
|
||||
// Type definitions for node-scanf
|
||||
// Project: https://github.com/Lellansin/node-scanf
|
||||
// Definitions by: Jeongho Nam <http://samchon.org>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "scanf"
|
||||
{
|
||||
export = __node_scanf.scanf;
|
||||
}
|
||||
|
||||
declare namespace __node_scanf
|
||||
{
|
||||
/* ------------------------------------------------------------
|
||||
SCANF - FROM STDIN
|
||||
------------------------------------------------------------ */
|
||||
/**
|
||||
* <p> Read formatted word from stdin. </p>
|
||||
*
|
||||
* <p> Reads a word from stdin and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param format The format represents a word.
|
||||
* @return A word.
|
||||
*/
|
||||
function scanf(format: "%s"): string;
|
||||
|
||||
/**
|
||||
* <p> Read formatted line from stdin. </p>
|
||||
*
|
||||
* <p> Reads a word from stdin and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param format The format represents a word.
|
||||
* @return A word.
|
||||
*/
|
||||
function scanf(format: "%S"): string;
|
||||
|
||||
/**
|
||||
* <p> Read formatted integer from stdin. </p>
|
||||
*
|
||||
* <p> Reads an integer from stdin and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param format The format represents an integer value.
|
||||
* @return An integer.
|
||||
*/
|
||||
function scanf(format: "%d"): number;
|
||||
|
||||
/**
|
||||
* <p> Read formatted float from stdin. </p>
|
||||
*
|
||||
* <p> Reads a float from stdin and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param format The format represents an float value.
|
||||
* @return A float.
|
||||
*/
|
||||
function scanf(format: "%f"): number;
|
||||
|
||||
/**
|
||||
* <p> Read formatted octal from stdin. </p>
|
||||
*
|
||||
* <p> Reads an octal from stdin and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param format The format represents an octal value.
|
||||
* @return An octal.
|
||||
*/
|
||||
function scanf(format: "%o"): number;
|
||||
|
||||
/**
|
||||
* <p> Read formatted hex from stdin. </p>
|
||||
*
|
||||
* <p> Reads a hex from stdin and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param format The format represents a hex value.
|
||||
* @return A hex.
|
||||
*/
|
||||
function scanf(format: "%x"): number;
|
||||
|
||||
/**
|
||||
* <p> Reads formatted data from stdin. </p>
|
||||
*
|
||||
* <p> Reads data from stdin and stores them according to the parameter <i>format</i> into an array to be returned. </p>
|
||||
*
|
||||
* @param format The format contains a sequence of characters that control how characters extracted from the stream are tread.
|
||||
* @return An array containing data constructed from stdin with the <i>format</i>.
|
||||
*/
|
||||
function scanf(format: string): Array<number|string>;
|
||||
|
||||
/**
|
||||
* <p> Reads formatted data from stdin. </p>
|
||||
*
|
||||
* <p> Reads data from stdin and stores them according to the parameter <i>format</i> into a JSON object following sequence of <i>names</i>. </p>
|
||||
*
|
||||
* @param format The format contains a sequence of characters that control how characters extracted from the stream are tread.
|
||||
* @param names Names of data constructed from stdin with the <i>format</i>.
|
||||
*
|
||||
* @return A JSON object containing data constructed from stdin with the <i>format</i> and following <i>names</i>.
|
||||
*/
|
||||
function scanf(format: string, ...names: string[]): Object;
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
SSCANF - FROM SOURCE STRING
|
||||
------------------------------------------------------------ */
|
||||
namespace scanf
|
||||
{
|
||||
/**
|
||||
* <p> Read formatted word from string. </p>
|
||||
*
|
||||
* <p> Reads a word from <i>source</i> and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format represents a word.
|
||||
*
|
||||
* @return A word.
|
||||
*/
|
||||
function sscanf(source: string, format: "%s"): string;
|
||||
|
||||
/**
|
||||
* <p> Read formatted line from string. </p>
|
||||
*
|
||||
* <p> Reads a word from <i>source</i> and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format represents a word.
|
||||
*
|
||||
* @return A word.
|
||||
*/
|
||||
function sscanf(source: string, format: "%S"): string;
|
||||
|
||||
/**
|
||||
* <p> Read formatted integer from string. </p>
|
||||
*
|
||||
* <p> Reads an integer from <i>source</i> and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format represents an integer value.
|
||||
*
|
||||
* @return An integer.
|
||||
*/
|
||||
function sscanf(source: string, format: "%d"): number;
|
||||
|
||||
/**
|
||||
* <p> Read formatted float from string. </p>
|
||||
*
|
||||
* <p> Reads a float from <i>source</i> and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format represents an float value.
|
||||
*
|
||||
* @return A float.
|
||||
*/
|
||||
function sscanf(source: string, format: "%f"): number;
|
||||
|
||||
/**
|
||||
* <p> Read formatted octal from string. </p>
|
||||
*
|
||||
* <p> Reads an octal from <i>source</i> and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format represents an octal value.
|
||||
*
|
||||
* @return An octal.
|
||||
*/
|
||||
function sscanf(source: string, format: "%o"): number;
|
||||
|
||||
/**
|
||||
* <p> Read formatted hex from string. </p>
|
||||
*
|
||||
* <p> Reads a hex from <i>source</i> and returns it according to parameter <i>format</i>. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format represents a hex value.
|
||||
*
|
||||
* @return A hex.
|
||||
*/
|
||||
function sscanf(source: string, format: "%x"): number;
|
||||
|
||||
/**
|
||||
* <p> Reads formatted data from string. </p>
|
||||
*
|
||||
* <p> Reads data from <i>source</i> and stores them according to the parameter <i>format</i> into an array to be returned. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format contains a sequence of characters that control how characters extracted from the stream are tread.
|
||||
*
|
||||
* @return An array containing data constructed from string with the <i>format</i>.
|
||||
*/
|
||||
function sscanf(source: string, format: string): Array<number|string>;
|
||||
|
||||
/**
|
||||
* <p> Reads formatted data from string. </p>
|
||||
*
|
||||
* <p> Reads data from <i>source</i> and stores them according to the parameter <i>format</i> into a JSON object following sequence of <i>names</i>. </p>
|
||||
*
|
||||
* @param source Source string to retrieve data.
|
||||
* @param format The format contains a sequence of characters that control how characters extracted from the stream are tread.
|
||||
* @param names Names of data constructed from string with the <i>format</i>.
|
||||
*
|
||||
* @return A JSON object containing data constructed from string with the <i>format</i> and following <i>names</i>.
|
||||
*/
|
||||
function sscanf(source: string, format: string, ...names: string[]): Object;
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -78,7 +78,7 @@ interface Select2Options {
|
||||
*/
|
||||
templateSelection?: (object: Select2SelectionObject) => any;
|
||||
templateResult?: (object: Select2SelectionObject) => any;
|
||||
language?: string;
|
||||
language?: string | string[] | {};
|
||||
}
|
||||
|
||||
interface Select2JQueryEventObject extends JQueryEventObject {
|
||||
|
||||
Vendored
+1
-1
@@ -3727,7 +3727,7 @@ declare module "sequelize" {
|
||||
* @return Returns the aggregate result cast to `options.dataType`, unless `options.plain` is false, in
|
||||
* which case the complete data result is returned.
|
||||
*/
|
||||
aggregate( field : string, aggregateFunction : Function, options? : AggregateOptions ) : Promise<Object>;
|
||||
aggregate( field : string, aggregateFunction : string, options? : AggregateOptions ) : Promise<Object>;
|
||||
|
||||
/**
|
||||
* Count the number of records matching the provided where clause.
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/// <reference path="simplemde.d.ts" />
|
||||
|
||||
function testSimplemde() {
|
||||
|
||||
function customMarkdownParser(markdown: string) {
|
||||
return "<div>" + markdown + "</div>";
|
||||
}
|
||||
|
||||
function testInit() {
|
||||
var simplemde1 = new SimpleMDE();
|
||||
var simplemde2 = new SimpleMDE({ element: document.getElementById("MyID") });
|
||||
}
|
||||
|
||||
function testAccessValue() {
|
||||
var simplemde = new SimpleMDE();
|
||||
var value: string = simplemde.value();
|
||||
simplemde.value("This text will appear in the editor");
|
||||
}
|
||||
|
||||
function testConfiguration() {
|
||||
var simplemde: SimpleMDE;
|
||||
|
||||
// Most options demonstrate the non-default behavior
|
||||
simplemde = new SimpleMDE({
|
||||
autofocus: true,
|
||||
autosave: {
|
||||
enabled: true,
|
||||
uniqueId: "MyUniqueID",
|
||||
delay: 1000
|
||||
},
|
||||
blockStyles: {
|
||||
bold: "__",
|
||||
italic: "_"
|
||||
},
|
||||
element: document.getElementById("MyID"),
|
||||
forceSync: true,
|
||||
hideIcons: ["guide", "heading"],
|
||||
indentWithTabs: false,
|
||||
initialValue: "Hello world!",
|
||||
insertTexts: {
|
||||
horizontalRule: ["", "\n\n-----\n\n"],
|
||||
image: [""],
|
||||
link: ["[", "](http://)"],
|
||||
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"]
|
||||
},
|
||||
lineWrapping: false,
|
||||
parsingConfig: {
|
||||
allowAtxHeaderWithoutSpace: true,
|
||||
strikethrough: false,
|
||||
underscoresBreakWords: true
|
||||
},
|
||||
placeholder: "Type here...",
|
||||
previewRender: function (plainText) {
|
||||
return customMarkdownParser(plainText); // Returns HTML from a custom parser
|
||||
},
|
||||
promptURLs: true,
|
||||
renderingConfig: {
|
||||
singleLineBreaks: false,
|
||||
codeSyntaxHighlighting: true
|
||||
},
|
||||
shortcuts: {
|
||||
drawTable: "Cmd-Alt-T"
|
||||
},
|
||||
showIcons: ["code", "table"],
|
||||
spellChecker: false,
|
||||
status: false,
|
||||
styleSelectedText: false,
|
||||
tabSize: 4,
|
||||
toolbar: false,
|
||||
toolbarTips: false
|
||||
});
|
||||
|
||||
simplemde = new SimpleMDE({
|
||||
previewRender: function (plainText, preview) { // Async method
|
||||
setTimeout(function () {
|
||||
preview.innerHTML = customMarkdownParser(plainText);
|
||||
}, 250);
|
||||
|
||||
return "Loading...";
|
||||
},
|
||||
status: ["autosave", "lines", "words", "cursor"] // Optional usage
|
||||
});
|
||||
|
||||
simplemde = new SimpleMDE({
|
||||
status: ["autosave", "lines", "words", "cursor", {
|
||||
className: "keystrokes",
|
||||
defaultValue: function (el) {
|
||||
this.keystrokes = 0;
|
||||
el.innerHTML = "0 Keystrokes";
|
||||
},
|
||||
onUpdate: function (el) {
|
||||
el.innerHTML = ++this.keystrokes + " Keystrokes";
|
||||
}
|
||||
}] // Another optional usage, with a custom status bar item that counts keystrokes
|
||||
});
|
||||
}
|
||||
|
||||
function testToolbarCustomize() {
|
||||
var simplemde: SimpleMDE;
|
||||
|
||||
// Customize only the order of existing buttons
|
||||
simplemde = new SimpleMDE({
|
||||
toolbar: ["bold", "italic", "heading", "|", "quote"]
|
||||
});
|
||||
|
||||
// Customize all information and/or add your own icons
|
||||
simplemde = new SimpleMDE({
|
||||
toolbar: [{
|
||||
name: "bold",
|
||||
action: SimpleMDE.toggleBold,
|
||||
className: "fa fa-bold",
|
||||
title: "Bold"
|
||||
},
|
||||
{
|
||||
name: "custom",
|
||||
action: function customFunction(editor) {
|
||||
// Add your own code
|
||||
},
|
||||
className: "fa fa-star",
|
||||
title: "Custom Button"
|
||||
},
|
||||
"|" // Separator
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function testKeyboardShortcuts() {
|
||||
var simplemde = new SimpleMDE({
|
||||
shortcuts: {
|
||||
"toggleOrderedList": "Ctrl-Alt-K", // alter the shortcut for toggleOrderedList
|
||||
"toggleCodeBlock": null, // unbind Ctrl-Alt-C
|
||||
"drawTable": "Cmd-Alt-T" // bind Cmd-Alt-T to drawTable action, which doesn't come with a default shortcut
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testEventHandling() {
|
||||
var simplemde = new SimpleMDE();
|
||||
simplemde.codemirror.on("change", function () {
|
||||
console.log(simplemde.value());
|
||||
});
|
||||
}
|
||||
|
||||
function testRemoveFromTextArea() {
|
||||
var simplemde = new SimpleMDE();
|
||||
simplemde.toTextArea();
|
||||
simplemde = null;
|
||||
}
|
||||
|
||||
function testOtherMethods() {
|
||||
var simplemde = new SimpleMDE();
|
||||
var booleanVal: boolean;
|
||||
booleanVal = simplemde.isPreviewActive(); // returns boolean
|
||||
booleanVal = simplemde.isSideBySideActive(); // returns boolean
|
||||
booleanVal = simplemde.isFullscreenActive(); // returns boolean
|
||||
simplemde.clearAutosavedValue(); // no returned value
|
||||
}
|
||||
}
|
||||
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
// Type definitions for SimpleMDE v1.11.2
|
||||
// Project: https://github.com/NextStepWebs/simplemde-markdown-editor
|
||||
// Definitions by: Scalesoft <https://github.com/Scalesoft>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace SimpleMDE {
|
||||
interface AutoSaveOptions {
|
||||
enabled?: boolean;
|
||||
delay?: number;
|
||||
uniqueId: string;
|
||||
}
|
||||
|
||||
interface BlockStyleOptions {
|
||||
bold?: string;
|
||||
code?: string;
|
||||
italic?: string;
|
||||
}
|
||||
|
||||
interface InsertTextOptions {
|
||||
horizontalRule?: string[];
|
||||
image?: string[];
|
||||
link?: string[];
|
||||
table?: string[];
|
||||
}
|
||||
|
||||
interface ParsingOptions {
|
||||
allowAtxHeaderWithoutSpace?: boolean;
|
||||
strikethrough?: boolean;
|
||||
underscoresBreakWords?: boolean;
|
||||
}
|
||||
|
||||
interface RenderingOptions {
|
||||
singleLineBreaks?: boolean;
|
||||
codeSyntaxHighlighting: boolean;
|
||||
}
|
||||
|
||||
interface ShortcutsArray {
|
||||
[action: string]: string;
|
||||
toggleBlockquote?: string;
|
||||
toggleBold?: string;
|
||||
cleanBlock?: string;
|
||||
toggleHeadingSmaller?: string;
|
||||
toggleItalic?: string;
|
||||
drawLink?: string;
|
||||
toggleUnorderedList?: string;
|
||||
togglePreview?: string;
|
||||
toggleCodeBlock?: string;
|
||||
drawImage?: string;
|
||||
toggleOrderedList?: string;
|
||||
toggleHeadingBigger?: string;
|
||||
toggleSideBySide?: string;
|
||||
toggleFullScreen?: string;
|
||||
}
|
||||
|
||||
interface StatusBarItem {
|
||||
className: string;
|
||||
defaultValue: (element: HTMLElement) => void;
|
||||
onUpdate: (element: HTMLElement) => void;
|
||||
}
|
||||
|
||||
interface ToolbarIcon {
|
||||
name: string;
|
||||
action: string|((editor: SimpleMDE) => void);
|
||||
className: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
autoDownloadFontAwesome?: boolean;
|
||||
autofocus?: boolean;
|
||||
autosave?: AutoSaveOptions;
|
||||
blockStyles?: BlockStyleOptions;
|
||||
element?: HTMLElement;
|
||||
forceSync?: boolean;
|
||||
hideIcons?: string[];
|
||||
indentWithTabs?: boolean;
|
||||
initialValue?: string;
|
||||
insertTexts?: InsertTextOptions;
|
||||
lineWrapping?: boolean;
|
||||
parsingConfig?: ParsingOptions;
|
||||
placeholder?: string;
|
||||
previewRender?: (markdownPlaintext: string, previewElement?: HTMLElement) => string;
|
||||
promptURLs?: boolean;
|
||||
renderingConfig?: RenderingOptions;
|
||||
shortcuts?: ShortcutsArray;
|
||||
showIcons?: string[];
|
||||
spellChecker?: boolean;
|
||||
status?: boolean|Array<string|StatusBarItem>;
|
||||
styleSelectedText?: boolean;
|
||||
tabSize?: number;
|
||||
toolbar?: boolean|Array<string|ToolbarIcon>;
|
||||
toolbarTips?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare class SimpleMDE {
|
||||
constructor();
|
||||
constructor(options: SimpleMDE.Options);
|
||||
value(): string;
|
||||
value(val: string): void;
|
||||
codemirror: any;
|
||||
toTextArea(): void;
|
||||
isPreviewActive(): boolean;
|
||||
isSideBySideActive(): boolean;
|
||||
isFullscreenActive(): boolean;
|
||||
clearAutosavedValue(): void;
|
||||
|
||||
static toggleBold: (editor: SimpleMDE) => void;
|
||||
static toggleItalic: (editor: SimpleMDE) => void;
|
||||
static toggleStrikethrough: (editor: SimpleMDE) => void;
|
||||
static toggleHeadingSmaller: (editor: SimpleMDE) => void;
|
||||
static toggleHeadingBigger: (editor: SimpleMDE) => void;
|
||||
static toggleHeading1: (editor: SimpleMDE) => void;
|
||||
static toggleHeading2: (editor: SimpleMDE) => void;
|
||||
static toggleHeading3: (editor: SimpleMDE) => void;
|
||||
static toggleCodeBlock: (editor: SimpleMDE) => void;
|
||||
static toggleBlockquote: (editor: SimpleMDE) => void;
|
||||
static toggleUnorderedList: (editor: SimpleMDE) => void;
|
||||
static toggleOrderedList: (editor: SimpleMDE) => void;
|
||||
static cleanBlock: (editor: SimpleMDE) => void;
|
||||
static drawLink: (editor: SimpleMDE) => void;
|
||||
static drawImage: (editor: SimpleMDE) => void;
|
||||
static drawTable: (editor: SimpleMDE) => void;
|
||||
static drawHorizontalRule: (editor: SimpleMDE) => void;
|
||||
static togglePreview: (editor: SimpleMDE) => void;
|
||||
static toggleSideBySide: (editor: SimpleMDE) => void;
|
||||
static toggleFullScreen: (editor: SimpleMDE) => void;
|
||||
static undo: (editor: SimpleMDE) => void;
|
||||
static redo: (editor: SimpleMDE) => void;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/// <reference path="smart-fox-server.d.ts" />
|
||||
|
||||
function test_Vec3D() {
|
||||
var Vec3D: SFS2X.Entities.Data.Vec3D = new SFS2X.Entities.Data.Vec3D(0, 0, 0);
|
||||
var Vec3Dalt: SFS2X.Entities.Data.Vec3D = new SFS2X.Entities.Data.Vec3D(0, 0);
|
||||
|
||||
var positionX: number = Vec3D.px;
|
||||
var positionY: number = Vec3D.py;
|
||||
var positionZ: number = Vec3D.pz;
|
||||
|
||||
var isFloat: boolean = Vec3D.isFloat();
|
||||
|
||||
return Vec3D;
|
||||
};
|
||||
|
||||
function test_MatchExpression() {
|
||||
|
||||
var exp = new SFS2X.Entities.Match.MatchExpression('rank', SFS2X.Entities.Match.NumberMatch.GREATER_THAN, 5)
|
||||
.and('country', SFS2X.Entities.Match.StringMatch.EQUALS, 'Italy');
|
||||
|
||||
var exp = new SFS2X.Entities.Match.MatchExpression(SFS2X.Entities.Match.RoomProperties.IS_GAME, SFS2X.Entities.Match.BoolMatch.EQUALS, true)
|
||||
.and(SFS2X.Entities.Match.RoomProperties.HAS_FREE_PLAYER_SLOTS, SFS2X.Entities.Match.BoolMatch.EQUALS, true)
|
||||
.and('isGameStarted', SFS2X.Entities.Match.BoolMatch.EQUALS, false);
|
||||
|
||||
var exp = new SFS2X.Entities.Match.MatchExpression('avatarData.shield.inUse', SFS2X.Entities.Match.BoolMatch.EQUALS, true);
|
||||
|
||||
var exp = new SFS2X.Entities.Match.MatchExpression('avatarData.weapons.3.name', SFS2X.Entities.Match.StringMatch.EQUALS, "Narsil");
|
||||
}
|
||||
|
||||
function test_MMOItemVariable() {
|
||||
var MMOItemVar1: SFS2X.Entities.Variables.MMOItemVariable = new SFS2X.Entities.Variables.MMOItemVariable('string', 'vlaue');
|
||||
var MMOItemVar2: SFS2X.Entities.Variables.MMOItemVariable = new SFS2X.Entities.Variables.MMOItemVariable('string', 'vlaue', 2);
|
||||
|
||||
var MMOItemTypeName: string = MMOItemVar1.getTypeName(1);
|
||||
var MMOItemisNull: boolean = MMOItemVar1.isNull();
|
||||
var MMOItemString: string = MMOItemVar1.toString();
|
||||
|
||||
var name: string = MMOItemVar1.name;
|
||||
var value: any = MMOItemVar1.value;
|
||||
|
||||
return MMOItemVar1;
|
||||
}
|
||||
|
||||
function test_BuddyListAddBuddyRequest() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
sfs.send(new SFS2X.Requests.BuddyList.AddBuddyRequest('John'));
|
||||
}
|
||||
|
||||
function test_BuddyListBlockBuddyRequest() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
sfs.send(new SFS2X.Requests.BuddyList.BlockBuddyRequest('John', true));
|
||||
}
|
||||
|
||||
function test_BuddyListGoOnlineRequest() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
sfs.send(new SFS2X.Requests.BuddyList.GoOnlineRequest(true));
|
||||
}
|
||||
|
||||
function test_BuddyListInitBuddyListRequest() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
sfs.send(new SFS2X.Requests.BuddyList.InitBuddyListRequest());
|
||||
}
|
||||
|
||||
function test_BuddyListRemoveBuddyRequest() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
sfs.send(new SFS2X.Requests.BuddyList.RemoveBuddyRequest('John'));
|
||||
}
|
||||
|
||||
function test_BuddyListSetBuddyVariablesRequest() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
sfs.send(new SFS2X.Requests.BuddyList.SetBuddyVariablesRequest([]));
|
||||
}
|
||||
|
||||
function test_GameCreateSFSGameRequest() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
var settings = new SFS2X.Requests.Game.SFSGameSettings("DartsGame");
|
||||
settings.maxUsers = 2;
|
||||
settings.maxSpectators = 8;
|
||||
settings.isPublic = true;
|
||||
settings.minPlayersToStartGame = 2;
|
||||
settings.notifyGameStarted = true;
|
||||
|
||||
sfs.send(new SFS2X.Requests.Game.CreateSFSGameRequest(settings));
|
||||
}
|
||||
|
||||
function test_ErrorCodes() {
|
||||
SFS2X.ErrorCodes.setErrorMessage(13, "Le Groupe demandé n'est pas disponible - Salle: {0}; Groupe: {1}");
|
||||
}
|
||||
|
||||
function test_SmartFoxaddEventListener() {
|
||||
var sfs = new SFS2X.SmartFox();
|
||||
|
||||
function onConnection(event: SFS2X.ICONNECTION) {
|
||||
if(event.success)
|
||||
{
|
||||
// On Success
|
||||
}
|
||||
};
|
||||
function onConnectionLost(event: SFS2X.ICONNECTION_LOST) {
|
||||
// Print why connection was lost
|
||||
console.log(event.reason);
|
||||
};
|
||||
function onLoginError(event: SFS2X.ILOGIN_ERROR) {
|
||||
if (event.errorCode)
|
||||
{
|
||||
// handle error
|
||||
}
|
||||
};
|
||||
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION, onConnection, this);
|
||||
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION_LOST, onConnectionLost, this);
|
||||
sfs.addEventListener(SFS2X.SFSEvent.LOGIN_ERROR, onLoginError, this);
|
||||
}
|
||||
+2411
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -58,7 +58,7 @@ declare namespace SocketIORedis {
|
||||
* The optional port to connect to redis on
|
||||
* @default 6379
|
||||
*/
|
||||
port?: string;
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* The optional redis client to publish events on
|
||||
|
||||
Vendored
+4
@@ -458,6 +458,10 @@ interface UnderscoreStatic {
|
||||
object: _.Dictionary<T>,
|
||||
iterator?: _.ObjectIterator<T, boolean>,
|
||||
context?: any): boolean;
|
||||
|
||||
any<T>(
|
||||
list: _.List<T>,
|
||||
value: T): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value is present in the list. Uses indexOf internally,
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/// <reference path="v8-profiler.d.ts" />
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as profiler from "v8-profiler";
|
||||
|
||||
{
|
||||
var snapshot1 = profiler.takeSnapshot('1');
|
||||
var snapshot2 = profiler.takeSnapshot();
|
||||
profiler.deleteAllSnapshots();
|
||||
}
|
||||
{
|
||||
profiler.startProfiling('', true);
|
||||
setTimeout(function () {
|
||||
var profile = profiler.stopProfiling('');
|
||||
profiler.deleteAllProfiles();
|
||||
}, 1000);
|
||||
}
|
||||
{
|
||||
var snapshot1 = profiler.takeSnapshot();
|
||||
var snapshot2 = profiler.takeSnapshot();
|
||||
|
||||
console.log(snapshot1.getHeader(), snapshot2.getHeader());
|
||||
|
||||
console.log(snapshot1.compare(snapshot2));
|
||||
|
||||
// Export snapshot to file file
|
||||
snapshot1.export(function (error, result) {
|
||||
fs.writeFileSync('snapshot1.json', result);
|
||||
snapshot1.delete();
|
||||
});
|
||||
|
||||
// Export snapshot to file stream
|
||||
snapshot2.export()
|
||||
.pipe(fs.createWriteStream('snapshot2.json'))
|
||||
.on('finish', snapshot2.delete);
|
||||
}
|
||||
{
|
||||
profiler.startProfiling('1', true);
|
||||
var profile1 = profiler.stopProfiling();
|
||||
profiler.startProfiling('2', true);
|
||||
var profile2 = profiler.stopProfiling();
|
||||
|
||||
console.log(snapshot1.getHeader(), snapshot2.getHeader());
|
||||
|
||||
profile1.export(function (error, result) {
|
||||
fs.writeFileSync('profile1.json', result);
|
||||
profile1.delete();
|
||||
});
|
||||
|
||||
profile2.export()
|
||||
.pipe(fs.createWriteStream('profile2.json'))
|
||||
.on('finish', function () {
|
||||
profile2.delete();
|
||||
});
|
||||
}
|
||||
{
|
||||
var a: profiler.Profile;
|
||||
var b: profiler.Profiler;
|
||||
var c: profiler.Snapshot;
|
||||
}
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
// Type definitions for v8-profiler
|
||||
// Project: https://github.com/node-inspector/v8-profiler
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
import * as profiler from "v8-profiler";
|
||||
profiler.startProfiling();
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "v8-profiler" {
|
||||
import * as fs from "fs";
|
||||
|
||||
namespace V8Profiler {
|
||||
type Profiler = {
|
||||
/**
|
||||
* returns new HEAP Snapshot instance.
|
||||
* name is optional argument, by default snapshot name will be constructed from his uid.
|
||||
*/
|
||||
takeSnapshot: (name?: string) => Snapshot;
|
||||
deleteAllSnapshots: () => void;
|
||||
/**
|
||||
* start CPU profiling.
|
||||
* name is optional argument, by default profile name will be constructed from his uid.
|
||||
* recsamples is true by default.
|
||||
*/
|
||||
startProfiling: (name?: string, recsamples?: boolean) => void;
|
||||
/**
|
||||
* returns new CPU Profile instance.
|
||||
* There is no strictly described behavior for usage without name argument.
|
||||
*/
|
||||
stopProfiling: (name?: string) => Profile;
|
||||
/**
|
||||
* Changes default CPU profiler sampling interval to the specified number of microseconds.
|
||||
* Default interval is 1000us.
|
||||
* This method must be called when there are no profiles being recorded.
|
||||
* If called without arguments it resets interval to default.
|
||||
*/
|
||||
setSamplingInterval: (ms?: number) => void;
|
||||
deleteAllProfiles: () => void;
|
||||
};
|
||||
type Snapshot = {
|
||||
/**
|
||||
* provides short information about snapshot.
|
||||
*/
|
||||
getHeader: () => any;
|
||||
/**
|
||||
* creates HEAP diff for two snapshots.
|
||||
*/
|
||||
compare: (snapshot: Snapshot) => void;
|
||||
/**
|
||||
* removes snapshot from memory.
|
||||
*/
|
||||
delete: () => any;
|
||||
/**
|
||||
* provides simple export API for snapshot.
|
||||
* callback(error, data) receives serialized snapshot as second argument. (Serialization is not equal to JSON.stringify result).
|
||||
* If callback will not be passed, export returns transform stream.
|
||||
*/
|
||||
export(callback: (error?: Error, data?: any) => void): void;
|
||||
/**
|
||||
* provides simple export API for snapshot.
|
||||
* callback(error, data) receives serialized snapshot as second argument. (Serialization is not equal to JSON.stringify result).
|
||||
* If callback will not be passed, export returns transform stream.
|
||||
*/
|
||||
export(): fs.ReadStream;
|
||||
/**
|
||||
* low level serialization method.
|
||||
* Look Snapshot.export source for usage example.
|
||||
*/
|
||||
serialize: Function;
|
||||
};
|
||||
|
||||
type Profile = {
|
||||
/**
|
||||
* provides short information about profile.
|
||||
*/
|
||||
getHeader: () => any;
|
||||
/**
|
||||
* removes profile from memory.
|
||||
*/
|
||||
delete: () => any;
|
||||
/**
|
||||
* provides simple export API for profile.
|
||||
* callback(error, data) receives serialized profile as second argument. (Serialization is equal to JSON.stringify result).
|
||||
*/
|
||||
export(callback: (error?: Error, data?: any) => void): void;
|
||||
/**
|
||||
* provides simple export API for profile.
|
||||
* callback(error, data) receives serialized profile as second argument. (Serialization is equal to JSON.stringify result).
|
||||
*/
|
||||
export(): fs.ReadStream;
|
||||
}
|
||||
}
|
||||
|
||||
var V8Profiler: V8Profiler.Profiler;
|
||||
export = V8Profiler;
|
||||
}
|
||||
@@ -0,0 +1,607 @@
|
||||
/// <reference path="victory.d.ts"/>
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
|
||||
import * as React from "react";
|
||||
import {
|
||||
VictoryAnimation,
|
||||
VictoryLabel,
|
||||
AnimationStyle,
|
||||
VictoryArea,
|
||||
VictoryAxis,
|
||||
VictoryStack,
|
||||
VictoryBar,
|
||||
VictoryLine,
|
||||
VictoryChart,
|
||||
VictoryScatter,
|
||||
VictoryPie
|
||||
} from "victory";
|
||||
|
||||
// VictoryAnimation test
|
||||
let test = <VictoryAnimation
|
||||
data={[
|
||||
{ color: "red" },
|
||||
{ color: "green" },
|
||||
{ color: "blue" },
|
||||
{ color: "yellow" },
|
||||
{ color: "purple" }
|
||||
]}
|
||||
delay={3000}
|
||||
easing="back"
|
||||
duration={500}
|
||||
onEnd={() => {}}
|
||||
>
|
||||
{(style: AnimationStyle) =>
|
||||
<span style={{color: style["color"]}}>Hello!</span>
|
||||
}
|
||||
</VictoryAnimation>
|
||||
|
||||
// VictoryLabel test
|
||||
test = <VictoryLabel x={50} y={10}
|
||||
angle={90}
|
||||
capHeight={() => 50}
|
||||
textAnchor="middle"
|
||||
verticalAnchor="start"
|
||||
events={{
|
||||
onClick: () => {}
|
||||
}}
|
||||
text="test"
|
||||
transform="scale(1.2)"
|
||||
dx={10}
|
||||
dy={10}
|
||||
lineHeight={1.5}>
|
||||
{"data viz \n is \n fun!"}
|
||||
</VictoryLabel>
|
||||
|
||||
// VictoryArea test
|
||||
test = (
|
||||
<VictoryArea
|
||||
data={[
|
||||
{amount: 1, yield: 1, error: 0.5},
|
||||
{amount: 2, yield: 2, error: 1.1},
|
||||
{amount: 3, yield: 3, error: 0},
|
||||
{amount: 4, yield: 2, error: 0.1},
|
||||
{amount: 5, yield: 1, error: 1.5}
|
||||
]}
|
||||
x={"amount"}
|
||||
y={(data) => (data.yield + data.error)}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryArea
|
||||
height={400}
|
||||
style={{
|
||||
data: {fill: "gold"}
|
||||
}}
|
||||
data={[
|
||||
{x: 1, y: 1},
|
||||
{x: 2, y: 2},
|
||||
{x: 3, y: 1},
|
||||
{x: 4, y: 3},
|
||||
{x: 5, y: 2},
|
||||
{x: 6, y: 5}
|
||||
]}
|
||||
scale="sqrt"
|
||||
events={[
|
||||
{
|
||||
target: "data",
|
||||
eventKey: "all",
|
||||
eventHandlers: {
|
||||
onClick: () => {
|
||||
return {
|
||||
mutation: (props) => {
|
||||
return { style: { fill: "orange" } }
|
||||
}
|
||||
}
|
||||
},
|
||||
onMouseEnter: () => {
|
||||
return [
|
||||
{
|
||||
target: "labels",
|
||||
mutation: (props) => {
|
||||
return { text: "hey" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryStack
|
||||
height={800}
|
||||
style={{ data: {
|
||||
strokeDasharray: "5,5",
|
||||
strokeWidth: 2,
|
||||
fillOpacity: 0.4
|
||||
}}}
|
||||
>
|
||||
<VictoryArea
|
||||
style={{ data: {
|
||||
fill: "tomato", stroke: "tomato"
|
||||
}}}
|
||||
data={[
|
||||
{x: 1, y: 1},
|
||||
{x: 2, y: 2},
|
||||
{x: 3, y: 3}
|
||||
]}
|
||||
/>
|
||||
<VictoryArea
|
||||
style={{ data: {
|
||||
fill: "orange", stroke: "orange"
|
||||
}}}
|
||||
data={[
|
||||
{x: 1, y: 2},
|
||||
{x: 2, y: 1},
|
||||
{x: 3, y: 1}
|
||||
]}
|
||||
/>
|
||||
<VictoryArea
|
||||
style={{ data: {
|
||||
fill: "gold", stroke: "gold"
|
||||
}}}
|
||||
data={[
|
||||
{x: 1, y: 3},
|
||||
{x: 2, y: 4},
|
||||
{x: 3, y: 2}
|
||||
]}
|
||||
/>
|
||||
</VictoryStack>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryAxis
|
||||
style={{
|
||||
axis: {stroke: "black"},
|
||||
grid: {strokeWidth: 2},
|
||||
ticks: {stroke: "red"},
|
||||
tickLabels: {fontSize: 12},
|
||||
axisLabel: {fontsize: 16}
|
||||
}}
|
||||
label="Planets"
|
||||
tickValues={[
|
||||
"Mercury",
|
||||
"Venus",
|
||||
"Earth",
|
||||
"Mars",
|
||||
"Jupiter"
|
||||
]}/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryAxis
|
||||
scale="time"
|
||||
tickValues={[
|
||||
new Date(1980, 1, 1),
|
||||
new Date(1990, 1, 1),
|
||||
new Date(2000, 1, 1),
|
||||
new Date(2010, 1, 1),
|
||||
new Date(2020, 1, 1)]}
|
||||
tickFormat={(x) => x.getFullYear()}/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryAxis
|
||||
dependentAxis
|
||||
padding={{left: 50, top: 20, bottom: 20}}
|
||||
scale="log"
|
||||
domain={[1, 5]}
|
||||
/>
|
||||
);
|
||||
|
||||
// VictoryBar test
|
||||
test = (
|
||||
<VictoryBar
|
||||
data={[
|
||||
{x: 1, y: 1},
|
||||
{x: 2, y: 2},
|
||||
{x: 3, y: 3},
|
||||
{x: 4, y: 2},
|
||||
{x: 5, y: 1}
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryBar
|
||||
data={[
|
||||
{amount: 1, yield: 1, error: 0.5},
|
||||
{amount: 2, yield: 2, error: 1.1},
|
||||
{amount: 3, yield: 3, error: 0},
|
||||
{amount: 4, yield: 2, error: 0.1},
|
||||
{amount: 5, yield: 1, error: 1.5}
|
||||
]}
|
||||
x={"amount"}
|
||||
y={(data) => (data.yield + data.error)}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryBar
|
||||
height={500}
|
||||
padding={75}
|
||||
style={{
|
||||
labels: {fontSize: 20}
|
||||
}}
|
||||
data={[
|
||||
{x: 1, y: 1, fill: "gold", label: "SO"},
|
||||
{x: 2, y: 3, fill: "orange"},
|
||||
{x: 3, y: 2, fill: "tomato", label: "WOW"},
|
||||
{x: 4, y: 4, fill: "pink"},
|
||||
{x: 5, y: 3, fill: "magenta", label: "SUCH"},
|
||||
{x: 6, y: 5, fill: "purple"},
|
||||
{x: 7, y: 6, fill: "blue", label: "LABEL"}
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryBar
|
||||
height={500}
|
||||
padding={75}
|
||||
style={{
|
||||
data: {
|
||||
fill: (data: any) => data.y > 2 ?
|
||||
"red" : "blue"
|
||||
}
|
||||
}}
|
||||
data={[
|
||||
{x: 1, y: 1},
|
||||
{x: 2, y: 2},
|
||||
{x: 3, y: 3},
|
||||
{x: 4, y: 2},
|
||||
{x: 5, y: 1}
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryBar
|
||||
height={500}
|
||||
style={{
|
||||
data: {fill: "blue", width: 20},
|
||||
labels: {fontSize: 20}
|
||||
}}
|
||||
labels={[
|
||||
"a", "b", "c", "d", "e"
|
||||
]}
|
||||
data={[
|
||||
{x: 1, y: 1},
|
||||
{x: 2, y: 2},
|
||||
{x: 3, y: 3, label: "click me"},
|
||||
{x: 4, y: 2},
|
||||
{x: 5, y: 1}
|
||||
]}
|
||||
events={[
|
||||
{
|
||||
target: "data",
|
||||
eventKey: 2,
|
||||
eventHandlers: {
|
||||
onClick: (evt) => {
|
||||
evt.stopPropagation();
|
||||
return [
|
||||
{
|
||||
mutation: () => {
|
||||
return {style: {fill: "orange", width: 20}};
|
||||
}
|
||||
},
|
||||
{
|
||||
target: "labels",
|
||||
eventKey: 3,
|
||||
mutation: () => {
|
||||
return {text: "now click me"};
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
}, {
|
||||
target: "parent",
|
||||
eventHandlers: {
|
||||
onClick: () => {
|
||||
return [
|
||||
{
|
||||
target: "data",
|
||||
mutation: () => {
|
||||
return {style: {fill: "tomato", width: 10}};
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
// VictoryChart test
|
||||
test = (
|
||||
<VictoryChart>
|
||||
<VictoryLine
|
||||
y={(data) => 0.5 * data.x * data.x}/>
|
||||
</VictoryChart>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryChart>
|
||||
<VictoryLine
|
||||
style={{data:
|
||||
{stroke: "red", strokeWidth: 4}
|
||||
}}
|
||||
y={(data) =>
|
||||
Math.sin(2 * Math.PI * data.x)
|
||||
}
|
||||
/>
|
||||
<VictoryLine
|
||||
style={{data:
|
||||
{stroke: "blue", strokeWidth: 4}
|
||||
}}
|
||||
y={(data) =>
|
||||
Math.cos(2 * Math.PI * data.x)
|
||||
}
|
||||
/>
|
||||
</VictoryChart>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryChart
|
||||
height={500}
|
||||
padding={{
|
||||
top: 75,
|
||||
bottom: 40,
|
||||
left: 40,
|
||||
right: 40
|
||||
}}
|
||||
domainPadding={{x: 20}}
|
||||
>
|
||||
<VictoryAxis
|
||||
label="X AXIS"
|
||||
orientation="top"/>
|
||||
<VictoryAxis dependentAxis
|
||||
tickValues={[0, 1.5, 3, 4.5]}
|
||||
style={{
|
||||
grid: {
|
||||
stroke: "grey",
|
||||
strokeWidth: 1
|
||||
},
|
||||
axis: {stroke: "transparent"},
|
||||
ticks: {stroke: "transparent"}
|
||||
}}/>
|
||||
<VictoryBar
|
||||
style={{
|
||||
data: {
|
||||
width: 15,
|
||||
fill: (data: any) => data.y > 3 ?
|
||||
"gold" : "orange"
|
||||
}
|
||||
}}
|
||||
data={[
|
||||
{x: 1, y: 1},
|
||||
{x: 2, y: 2.5},
|
||||
{x: 3, y: 4},
|
||||
{x: 4, y: 2.5},
|
||||
{x: 5, y: 1},
|
||||
]}/>
|
||||
</VictoryChart>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryChart
|
||||
height={450}
|
||||
scale={{
|
||||
x: "time"
|
||||
}}
|
||||
>
|
||||
<VictoryAxis
|
||||
label="Decades"
|
||||
tickValues={[
|
||||
new Date(1980, 1, 1),
|
||||
new Date(2000, 1, 1),
|
||||
new Date(2020, 1, 1),
|
||||
]}
|
||||
tickFormat={(x) => x.getFullYear()}/>
|
||||
<VictoryLine
|
||||
data={[
|
||||
{x: new Date(1982, 1, 1), y: 125},
|
||||
{x: new Date(1987, 1, 1), y: 257},
|
||||
{x: new Date(1993, 1, 1), y: 345},
|
||||
{x: new Date(1997, 1, 1), y: 515},
|
||||
{x: new Date(2001, 1, 1), y: 132},
|
||||
{x: new Date(2005, 1, 1), y: 305},
|
||||
{x: new Date(2011, 1, 1), y: 270},
|
||||
{x: new Date(2015, 1, 1), y: 470}
|
||||
]}/>
|
||||
</VictoryChart>
|
||||
);
|
||||
|
||||
// VictoryLine test
|
||||
test = (
|
||||
<VictoryLine
|
||||
data={[
|
||||
{x: 0, y: 1},
|
||||
{x: 1, y: 3},
|
||||
{x: 2, y: 2},
|
||||
{x: 3, y: 4},
|
||||
{x: 4, y: 3},
|
||||
{x: 5, y: 5}
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryLine
|
||||
data={[
|
||||
{amount: 1, yield: 1, error: 0.5},
|
||||
{amount: 2, yield: 2, error: 1.1},
|
||||
{amount: 3, yield: 3, error: 0},
|
||||
{amount: 4, yield: 2, error: 0.1},
|
||||
{amount: 5, yield: 1, error: 1.5}
|
||||
]}
|
||||
x={"amount"}
|
||||
y={(data) => (data.yield + data.error)}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryLine
|
||||
domain={[0, 5]}
|
||||
padding={75}
|
||||
height={500}
|
||||
data={[
|
||||
{x: 0, y: 1},
|
||||
{x: 1, y: 3},
|
||||
{x: 2, y: 2},
|
||||
{x: 3, y: 4},
|
||||
{x: 4, y: 3},
|
||||
{x: 5, y: 5}
|
||||
]}
|
||||
interpolation="cardinal"
|
||||
label="LINE"
|
||||
style={{
|
||||
data: {
|
||||
stroke: "#822722",
|
||||
strokeWidth: 3
|
||||
},
|
||||
labels: {fontSize: 18}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
// VictoryScatter test
|
||||
test = (
|
||||
<VictoryScatter
|
||||
data={[
|
||||
{amount: 1, yield: 1, error: 0.5},
|
||||
{amount: 2, yield: 2, error: 1.1},
|
||||
{amount: 3, yield: 3, error: 0},
|
||||
{amount: 4, yield: 2, error: 0.1},
|
||||
{amount: 5, yield: 1, error: 1.5}
|
||||
]}
|
||||
x={"amount"}
|
||||
y={(data) => (data.yield + data.error)}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryScatter
|
||||
data={[
|
||||
{x: 1, y: 3},
|
||||
{x: 2, y: 5},
|
||||
{x: 3, y: 4},
|
||||
{x: 4, y: 2},
|
||||
{x: 5, y: 5}
|
||||
]}
|
||||
size={8}
|
||||
symbol="star"
|
||||
style={{
|
||||
data: {
|
||||
fill: "gold",
|
||||
stroke: "orange",
|
||||
strokeWidth: 3
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
// VictoryPie test
|
||||
test = (
|
||||
<VictoryPie
|
||||
data={[
|
||||
{animal: "Cat", pet: 45, wild: 17},
|
||||
{animal: "Dog", pet: 85, wild: 6},
|
||||
{animal: "Fish", pet: 55, wild: 0},
|
||||
{animal: "Bird", pet: 15, wild: 40},
|
||||
]}
|
||||
x={"animal"}
|
||||
y={(data) => data.pet + data.wild}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryPie
|
||||
style={{
|
||||
labels: {
|
||||
fill: "white",
|
||||
fontSize: 12,
|
||||
fontWeight: "bold"
|
||||
}
|
||||
}}
|
||||
data={[
|
||||
{x: "<5", y: 6279},
|
||||
{x: "5-13", y: 9182},
|
||||
{x: "14-17", y: 5511},
|
||||
{x: "18-24", y: 7164},
|
||||
{x: "25-44", y: 6716},
|
||||
{x: "45-64", y: 4263},
|
||||
{x: "≥65", y: 7502}
|
||||
]}
|
||||
innerRadius={110}
|
||||
colorScale={[
|
||||
"#D85F49",
|
||||
"#F66D3B",
|
||||
"#D92E1D",
|
||||
"#D73C4C",
|
||||
"#FFAF59",
|
||||
"#E28300",
|
||||
"#F6A57F"
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryPie
|
||||
data={[
|
||||
{x: "Cat", y: 62},
|
||||
{x: "Dog", y: 91},
|
||||
{x: "Fish", y: 55},
|
||||
{x: "Bird", y: 55},
|
||||
]}
|
||||
events={[{
|
||||
target: "data",
|
||||
eventHandlers: {
|
||||
onClick: () => {
|
||||
return [
|
||||
{
|
||||
mutation: (props) => {
|
||||
return {
|
||||
style: {fill: "orange"}
|
||||
};
|
||||
}
|
||||
}, {
|
||||
target: "labels",
|
||||
eventKey: [1, 2, 3],
|
||||
mutation: () => {
|
||||
return {text: "KITTEN"};
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
}]}
|
||||
/>
|
||||
);
|
||||
|
||||
test = (
|
||||
<VictoryPie
|
||||
data={[
|
||||
{x: "Cat", y: 62},
|
||||
{x: "Dog", y: 91},
|
||||
{x: "Fish", y: 55},
|
||||
{x: "Bird", y: 55},
|
||||
]}
|
||||
animate={{
|
||||
duration: 1000,
|
||||
onEnter: {
|
||||
duration: 500,
|
||||
before: () =>
|
||||
({y: 0, label: " "}),
|
||||
after: (datum) =>
|
||||
({y: datum.y, label: "NEW"})
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
Vendored
+1494
File diff suppressed because it is too large
Load Diff
+12
-1
@@ -30,9 +30,20 @@ namespace TestGlobalAPI {
|
||||
twoWay: true,
|
||||
acceptStatement: true,
|
||||
priority: 1,
|
||||
terminal: true,
|
||||
count: 30
|
||||
});
|
||||
Vue.directive("my-directive", () => {});
|
||||
Vue.directive("my-directive", function() {
|
||||
const d = this as vuejs.Directive;
|
||||
d.el;
|
||||
d.vm;
|
||||
d.expression;
|
||||
d.arg;
|
||||
d.name;
|
||||
d.modifiers;
|
||||
d.descriptor;
|
||||
d.params;
|
||||
});
|
||||
var myDirective = Vue.directive("my-directive");
|
||||
var elementDirective = Vue.elementDirective("element-directive");
|
||||
Vue.elementDirective("element-directive", elementDirective);
|
||||
|
||||
Vendored
+12
@@ -38,10 +38,22 @@ declare namespace vuejs {
|
||||
deep?: boolean;
|
||||
twoWay?: boolean;
|
||||
acceptStatement?: boolean;
|
||||
terminal?: boolean;
|
||||
priority?: number;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Directive {
|
||||
el: HTMLElement;
|
||||
vm: Vue;
|
||||
expression: string;
|
||||
arg?: string;
|
||||
name: string;
|
||||
modifiers: { [key: string]: boolean };
|
||||
descriptor: any;
|
||||
params?: { [key: string]: any };
|
||||
}
|
||||
|
||||
interface FilterOption {
|
||||
read?: Function;
|
||||
write?: Function;
|
||||
|
||||
@@ -41,7 +41,7 @@ navigator.getUserMedia({ audio: true, video: true },
|
||||
});
|
||||
|
||||
peerConnection.onaddstream = ev => console.log(ev.type);
|
||||
peerConnection.ondatachannel = ev => console.log(ev.type);
|
||||
peerConnection.ondatachannel = ev => console.log(ev.channel);
|
||||
peerConnection.oniceconnectionstatechange = ev => console.log(ev.type);
|
||||
peerConnection.onnegotiationneeded = ev => console.log(ev.type);
|
||||
peerConnection.onopen = ev => console.log(ev.type);
|
||||
|
||||
Vendored
+2
-1
@@ -191,6 +191,7 @@ declare var RTCDataChannel: {
|
||||
new (): RTCDataChannel;
|
||||
};
|
||||
|
||||
// https://www.w3.org/TR/webrtc/#rtcdatachannelevent
|
||||
interface RTCDataChannelEvent extends Event {
|
||||
channel: RTCDataChannel;
|
||||
}
|
||||
@@ -309,7 +310,7 @@ interface RTCPeerConnection {
|
||||
getRemoteStreams(): MediaStream[];
|
||||
createDataChannel(label?: string,
|
||||
dataChannelDict?: RTCDataChannelInit): RTCDataChannel;
|
||||
ondatachannel: (event: Event) => void;
|
||||
ondatachannel: (event: RTCDataChannelEvent) => void;
|
||||
addStream(stream: MediaStream, constraints?: RTCMediaConstraints): void;
|
||||
removeStream(stream: MediaStream): void;
|
||||
close(): void;
|
||||
|
||||
Vendored
+3
-2
@@ -1,5 +1,5 @@
|
||||
// Type definitions for websocket
|
||||
// Project: https://github.com/Worlize/WebSocket-Node
|
||||
// Project: https://github.com/theturtle32/WebSocket-Node
|
||||
// Definitions by: Paul Loyd <https://github.com/loyd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
@@ -236,8 +236,9 @@ declare module "websocket" {
|
||||
* You may optionally pass in an HTTP Status code (such as 404) and a textual
|
||||
* description that will be sent to the client in the form of an
|
||||
* `X-WebSocket-Reject-Reason` header.
|
||||
* Optional extra http headers can be added via Object key/values on extraHeaders.
|
||||
*/
|
||||
reject(httpStatus?: number, reason?: string): void;
|
||||
reject(httpStatus?: number, reason?: string, extraHeaders?: Object): void;
|
||||
|
||||
// Events
|
||||
on(event: string, listener: () => void): this;
|
||||
|
||||
Reference in New Issue
Block a user