mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Vendored
+3
@@ -27,6 +27,9 @@ declare namespace AmCharts {
|
||||
/** Clears all the charts on page, removes listeners and intervals. */
|
||||
function clear();
|
||||
|
||||
/** Handle ready event */
|
||||
function ready(Function): void;
|
||||
|
||||
/** Create chart by params. */
|
||||
function makeChart(selector: string, params: any, delay?: number): AmChart;
|
||||
|
||||
|
||||
Vendored
+15
-15
@@ -45,12 +45,12 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Component: (component: iComponent) => ngESDecorator;
|
||||
function Component(component: iComponent): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register config block
|
||||
*/
|
||||
var Config: () => ngESDecorator;
|
||||
function Config(): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register constant
|
||||
@@ -59,7 +59,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Constant: (name: string) => ngESDecorator;
|
||||
function Constant(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register controller
|
||||
@@ -68,7 +68,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Controller: (name: string) => ngESDecorator;
|
||||
function Controller(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register decorator
|
||||
@@ -77,7 +77,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Decorator: (name: string) => ngESDecorator;
|
||||
function Decorator(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register directive
|
||||
@@ -86,7 +86,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Directive: (name: string) => ngESDecorator;
|
||||
function Directive(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register factory
|
||||
@@ -95,7 +95,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Factory: (name: string) => ngESDecorator;
|
||||
function Factory(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register filter
|
||||
@@ -104,7 +104,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Filter: (name: string) => ngESDecorator;
|
||||
function Filter(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Add $inject property to target
|
||||
@@ -113,7 +113,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Inject: (...dependencies: Array<string>) => ngESDecorator;
|
||||
function Inject(...dependencies: Array<string>): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Inject dependencies as properties to target
|
||||
@@ -122,7 +122,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var InjectAsProperty: (...dependencies: Array<string>) => ngESDecorator;
|
||||
function InjectAsProperty(...dependencies: Array<string>): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Attach target to the specified module
|
||||
@@ -131,7 +131,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Module: (name: string) => ngESDecorator;
|
||||
function Module(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register provider
|
||||
@@ -140,14 +140,14 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Provider: (name: string) => ngESDecorator;
|
||||
function Provider(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register run block
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Run: () => ngESDecorator;
|
||||
function Run(): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register service
|
||||
@@ -156,7 +156,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Service: (name: string) => ngESDecorator;
|
||||
function Service(name: string): ngESDecorator;
|
||||
|
||||
/**
|
||||
* Register value
|
||||
@@ -165,7 +165,7 @@ declare module 'angular-es' {
|
||||
*
|
||||
* @returns {ngESDecorator} - decorated class
|
||||
*/
|
||||
var Value: (name: string) => ngESDecorator;
|
||||
function Value(name: string): ngESDecorator;
|
||||
|
||||
export {
|
||||
Component,
|
||||
|
||||
@@ -127,15 +127,30 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
|
||||
instance.isOpen();
|
||||
instance.isLockedOpen();
|
||||
});
|
||||
|
||||
$scope['onClose'] = $mdSidenav(componentId).onClose(() => {});
|
||||
});
|
||||
|
||||
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
|
||||
$scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!'));
|
||||
|
||||
$scope['customToast'] = () => {
|
||||
var options = {
|
||||
hideDelay: 3000,
|
||||
position: 'top right',
|
||||
controller : 'ToastCtrl',
|
||||
templateUrl : 'toast-template.html',
|
||||
toastClass: 'my-class'
|
||||
};
|
||||
|
||||
$mdToast.show(options);
|
||||
}
|
||||
});
|
||||
|
||||
myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService) => {
|
||||
$scope['createPanel'] = () => {
|
||||
var config = {
|
||||
id: 'myPanel',
|
||||
template: '<h1>Hello!</h1>',
|
||||
hasBackdrop: true,
|
||||
disableParentScroll: true,
|
||||
|
||||
+8
-5
@@ -22,7 +22,7 @@ declare namespace angular.material {
|
||||
clickOutsideToClose?: boolean;
|
||||
disableBackdrop?: boolean;
|
||||
escapeToClose?: boolean;
|
||||
resolve?: {[index: string]: angular.IPromise<any>};
|
||||
resolve?: {[index: string]: () => angular.IPromise<any>};
|
||||
controllerAs?: string;
|
||||
parent?: Function|string|Object; // default: root node
|
||||
disableParentScroll?: boolean; // default: true
|
||||
@@ -53,7 +53,7 @@ declare namespace angular.material {
|
||||
controller(controller?: string|Function): T;
|
||||
locals(locals?: {[index: string]: any}): T;
|
||||
bindToController(bindToController?: boolean): T; // default: false
|
||||
resolve(resolve?: {[index: string]: angular.IPromise<any>}): T;
|
||||
resolve(resolve?: {[index: string]: () => angular.IPromise<any>}): T;
|
||||
controllerAs(controllerAs?: string): T;
|
||||
parent(parent?: string|Element|JQuery): T; // default: root node
|
||||
onComplete(onComplete?: Function): T;
|
||||
@@ -91,7 +91,7 @@ declare namespace angular.material {
|
||||
controller?: string|Function;
|
||||
locals?: {[index: string]: any};
|
||||
bindToController?: boolean; // default: false
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
resolve?: {[index: string]: () => angular.IPromise<any>}
|
||||
controllerAs?: string;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
onShowing?: Function;
|
||||
@@ -132,6 +132,7 @@ declare namespace angular.material {
|
||||
close(): angular.IPromise<void>;
|
||||
isOpen(): boolean;
|
||||
isLockedOpen(): boolean;
|
||||
onClose(onClose: Function): void;
|
||||
}
|
||||
|
||||
interface ISidenavService {
|
||||
@@ -162,10 +163,11 @@ declare namespace angular.material {
|
||||
preserveScope?: boolean; // default: false
|
||||
hideDelay?: number; // default (ms): 3000
|
||||
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
|
||||
toastClass?: string;
|
||||
controller?: string|Function;
|
||||
locals?: {[index: string]: any};
|
||||
bindToController?: boolean; // default: false
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
resolve?: {[index: string]: () => angular.IPromise<any>}
|
||||
controllerAs?: string;
|
||||
parent?: string|Element|JQuery; // default: root node
|
||||
}
|
||||
@@ -291,13 +293,14 @@ declare namespace angular.material {
|
||||
}
|
||||
|
||||
interface IPanelConfig {
|
||||
id?: string;
|
||||
template?: string;
|
||||
templateUrl?: string;
|
||||
controller?: string|Function;
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean; // default: true
|
||||
locals?: {[index: string]: any};
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
resolve?: {[index: string]: () => angular.IPromise<any>}
|
||||
attachTo?: string|JQuery|Element;
|
||||
propagateContainerEvents?: boolean;
|
||||
panelClass?: string;
|
||||
|
||||
Vendored
+11
@@ -125,6 +125,7 @@ declare namespace angular {
|
||||
isFunction(value: any): value is Function;
|
||||
isNumber(value: any): value is number;
|
||||
isObject(value: any): value is Object;
|
||||
isObject<T>(value: any): value is T;
|
||||
isString(value: any): value is string;
|
||||
isUndefined(value: any): boolean;
|
||||
lowercase(str: string): string;
|
||||
@@ -1411,6 +1412,16 @@ declare namespace angular {
|
||||
* Absolute or relative URL of the resource that is being requested.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Event listeners to be bound to the XMLHttpRequest object.
|
||||
* To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block.
|
||||
*/
|
||||
eventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
|
||||
/**
|
||||
* Event listeners to be bound to the XMLHttpRequest upload object.
|
||||
* To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block.
|
||||
*/
|
||||
uploadEventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
|
||||
}
|
||||
|
||||
interface IHttpHeadersGetter {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/// <reference path="autobind-decorator.d.ts" />
|
||||
|
||||
import autobind = require('autobind-decorator');
|
||||
|
||||
class Test {
|
||||
public static what: string = 'static';
|
||||
|
||||
@autobind
|
||||
public static test(): void {
|
||||
console.log(this.what);
|
||||
}
|
||||
|
||||
public constructor(public what: string) {
|
||||
this.what = what;
|
||||
}
|
||||
|
||||
@autobind
|
||||
public test(): void {
|
||||
console.warn(this.what);
|
||||
}
|
||||
}
|
||||
|
||||
const tester: Test = new Test('bind');
|
||||
const { test } = tester;
|
||||
tester.test(); // warns 'bind'.
|
||||
test(); // warns 'bind'.
|
||||
Test.test(); // logs 'static'.
|
||||
|
||||
@autobind
|
||||
class Component {
|
||||
public constructor(private someMember: string) {
|
||||
this.someMember = someMember;
|
||||
}
|
||||
|
||||
public someMethod(): void {
|
||||
console.error(this.someMember);
|
||||
}
|
||||
}
|
||||
|
||||
const component: Component = new Component('React vs Angular2');
|
||||
const { someMethod } = component;
|
||||
component.someMethod(); // errors 'React vs Angular2'
|
||||
someMethod(); // errors 'React vs Angular2'
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for autobind-decorator v1.3.3
|
||||
// Project: https://github.com/andreypopp/autobind-decorator
|
||||
// Definitions by: Ivo Stratev <https://github.com/NoHomey/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'autobind-decorator' {
|
||||
function autobind<TFunction extends Function>(target: TFunction): TFunction | void;
|
||||
function autobind<T extends Function>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
|
||||
export = autobind;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
--experimentalDecorators
|
||||
Vendored
+1
-1
@@ -226,7 +226,7 @@ declare module "aws-sdk" {
|
||||
constructor(options?: any);
|
||||
endpoint: Endpoint;
|
||||
|
||||
getObject(params: s3.GetObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
getObject(params: s3.GetObjectRequest, callback?: (err: Error, data: any) => void): any;
|
||||
putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
|
||||
@@ -84,4 +84,14 @@ mobileApps.logger.debug('a debug message')
|
||||
|
||||
// Query
|
||||
queries.create('table').where({ x: 10 }).select('col1,col2');
|
||||
mobileApps.query.create('table');
|
||||
mobileApps.query.create('table');
|
||||
|
||||
// custom sql query
|
||||
mobileApp.api.add('query', { authorize: true, get: (req, res, next) => {
|
||||
req.azureMobile.data.execute({
|
||||
sql: "SELECT * FROM TODOITEM WHERE COMPLETE = :complete",
|
||||
parameters: [
|
||||
{ name: 'complete', value: 1 }
|
||||
]
|
||||
}).then(x => {});
|
||||
}, delete: function () {} });
|
||||
|
||||
+16
-1
@@ -215,7 +215,7 @@ declare namespace Azure.MobileApps {
|
||||
item: any;
|
||||
req: Express.Request;
|
||||
res: Express.Response;
|
||||
data: (table: TableDefinition) => Data.Table;
|
||||
data: ContextData;
|
||||
tables: (tableName: string) => Data.Table;
|
||||
user: User;
|
||||
push: typeof nh;
|
||||
@@ -223,6 +223,21 @@ declare namespace Azure.MobileApps {
|
||||
execute(): Thenable<any>;
|
||||
}
|
||||
|
||||
interface ContextData {
|
||||
(table: TableDefinition): Data.Table;
|
||||
execute(q: SqlQueryDefinition): Thenable<any>;
|
||||
}
|
||||
|
||||
interface SqlQueryDefinition {
|
||||
sql: string;
|
||||
parameters?: SqlParameterDefinition[];
|
||||
}
|
||||
|
||||
interface SqlParameterDefinition {
|
||||
name: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
interface TableDefinition {
|
||||
authorize?: boolean;
|
||||
autoIncrement?: boolean;
|
||||
|
||||
@@ -0,0 +1,432 @@
|
||||
/// <reference path="braintree-web.d.ts" />
|
||||
|
||||
let version: string = braintree.VERSION;
|
||||
|
||||
let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI0YjlhYzVmYmI4ZTNkYzQzMmFkZjJhNzBlNjZlMWNjY2M5ODRkYzE4ZTM4YmY4NjYzZTM5NjM3NWZjYmQzY2U5fGNyZWF0ZWRfYXQ9MjAxNi0wOS0wOFQwNTowMzo0MC4xNjk1NTUwMzUrMDAwMFx1MDAyNm1lcmNoYW50X2lkPTM0OHBrOWNnZjNiZ3l3MmJcdTAwMjZwdWJsaWNfa2V5PTJuMjQ3ZHY4OWJxOXZtcHIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvMzQ4cGs5Y2dmM2JneXcyYi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzLzM0OHBrOWNnZjNiZ3l3MmIvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tLzM0OHBrOWNnZjNiZ3l3MmIifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiQWNtZSBXaWRnZXRzLCBMdGQuIChTYW5kYm94KSIsImNsaWVudElkIjpudWxsLCJwcml2YWN5VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3BwIiwidXNlckFncmVlbWVudFVybCI6Imh0dHA6Ly9leGFtcGxlLmNvbS90b3MiLCJiYXNlVXJsIjoiaHR0cHM6Ly9hc3NldHMuYnJhaW50cmVlZ2F0ZXdheS5jb20iLCJhc3NldHNVcmwiOiJodHRwczovL2NoZWNrb3V0LnBheXBhbC5jb20iLCJkaXJlY3RCYXNlVXJsIjpudWxsLCJhbGxvd0h0dHAiOnRydWUsImVudmlyb25tZW50Tm9OZXR3b3JrIjp0cnVlLCJlbnZpcm9ubWVudCI6Im9mZmxpbmUiLCJ1bnZldHRlZE1lcmNoYW50IjpmYWxzZSwiYnJhaW50cmVlQ2xpZW50SWQiOiJtYXN0ZXJjbGllbnQzIiwiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJtZXJjaGFudEFjY291bnRJZCI6ImFjbWV3aWRnZXRzbHRkc2FuZGJveCIsImN1cnJlbmN5SXNvQ29kZSI6IlVTRCJ9LCJjb2luYmFzZUVuYWJsZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0=";
|
||||
|
||||
braintree.client.create({
|
||||
authorization: clientToken
|
||||
}, function (error: BraintreeError, clientInstance: any) {
|
||||
|
||||
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
|
||||
var data: { creditCard: BraintreeWeb.CreditCardInfo } = {
|
||||
creditCard: {
|
||||
number: form['cc-number'].value,
|
||||
cvv: form['cc-cvv'].value,
|
||||
expirationDate: form['cc-date'].value,
|
||||
billingAddress: {
|
||||
postalCode: form['cc-postal'].value
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
clientInstance.request({
|
||||
endpoint: 'payment_methods/credit_cards',
|
||||
method: 'post',
|
||||
data: data
|
||||
}, function (requestErr: BraintreeError, response: { creditCards: any[]; }) {
|
||||
if (requestErr) { throw new Error(requestErr.message); }
|
||||
|
||||
console.log('Got nonce:', response.creditCards[0].nonce);
|
||||
});
|
||||
|
||||
braintree.hostedFields.create({
|
||||
client: clientInstance,
|
||||
styles: {
|
||||
'input': {
|
||||
'font-size': '16pt',
|
||||
'color': '#3A3A3A'
|
||||
},
|
||||
|
||||
'.number': {
|
||||
'font-family': 'monospace'
|
||||
},
|
||||
'.valid': {
|
||||
'color': 'green'
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
number: {
|
||||
selector: '#card-number'
|
||||
},
|
||||
cvv: {
|
||||
selector: '#cvv'
|
||||
},
|
||||
expirationDate: {
|
||||
selector: '#expiration-date'
|
||||
}
|
||||
}
|
||||
}, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) {
|
||||
|
||||
if (hostedFieldsErr) {
|
||||
// Handle error in Hosted Fields creation
|
||||
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let form = new HTMLFormElement();
|
||||
|
||||
form.addEventListener('submit', function (event: Event) {
|
||||
event.preventDefault();
|
||||
|
||||
hostedFieldsInstance.tokenize(function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
// Handle error in Hosted Fields tokenization
|
||||
switch (tokenizeErr.code) {
|
||||
case 'HOSTED_FIELDS_FIELDS_EMPTY':
|
||||
console.error('All fields are empty! Please fill out the form.');
|
||||
break;
|
||||
case 'HOSTED_FIELDS_FIELDS_INVALID':
|
||||
console.error('Some fields are invalid:', tokenizeErr.details.invalidFieldKeys);
|
||||
break;
|
||||
case 'HOSTED_FIELDS_FAILED_TOKENIZATION':
|
||||
console.error('Tokenization failed server side. Is the card valid?');
|
||||
break;
|
||||
case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR':
|
||||
console.error('Network error occurred when tokenizing.');
|
||||
break;
|
||||
default:
|
||||
console.error('Something bad happened!', tokenizeErr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Put `payload.nonce` into the `payment-method-nonce` input, and then
|
||||
// submit the form. Alternatively, you could send the nonce to your server
|
||||
// with AJAX.
|
||||
(document.querySelector('input[name="payment-method-nonce"]') as HTMLInputElement).value = payload.nonce;
|
||||
form.submit();
|
||||
});
|
||||
}, false);
|
||||
|
||||
hostedFieldsInstance.on('focus', function (event: BraintreeWeb.HostedFieldsStateObject) {
|
||||
console.log(event.emittedBy, 'has been focused');
|
||||
});
|
||||
|
||||
hostedFieldsInstance.teardown(function (teardownErr: BraintreeError) {
|
||||
if (teardownErr) {
|
||||
console.error('Could not tear down Hosted Fields!');
|
||||
} else {
|
||||
console.info('Hosted Fields has been torn down!');
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.tokenize({
|
||||
vault: true
|
||||
}, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
console.error(tokenizeErr);
|
||||
} else {
|
||||
console.log('Got nonce:', payload.nonce);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
|
||||
if (addClassErr) {
|
||||
console.error(addClassErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
|
||||
if (addClassErr) {
|
||||
console.error(addClassErr);
|
||||
return;
|
||||
}
|
||||
|
||||
// some time later...
|
||||
hostedFieldsInstance.removeClass('number', 'custom-class');
|
||||
});
|
||||
|
||||
hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: BraintreeError) {
|
||||
if (placeholderErr) {
|
||||
console.error(placeholderErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.on('cardTypeChange', function (event: BraintreeWeb.HostedFieldsStateObject) {
|
||||
// Update the placeholder value if there is only one possible card type
|
||||
if (event.cards.length === 1) {
|
||||
braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: BraintreeError) {
|
||||
if (placeholderErr) {
|
||||
// Handle errors, such as invalid field name
|
||||
console.error(placeholderErr);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.clear('number', function (clearErr: BraintreeError) {
|
||||
if (clearErr) {
|
||||
console.error(clearErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.clear('number');
|
||||
hostedFieldsInstance.clear('cvv');
|
||||
hostedFieldsInstance.clear('expirationDate');
|
||||
|
||||
var state = braintree.hostedFields.getState();
|
||||
|
||||
var formValid = Object.keys(state.fields).every(function (key) {
|
||||
return state.fields[key].isValid;
|
||||
});
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr?: BraintreeError, applePayInstance?: any) {
|
||||
if (createErr) {
|
||||
// Handle error in client creation
|
||||
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let request = {
|
||||
countryCode: 'US',
|
||||
currencyCode: 'USD',
|
||||
supportedNetworks: ['visa', 'masterCard'],
|
||||
merchantCapabilities: ['supports3DS'],
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var paymentRequest = braintree.applePay.createPaymentRequest(request);
|
||||
|
||||
console.log(paymentRequest);
|
||||
// { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
|
||||
let request = {
|
||||
countryCode: 'US',
|
||||
currencyCode: 'USD',
|
||||
supportedNetworks: ['visa', 'masterCard'],
|
||||
merchantCapabilities: ['supports3DS'],
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var session = new ApplePaySession(1, request);
|
||||
|
||||
session.onvalidatemerchant = function (event: { validationURL: string }) {
|
||||
braintree.applePay.performValidation({
|
||||
validationURL: event.validationURL
|
||||
}, function (err, validationData) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
session.abort();
|
||||
return;
|
||||
}
|
||||
session.completeMerchantValidation(validationData);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
|
||||
let request = {
|
||||
countryCode: 'US',
|
||||
currencyCode: 'USD',
|
||||
supportedNetworks: ['visa', 'masterCard'],
|
||||
merchantCapabilities: ['supports3DS'],
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var session = new ApplePaySession(1, request);
|
||||
|
||||
session.onpaymentauthorized = function (event) {
|
||||
braintree.applePay.tokenize({
|
||||
token: event.payment.token
|
||||
}, function (err, tokenizedPayload) {
|
||||
if (err) {
|
||||
session.completePayment(ApplePayStatusCodes.STATUS_FAILURE);
|
||||
return;
|
||||
}
|
||||
session.completePayment(ApplePayStatusCodes.STATUS_SUCCESS);
|
||||
|
||||
// Send the tokenizedPayload to your server.
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
braintree.paypal.create({
|
||||
client: clientInstance
|
||||
}, function (createErr, paypalInstance) {
|
||||
if (createErr) {
|
||||
if (createErr.code === 'PAYPAL_BROWSER_NOT_SUPPORTED') {
|
||||
console.error('This browser is not supported.');
|
||||
} else {
|
||||
console.error('Error!', createErr);
|
||||
}
|
||||
}
|
||||
|
||||
let button = new HTMLButtonElement();
|
||||
|
||||
button.addEventListener('click', function () {
|
||||
// Disable the button so that we don't attempt to open multiple popups.
|
||||
button.setAttribute('disabled', 'disabled');
|
||||
|
||||
// Because PayPal tokenization opens a popup, this must be called
|
||||
// as a result of a user action, such as a button click.
|
||||
paypalInstance.tokenize({
|
||||
flow: 'vault' // Required
|
||||
// Any other tokenization options
|
||||
}, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.PayPalTokenizePayload) {
|
||||
button.removeAttribute('disabled');
|
||||
|
||||
if (tokenizeErr) {
|
||||
// Handle tokenization errors or premature flow closure
|
||||
|
||||
switch (tokenizeErr.code) {
|
||||
case 'PAYPAL_POPUP_CLOSED':
|
||||
console.error('Customer closed PayPal popup.');
|
||||
break;
|
||||
case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
|
||||
console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
|
||||
break;
|
||||
case 'PAYPAL_FLOW_FAILED':
|
||||
console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
|
||||
break;
|
||||
default:
|
||||
console.error('Error!', tokenizeErr);
|
||||
}
|
||||
} else {
|
||||
// Submit payload.nonce to your server
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
braintree.unionpay.create({ client: clientInstance }, function (createErr, unionpayInstance) {
|
||||
if (createErr) {
|
||||
console.error(createErr);
|
||||
return;
|
||||
}
|
||||
|
||||
unionpayInstance.fetchCapabilities({
|
||||
card: {
|
||||
number: '4111111111111111'
|
||||
}
|
||||
}, function (fetchErr: BraintreeError, cardCapabilities: BraintreeWeb.UnionPayFetchCapabilitiesPayload) {
|
||||
if (fetchErr) {
|
||||
console.error(fetchErr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardCapabilities.isUnionPay) {
|
||||
if (cardCapabilities.unionPay && !cardCapabilities.unionPay.isSupported) {
|
||||
// Braintree cannot process this UnionPay card.
|
||||
// Ask the user for a different card.
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardCapabilities.isDebit) {
|
||||
// CVV and expiration date are not required
|
||||
} else {
|
||||
// CVV and expiration date are required
|
||||
}
|
||||
|
||||
// Show mobile phone number field for enrollment
|
||||
}
|
||||
});
|
||||
|
||||
unionpayInstance.enroll({
|
||||
card: {
|
||||
number: '4111111111111111',
|
||||
expirationMonth: '12',
|
||||
expirationYear: '2038'
|
||||
},
|
||||
mobile: {
|
||||
countryCode: '62',
|
||||
number: '111111111111'
|
||||
}
|
||||
}, function (enrollErr: BraintreeError, response: BraintreeWeb.UnionPayEnrollPayload) {
|
||||
if (enrollErr) {
|
||||
console.error(enrollErr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.smsCodeRequired) {
|
||||
// If smsCodeRequired, wait for SMS auth code from customer
|
||||
// Then use response.enrollmentId during {@link UnionPay#tokenize}
|
||||
} else {
|
||||
// SMS code is not required from the user.
|
||||
// {@link UnionPay#tokenize} can be called immediately
|
||||
}
|
||||
});
|
||||
|
||||
let enrollResponse: {
|
||||
enrollmentId: string
|
||||
};
|
||||
|
||||
unionpayInstance.tokenize({
|
||||
card: {
|
||||
number: '4111111111111111',
|
||||
expirationMonth: '12',
|
||||
expirationYear: '2038',
|
||||
cvv: '123'
|
||||
},
|
||||
enrollmentId: enrollResponse.enrollmentId, // Returned from enroll
|
||||
smsCode: '11111' // Received by customer's phone, if SMS enrollment was required. Otherwise it should be omitted
|
||||
}, function (tokenizeErr: BraintreeError, response: BraintreeWeb.UnionPayTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
console.error(tokenizeErr);
|
||||
return;
|
||||
}
|
||||
|
||||
// Send response.nonce to your server
|
||||
});
|
||||
|
||||
unionpayInstance.teardown(function (teardownErr: BraintreeError) {
|
||||
if (teardownErr) {
|
||||
console.error('Could not tear down UnionPay.');
|
||||
} else {
|
||||
console.log('UnionPay has been torn down.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
let existingNonce = "fake-valid-nonce";
|
||||
let submitNonceToServer: (nonce: string) => void;
|
||||
|
||||
braintree.threeDSecure.verifyCard({
|
||||
nonce: existingNonce,
|
||||
amount: 123.45,
|
||||
addFrame: function (err, iframe) {
|
||||
// Set up your UI and add the iframe.
|
||||
let my3DSContainer = document.createElement('div');
|
||||
my3DSContainer.appendChild(iframe);
|
||||
document.body.appendChild(my3DSContainer);
|
||||
},
|
||||
removeFrame: function () {
|
||||
let my3DSContainer = document.createElement('div');
|
||||
|
||||
// Remove UI that you added in addFrame.
|
||||
document.body.removeChild(my3DSContainer);
|
||||
}
|
||||
}, function (err: BraintreeError, payload: BraintreeWeb.ThreeDSecureVerifyPayload) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (payload.liabilityShifted) {
|
||||
// Liablity has shifted
|
||||
submitNonceToServer(payload.nonce);
|
||||
} else if (payload.liabilityShiftPossible) {
|
||||
// Liablity may still be shifted
|
||||
// Decide if you want to submit the nonce
|
||||
} else {
|
||||
// Liablity has not shifted and will not shift
|
||||
// Decide if you want to submit the nonce
|
||||
}
|
||||
});
|
||||
|
||||
braintree.threeDSecure.cancelVerifyCard(function (err: BraintreeError, verifyPayload: BraintreeWeb.ThreeDSecureVerifyPayload) {
|
||||
if (err) {
|
||||
// Handle error
|
||||
console.log(err.message); // No verification payload available
|
||||
return;
|
||||
}
|
||||
|
||||
verifyPayload.nonce; // The nonce returned from the 3ds lookup call
|
||||
verifyPayload.liabilityShifted; // boolean
|
||||
verifyPayload.liabilityShiftPossible; // boolean
|
||||
});
|
||||
Vendored
+1738
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -28,7 +28,7 @@ declare module 'cache-manager' {
|
||||
|
||||
|
||||
module cacheManager {
|
||||
function caching(ICongig: StoreConfig): Cache;
|
||||
function caching(IConfig: StoreConfig): Cache;
|
||||
function multiCaching(Caches: Cache[]): Cache;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+8
@@ -159,6 +159,14 @@ declare module 'couchbase' {
|
||||
* Creates a manager allowing the management of a Couchbase cluster.
|
||||
*/
|
||||
manager(): ClusterManager;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a manager allowing the management of a Couchbase cluster using credentials.
|
||||
* @param username The username for your cluster.
|
||||
* @param password The password for your cluster.
|
||||
*/
|
||||
manager(username: string, password: string): ClusterManager;
|
||||
|
||||
/**
|
||||
* Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/// <reference path="cucumber.d.ts" />
|
||||
/// <reference path="../assert/assert.d.ts" />
|
||||
|
||||
function StepSample() {
|
||||
type Callback = cucumber.CallbackStepDefinition;
|
||||
type Table = cucumber.TableDefinition;
|
||||
var step = <cucumber.StepDefinitions>this;
|
||||
var hook = <cucumber.Hooks>this;
|
||||
|
||||
@@ -36,5 +38,43 @@ function StepSample() {
|
||||
callback(new Error("Expected to be on page with title " + title));
|
||||
}
|
||||
});
|
||||
|
||||
// Type for data_table.js on
|
||||
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
|
||||
|
||||
step.Given(/^a table step with Table raw$/, function(table:Table){
|
||||
var expected = [
|
||||
['Cucumber', 'Cucumis sativus'],
|
||||
['Burr Gherkin', 'Cucumis anguria']
|
||||
];
|
||||
|
||||
assert.deepEqual(table.raw(), expected);
|
||||
});
|
||||
|
||||
step.Given(/^a table step with Table rows$/, function(table: Table){
|
||||
var expected = [
|
||||
['Apricot', '5'],
|
||||
['Brocolli', '2'],
|
||||
['Cucumber', '10']
|
||||
];
|
||||
assert.deepEqual(table.rows(), expected)
|
||||
});
|
||||
|
||||
step.Given(/^a table step with Table rowHash$/, function(table:Table){
|
||||
var expected = {
|
||||
'Cucumber': 'Cucumis sativus',
|
||||
'Burr Gherkin': 'Cucumis anguria'
|
||||
};
|
||||
assert.deepEqual(table.rowsHash(), expected)
|
||||
});
|
||||
|
||||
step.Given(/^a table step$/, function(table:Table){
|
||||
var expected = [
|
||||
{'Vegetable': 'Apricot', 'Rating': '5'},
|
||||
{'Vegetable': 'Brocolli', 'Rating': '2'},
|
||||
{'Vegetable': 'Cucumber', 'Rating': '10'}
|
||||
];
|
||||
assert.deepEqual(table.hashes(), expected)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+10
-1
@@ -10,8 +10,17 @@ declare namespace cucumber {
|
||||
(errror?:any, pending?: string):void;
|
||||
}
|
||||
|
||||
export interface TableDefinition{
|
||||
raw: () => Array<any>;
|
||||
rows: () => Array<any>;
|
||||
rowsHash: () => {};
|
||||
hashes: () => {};
|
||||
}
|
||||
|
||||
type StepDefinitionParam = string | CallbackStepDefinition | TableDefinition;
|
||||
|
||||
interface StepDefinitionCode {
|
||||
(...stepArgs: Array<string |CallbackStepDefinition>): PromiseLike<any> | any | void;
|
||||
(...stepArgs: Array<StepDefinitionParam>): PromiseLike<any> | any | void;
|
||||
}
|
||||
|
||||
interface StepDefinitionOptions{
|
||||
|
||||
Vendored
+9
-10
@@ -14,13 +14,13 @@ declare module 'dva' {
|
||||
use: (hooks:Object)=>void,
|
||||
|
||||
/** dva bootstrap */
|
||||
start: (selector?:Object)=>void,
|
||||
start: (selector?:String|HTMLElement)=>void,
|
||||
|
||||
/** dva add model */
|
||||
model: (model:Object)=>void,
|
||||
|
||||
/** dva setting router */
|
||||
router: (router:Object)=>void,
|
||||
router: (router:Object)=>Object|JSX.Element,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ declare module 'dva/router' {
|
||||
history?: Object
|
||||
}
|
||||
export class Router extends React.Component<RouterProps, {}> {
|
||||
render(): JSX.Element
|
||||
render():JSX.Element
|
||||
}
|
||||
|
||||
|
||||
@@ -43,15 +43,14 @@ declare module 'dva/router' {
|
||||
component?: React.ReactNode
|
||||
}
|
||||
export class Route extends React.Component<RouteProps, {}> {
|
||||
render(): JSX.Element
|
||||
render():JSX.Element
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/reactjs/react-router-redux
|
||||
*/
|
||||
declare module 'dva/routerRedux' {
|
||||
export default Object;
|
||||
/**
|
||||
* https://github.com/reactjs/react-router-redux
|
||||
*/
|
||||
export class routerRedux {}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
-2
@@ -333,7 +333,6 @@ declare namespace fabric {
|
||||
on(eventName: {[key:string] : Function}): T;
|
||||
/**
|
||||
* Fires event with an optional options object
|
||||
* @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead)
|
||||
* @param {String} eventName Event name to fire
|
||||
* @param {Object} [options] Options object
|
||||
*/
|
||||
@@ -341,7 +340,6 @@ declare namespace fabric {
|
||||
/**
|
||||
* Stops event observing for a particular event handler. Calling this method
|
||||
* without arguments removes all handlers for all events
|
||||
* @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead)
|
||||
* @param eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler})
|
||||
* @param handler Function to be deleted from EventListeners
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/// <reference path="humps.d.ts" />
|
||||
|
||||
// Tests evaluated from:
|
||||
// https://github.com/domchristie/humps/blob/master/README.md
|
||||
|
||||
import * as humps from "humps";
|
||||
|
||||
let someObject = { attr_one: 'foo', attr_two: 'bar' };
|
||||
let someArray = [{ attr_one: 'foo' }, { attr_one: 'bar' }]
|
||||
|
||||
let someOptions: humps.HumpsOptions = {
|
||||
separator: '-'
|
||||
};
|
||||
let someOptions2: humps.HumpsOptions = {
|
||||
split: /^[A-Z0-9_]+$/
|
||||
};
|
||||
let someOptions3: humps.HumpsOptions = {
|
||||
separator: '-',
|
||||
process: function (key: string, convert: humps.HumpsProcessorParameter, options: humps.HumpsOptions) {
|
||||
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
humps.camelize('hello_world')
|
||||
|
||||
humps.decamelize('fooBar')
|
||||
humps.decamelize('fooBarBaz', someOptions)
|
||||
|
||||
humps.camelizeKeys(someObject);
|
||||
|
||||
humps.camelizeKeys(someArray);
|
||||
|
||||
humps.camelizeKeys(someObject, function (key, convert) {
|
||||
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key);
|
||||
});
|
||||
|
||||
humps.decamelizeKeys(someObject, function (key, convert, options) {
|
||||
return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
|
||||
});
|
||||
|
||||
|
||||
humps.camelize('hello_world-foo bar');
|
||||
|
||||
humps.pascalize('hello_world-foo bar');
|
||||
|
||||
humps.decamelize('helloWorldFooBar');
|
||||
humps.decamelize('helloWorldFooBar', someOptions);
|
||||
humps.decamelize('helloWorld1', { split: /(?=[A-Z0-9])/ })
|
||||
|
||||
humps.depascalize('helloWorldFooBar');
|
||||
|
||||
humps.camelizeKeys(someObject);
|
||||
humps.pascalizeKeys(someObject);
|
||||
humps.decamelizeKeys(someObject);
|
||||
humps.depascalizeKeys(someObject);
|
||||
|
||||
humps.camelizeKeys(someObject, someOptions);
|
||||
humps.pascalizeKeys(someObject, someOptions);
|
||||
humps.decamelizeKeys(someObject, someOptions);
|
||||
humps.depascalizeKeys(someObject, someOptions);
|
||||
|
||||
humps.camelizeKeys(someObject, someOptions2);
|
||||
humps.pascalizeKeys(someObject, someOptions2);
|
||||
humps.decamelizeKeys(someObject, someOptions2);
|
||||
humps.depascalizeKeys(someObject, someOptions2);
|
||||
|
||||
humps.camelizeKeys(someObject, someOptions3);
|
||||
humps.pascalizeKeys(someObject, someOptions3);
|
||||
humps.decamelizeKeys(someObject, someOptions3);
|
||||
humps.depascalizeKeys(someObject, someOptions3);
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for humps v1.1.0
|
||||
// Project: https://github.com/domchristie/humps
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace humps {
|
||||
|
||||
function camelize(value: string): string;
|
||||
function pascalize(value: string): string;
|
||||
function decamelize(value: string, optionsOrProcessor?: OptionOrProcessor): string;
|
||||
function depascalize(value: string, optionsOrProcessor?: OptionOrProcessor): string;
|
||||
|
||||
function camelizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
|
||||
function pascalizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
|
||||
function decamelizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
|
||||
function depascalizeKeys(str: Object, optionsOrProcessor?: OptionOrProcessor): Object;
|
||||
|
||||
function camelizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
|
||||
function pascalizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
|
||||
function decamelizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
|
||||
function depascalizeKeys(str: Object[], optionsOrProcessor?: OptionOrProcessor): Object[];
|
||||
|
||||
interface HumpsOptions {
|
||||
separator?: string;
|
||||
split?: RegExp;
|
||||
process?: HumpsProcessor;
|
||||
}
|
||||
interface HumpsProcessor {
|
||||
(key: string, convert: HumpsProcessorParameter, options?: HumpsOptions): string;
|
||||
}
|
||||
interface HumpsProcessorParameter {
|
||||
(key: string, options?: HumpsOptions): string;
|
||||
}
|
||||
type OptionOrProcessor = HumpsOptions | HumpsProcessor;
|
||||
}
|
||||
|
||||
declare module "humps" {
|
||||
export = humps;
|
||||
}
|
||||
Vendored
+5
-5
@@ -27,7 +27,7 @@ declare module "incremental-dom" {
|
||||
* @param {...*} var_args Attribute name/value pairs of the dynamic attributes
|
||||
* for the Element.
|
||||
*/
|
||||
export var elementOpen: (tag: string, key?: string, statics?: any[], ...var_args: any[]) => void;
|
||||
export var elementOpen: (tag: string, key?: string, statics?: any[], ...var_args: any[]) => HTMLElement;
|
||||
/**
|
||||
* Declares a virtual Element at the current location in the document. This
|
||||
* corresponds to an opening tag and a elementClose tag is required. This is
|
||||
@@ -54,11 +54,11 @@ declare module "incremental-dom" {
|
||||
/**
|
||||
* Closes an open tag started with elementOpenStart.
|
||||
*/
|
||||
export var elementOpenEnd: () => void;
|
||||
export var elementOpenEnd: () => HTMLElement;
|
||||
/**
|
||||
* Closes an open virtual Element.
|
||||
*/
|
||||
export var elementClose: (tag: string) => void;
|
||||
export var elementClose: (tag: string) => HTMLElement;
|
||||
/**
|
||||
* Declares a virtual Element at the current location in the document that has
|
||||
* no children.
|
||||
@@ -72,11 +72,11 @@ declare module "incremental-dom" {
|
||||
* @param {...*} var_args Attribute name/value pairs of the dynamic attributes
|
||||
* for the Element.
|
||||
*/
|
||||
export var elementVoid: (tag: string, key?: string, statics?: any, ...var_args: any[]) => void;
|
||||
export var elementVoid: (tag: string, key?: string, statics?: any, ...var_args: any[]) => HTMLElement;
|
||||
/**
|
||||
* Declares a virtual Text at this point in the document.
|
||||
*
|
||||
* @param {string} value The text of the Text.
|
||||
*/
|
||||
export var text: (value: string) => void;
|
||||
export var text: (value: string) => Text;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="is-plain-object.d.ts" />
|
||||
|
||||
import * as isPlainObject from 'is-plain-object';
|
||||
|
||||
isPlainObject(Object.create({}));
|
||||
//=> true
|
||||
isPlainObject(Object.create(Object.prototype));
|
||||
//=> true
|
||||
isPlainObject({foo: 'bar'});
|
||||
//=> true
|
||||
isPlainObject({});
|
||||
|
||||
isPlainObject(1);
|
||||
//=> false
|
||||
isPlainObject(['foo', 'bar']);
|
||||
//=> false
|
||||
isPlainObject([]);
|
||||
//=> false
|
||||
class Foo {}
|
||||
isPlainObject(new Foo);
|
||||
//=> false
|
||||
isPlainObject(null);
|
||||
//=> false
|
||||
isPlainObject(Object.create(null));
|
||||
//=> false
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for is-plain-object
|
||||
// Project: https://github.com/jonschlinkert/is-plain-object
|
||||
// Definitions by: Kevin Zeng <https://github.com/zengfenfei/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "is-plain-object" {
|
||||
namespace isPlainObject {}
|
||||
function isPlainObject(obj: any): boolean;
|
||||
export = isPlainObject;
|
||||
}
|
||||
Vendored
+4
-2
@@ -2780,8 +2780,9 @@ interface JQuery {
|
||||
|
||||
/**
|
||||
* Retrieve all the elements contained in the jQuery set, as an array.
|
||||
* @name toArray
|
||||
*/
|
||||
toArray(): any[];
|
||||
toArray(): HTMLElement[];
|
||||
|
||||
/**
|
||||
* Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
|
||||
@@ -2837,8 +2838,9 @@ interface JQuery {
|
||||
get(index: number): HTMLElement;
|
||||
/**
|
||||
* Retrieve the elements matched by the jQuery object.
|
||||
* @alias toArray
|
||||
*/
|
||||
get(): any[];
|
||||
get(): HTMLElement[];
|
||||
|
||||
/**
|
||||
* Search for a given element from among the matched elements.
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/// <reference path="libxslt.d.ts" />
|
||||
/// <reference path="../libxmljs/libxmljs.d.ts" />
|
||||
|
||||
import * as libxslt from 'libxslt';
|
||||
import * as libxmljs from 'libxmljs';
|
||||
|
||||
const document: libxmljs.XMLDocument = libxslt.libxmljs.parseXmlString('<xml></xml>');
|
||||
|
||||
let stylesheet: libxslt.Stylesheet;
|
||||
|
||||
stylesheet = libxslt.parse('<xslt></xslt>');
|
||||
|
||||
stylesheet = libxslt.parse(document);
|
||||
|
||||
libxslt.parse('<xslt></xslt>', (err, result) => {
|
||||
if (err == null) {
|
||||
stylesheet = result;
|
||||
}
|
||||
});
|
||||
|
||||
libxslt.parse(document, (err, result) => {
|
||||
if (err == null) {
|
||||
stylesheet = result;
|
||||
}
|
||||
});
|
||||
|
||||
libxslt.parseFile('/path/to/file', (err, result) => {
|
||||
if (err == null) {
|
||||
stylesheet = result;
|
||||
}
|
||||
});
|
||||
|
||||
let applyOptions: libxslt.ApplyOptions = {};
|
||||
|
||||
applyOptions = {
|
||||
outputFormat: 'string',
|
||||
noWrapParams: true
|
||||
};
|
||||
|
||||
let transformedString: string;
|
||||
|
||||
let transformedDocument: libxmljs.XMLDocument;
|
||||
|
||||
transformedString = stylesheet.apply('<xml></xml>');
|
||||
|
||||
transformedString = stylesheet.apply('<xml></xml>', {});
|
||||
|
||||
let applyResult = stylesheet.apply('<xml></xml>', {}, applyOptions);
|
||||
|
||||
if (typeof applyResult === 'string') {
|
||||
transformedString = applyResult;
|
||||
} else {
|
||||
transformedDocument = applyResult;
|
||||
}
|
||||
|
||||
stylesheet.apply('<xml></xml>', {}, applyOptions, (err, result) => {
|
||||
if (err != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof result === 'string') {
|
||||
transformedString = result;
|
||||
} else {
|
||||
transformedDocument = result;
|
||||
}
|
||||
});
|
||||
|
||||
transformedDocument = stylesheet.apply(document);
|
||||
|
||||
transformedDocument = stylesheet.apply(document, {});
|
||||
|
||||
applyResult = stylesheet.apply(document, {}, applyOptions);
|
||||
|
||||
if (typeof applyResult === 'string') {
|
||||
transformedString = applyResult;
|
||||
} else {
|
||||
transformedDocument = applyResult;
|
||||
}
|
||||
|
||||
stylesheet.apply(document, {}, applyOptions, (err, result) => {
|
||||
if (err != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof result === 'string') {
|
||||
transformedString = result;
|
||||
} else {
|
||||
transformedDocument = result;
|
||||
}
|
||||
});
|
||||
|
||||
stylesheet.applyToFile('/path/to/file', {}, applyOptions, (err, result) => {
|
||||
if (err == null) {
|
||||
transformedString = result;
|
||||
}
|
||||
});
|
||||
|
||||
stylesheet.applyToFile('/path/to/file', (err, result) => {
|
||||
if (err == null) {
|
||||
transformedString = result;
|
||||
}
|
||||
});
|
||||
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
// Type definitions for node-libxslt
|
||||
// Project: https://github.com/albanm/node-libxslt
|
||||
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../libxmljs/libxmljs.d.ts" />
|
||||
|
||||
declare module 'libxslt' {
|
||||
import * as xmljs from 'libxmljs';
|
||||
|
||||
export const libxmljs: typeof xmljs;
|
||||
|
||||
type OutputFormat = 'document' | 'string';
|
||||
|
||||
export interface ApplyOptions {
|
||||
outputFormat?: OutputFormat;
|
||||
noWrapParams?: boolean;
|
||||
}
|
||||
|
||||
type ApplyResult = string | xmljs.XMLDocument;
|
||||
|
||||
type ApplyCallback = (err: Error, result: ApplyResult) => void;
|
||||
|
||||
type ApplyStringCallback = (err: Error, result: string) => void;
|
||||
|
||||
type ApplyDocumentCallback = (err: Error, result: xmljs.XMLDocument) => void;
|
||||
|
||||
export interface Stylesheet {
|
||||
apply(source: string, params?: Object): string;
|
||||
|
||||
apply(source: string, params: Object, options: ApplyOptions): ApplyResult;
|
||||
|
||||
apply(source: string, params: Object, options: ApplyOptions, callback: ApplyCallback): void;
|
||||
|
||||
apply(source: string, callback: ApplyStringCallback): void;
|
||||
|
||||
apply(source: xmljs.XMLDocument, params?: Object): xmljs.XMLDocument;
|
||||
|
||||
apply(source: xmljs.XMLDocument, params: Object, options: ApplyOptions): ApplyResult;
|
||||
|
||||
apply(source: xmljs.XMLDocument, params: Object, options: ApplyOptions, callback: ApplyCallback): void;
|
||||
|
||||
apply(source: xmljs.XMLDocument, callback: ApplyDocumentCallback): void;
|
||||
|
||||
applyToFile(sourcePath: string, params: Object, options: ApplyOptions, callback: ApplyStringCallback): void;
|
||||
|
||||
applyToFile(sourcePath: string, callback: ApplyStringCallback): void;
|
||||
}
|
||||
|
||||
type ParseCallback = (err: Error, stylesheet: Stylesheet) => void;
|
||||
|
||||
export function parse(source: string): Stylesheet;
|
||||
|
||||
export function parse(source: string, callback: ParseCallback): void;
|
||||
|
||||
export function parse(source: xmljs.XMLDocument): Stylesheet;
|
||||
|
||||
export function parse(source: xmljs.XMLDocument, callback: ParseCallback): void;
|
||||
|
||||
export function parseFile(sourcePath: string, callback: ParseCallback): void;
|
||||
}
|
||||
Vendored
+1
-1
@@ -556,7 +556,7 @@ declare namespace __MaterialUI {
|
||||
errorStyle?: React.CSSProperties;
|
||||
errorText?: string;
|
||||
filter?: (searchText: string, key: string, item: AutoCompleteDataItem) => boolean;
|
||||
floatingLabelText?: string;
|
||||
floatingLabelText?: React.ReactNode;
|
||||
fullWidth?: boolean;
|
||||
hintText?: string;
|
||||
listStyle?: React.CSSProperties;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="node-7z.d.ts" />
|
||||
|
||||
import Zip = require('node-7z'); // Name the class as you want!
|
||||
var myTask = new Zip();
|
||||
myTask.extractFull('myArchive.7z', 'destination', { p: 'myPassword' })
|
||||
|
||||
// Equivalent to `on('data', function (files) { // ... });`
|
||||
.progress(function (files: Array<string>): void {
|
||||
console.log('Some files are extracted: %s', files);
|
||||
})
|
||||
|
||||
// When all is done
|
||||
.then(function () {
|
||||
console.log('Extracting done!');
|
||||
})
|
||||
|
||||
// On error
|
||||
.catch(function (err: any) {
|
||||
console.error(err);
|
||||
});
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for node-7z v0.4.1
|
||||
// Project: https://github.com/quentinrossetti/node-7z
|
||||
// Definitions by: Erik Rothoff Andersson <https://github.com/erkie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/
|
||||
|
||||
declare module "node-7z" {
|
||||
// node-7z uses `when` promises which have a progress method, however they are deprecated
|
||||
// internally node-7z uses the progress events to emit files that are extracted,
|
||||
// (also the progress event emits an array of strings, which doesn't correlate with any promise<T>)
|
||||
// so instead of patching `when` promises I'm extending the generic Promise for use internally
|
||||
interface PromiseWithProgress<T> extends Promise<T> {
|
||||
progress(progress: (files: Array<string>) => void): this;
|
||||
}
|
||||
|
||||
// Options are mapped to the 7z program so there is no idea to define all possible types here
|
||||
interface CommandLineSwitches {
|
||||
raw?: Array<string>;
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
interface FileSpec {
|
||||
path: string;
|
||||
type: string;
|
||||
method: string;
|
||||
physicalSize: number;
|
||||
}
|
||||
|
||||
class Zip {
|
||||
add(archive: string, files: string | Array<string>, options: CommandLineSwitches): PromiseWithProgress<{}>;
|
||||
delete(archive: string, files: string | Array<string>, options: CommandLineSwitches): PromiseWithProgress<{}>;
|
||||
extract(archive: string, dest: string, options: CommandLineSwitches): PromiseWithProgress<{}>;
|
||||
extractFull(archive: string, dest: string, options: CommandLineSwitches): PromiseWithProgress<{}>;
|
||||
list(archive: string, options: CommandLineSwitches): PromiseWithProgress<FileSpec>;
|
||||
test(archive: string, options: CommandLineSwitches): PromiseWithProgress<{}>;
|
||||
update(archive: string, files: string | Array<string>, options: CommandLineSwitches): PromiseWithProgress<{}>;
|
||||
}
|
||||
|
||||
export = Zip;
|
||||
}
|
||||
+197
-123
@@ -24,22 +24,44 @@ import * as string_decoder from "string_decoder";
|
||||
// Specifically test buffer module regression.
|
||||
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
//////////////////////////////////////////////////////////
|
||||
/// Assert Tests : https://nodejs.org/api/assert.html ///
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
namespace assert_tests{
|
||||
{
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
|
||||
// TODO: assert.deepStrictEqual
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
const b = false;
|
||||
if (b) { throw "a hammer at your face"; }
|
||||
}, undefined, "What the...*crunch*");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator");
|
||||
|
||||
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
const b = false;
|
||||
if (b) { throw "a hammer at your face"; }
|
||||
}, undefined, "What the...*crunch*");
|
||||
// TODO: assert.fail
|
||||
|
||||
// TODO: assert.ifError
|
||||
|
||||
assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator");
|
||||
|
||||
// TODO: assert.notDeepStrictEqual
|
||||
|
||||
// TODO: assert.notEqual
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
// TODO: assert.ok
|
||||
|
||||
// TODO: assert.strictEqual
|
||||
|
||||
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Events tests : http://nodejs.org/api/events.html
|
||||
@@ -92,30 +114,59 @@ namespace events_tests {
|
||||
////////////////////////////////////////////////////
|
||||
/// File system tests : http://nodejs.org/api/fs.html
|
||||
////////////////////////////////////////////////////
|
||||
fs.writeFile("thebible.txt",
|
||||
"Do unto others as you would have them do unto you.",
|
||||
assert.ifError);
|
||||
|
||||
fs.write(1234, "test");
|
||||
|
||||
fs.writeFile("Harry Potter",
|
||||
"\"You be wizzing, Harry,\" jived Dumbledore.",
|
||||
namespace fs_tests {
|
||||
{
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
fs.writeFile("thebible.txt",
|
||||
"Do unto others as you would have them do unto you.",
|
||||
assert.ifError);
|
||||
|
||||
var content: string,
|
||||
buffer: Buffer;
|
||||
fs.write(1234, "test");
|
||||
|
||||
content = fs.readFileSync('testfile', 'utf8');
|
||||
content = fs.readFileSync('testfile', {encoding : 'utf8'});
|
||||
buffer = fs.readFileSync('testfile');
|
||||
buffer = fs.readFileSync('testfile', {flag : 'r'});
|
||||
fs.readFile('testfile', 'utf8', (err, data) => content = data);
|
||||
fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data);
|
||||
fs.readFile('testfile', (err, data) => buffer = data);
|
||||
fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data);
|
||||
fs.writeFile("Harry Potter",
|
||||
"\"You be wizzing, Harry,\" jived Dumbledore.",
|
||||
{
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
}
|
||||
|
||||
{
|
||||
var content: string;
|
||||
var buffer: Buffer;
|
||||
|
||||
content = fs.readFileSync('testfile', 'utf8');
|
||||
content = fs.readFileSync('testfile', {encoding : 'utf8'});
|
||||
buffer = fs.readFileSync('testfile');
|
||||
buffer = fs.readFileSync('testfile', {flag : 'r'});
|
||||
fs.readFile('testfile', 'utf8', (err, data) => content = data);
|
||||
fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data);
|
||||
fs.readFile('testfile', (err, data) => buffer = data);
|
||||
fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data);
|
||||
}
|
||||
|
||||
{
|
||||
var errno: number;
|
||||
fs.readFile('testfile', (err, data) => {
|
||||
if (err && err.errno) {
|
||||
errno = err.errno;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
fs.mkdtemp('/tmp/foo-', (err, folder) => {
|
||||
console.log(folder);
|
||||
// Prints: /tmp/foo-itXde2
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
var tempDir: string;
|
||||
tempDir = fs.mkdtempSync('/tmp/foo-');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Networker extends events.EventEmitter {
|
||||
constructor() {
|
||||
@@ -125,21 +176,6 @@ class Networker extends events.EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
var errno: number;
|
||||
fs.readFile('testfile', (err, data) => {
|
||||
if (err && err.errno) {
|
||||
errno = err.errno;
|
||||
}
|
||||
});
|
||||
|
||||
fs.mkdtemp('/tmp/foo-', (err, folder) => {
|
||||
console.log(folder);
|
||||
// Prints: /tmp/foo-itXde2
|
||||
});
|
||||
|
||||
var tempDir: string;
|
||||
tempDir = fs.mkdtempSync('/tmp/foo-');
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
/// Buffer tests : https://nodejs.org/api/buffer.html
|
||||
///////////////////////////////////////////////////////
|
||||
@@ -235,23 +271,36 @@ function bufferTests() {
|
||||
/// Url tests : http://nodejs.org/api/url.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
namespace url_tests {
|
||||
{
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
}
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
{
|
||||
var helloUrl = url.parse('http://example.com/?hello=world', true)
|
||||
assert.equal(helloUrl.query.hello, 'world');
|
||||
}
|
||||
}
|
||||
|
||||
var helloUrl = url.parse('http://example.com/?hello=world', true)
|
||||
assert.equal(helloUrl.query.hello, 'world');
|
||||
/////////////////////////////////////////////////////
|
||||
/// util tests : https://nodejs.org/api/util.html ///
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Old and new util.inspect APIs
|
||||
util.inspect(["This is nice"], false, 5);
|
||||
util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false });
|
||||
namespace util_tests {
|
||||
{
|
||||
// Old and new util.inspect APIs
|
||||
util.inspect(["This is nice"], false, 5);
|
||||
util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false });
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Stream tests : http://nodejs.org/api/stream.html
|
||||
@@ -416,11 +465,13 @@ namespace tty_tests {
|
||||
/// Dgram tests : http://nodejs.org/api/dgram.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
|
||||
});
|
||||
var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
namespace dgram_tests {
|
||||
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
|
||||
});
|
||||
var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
///Querystring tests : https://nodejs.org/api/querystring.html
|
||||
@@ -516,82 +567,82 @@ namespace path_tests {
|
||||
path.isAbsolute('.') // false
|
||||
|
||||
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb')
|
||||
// returns
|
||||
// '..\\..\\impl\\bbb'
|
||||
// returns
|
||||
// '..\\..\\impl\\bbb'
|
||||
|
||||
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb')
|
||||
// returns
|
||||
// '../../impl/bbb'
|
||||
// returns
|
||||
// '../../impl/bbb'
|
||||
|
||||
path.dirname('/foo/bar/baz/asdf/quux')
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html')
|
||||
// returns
|
||||
// 'quux.html'
|
||||
// returns
|
||||
// 'quux.html'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html', '.html')
|
||||
// returns
|
||||
// 'quux'
|
||||
// returns
|
||||
// 'quux'
|
||||
|
||||
path.extname('index.html')
|
||||
// returns
|
||||
// '.html'
|
||||
// returns
|
||||
// '.html'
|
||||
|
||||
path.extname('index.coffee.md')
|
||||
// returns
|
||||
// '.md'
|
||||
// returns
|
||||
// '.md'
|
||||
|
||||
path.extname('index.')
|
||||
// returns
|
||||
// '.'
|
||||
// returns
|
||||
// '.'
|
||||
|
||||
path.extname('index')
|
||||
// returns
|
||||
// ''
|
||||
// returns
|
||||
// ''
|
||||
|
||||
'foo/bar/baz'.split(path.sep)
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
'foo\\bar\\baz'.split(path.sep)
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
console.log(process.env.PATH)
|
||||
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
|
||||
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
|
||||
|
||||
process.env.PATH.split(path.delimiter)
|
||||
// returns
|
||||
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
|
||||
// returns
|
||||
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
|
||||
|
||||
console.log(process.env.PATH)
|
||||
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
|
||||
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
|
||||
|
||||
process.env.PATH.split(path.delimiter)
|
||||
// returns
|
||||
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
|
||||
// returns
|
||||
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
|
||||
|
||||
path.parse('/home/user/dir/file.txt')
|
||||
// returns
|
||||
// {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
// returns
|
||||
// {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
|
||||
path.parse('C:\\path\\dir\\index.html')
|
||||
// returns
|
||||
// {
|
||||
// root : "C:\",
|
||||
// dir : "C:\path\dir",
|
||||
// base : "index.html",
|
||||
// ext : ".html",
|
||||
// name : "index"
|
||||
// }
|
||||
// returns
|
||||
// {
|
||||
// root : "C:\",
|
||||
// dir : "C:\path\dir",
|
||||
// base : "index.html",
|
||||
// ext : ".html",
|
||||
// name : "index"
|
||||
// }
|
||||
|
||||
path.format({
|
||||
root : "/",
|
||||
@@ -600,8 +651,8 @@ namespace path_tests {
|
||||
ext : ".txt",
|
||||
name : "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -717,20 +768,28 @@ namespace string_decoder_tests {
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
childProcess.exec("echo test");
|
||||
childProcess.spawnSync("echo test");
|
||||
namespace child_process_tests {
|
||||
{
|
||||
childProcess.exec("echo test");
|
||||
childProcess.spawnSync("echo test");
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// cluster tests: https://nodejs.org/api/cluster.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
cluster.fork();
|
||||
Object.keys(cluster.workers).forEach(key => {
|
||||
const worker = cluster.workers[key];
|
||||
if (worker.isDead()) {
|
||||
console.log('worker %d is dead', worker.process.pid);
|
||||
namespace cluster_tests {
|
||||
{
|
||||
cluster.fork();
|
||||
Object.keys(cluster.workers).forEach(key => {
|
||||
const worker = cluster.workers[key];
|
||||
if (worker.isDead()) {
|
||||
console.log('worker %d is dead', worker.process.pid);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// os tests : https://nodejs.org/api/os.html
|
||||
@@ -841,6 +900,22 @@ namespace errors_tests {
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Process Tests : https://nodejs.org/api/process.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
import * as p from "process";
|
||||
namespace process_tests{
|
||||
{
|
||||
var eventEmitter: events.EventEmitter;
|
||||
eventEmitter = process; // Test that process implements EventEmitter...
|
||||
|
||||
var _p: NodeJS.Process = process;
|
||||
_p = p;
|
||||
assert(p === process);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Console Tests : https://nodejs.org/api/console.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -851,4 +926,3 @@ namespace console_tests{
|
||||
assert(c === console);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+51
@@ -2403,6 +2403,57 @@ declare module "constants" {
|
||||
export var W_OK: number;
|
||||
export var X_OK: number;
|
||||
export var UV_UDP_REUSEADDR: number;
|
||||
export var EDQUOT: number;
|
||||
export var EMULTIHOP: number;
|
||||
export var ESTALE: number;
|
||||
export var O_DIRECT: number;
|
||||
export var O_DIRECTORY: number;
|
||||
export var O_NOCTTY: number;
|
||||
export var O_NOFOLLOW: number;
|
||||
export var O_NONBLOCK: number;
|
||||
export var O_SYNC: number;
|
||||
export var SIGALRM: number;
|
||||
export var SIGBUS: number;
|
||||
export var SIGCHLD: number;
|
||||
export var SIGCONT: number;
|
||||
export var SIGIO: number;
|
||||
export var SIGIOT: number;
|
||||
export var SIGPIPE: number;
|
||||
export var SIGPOLL: number;
|
||||
export var SIGPROF: number;
|
||||
export var SIGPWR: number;
|
||||
export var SIGQUIT: number;
|
||||
export var SIGSTKFLT: number;
|
||||
export var SIGSTOP: number;
|
||||
export var SIGSYS: number;
|
||||
export var SIGTRAP: number;
|
||||
export var SIGTSTP: number;
|
||||
export var SIGTTIN: number;
|
||||
export var SIGTTOU: number;
|
||||
export var SIGUNUSED: number;
|
||||
export var SIGURG: number;
|
||||
export var SIGUSR1: number;
|
||||
export var SIGUSR2: number;
|
||||
export var SIGVTALRM: number;
|
||||
export var SIGXCPU: number;
|
||||
export var SIGXFSZ: number;
|
||||
export var S_IFBLK: number;
|
||||
export var S_IFIFO: number;
|
||||
export var S_IFSOCK: number;
|
||||
export var S_IRGRP: number;
|
||||
export var S_IROTH: number;
|
||||
export var S_IRUSR: number;
|
||||
export var S_IRWXG: number;
|
||||
export var S_IRWXO: number;
|
||||
export var S_IRWXU: number;
|
||||
export var S_IWGRP: number;
|
||||
export var S_IWOTH: number;
|
||||
export var S_IWUSR: number;
|
||||
export var S_IXGRP: number;
|
||||
export var S_IXOTH: number;
|
||||
export var S_IXUSR: number;
|
||||
export var defaultCipherList: string;
|
||||
export var defaultCoreCipherList: string;
|
||||
}
|
||||
|
||||
declare module "process" {
|
||||
|
||||
+384
-145
@@ -26,22 +26,44 @@ import * as timers from "timers";
|
||||
// Specifically test buffer module regression.
|
||||
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
//////////////////////////////////////////////////////////
|
||||
/// Assert Tests : https://nodejs.org/api/assert.html ///
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
namespace assert_tests{
|
||||
{
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
|
||||
// TODO: assert.deepStrictEqual
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
const b = false;
|
||||
if (b) { throw "a hammer at your face"; }
|
||||
}, undefined, "What the...*crunch*");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator");
|
||||
|
||||
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
const b = false;
|
||||
if (b) { throw "a hammer at your face"; }
|
||||
}, undefined, "What the...*crunch*");
|
||||
// TODO: assert.fail
|
||||
|
||||
// TODO: assert.ifError
|
||||
|
||||
assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator");
|
||||
|
||||
// TODO: assert.notDeepStrictEqual
|
||||
|
||||
// TODO: assert.notEqual
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
// TODO: assert.ok
|
||||
|
||||
// TODO: assert.strictEqual
|
||||
|
||||
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Events tests : http://nodejs.org/api/events.html
|
||||
@@ -102,30 +124,94 @@ namespace events_tests {
|
||||
////////////////////////////////////////////////////
|
||||
/// File system tests : http://nodejs.org/api/fs.html
|
||||
////////////////////////////////////////////////////
|
||||
fs.writeFile("thebible.txt",
|
||||
"Do unto others as you would have them do unto you.",
|
||||
assert.ifError);
|
||||
|
||||
fs.write(1234, "test");
|
||||
|
||||
fs.writeFile("Harry Potter",
|
||||
"\"You be wizzing, Harry,\" jived Dumbledore.",
|
||||
namespace fs_tests {
|
||||
{
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
fs.writeFile("thebible.txt",
|
||||
"Do unto others as you would have them do unto you.",
|
||||
assert.ifError);
|
||||
|
||||
fs.write(1234, "test");
|
||||
|
||||
fs.writeFile("Harry Potter",
|
||||
"\"You be wizzing, Harry,\" jived Dumbledore.",
|
||||
{
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
}
|
||||
|
||||
var content: string,
|
||||
buffer: Buffer;
|
||||
|
||||
content = fs.readFileSync('testfile', 'utf8');
|
||||
content = fs.readFileSync('testfile', {encoding : 'utf8'});
|
||||
buffer = fs.readFileSync('testfile');
|
||||
buffer = fs.readFileSync('testfile', {flag : 'r'});
|
||||
fs.readFile('testfile', 'utf8', (err, data) => content = data);
|
||||
fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data);
|
||||
fs.readFile('testfile', (err, data) => buffer = data);
|
||||
fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data);
|
||||
{
|
||||
var content: string;
|
||||
var buffer: Buffer;
|
||||
|
||||
content = fs.readFileSync('testfile', 'utf8');
|
||||
content = fs.readFileSync('testfile', {encoding : 'utf8'});
|
||||
buffer = fs.readFileSync('testfile');
|
||||
buffer = fs.readFileSync('testfile', {flag : 'r'});
|
||||
fs.readFile('testfile', 'utf8', (err, data) => content = data);
|
||||
fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data);
|
||||
fs.readFile('testfile', (err, data) => buffer = data);
|
||||
fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data);
|
||||
}
|
||||
|
||||
{
|
||||
var errno: string;
|
||||
fs.readFile('testfile', (err, data) => {
|
||||
if (err && err.errno) {
|
||||
errno = err.errno;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
fs.mkdtemp('/tmp/foo-', (err, folder) => {
|
||||
console.log(folder);
|
||||
// Prints: /tmp/foo-itXde2
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
var tempDir: string;
|
||||
tempDir = fs.mkdtempSync('/tmp/foo-');
|
||||
}
|
||||
|
||||
{
|
||||
fs.watch('/tmp/foo-', (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
fs.watch('/tmp/foo-', 'utf8', (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
fs.watch('/tmp/foo-', {
|
||||
recursive: true,
|
||||
persistent: true,
|
||||
encoding: 'utf8'
|
||||
}, (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
fs.access('/path/to/folder', (err) => {});
|
||||
|
||||
fs.access(Buffer.from(''), (err) => {});
|
||||
|
||||
fs.access('/path/to/folder', fs.constants.F_OK | fs.constants.R_OK, (err) => {});
|
||||
|
||||
fs.access(Buffer.from(''), fs.constants.F_OK | fs.constants.R_OK, (err) => {});
|
||||
|
||||
fs.accessSync('/path/to/folder');
|
||||
|
||||
fs.accessSync(Buffer.from(''));
|
||||
|
||||
fs.accessSync('path/to/folder', fs.constants.W_OK | fs.constants.X_OK);
|
||||
|
||||
fs.accessSync(Buffer.from(''), fs.constants.W_OK | fs.constants.X_OK);
|
||||
}
|
||||
}
|
||||
|
||||
class Networker extends events.EventEmitter {
|
||||
constructor() {
|
||||
@@ -135,37 +221,6 @@ class Networker extends events.EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
var errno: string;
|
||||
fs.readFile('testfile', (err, data) => {
|
||||
if (err && err.errno) {
|
||||
errno = err.errno;
|
||||
}
|
||||
});
|
||||
|
||||
fs.mkdtemp('/tmp/foo-', (err, folder) => {
|
||||
console.log(folder);
|
||||
// Prints: /tmp/foo-itXde2
|
||||
});
|
||||
|
||||
var tempDir: string;
|
||||
tempDir = fs.mkdtempSync('/tmp/foo-');
|
||||
|
||||
fs.watch('/tmp/foo-', (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
fs.watch('/tmp/foo-', 'utf8', (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
fs.watch('/tmp/foo-', {
|
||||
recursive: true,
|
||||
persistent: true,
|
||||
encoding: 'utf8'
|
||||
}, (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
/// Buffer tests : https://nodejs.org/api/buffer.html
|
||||
///////////////////////////////////////////////////////
|
||||
@@ -327,23 +382,36 @@ function bufferTests() {
|
||||
/// Url tests : http://nodejs.org/api/url.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
namespace url_tests {
|
||||
{
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
}
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
{
|
||||
var helloUrl = url.parse('http://example.com/?hello=world', true)
|
||||
assert.equal(helloUrl.query.hello, 'world');
|
||||
}
|
||||
}
|
||||
|
||||
var helloUrl = url.parse('http://example.com/?hello=world', true)
|
||||
assert.equal(helloUrl.query.hello, 'world');
|
||||
/////////////////////////////////////////////////////
|
||||
/// util tests : https://nodejs.org/api/util.html ///
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Old and new util.inspect APIs
|
||||
util.inspect(["This is nice"], false, 5);
|
||||
util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false });
|
||||
namespace util_tests {
|
||||
{
|
||||
// Old and new util.inspect APIs
|
||||
util.inspect(["This is nice"], false, 5);
|
||||
util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false });
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Stream tests : http://nodejs.org/api/stream.html
|
||||
@@ -479,11 +547,11 @@ var ctx: tls.SecureContext = tls.createSecureContext({
|
||||
});
|
||||
var blah = ctx.context;
|
||||
|
||||
var tlsOpts: tls.TlsOptions = {
|
||||
var connOpts: tls.ConnectionOptions = {
|
||||
host: "127.0.0.1",
|
||||
port: 55
|
||||
};
|
||||
var tlsSocket = tls.connect(tlsOpts);
|
||||
var tlsSocket = tls.connect(connOpts);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -572,14 +640,16 @@ namespace tty_tests {
|
||||
/// Dgram tests : http://nodejs.org/api/dgram.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
|
||||
});
|
||||
ds.bind();
|
||||
ds.bind(41234);
|
||||
var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
ds.send(new Buffer("hello"), 5000, "127.0.0.1");
|
||||
namespace dgram_tests {
|
||||
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
|
||||
});
|
||||
ds.bind();
|
||||
ds.bind(41234);
|
||||
var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
ds.send(new Buffer("hello"), 5000, "127.0.0.1");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
///Querystring tests : https://nodejs.org/api/querystring.html
|
||||
@@ -675,82 +745,82 @@ namespace path_tests {
|
||||
path.isAbsolute('.') // false
|
||||
|
||||
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb')
|
||||
// returns
|
||||
// '..\\..\\impl\\bbb'
|
||||
// returns
|
||||
// '..\\..\\impl\\bbb'
|
||||
|
||||
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb')
|
||||
// returns
|
||||
// '../../impl/bbb'
|
||||
// returns
|
||||
// '../../impl/bbb'
|
||||
|
||||
path.dirname('/foo/bar/baz/asdf/quux')
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html')
|
||||
// returns
|
||||
// 'quux.html'
|
||||
// returns
|
||||
// 'quux.html'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html', '.html')
|
||||
// returns
|
||||
// 'quux'
|
||||
// returns
|
||||
// 'quux'
|
||||
|
||||
path.extname('index.html')
|
||||
// returns
|
||||
// '.html'
|
||||
// returns
|
||||
// '.html'
|
||||
|
||||
path.extname('index.coffee.md')
|
||||
// returns
|
||||
// '.md'
|
||||
// returns
|
||||
// '.md'
|
||||
|
||||
path.extname('index.')
|
||||
// returns
|
||||
// '.'
|
||||
// returns
|
||||
// '.'
|
||||
|
||||
path.extname('index')
|
||||
// returns
|
||||
// ''
|
||||
// returns
|
||||
// ''
|
||||
|
||||
'foo/bar/baz'.split(path.sep)
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
'foo\\bar\\baz'.split(path.sep)
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
console.log(process.env.PATH)
|
||||
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
|
||||
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
|
||||
|
||||
process.env.PATH.split(path.delimiter)
|
||||
// returns
|
||||
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
|
||||
// returns
|
||||
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
|
||||
|
||||
console.log(process.env.PATH)
|
||||
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
|
||||
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
|
||||
|
||||
process.env.PATH.split(path.delimiter)
|
||||
// returns
|
||||
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
|
||||
// returns
|
||||
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
|
||||
|
||||
path.parse('/home/user/dir/file.txt')
|
||||
// returns
|
||||
// {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
// returns
|
||||
// {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
|
||||
path.parse('C:\\path\\dir\\index.html')
|
||||
// returns
|
||||
// {
|
||||
// root : "C:\",
|
||||
// dir : "C:\path\dir",
|
||||
// base : "index.html",
|
||||
// ext : ".html",
|
||||
// name : "index"
|
||||
// }
|
||||
// returns
|
||||
// {
|
||||
// root : "C:\",
|
||||
// dir : "C:\path\dir",
|
||||
// base : "index.html",
|
||||
// ext : ".html",
|
||||
// name : "index"
|
||||
// }
|
||||
|
||||
path.format({
|
||||
root : "/",
|
||||
@@ -759,8 +829,8 @@ namespace path_tests {
|
||||
ext : ".txt",
|
||||
name : "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -879,20 +949,28 @@ namespace string_decoder_tests {
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
childProcess.exec("echo test");
|
||||
childProcess.spawnSync("echo test");
|
||||
namespace child_process_tests {
|
||||
{
|
||||
childProcess.exec("echo test");
|
||||
childProcess.spawnSync("echo test");
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// cluster tests: https://nodejs.org/api/cluster.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
cluster.fork();
|
||||
Object.keys(cluster.workers).forEach(key => {
|
||||
const worker = cluster.workers[key];
|
||||
if (worker.isDead()) {
|
||||
console.log('worker %d is dead', worker.process.pid);
|
||||
namespace cluster_tests {
|
||||
{
|
||||
cluster.fork();
|
||||
Object.keys(cluster.workers).forEach(key => {
|
||||
const worker = cluster.workers[key];
|
||||
if (worker.isDead()) {
|
||||
console.log('worker %d is dead', worker.process.pid);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// os tests : https://nodejs.org/api/os.html
|
||||
@@ -1028,10 +1106,19 @@ namespace errors_tests {
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Process Tests : https://nodejs.org/api/process.html ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
import * as p from "process";
|
||||
namespace process_tests{
|
||||
{
|
||||
var eventEmitter: events.EventEmitter;
|
||||
eventEmitter = process; // Test that process implements EventEmitter...
|
||||
eventEmitter = process; // Test that process implements EventEmitter...
|
||||
|
||||
var _p: NodeJS.Process = process;
|
||||
_p = p;
|
||||
assert(p === process);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1045,3 +1132,155 @@ namespace console_tests{
|
||||
assert(c === console);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// Constants Tests ///
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
import * as constants from 'constants';
|
||||
namespace constants_tests {
|
||||
var str: string;
|
||||
var num: number;
|
||||
num = constants.SIGHUP
|
||||
num = constants.SIGINT
|
||||
num = constants.SIGQUIT
|
||||
num = constants.SIGILL
|
||||
num = constants.SIGTRAP
|
||||
num = constants.SIGABRT
|
||||
num = constants.SIGIOT
|
||||
num = constants.SIGBUS
|
||||
num = constants.SIGFPE
|
||||
num = constants.SIGKILL
|
||||
num = constants.SIGUSR1
|
||||
num = constants.SIGSEGV
|
||||
num = constants.SIGUSR2
|
||||
num = constants.SIGPIPE
|
||||
num = constants.SIGALRM
|
||||
num = constants.SIGTERM
|
||||
num = constants.SIGCHLD
|
||||
num = constants.SIGSTKFLT
|
||||
num = constants.SIGCONT
|
||||
num = constants.SIGSTOP
|
||||
num = constants.SIGTSTP
|
||||
num = constants.SIGTTIN
|
||||
num = constants.SIGTTOU
|
||||
num = constants.SIGURG
|
||||
num = constants.SIGXCPU
|
||||
num = constants.SIGXFSZ
|
||||
num = constants.SIGVTALRM
|
||||
num = constants.SIGPROF
|
||||
num = constants.SIGWINCH
|
||||
num = constants.SIGIO
|
||||
num = constants.SIGPOLL
|
||||
num = constants.SIGPWR
|
||||
num = constants.SIGSYS
|
||||
num = constants.SIGUNUSED
|
||||
num = constants.O_RDONLY
|
||||
num = constants.O_WRONLY
|
||||
num = constants.O_RDWR
|
||||
num = constants.S_IFMT
|
||||
num = constants.S_IFREG
|
||||
num = constants.S_IFDIR
|
||||
num = constants.S_IFCHR
|
||||
num = constants.S_IFBLK
|
||||
num = constants.S_IFIFO
|
||||
num = constants.S_IFLNK
|
||||
num = constants.S_IFSOCK
|
||||
num = constants.O_CREAT
|
||||
num = constants.O_EXCL
|
||||
num = constants.O_NOCTTY
|
||||
num = constants.O_TRUNC
|
||||
num = constants.O_APPEND
|
||||
num = constants.O_DIRECTORY
|
||||
num = constants.O_NOATIME
|
||||
num = constants.O_NOFOLLOW
|
||||
num = constants.O_SYNC
|
||||
num = constants.O_DIRECT
|
||||
num = constants.O_NONBLOCK
|
||||
num = constants.S_IRWXU
|
||||
num = constants.S_IRUSR
|
||||
num = constants.S_IWUSR
|
||||
num = constants.S_IXUSR
|
||||
num = constants.S_IRWXG
|
||||
num = constants.S_IRGRP
|
||||
num = constants.S_IWGRP
|
||||
num = constants.S_IXGRP
|
||||
num = constants.S_IRWXO
|
||||
num = constants.S_IROTH
|
||||
num = constants.S_IWOTH
|
||||
num = constants.S_IXOTH
|
||||
num = constants.F_OK
|
||||
num = constants.R_OK
|
||||
num = constants.W_OK
|
||||
num = constants.X_OK
|
||||
num = constants.SSL_OP_ALL
|
||||
num = constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
|
||||
num = constants.SSL_OP_CIPHER_SERVER_PREFERENCE
|
||||
num = constants.SSL_OP_CISCO_ANYCONNECT
|
||||
num = constants.SSL_OP_COOKIE_EXCHANGE
|
||||
num = constants.SSL_OP_CRYPTOPRO_TLSEXT_BUG
|
||||
num = constants.SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
|
||||
num = constants.SSL_OP_EPHEMERAL_RSA
|
||||
num = constants.SSL_OP_LEGACY_SERVER_CONNECT
|
||||
num = constants.SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
|
||||
num = constants.SSL_OP_MICROSOFT_SESS_ID_BUG
|
||||
num = constants.SSL_OP_MSIE_SSLV2_RSA_PADDING
|
||||
num = constants.SSL_OP_NETSCAPE_CA_DN_BUG
|
||||
num = constants.SSL_OP_NETSCAPE_CHALLENGE_BUG
|
||||
num = constants.SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
|
||||
num = constants.SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
|
||||
num = constants.SSL_OP_NO_COMPRESSION
|
||||
num = constants.SSL_OP_NO_QUERY_MTU
|
||||
num = constants.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
|
||||
num = constants.SSL_OP_NO_SSLv2
|
||||
num = constants.SSL_OP_NO_SSLv3
|
||||
num = constants.SSL_OP_NO_TICKET
|
||||
num = constants.SSL_OP_NO_TLSv1
|
||||
num = constants.SSL_OP_NO_TLSv1_1
|
||||
num = constants.SSL_OP_NO_TLSv1_2
|
||||
num = constants.SSL_OP_PKCS1_CHECK_1
|
||||
num = constants.SSL_OP_PKCS1_CHECK_2
|
||||
num = constants.SSL_OP_SINGLE_DH_USE
|
||||
num = constants.SSL_OP_SINGLE_ECDH_USE
|
||||
num = constants.SSL_OP_SSLEAY_080_CLIENT_DH_BUG
|
||||
num = constants.SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
|
||||
num = constants.SSL_OP_TLS_BLOCK_PADDING_BUG
|
||||
num = constants.SSL_OP_TLS_D5_BUG
|
||||
num = constants.SSL_OP_TLS_ROLLBACK_BUG
|
||||
num = constants.ENGINE_METHOD_RSA
|
||||
num = constants.ENGINE_METHOD_DSA
|
||||
num = constants.ENGINE_METHOD_DH
|
||||
num = constants.ENGINE_METHOD_RAND
|
||||
num = constants.ENGINE_METHOD_ECDH
|
||||
num = constants.ENGINE_METHOD_ECDSA
|
||||
num = constants.ENGINE_METHOD_CIPHERS
|
||||
num = constants.ENGINE_METHOD_DIGESTS
|
||||
num = constants.ENGINE_METHOD_STORE
|
||||
num = constants.ENGINE_METHOD_PKEY_METHS
|
||||
num = constants.ENGINE_METHOD_PKEY_ASN1_METHS
|
||||
num = constants.ENGINE_METHOD_ALL
|
||||
num = constants.ENGINE_METHOD_NONE
|
||||
num = constants.DH_CHECK_P_NOT_SAFE_PRIME
|
||||
num = constants.DH_CHECK_P_NOT_PRIME
|
||||
num = constants.DH_UNABLE_TO_CHECK_GENERATOR
|
||||
num = constants.DH_NOT_SUITABLE_GENERATOR
|
||||
num = constants.NPN_ENABLED
|
||||
num = constants.ALPN_ENABLED
|
||||
num = constants.RSA_PKCS1_PADDING
|
||||
num = constants.RSA_SSLV23_PADDING
|
||||
num = constants.RSA_NO_PADDING
|
||||
num = constants.RSA_PKCS1_OAEP_PADDING
|
||||
num = constants.RSA_X931_PADDING
|
||||
num = constants.RSA_PKCS1_PSS_PADDING
|
||||
num = constants.POINT_CONVERSION_COMPRESSED
|
||||
num = constants.POINT_CONVERSION_UNCOMPRESSED
|
||||
num = constants.POINT_CONVERSION_HYBRID
|
||||
str = constants.defaultCoreCipherList
|
||||
str = constants.defaultCipherList
|
||||
}
|
||||
|
||||
Vendored
+374
-165
@@ -885,22 +885,144 @@ declare module "os" {
|
||||
internal: boolean;
|
||||
}
|
||||
|
||||
export function tmpdir(): string;
|
||||
export function homedir(): string;
|
||||
export function endianness(): "BE" | "LE";
|
||||
export function hostname(): string;
|
||||
export function type(): string;
|
||||
export function platform(): string;
|
||||
export function arch(): string;
|
||||
export function release(): string;
|
||||
export function uptime(): number;
|
||||
export function loadavg(): number[];
|
||||
export function totalmem(): number;
|
||||
export function uptime(): number;
|
||||
export function freemem(): number;
|
||||
export function totalmem(): number;
|
||||
export function cpus(): CpuInfo[];
|
||||
export function type(): string;
|
||||
export function release(): string;
|
||||
export function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] };
|
||||
export function userInfo(options?: {encoding: string}): { username: string, uid: number, gid: number, shell: any, homedir: string }
|
||||
export function homedir(): string;
|
||||
export function userInfo(options?: { encoding: string }): { username: string, uid: number, gid: number, shell: any, homedir: string }
|
||||
export var constants: {
|
||||
UV_UDP_REUSEADDR: number,
|
||||
errno: {
|
||||
SIGHUP: number;
|
||||
SIGINT: number;
|
||||
SIGQUIT: number;
|
||||
SIGILL: number;
|
||||
SIGTRAP: number;
|
||||
SIGABRT: number;
|
||||
SIGIOT: number;
|
||||
SIGBUS: number;
|
||||
SIGFPE: number;
|
||||
SIGKILL: number;
|
||||
SIGUSR1: number;
|
||||
SIGSEGV: number;
|
||||
SIGUSR2: number;
|
||||
SIGPIPE: number;
|
||||
SIGALRM: number;
|
||||
SIGTERM: number;
|
||||
SIGCHLD: number;
|
||||
SIGSTKFLT: number;
|
||||
SIGCONT: number;
|
||||
SIGSTOP: number;
|
||||
SIGTSTP: number;
|
||||
SIGTTIN: number;
|
||||
SIGTTOU: number;
|
||||
SIGURG: number;
|
||||
SIGXCPU: number;
|
||||
SIGXFSZ: number;
|
||||
SIGVTALRM: number;
|
||||
SIGPROF: number;
|
||||
SIGWINCH: number;
|
||||
SIGIO: number;
|
||||
SIGPOLL: number;
|
||||
SIGPWR: number;
|
||||
SIGSYS: number;
|
||||
SIGUNUSED: number;
|
||||
},
|
||||
signals: {
|
||||
E2BIG: number;
|
||||
EACCES: number;
|
||||
EADDRINUSE: number;
|
||||
EADDRNOTAVAIL: number;
|
||||
EAFNOSUPPORT: number;
|
||||
EAGAIN: number;
|
||||
EALREADY: number;
|
||||
EBADF: number;
|
||||
EBADMSG: number;
|
||||
EBUSY: number;
|
||||
ECANCELED: number;
|
||||
ECHILD: number;
|
||||
ECONNABORTED: number;
|
||||
ECONNREFUSED: number;
|
||||
ECONNRESET: number;
|
||||
EDEADLK: number;
|
||||
EDESTADDRREQ: number;
|
||||
EDOM: number;
|
||||
EDQUOT: number;
|
||||
EEXIST: number;
|
||||
EFAULT: number;
|
||||
EFBIG: number;
|
||||
EHOSTUNREACH: number;
|
||||
EIDRM: number;
|
||||
EILSEQ: number;
|
||||
EINPROGRESS: number;
|
||||
EINTR: number;
|
||||
EINVAL: number;
|
||||
EIO: number;
|
||||
EISCONN: number;
|
||||
EISDIR: number;
|
||||
ELOOP: number;
|
||||
EMFILE: number;
|
||||
EMLINK: number;
|
||||
EMSGSIZE: number;
|
||||
EMULTIHOP: number;
|
||||
ENAMETOOLONG: number;
|
||||
ENETDOWN: number;
|
||||
ENETRESET: number;
|
||||
ENETUNREACH: number;
|
||||
ENFILE: number;
|
||||
ENOBUFS: number;
|
||||
ENODATA: number;
|
||||
ENODEV: number;
|
||||
ENOENT: number;
|
||||
ENOEXEC: number;
|
||||
ENOLCK: number;
|
||||
ENOLINK: number;
|
||||
ENOMEM: number;
|
||||
ENOMSG: number;
|
||||
ENOPROTOOPT: number;
|
||||
ENOSPC: number;
|
||||
ENOSR: number;
|
||||
ENOSTR: number;
|
||||
ENOSYS: number;
|
||||
ENOTCONN: number;
|
||||
ENOTDIR: number;
|
||||
ENOTEMPTY: number;
|
||||
ENOTSOCK: number;
|
||||
ENOTSUP: number;
|
||||
ENOTTY: number;
|
||||
ENXIO: number;
|
||||
EOPNOTSUPP: number;
|
||||
EOVERFLOW: number;
|
||||
EPERM: number;
|
||||
EPIPE: number;
|
||||
EPROTO: number;
|
||||
EPROTONOSUPPORT: number;
|
||||
EPROTOTYPE: number;
|
||||
ERANGE: number;
|
||||
EROFS: number;
|
||||
ESPIPE: number;
|
||||
ESRCH: number;
|
||||
ESTALE: number;
|
||||
ETIME: number;
|
||||
ETIMEDOUT: number;
|
||||
ETXTBSY: number;
|
||||
EWOULDBLOCK: number;
|
||||
EXDEV: number;
|
||||
},
|
||||
};
|
||||
export function arch(): string;
|
||||
export function platform(): string;
|
||||
export function tmpdir(): string;
|
||||
export function tmpDir(): string;
|
||||
export function getNetworkInterfaces(): { [index: string]: NetworkInterfaceInfo[] };
|
||||
export var EOL: string;
|
||||
export function endianness(): "BE" | "LE";
|
||||
}
|
||||
|
||||
declare module "https" {
|
||||
@@ -1423,14 +1545,14 @@ declare module "dgram" {
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
type: string;
|
||||
type: "udp4" | "udp6";
|
||||
reuseAddr?: boolean;
|
||||
}
|
||||
|
||||
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
||||
export function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
||||
|
||||
interface Socket extends events.EventEmitter {
|
||||
export interface Socket extends events.EventEmitter {
|
||||
send(msg: Buffer | String | any[], port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
|
||||
send(msg: Buffer | String | any[], offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
|
||||
bind(port?: number, address?: string, callback?: () => void): void;
|
||||
@@ -1717,14 +1839,23 @@ declare module "fs" {
|
||||
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. */
|
||||
export var F_OK: number;
|
||||
/** Constant for fs.access(). File can be read by the calling process. */
|
||||
export var R_OK: number;
|
||||
/** Constant for fs.access(). File can be written by the calling process. */
|
||||
export var W_OK: number;
|
||||
/** Constant for fs.access(). File can be executed by the calling process. */
|
||||
export var X_OK: number;
|
||||
|
||||
interface Constants {
|
||||
/** Constant for fs.access(). File is visible to the calling process. */
|
||||
F_OK: number;
|
||||
|
||||
/** Constant for fs.access(). File can be read by the calling process. */
|
||||
R_OK: number;
|
||||
|
||||
/** Constant for fs.access(). File can be written by the calling process. */
|
||||
W_OK: number;
|
||||
|
||||
/** Constant for fs.access(). File can be executed by the calling process. */
|
||||
X_OK: number;
|
||||
}
|
||||
|
||||
export const constants: Constants;
|
||||
|
||||
/** Tests a user's permissions for the file specified by path. */
|
||||
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;
|
||||
@@ -2056,18 +2187,26 @@ declare module "tls" {
|
||||
export interface TlsOptions {
|
||||
host?: string;
|
||||
port?: number;
|
||||
pfx?: any; //string or buffer
|
||||
key?: any; //string or buffer
|
||||
pfx?: string | Buffer[];
|
||||
key?: string | string[] | Buffer | any[];
|
||||
passphrase?: string;
|
||||
cert?: any;
|
||||
ca?: any; //string or buffer
|
||||
crl?: any; //string or string array
|
||||
cert?: string | string[] | Buffer | Buffer[];
|
||||
ca?: string | string[] | Buffer | Buffer[];
|
||||
crl?: string | string[];
|
||||
ciphers?: string;
|
||||
honorCipherOrder?: any;
|
||||
honorCipherOrder?: boolean;
|
||||
requestCert?: boolean;
|
||||
rejectUnauthorized?: boolean;
|
||||
NPNProtocols?: any; //array or Buffer;
|
||||
NPNProtocols?: string[] | Buffer;
|
||||
SNICallback?: (servername: string, cb:(err:Error,ctx:SecureContext)=>any) => any;
|
||||
ecdhCurve?: string;
|
||||
dhparam?: string | Buffer;
|
||||
handshakeTimeout?: number;
|
||||
ALPNProtocols?: string[] | Buffer;
|
||||
sessionTimeout?: number;
|
||||
ticketKeys?: any;
|
||||
sessionIdContext?: string;
|
||||
secureProtocol?: string;
|
||||
}
|
||||
|
||||
export interface ConnectionOptions {
|
||||
@@ -2075,13 +2214,20 @@ declare module "tls" {
|
||||
port?: number;
|
||||
socket?: net.Socket;
|
||||
pfx?: string | Buffer
|
||||
key?: string | Buffer
|
||||
key?: string |string[] | Buffer | Buffer[];
|
||||
passphrase?: string;
|
||||
cert?: string | Buffer
|
||||
ca?: (string | Buffer)[];
|
||||
cert?: string | string[] | Buffer | Buffer[];
|
||||
ca?: string | Buffer | (string | Buffer)[];
|
||||
rejectUnauthorized?: boolean;
|
||||
NPNProtocols?: (string | Buffer)[];
|
||||
servername?: string;
|
||||
path?: string;
|
||||
ALPNProtocols?: (string | Buffer)[];
|
||||
checkServerIdentity?: (servername: string, cert: string | Buffer | (string | Buffer)[]) => any;
|
||||
secureProtocol?: string;
|
||||
secureContext?: Object;
|
||||
session?: Buffer;
|
||||
minDHSize?: number;
|
||||
}
|
||||
|
||||
export interface Server extends net.Server {
|
||||
@@ -2134,7 +2280,7 @@ declare module "tls" {
|
||||
}
|
||||
|
||||
export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) => void): Server;
|
||||
export function connect(options: TlsOptions, secureConnectionListener?: () => void): ClearTextStream;
|
||||
export function connect(options: ConnectionOptions, 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;
|
||||
@@ -2142,6 +2288,18 @@ declare module "tls" {
|
||||
}
|
||||
|
||||
declare module "crypto" {
|
||||
export interface Certificate {
|
||||
exportChallenge(spkac: string | Buffer): Buffer;
|
||||
exportPublicKey(spkac: string | Buffer): Buffer;
|
||||
verifySpkac(spkac: Buffer): boolean;
|
||||
}
|
||||
export var Certificate: {
|
||||
new (): Certificate;
|
||||
(): Certificate;
|
||||
}
|
||||
|
||||
export var fips: boolean;
|
||||
|
||||
export interface CredentialDetails {
|
||||
pfx: string;
|
||||
key: string;
|
||||
@@ -2154,72 +2312,93 @@ declare module "crypto" {
|
||||
export interface Credentials { context?: any; }
|
||||
export function createCredentials(details: CredentialDetails): Credentials;
|
||||
export function createHash(algorithm: string): Hash;
|
||||
export function createHmac(algorithm: string, key: string): Hmac;
|
||||
export function createHmac(algorithm: string, key: Buffer): Hmac;
|
||||
export interface Hash {
|
||||
update(data: any, input_encoding?: string): Hash;
|
||||
digest(encoding: 'buffer'): Buffer;
|
||||
digest(encoding: string): any;
|
||||
export function createHmac(algorithm: string, key: string | Buffer): Hmac;
|
||||
|
||||
type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1";
|
||||
type HexBase64Latin1Encoding = "latin1" | "hex" | "base64";
|
||||
type Utf8AsciiBinaryEncoding = "utf8" | "ascii" | "binary";
|
||||
type HexBase64BinaryEncoding = "binary" | "base64" | "hex";
|
||||
type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
|
||||
|
||||
export interface Hash extends NodeJS.ReadWriteStream {
|
||||
update(data: string | Buffer): Hash;
|
||||
update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Hash;
|
||||
digest(): Buffer;
|
||||
digest(encoding: HexBase64Latin1Encoding): string;
|
||||
}
|
||||
export interface Hmac extends NodeJS.ReadWriteStream {
|
||||
update(data: any, input_encoding?: string): Hmac;
|
||||
digest(encoding: 'buffer'): Buffer;
|
||||
digest(encoding: string): any;
|
||||
update(data: string | Buffer): Hmac;
|
||||
update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Hmac;
|
||||
digest(): Buffer;
|
||||
digest(encoding: HexBase64Latin1Encoding): string;
|
||||
}
|
||||
export function createCipher(algorithm: string, password: any): Cipher;
|
||||
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: Utf8AsciiBinaryEncoding): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: HexBase64BinaryEncoding): string;
|
||||
update(data: string, input_encoding: Utf8AsciiBinaryEncoding, output_encoding: HexBase64BinaryEncoding): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
setAutoPadding(auto_padding?: boolean): void;
|
||||
getAuthTag(): Buffer;
|
||||
setAAD(buffer: Buffer): void;
|
||||
}
|
||||
export function createDecipher(algorithm: string, password: any): Decipher;
|
||||
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: HexBase64BinaryEncoding): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: Utf8AsciiBinaryEncoding): string;
|
||||
update(data: string, input_encoding: HexBase64BinaryEncoding, output_encoding: Utf8AsciiBinaryEncoding): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
setAutoPadding(auto_padding?: boolean): void;
|
||||
setAuthTag(tag: Buffer): void;
|
||||
setAAD(buffer: Buffer): void;
|
||||
}
|
||||
export function createSign(algorithm: string): Signer;
|
||||
export interface Signer extends NodeJS.WritableStream {
|
||||
update(data: any): void;
|
||||
sign(private_key: string): Buffer;
|
||||
sign(private_key: string, output_format: 'latin1' | 'hex' | 'base64'): string;
|
||||
update(data: string | Buffer): Signer;
|
||||
update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Signer;
|
||||
sign(private_key: string | { key: string; passphrase: string }): Buffer;
|
||||
sign(private_key: string | { key: string; passphrase: string }, output_format: HexBase64Latin1Encoding): string;
|
||||
}
|
||||
export function createVerify(algorith: string): Verify;
|
||||
export interface Verify extends NodeJS.WritableStream {
|
||||
update(data: any): void;
|
||||
update(data: string | Buffer): Verify;
|
||||
update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Verify;
|
||||
verify(object: string, signature: Buffer): boolean;
|
||||
verify(object: string, signature: string, signature_format: 'latin1' | 'hex' | 'base64'): boolean;
|
||||
verify(object: string, signature: string, signature_format: HexBase64Latin1Encoding): boolean;
|
||||
}
|
||||
export function createDiffieHellman(prime_length: number): DiffieHellman;
|
||||
export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
|
||||
export function createDiffieHellman(prime_length: number, generator?: number): DiffieHellman;
|
||||
export function createDiffieHellman(prime: Buffer): DiffieHellman;
|
||||
export function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman;
|
||||
export function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | Buffer): DiffieHellman;
|
||||
export function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman;
|
||||
export interface DiffieHellman {
|
||||
generateKeys(encoding?: string): string;
|
||||
computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string;
|
||||
getPrime(encoding?: string): string;
|
||||
getGenerator(encoding: string): string;
|
||||
getPublicKey(encoding?: string): string;
|
||||
getPrivateKey(encoding?: string): string;
|
||||
setPublicKey(public_key: string, encoding?: string): void;
|
||||
setPrivateKey(public_key: string, encoding?: string): void;
|
||||
generateKeys(): Buffer;
|
||||
generateKeys(encoding: HexBase64Latin1Encoding): string;
|
||||
computeSecret(other_public_key: Buffer): Buffer;
|
||||
computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
|
||||
computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
|
||||
getPrime(): Buffer;
|
||||
getPrime(encoding: HexBase64Latin1Encoding): string;
|
||||
getGenerator(): Buffer;
|
||||
getGenerator(encoding: HexBase64Latin1Encoding): string;
|
||||
getPublicKey(): Buffer;
|
||||
getPublicKey(encoding: HexBase64Latin1Encoding): string;
|
||||
getPrivateKey(): Buffer;
|
||||
getPrivateKey(encoding: HexBase64Latin1Encoding): string;
|
||||
setPublicKey(public_key: Buffer): void;
|
||||
setPublicKey(public_key: string, encoding: string): void;
|
||||
setPrivateKey(private_key: Buffer): void;
|
||||
setPrivateKey(private_key: string, encoding: string): void;
|
||||
verifyError: number;
|
||||
}
|
||||
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 randomBytes(size: number): Buffer;
|
||||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
@@ -2227,25 +2406,34 @@ declare module "crypto" {
|
||||
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export interface RsaPublicKey {
|
||||
key: string;
|
||||
padding?: any;
|
||||
padding?: number;
|
||||
}
|
||||
export interface RsaPrivateKey {
|
||||
key: string;
|
||||
passphrase?: string,
|
||||
padding?: any;
|
||||
padding?: number;
|
||||
}
|
||||
export function publicEncrypt(public_key: string | RsaPublicKey, buffer: Buffer): Buffer
|
||||
export function privateDecrypt(private_key: string | RsaPrivateKey, buffer: Buffer): Buffer
|
||||
export function privateEncrypt(private_key: string | RsaPrivateKey, buffer: Buffer): Buffer
|
||||
export function publicDecrypt(public_key: string | RsaPublicKey, buffer: Buffer): Buffer
|
||||
export function getCiphers(): string[];
|
||||
export function getCurves(): string[];
|
||||
export function getHashes(): string[];
|
||||
export interface ECDH {
|
||||
computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string | Buffer;
|
||||
generateKeys(encoding?: string, format?: string): string | Buffer;
|
||||
getPrivateKey(encoding?: string): string | Buffer;
|
||||
getPublicKey(encodind?: string): string | Buffer;
|
||||
setPrivateKey(private_key: string | Buffer, encoding?: string): void;
|
||||
setPublicKey(publick_key: string | Buffer, encoding?: string): void;
|
||||
generateKeys(): Buffer;
|
||||
generateKeys(encoding: HexBase64Latin1Encoding): string;
|
||||
generateKeys(encoding: HexBase64Latin1Encoding, format: ECDHKeyFormat): string;
|
||||
computeSecret(other_public_key: Buffer): Buffer;
|
||||
computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
|
||||
computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
|
||||
getPrivateKey(): Buffer;
|
||||
getPrivateKey(encoding: HexBase64Latin1Encoding): string;
|
||||
getPublicKey(): Buffer;
|
||||
getPublicKey(encoding: HexBase64Latin1Encoding): string;
|
||||
getPublicKey(encoding: HexBase64Latin1Encoding, format: ECDHKeyFormat): string;
|
||||
setPrivateKey(private_key: Buffer): void;
|
||||
setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void;
|
||||
}
|
||||
export function createECDH(curve_name: string): ECDH;
|
||||
}
|
||||
@@ -2253,102 +2441,108 @@ declare module "crypto" {
|
||||
declare module "stream" {
|
||||
import * as events from "events";
|
||||
|
||||
export class Stream extends events.EventEmitter {
|
||||
class internal extends events.EventEmitter {
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
}
|
||||
namespace internal {
|
||||
|
||||
export interface ReadableOptions {
|
||||
highWaterMark?: number;
|
||||
encoding?: string;
|
||||
objectMode?: boolean;
|
||||
read?: (size?: number) => any;
|
||||
export class Stream extends internal {}
|
||||
|
||||
export interface ReadableOptions {
|
||||
highWaterMark?: number;
|
||||
encoding?: string;
|
||||
objectMode?: boolean;
|
||||
read?: (size?: number) => any;
|
||||
}
|
||||
|
||||
export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
|
||||
readable: boolean;
|
||||
constructor(opts?: ReadableOptions);
|
||||
_read(size: number): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): Readable;
|
||||
resume(): Readable;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: any): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
}
|
||||
|
||||
export interface WritableOptions {
|
||||
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 {
|
||||
writable: boolean;
|
||||
constructor(opts?: WritableOptions);
|
||||
_write(chunk: any, encoding: string, callback: Function): void;
|
||||
write(chunk: any, cb?: Function): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(chunk: any, cb?: Function): void;
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
||||
allowHalfOpen?: boolean;
|
||||
readableObjectMode?: boolean;
|
||||
writableObjectMode?: boolean;
|
||||
}
|
||||
|
||||
// Note: Duplex extends both Readable and Writable.
|
||||
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
||||
// Readable
|
||||
pause(): Duplex;
|
||||
resume(): Duplex;
|
||||
// Writeable
|
||||
writable: boolean;
|
||||
constructor(opts?: DuplexOptions);
|
||||
_write(chunk: any, encoding: string, callback: Function): void;
|
||||
write(chunk: any, cb?: Function): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(chunk: any, cb?: Function): void;
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
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 {
|
||||
readable: boolean;
|
||||
writable: boolean;
|
||||
constructor(opts?: TransformOptions);
|
||||
_transform(chunk: any, encoding: string, callback: Function): void;
|
||||
_flush(callback: Function): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): Transform;
|
||||
resume(): Transform;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: any): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
write(chunk: any, cb?: Function): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(chunk: any, cb?: Function): void;
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export class PassThrough extends Transform { }
|
||||
}
|
||||
|
||||
export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
|
||||
readable: boolean;
|
||||
constructor(opts?: ReadableOptions);
|
||||
_read(size: number): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): Readable;
|
||||
resume(): Readable;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: any): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
}
|
||||
|
||||
export interface WritableOptions {
|
||||
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 {
|
||||
writable: boolean;
|
||||
constructor(opts?: WritableOptions);
|
||||
_write(chunk: any, encoding: string, callback: Function): void;
|
||||
write(chunk: any, cb?: Function): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(chunk: any, cb?: Function): void;
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
||||
allowHalfOpen?: boolean;
|
||||
readableObjectMode?: boolean;
|
||||
writableObjectMode?: boolean;
|
||||
}
|
||||
|
||||
// Note: Duplex extends both Readable and Writable.
|
||||
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
||||
// Readable
|
||||
pause(): Duplex;
|
||||
resume(): Duplex;
|
||||
// Writeable
|
||||
writable: boolean;
|
||||
constructor(opts?: DuplexOptions);
|
||||
_write(chunk: any, encoding: string, callback: Function): void;
|
||||
write(chunk: any, cb?: Function): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(chunk: any, cb?: Function): void;
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
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 {
|
||||
readable: boolean;
|
||||
writable: boolean;
|
||||
constructor(opts?: TransformOptions);
|
||||
_transform(chunk: any, encoding: string, callback: Function): void;
|
||||
_flush(callback: Function): void;
|
||||
read(size?: number): any;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): Transform;
|
||||
resume(): Transform;
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||
unshift(chunk: any): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||
push(chunk: any, encoding?: string): boolean;
|
||||
write(chunk: any, cb?: Function): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(chunk: any, cb?: Function): void;
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export class PassThrough extends Transform { }
|
||||
export = internal;
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
@@ -2740,12 +2934,27 @@ declare module "constants" {
|
||||
export var SIGUNUSED: number;
|
||||
export var defaultCoreCipherList: string;
|
||||
export var defaultCipherList: string;
|
||||
export var ENGINE_METHOD_RSA: number;
|
||||
export var ALPN_ENABLED: number;
|
||||
}
|
||||
|
||||
declare module "process" {
|
||||
export = process;
|
||||
}
|
||||
|
||||
declare module "v8" {
|
||||
interface HeapSpaceInfo {
|
||||
space_name: string;
|
||||
space_size: number;
|
||||
space_used_size: number;
|
||||
space_available_size: number;
|
||||
physical_space_size: number;
|
||||
}
|
||||
export function getHeapStatistics() : {total_heap_size: number, total_heap_size_executable: number, total_physical_size: number, total_avaialble_size: number, used_heap_size: number, heap_size_limit: number};
|
||||
export function getHeapSpaceStatistics(): HeapSpaceInfo[];
|
||||
export function setFlagsFromString(flags: string): void;
|
||||
}
|
||||
|
||||
declare module "timers" {
|
||||
export function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
|
||||
export function clearTimeout(timeoutId: NodeJS.Timer): void;
|
||||
@@ -2757,4 +2966,4 @@ declare module "timers" {
|
||||
|
||||
declare module "console" {
|
||||
export = console;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+630
-46
@@ -1,4 +1,4 @@
|
||||
// Type definitions for OpenLayers v3.6.0
|
||||
// Type definitions for OpenLayers v3.18.2
|
||||
// Project: http://openlayers.org/
|
||||
// Definitions by: Wouter Goedhart <https://github.com/woutergd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -48,6 +48,27 @@ declare namespace olx {
|
||||
extent: ol.Extent;
|
||||
}
|
||||
|
||||
interface OverviewMapOptions {
|
||||
/*** Whether the control should start collapsed or not (expanded). Default to true.*/
|
||||
collapsed?: boolean;
|
||||
/*** Text label to use for the expanded overviewmap button. Default is «. Instead of text, also a Node (e.g. a span element) can be used.*/
|
||||
collapseLabel? :string | Node;
|
||||
/*** Whether the control can be collapsed or not. Default to true.*/
|
||||
collapsible?: boolean;
|
||||
/*** Text label to use for the collapsed overviewmap button. Default is ». Instead of text, also a Node (e.g. a span element) can be used.*/
|
||||
label?: string | Node;
|
||||
/*** Layers for the overview map. If not set, then all main map layers are used instead.*/
|
||||
layers?: ol.layer.Layer[] | ol.Collection<ol.layer.Layer>;
|
||||
/*** Function called when the control should be re-rendered. This is called in a requestAnimationFrame callback.*/
|
||||
render?: Function;
|
||||
/*** Specify a target if you want the control to be rendered outside of the map's viewport.*/
|
||||
target?: Element;
|
||||
/*** Text label to use for the button tip. Default is Overview map*/
|
||||
tipLabel?: string;
|
||||
/*** Custom view for the overview map. If not provided, a default view with an EPSG:3857 projection will be used.*/
|
||||
view?: ol.View;
|
||||
}
|
||||
|
||||
interface RotateOptions {
|
||||
/*** CSS class name. Default is ol-rotate.*/
|
||||
className?: string;
|
||||
@@ -230,6 +251,30 @@ declare namespace olx {
|
||||
/** experimental Whether to wrap the world horizontally. When set to false, only one world will be rendered. When true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds. The default is true. */
|
||||
wrapX?: boolean;
|
||||
}
|
||||
interface OSMOptions {
|
||||
/** Attributions */
|
||||
attributions?: ol.AttributionLike;
|
||||
/** Cache size. Default is 2048. */
|
||||
cacheSize?: number;
|
||||
/**
|
||||
* The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL
|
||||
* renderer or if you want to access pixel data with the Canvas renderer.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. Default is anonymous.
|
||||
*/
|
||||
crossOrigin?: string;
|
||||
/** Max zoom. Default is 19. */
|
||||
maxZoom?: number;
|
||||
/** Whether the layer is opaque. Default is true. */
|
||||
opaque?: boolean;
|
||||
/** Maximum allowed reprojection error (in pixels). Default is 0.5. Higher values can increase reprojection performance, but decrease precision. */
|
||||
reprojectionErrorThreshold?: number;
|
||||
/** Optional function to load a tile given a URL. */
|
||||
tileLoadFunction?: ol.TileLoadFunctionType;
|
||||
/** URL template. Must include {x}, {y} or {-y}, and {z} placeholders. Default is https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png. */
|
||||
url?: string;
|
||||
/** Whether to wrap the world horizontally. Default is true. */
|
||||
wrapX?: boolean;
|
||||
}
|
||||
/**
|
||||
* Object literal with config options for the map logo.
|
||||
*/
|
||||
@@ -581,46 +626,365 @@ declare namespace olx {
|
||||
|
||||
namespace interaction {
|
||||
interface DefaultsOptions {
|
||||
/*** Whether Alt-Shift-drag rotate is desired. Default is true.*/
|
||||
altShiftDragRotate?: boolean;
|
||||
/*** Whether double click zoom is desired. Default is true.*/
|
||||
doubleClickZoom?: boolean;
|
||||
/*** Whether keyboard interaction is desired. Default is true.*/
|
||||
keyboard?: boolean;
|
||||
/*** Whether mousewheel zoom is desired. Default is true.*/
|
||||
mouseWheelZoom?: boolean;
|
||||
/*** Whether Shift-drag zoom is desired. Default is true.*/
|
||||
shiftDragZoom?: boolean;
|
||||
/*** Whether drag pan is desired. Default is true.*/
|
||||
dragPan?: boolean;
|
||||
/*** Whether pinch rotate is desired. Default is true.*/
|
||||
pinchRotate?: boolean;
|
||||
/*** Whether pinch zoom is desired. Default is true.*/
|
||||
pinchZoom?: boolean;
|
||||
/*** Zoom delta*/
|
||||
zoomDelta?: number;
|
||||
/*** Zoom duration*/
|
||||
zoomDuration?: number;
|
||||
}
|
||||
interface InteractionOptions {
|
||||
/**
|
||||
* Method called by the map to notify the interaction that a browser event was dispatched to the map.
|
||||
* The function may return false to prevent the propagation of the event to other interactions in
|
||||
* the map's interactions chain. Required.
|
||||
*/
|
||||
handleEvent: Function;
|
||||
}
|
||||
interface ModifyOptions {
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event will
|
||||
* be considered to add or move a vertex to the sketch. Default is ol.events.condition.primaryAction.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should
|
||||
* be handled. By default, ol.events.condition.singleClick with ol.events.condition.noModifierKeys results
|
||||
* in a vertex deletion.
|
||||
*/
|
||||
deleteCondition?: ol.events.ConditionType;
|
||||
/*** Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is 10.*/
|
||||
pixelTolerance?: number;
|
||||
/*** Style used for the features being modified. By default the default edit style is used (see ol.style).*/
|
||||
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
|
||||
/*** The features the interaction works on. Required.*/
|
||||
features: ol.Collection<ol.Feature>;
|
||||
/*** Wrap the world horizontally on the sketch overlay. Default is false.*/
|
||||
wrapX?: boolean;
|
||||
}
|
||||
interface DragBoxOptions {
|
||||
/*** CSS class name for styling the box. The default is ol-dragbox.*/
|
||||
className?: string;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* Default is ol.events.condition.always.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/*** A function that takes a ol.MapBrowserEvent and two ol.Pixels to indicate whether a boxend event should be fired.*/
|
||||
boxEndCondition?: ol.interaction.DragBoxEndConditionType;
|
||||
}
|
||||
interface DrawOptions {
|
||||
/**
|
||||
* The maximum distance in pixels between "down" and "up" for a "up" event to be considered a "click" event and actually
|
||||
* add a point/vertex to the geometry being drawn. Default is 6 pixels. That value was chosen for the draw interaction
|
||||
* to behave correctly on mouse as well as on touch devices.
|
||||
*/
|
||||
clickTolerance?: number;
|
||||
/**
|
||||
* Destination collection for the drawn features.
|
||||
*/
|
||||
features?: ol.Collection<ol.Feature>;
|
||||
/**
|
||||
* Destination source for the drawn features.
|
||||
*/
|
||||
source?: ol.source.Vector;
|
||||
/**
|
||||
* Pixel distance for snapping to the drawing finish. Default is 12.
|
||||
*/
|
||||
snapTolerance?: number;
|
||||
/**
|
||||
* Drawing type ('Point', 'LineString', 'Polygon', 'MultiPoint', 'MultiLineString', 'MultiPolygon' or 'Circle'). Required.
|
||||
*/
|
||||
type: ol.geom.GeometryType;
|
||||
/**
|
||||
* The number of points that can be drawn before a polygon ring or line string is finished. The default is no restriction.
|
||||
*/
|
||||
maxPoints?: number;
|
||||
/**
|
||||
* The number of points that must be drawn before a polygon ring or line string can be finished. Default is 3 for polygon
|
||||
* rings and 2 for line strings.
|
||||
*/
|
||||
minPoints?: number;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether the drawing can be finished.
|
||||
*/
|
||||
finishCondition?: ol.events.ConditionType;
|
||||
/**
|
||||
* Style for sketch features.
|
||||
*/
|
||||
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
|
||||
/**
|
||||
* Function that is called when a geometry's coordinates are updated.
|
||||
*/
|
||||
geometryFunction?: ol.interaction.DrawGeometryFunctionType;
|
||||
/**
|
||||
* Geometry name to use for features created by the draw interaction.
|
||||
*/
|
||||
geometryName?: string;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* By default ol.events.condition.noModifierKeys, i.e. a click, adds a vertex or deactivates freehand drawing.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* Condition that activates freehand drawing for lines and polygons. This function takes an ol.MapBrowserEvent and returns
|
||||
* a boolean to indicate whether that event should be handled. The default is ol.events.condition.shiftKeyOnly, meaning that
|
||||
* the Shift key activates freehand drawing.
|
||||
*/
|
||||
freehandCondition?: ol.events.ConditionType;
|
||||
/**
|
||||
* Wrap the world horizontally on the sketch overlay. Default is false.
|
||||
*/
|
||||
wrapX?: boolean;
|
||||
}
|
||||
interface SelectOptions {
|
||||
addCondition?: ol.events.ConditionType;
|
||||
interface DoubleClickZoomOptions {
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 250.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* The zoom delta applied on each double click, default is 1.
|
||||
*/
|
||||
delta?: number;
|
||||
}
|
||||
interface DragAndDropOptions {
|
||||
/**
|
||||
* Format constructors.
|
||||
*/
|
||||
formatConstructors?: Array<ol.format.Feature>;
|
||||
/**
|
||||
* Target projection. By default, the map's view's projection is used.
|
||||
*/
|
||||
projection: ol.proj.ProjectionLike;
|
||||
/**
|
||||
* The element that is used as the drop target, default is the viewport element.
|
||||
*/
|
||||
target?: Element;
|
||||
}
|
||||
interface DragPanOptions {
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* Default is ol.events.condition.noModifierKeys.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
layers?: Array<ol.layer.Layer> | ((layer: ol.layer.Layer) => boolean);
|
||||
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
|
||||
removeCondition?: ol.events.ConditionType;
|
||||
toggleCondition?: ol.events.ConditionType;
|
||||
multi?: boolean;
|
||||
/**
|
||||
* Kinetic inertia to apply to the pan.
|
||||
*/
|
||||
kinetic?: ol.Kinetic;
|
||||
}
|
||||
interface DragRotateOptions {
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* Default is ol.events.condition.altShiftKeysOnly.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 250.
|
||||
*/
|
||||
duration?: number;
|
||||
}
|
||||
interface DragRotateAndZoomOptions {
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* Default is ol.events.condition.shiftKeyOnly.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 400.
|
||||
*/
|
||||
duration?: number;
|
||||
}
|
||||
interface DragZoomOptions {
|
||||
/**
|
||||
* CSS class name for styling the box. The default is ol-dragzoom.
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* Default is ol.events.condition.shiftKeyOnly.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 200.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* Use interaction for zooming out. Default is false.
|
||||
*/
|
||||
out?: boolean;
|
||||
}
|
||||
interface KeyboardPanOptions {
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* Default is ol.events.condition.noModifierKeys and ol.events.condition.targetNotEditable.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 100.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* Pixel The amount to pan on each key press. Default is 128 pixels.
|
||||
*/
|
||||
pixelDelta?: number;
|
||||
}
|
||||
interface KeyboardZoomOptions {
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 100.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* Default is ol.events.condition.targetNotEditable.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* The amount to zoom on each key press. Default is 1.
|
||||
*/
|
||||
delta?: number;
|
||||
}
|
||||
interface MouseWheelZoomOptions {
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 250.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* Enable zooming using the mouse's location as the anchor. Default is true.
|
||||
* When set to false, zooming in and out will zoom to the center of the screen instead of zooming on the mouse's location.
|
||||
*/
|
||||
useAnchor?: boolean;
|
||||
}
|
||||
interface PinchRotateOptions {
|
||||
/**
|
||||
* The duration of the animation in milliseconds. Default is 250.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* Minimal angle in radians to start a rotation. Default is 0.3.
|
||||
*/
|
||||
threshold?: number;
|
||||
}
|
||||
interface PinchZoomOptions {
|
||||
/**
|
||||
* Animation duration in milliseconds. Default is 400.
|
||||
*/
|
||||
duration?: number;
|
||||
}
|
||||
interface PointerOptions {
|
||||
/**
|
||||
* Function handling "down" events. If the function returns true then a drag sequence is started.
|
||||
*/
|
||||
handleDownEvent?: Function;
|
||||
/**
|
||||
* Function handling "drag" events. This function is called on "move" events during a drag sequence.
|
||||
*/
|
||||
handleDragEvent?: Function;
|
||||
/**
|
||||
* Method called by the map to notify the interaction that a browser event was dispatched to the map.
|
||||
* The function may return false to prevent the propagation of the event to other interactions in the map's interactions chain.
|
||||
*/
|
||||
handleEvent?: Function;
|
||||
/**
|
||||
* Function handling "move" events. This function is called on "move" events, also during a drag sequence
|
||||
* (so during a drag sequence both the handleDragEvent function and this function are called).
|
||||
*/
|
||||
handleMoveEvent?: Function;
|
||||
/**
|
||||
* Function handling "up" events. If the function returns false then the current drag sequence is stopped.
|
||||
*/
|
||||
handleUpEvent?: Function;
|
||||
}
|
||||
interface SnapOptions {
|
||||
/**
|
||||
* Snap to these features. Either this option or source should be provided.
|
||||
*/
|
||||
features?: ol.Collection<ol.Feature>;
|
||||
/**
|
||||
* Snap to edges. Default is true.
|
||||
*/
|
||||
edge?: boolean;
|
||||
/**
|
||||
* Snap to vertices. Default is true.
|
||||
*/
|
||||
vertex?: boolean;
|
||||
/**
|
||||
* Pixel tolerance for considering the pointer close enough to a segment or vertex for snapping. Default is 10 pixels.
|
||||
*/
|
||||
pixelTolerance?: number;
|
||||
/**
|
||||
* Snap to features from this source. Either this option or features should be provided.
|
||||
*/
|
||||
source?: ol.source.Vector;
|
||||
}
|
||||
interface SelectOptions {
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* By default, this is ol.events.condition.never.
|
||||
* Use this if you want to use different events for add and remove instead of toggle.
|
||||
*/
|
||||
addCondition?: ol.events.ConditionType;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* This is the event for the selected features as a whole. By default, this is ol.events.condition.singleClick.
|
||||
* Clicking on a feature selects that feature and removes any that were in the selection.
|
||||
* Clicking outside any feature removes all from the selection.
|
||||
* See toggle, add, remove options for adding/removing extra features to/ from the selection.
|
||||
*/
|
||||
condition?: ol.events.ConditionType;
|
||||
/**
|
||||
* A list of layers from which features should be selected. Alternatively, a filter function can be provided.
|
||||
* The function will be called for each layer in the map and should return true for layers that you want to be selectable.
|
||||
* If the option is absent, all visible layers will be considered selectable.
|
||||
*/
|
||||
layers?: Array<ol.layer.Layer> | ((layer: ol.layer.Layer) => boolean);
|
||||
/**
|
||||
* Style for the selected features. By default the default edit style is used (see ol.style).
|
||||
*/
|
||||
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* By default, this is ol.events.condition.never.
|
||||
* Use this if you want to use different events for add and remove instead of toggle.
|
||||
*/
|
||||
removeCondition?: ol.events.ConditionType;
|
||||
/**
|
||||
* A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled.
|
||||
* This is in addition to the condition event. By default, ol.events.condition.shiftKeyOnly,
|
||||
* i.e. pressing shift as well as the condition event, adds that feature to the current selection if it is not currently
|
||||
* selected, and removes it if it is. See add and remove if you want to use different events instead of a toggle.
|
||||
*/
|
||||
toggleCondition?: ol.events.ConditionType;
|
||||
/**
|
||||
* A boolean that determines if the default behaviour should select only single features or all (overlapping)
|
||||
* features at the clicked map position. Default is false i.e single select
|
||||
*/
|
||||
multi?: boolean;
|
||||
/**
|
||||
* Collection where the interaction will place selected features. Optional. If not set the interaction will create a collection.
|
||||
* In any case the collection used by the interaction is returned by ol.interaction.Select#getFeatures.
|
||||
*/
|
||||
features?: ol.Collection<ol.Feature>;
|
||||
/**
|
||||
* A function that takes an ol.Feature and an ol.layer.Layer and returns true if the feature may be selected or false otherwise.
|
||||
*/
|
||||
filter?: ol.interaction.SelectFilterFunction;
|
||||
/**
|
||||
* Wrap the world horizontally on the selection overlay. Default is true.
|
||||
*/
|
||||
wrapX?: boolean;
|
||||
}
|
||||
}
|
||||
@@ -1146,6 +1510,8 @@ declare namespace ol {
|
||||
|
||||
interface ImageLoadFunctionType { (image: ol.Image, url: string): void }
|
||||
|
||||
type AttributionLike = string | Array<string> | ol.Attribution | Array<ol.Attribution>
|
||||
|
||||
/**
|
||||
* An attribution for a layer source.
|
||||
*/
|
||||
@@ -2485,6 +2851,40 @@ declare namespace ol {
|
||||
}
|
||||
|
||||
class OverviewMap extends Control {
|
||||
constructor(options?: olx.OverviewMapOptions);
|
||||
|
||||
/**
|
||||
* Update the overview map element.
|
||||
* @param mapEvent
|
||||
*/
|
||||
render(mapEvent: ol.MapEvent): void;
|
||||
|
||||
/**
|
||||
* Determine if the overview map is collapsed.
|
||||
*/
|
||||
getCollapsed(): boolean;
|
||||
|
||||
/**
|
||||
* Return true if the overview map is collapsible, false otherwise.
|
||||
*/
|
||||
getCollapsible(): boolean;
|
||||
|
||||
/**
|
||||
* Return the overview map.
|
||||
*/
|
||||
getOverviewMap(): ol.Map;
|
||||
|
||||
/**
|
||||
* Collapse or expand the overview map according to the passed parameter. Will not do anything if the overview map isn't collapsible or if the current collapsed state is already the one requested.
|
||||
* @param collapsed
|
||||
*/
|
||||
setCollapsed(collapsed: boolean): void;
|
||||
|
||||
/**
|
||||
* Set whether the overview map should be collapsible.
|
||||
* @param collapsible
|
||||
*/
|
||||
setCollapsible(collapsible: boolean): void;
|
||||
}
|
||||
|
||||
class Rotate extends Control {
|
||||
@@ -3673,79 +4073,262 @@ declare namespace ol {
|
||||
}
|
||||
|
||||
namespace interaction {
|
||||
|
||||
class DoubleClickZoom {
|
||||
/**
|
||||
* Allows the user to zoom by double-clicking on the map.
|
||||
*/
|
||||
class DoubleClickZoom extends ol.interaction.Interaction {
|
||||
constructor(opt_options?: olx.interaction.DoubleClickZoomOptions);
|
||||
}
|
||||
|
||||
class DragAndDrop {
|
||||
/**
|
||||
* Handles input of vector data by drag and drop.
|
||||
*/
|
||||
class DragAndDrop extends ol.interaction.Interaction {
|
||||
constructor(opt_options?: olx.interaction.DragAndDropOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Events emitted by ol.interaction.DragAndDrop instances are instances of this type.
|
||||
*/
|
||||
class DragAndDropEvent extends ol.events.Event {
|
||||
}
|
||||
|
||||
class DragBox {
|
||||
/**
|
||||
* Allows the user to draw a vector box by clicking and dragging on the map,
|
||||
* normally combined with an ol.events.condition that limits it to when the shift or other key is held down.
|
||||
* This is used, for example, for zooming to a specific area of the map
|
||||
* (see ol.interaction.DragZoom and ol.interaction.DragRotateAndZoom).
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
*/
|
||||
class DragBox extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.DragBoxOptions);
|
||||
/**
|
||||
* Returns geometry of last drawn box.
|
||||
*/
|
||||
getGeometry(): ol.geom.Polygon;
|
||||
}
|
||||
|
||||
class DragPan {
|
||||
/**
|
||||
* Allows the user to pan the map by dragging the map.
|
||||
*/
|
||||
class DragPan extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.DragPanOptions);
|
||||
}
|
||||
|
||||
class DragRotate {
|
||||
/**
|
||||
* Allows the user to rotate the map by clicking and dragging on the map,
|
||||
* normally combined with an ol.events.condition that limits it to when the alt and shift keys are held down.
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
*/
|
||||
class DragRotate extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.DragRotateOptions);
|
||||
}
|
||||
|
||||
class DragRotateAndZoom {
|
||||
/**
|
||||
* Allows the user to zoom and rotate the map by clicking and dragging on the map.
|
||||
* By default, this interaction is limited to when the shift key is held down.
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
*
|
||||
* And this interaction is not included in the default interactions.
|
||||
*/
|
||||
class DragRotateAndZoom extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.DragRotateAndZoomOptions);
|
||||
}
|
||||
|
||||
class DragZoom {
|
||||
/**
|
||||
* Allows the user to zoom the map by clicking and dragging on the map,
|
||||
* normally combined with an ol.events.condition that limits it to when a key, shift by default, is held down.
|
||||
*
|
||||
* To change the style of the box, use CSS and the .ol-dragzoom selector, or your custom one configured with className.
|
||||
*/
|
||||
class DragZoom extends ol.interaction.DragBox {
|
||||
constructor(opt_options?: olx.interaction.DragZoomOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interaction for drawing feature geometries.
|
||||
*/
|
||||
class Draw extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.DrawOptions)
|
||||
constructor(opt_options?: olx.interaction.DrawOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Events emitted by ol.interaction.Draw instances are instances of this type.
|
||||
*/
|
||||
class DrawEvent extends ol.events.Event {
|
||||
/**
|
||||
* The feature being drawn.
|
||||
*/
|
||||
feature: ol.Feature;
|
||||
/**
|
||||
* The event target.
|
||||
*/
|
||||
target: ol.Object;
|
||||
/**
|
||||
* The event type.
|
||||
*/
|
||||
type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract base class; normally only used for creating subclasses and not instantiated in apps.
|
||||
* User actions that change the state of the map. Some are similar to controls, but are not associated with a DOM element.
|
||||
* For example, ol.interaction.KeyboardZoom is functionally the same as ol.control.Zoom, but triggered by a keyboard event
|
||||
* not a button element event. Although interactions do not have a DOM element,
|
||||
* some of them do render vectors and so are visible on the screen.
|
||||
*/
|
||||
class Interaction extends ol.Object {
|
||||
constructor (options: olx.interaction.InteractionOptions)
|
||||
/**
|
||||
* Return whether the interaction is currently active.
|
||||
*/
|
||||
getActive (): boolean;
|
||||
/**
|
||||
* Get the map associated with this interaction.
|
||||
*/
|
||||
getMap (): ol.Map;
|
||||
/**
|
||||
* Activate or deactivate the interaction.
|
||||
*/
|
||||
setActive (active: boolean): void;
|
||||
}
|
||||
|
||||
class KeyboardPan {
|
||||
/**
|
||||
* Allows the user to pan the map using keyboard arrows. Note that, although this interaction is by default included in maps,
|
||||
* the keys can only be used when browser focus is on the element to which the keyboard events are attached.
|
||||
* By default, this is the map div, though you can change this with the keyboardEventTarget in ol.Map.
|
||||
* document never loses focus but, for any other element, focus will have to be on, and returned to,
|
||||
* this element if the keys are to function. See also ol.interaction.KeyboardZoom.
|
||||
*/
|
||||
class KeyboardPan extends ol.interaction.Interaction {
|
||||
constructor(opt_options?: olx.interaction.KeyboardPanOptions);
|
||||
}
|
||||
|
||||
class KeyboardZoom {
|
||||
/**
|
||||
* Allows the user to zoom the map using keyboard + and -. Note that, although this interaction is by default included in maps,
|
||||
* the keys can only be used when browser focus is on the element to which the keyboard events are attached. By default,
|
||||
* this is the map div, though you can change this with the keyboardEventTarget in ol.Map. document never loses focus but,
|
||||
* for any other element, focus will have to be on, and returned to, this element if the keys are to function.
|
||||
* See also ol.interaction.KeyboardPan.
|
||||
*/
|
||||
class KeyboardZoom extends ol.interaction.Interaction {
|
||||
constructor(opt_options?: olx.interaction.KeyboardZoomOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interaction for modifying feature geometries.
|
||||
*/
|
||||
class Modify extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.ModifyOptions)
|
||||
constructor(opt_options?: olx.interaction.ModifyOptions);
|
||||
}
|
||||
|
||||
class MouseWheelZoom {
|
||||
/**
|
||||
* Allows the user to zoom the map by scrolling the mouse wheel.
|
||||
*/
|
||||
class MouseWheelZoom extends ol.interaction.Interaction {
|
||||
constructor(opt_options?: olx.interaction.MouseWheelZoomOptions);
|
||||
}
|
||||
|
||||
class PinchRotate {
|
||||
/**
|
||||
* Allows the user to rotate the map by twisting with two fingers on a touch screen.
|
||||
*/
|
||||
class PinchRotate extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.PinchRotateOptions);
|
||||
}
|
||||
|
||||
class PinchZoom {
|
||||
/**
|
||||
* Allows the user to zoom the map by pinching with two fingers on a touch screen.
|
||||
*/
|
||||
class PinchZoom extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.PinchZoomOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class that calls user-defined functions on down, move and up events. This class also manages "drag sequences".
|
||||
*
|
||||
* When the handleDownEvent user function returns true a drag sequence is started. During a drag sequence the handleDragEvent
|
||||
* user function is called on move events. The drag sequence ends when the handleUpEvent user function is called and returns false.
|
||||
*/
|
||||
class Pointer extends ol.interaction.Interaction {
|
||||
constructor(opt_options?: olx.interaction.PointerOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interaction for selecting vector features. By default, selected features are styled differently, so this interaction can be used
|
||||
* for visual highlighting, as well as selecting features for other actions, such as modification or output. There are three ways of
|
||||
* controlling which features are selected: using the browser event as defined by the condition and optionally the toggle,
|
||||
* add/remove, and multi options; a layers filter; and a further feature filter using the filter option.
|
||||
*
|
||||
* Selected features are added to an internal unmanaged layer.
|
||||
*/
|
||||
class Select extends ol.interaction.Interaction {
|
||||
constructor(opt_options?: olx.interaction.SelectOptions);
|
||||
/**
|
||||
* Returns the associated vectorlayer of the (last) selected feature.
|
||||
* Note that this will not work with any programmatic method like pushing features to collection.
|
||||
*/
|
||||
getLayer(): ol.layer.Layer;
|
||||
/**
|
||||
* Get the selected features.
|
||||
*/
|
||||
getFeatures(): ol.Collection<ol.Feature>;
|
||||
}
|
||||
|
||||
class Snap {
|
||||
/**
|
||||
* Events emitted by ol.interaction.Select instances are instances of this type.
|
||||
*/
|
||||
class SelectEvent extends ol.events.Event {
|
||||
/**
|
||||
* Deselectd features array.
|
||||
*/
|
||||
deselected: Array<ol.Feature>;
|
||||
/**
|
||||
* Associated ol.MapBrowserEvent.
|
||||
*/
|
||||
mapBrowserEvent: ol.MapBrowserEvent;
|
||||
/**
|
||||
* Selected features array.
|
||||
*/
|
||||
selected: Array<ol.Feature>;
|
||||
/**
|
||||
* The event target.
|
||||
*/
|
||||
target: ol.Object;
|
||||
/**
|
||||
* The event type.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Stop event propagation.
|
||||
*/
|
||||
preventDefault(): void;
|
||||
/**
|
||||
* Stop event propagation.
|
||||
*/
|
||||
stopPropagation(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles snapping of vector features while modifying or drawing them. The features can come from a ol.source.Vector or
|
||||
* ol.Collection Any interaction object that allows the user to interact with the features using the mouse can benefit
|
||||
* from the snapping, as long as it is added before.
|
||||
*
|
||||
*The snap interaction modifies map browser event coordinate and pixel properties to force the snap to occur
|
||||
* to any interaction that them.
|
||||
*/
|
||||
class Snap extends ol.interaction.Pointer {
|
||||
constructor(opt_options?: olx.interaction.SnapOptions);
|
||||
}
|
||||
/**
|
||||
* Set of interactions included in maps by default. Specific interactions can be excluded by setting the appropriate option
|
||||
* to false in the constructor options, but the order of the interactions is fixed. If you want to specify a different order for
|
||||
* interactions, you will need to create your own ol.interaction.Interaction instances and insert them into a ol.Collection in
|
||||
* the order you want before creating your ol.Map instance.
|
||||
*/
|
||||
function defaults(opts: olx.interaction.DefaultsOptions): ol.Collection<ol.interaction.Interaction>;
|
||||
interface DrawGeometryFunctionType { (coordinates: ol.Coordinate[], geom?: ol.geom.Geometry): ol.geom.Geometry; }
|
||||
/**
|
||||
* Function that takes coordinates and an optional existing geometry as arguments, and returns a geometry.
|
||||
* The optional existing geometry is the geometry that is returned when the function is called without a second argument.
|
||||
*/
|
||||
interface DrawGeometryFunctionType { (coordinates: ol.Coordinate, geom?: ol.geom.Geometry): ol.geom.Geometry; }
|
||||
/**
|
||||
* A function that takes an ol.Feature or ol.render.Feature and an ol.layer.Layer and returns true if the feature
|
||||
* may be selected or false otherwise.
|
||||
*/
|
||||
interface SelectFilterFunction { (feature: ol.Feature | ol.render.Feature, layer: ol.layer.Layer): boolean; }
|
||||
/**
|
||||
* A function that takes a ol.MapBrowserEvent and two ol.Pixels and returns a {boolean}.
|
||||
* If the condition is met, true should be returned.
|
||||
*/
|
||||
interface DragBoxEndConditionType {
|
||||
(evt: ol.MapBrowserEvent, startPixel: ol.Pixel, endPixel: ol.Pixel): boolean
|
||||
}
|
||||
}
|
||||
|
||||
namespace layer {
|
||||
|
||||
/**
|
||||
* Abstract base class; normally only used for creating subclasses and not instantiated in apps. Note that with ol.layer.Base and all its subclasses, any property set in the options is set as a ol.Object property on the layer object, so is observable, and has get/set accessors.
|
||||
*/
|
||||
@@ -4274,6 +4857,7 @@ declare namespace ol {
|
||||
}
|
||||
|
||||
class OSM extends XYZ {
|
||||
constructor(opt_options?: olx.OSMOptions);
|
||||
}
|
||||
|
||||
class Source extends ol.Object {
|
||||
|
||||
@@ -26,6 +26,12 @@ var instance = PINO({
|
||||
}
|
||||
})
|
||||
|
||||
var pretty = PINO.pretty()
|
||||
var instance2 = PINO({
|
||||
name: 'app',
|
||||
safe: true
|
||||
}, pretty)
|
||||
|
||||
|
||||
var logger = instance
|
||||
logger.child({ a: 'property' }).info('hello child!')
|
||||
|
||||
Vendored
+2
-2
@@ -41,8 +41,8 @@ declare module 'pino' {
|
||||
}
|
||||
|
||||
interface Pino {
|
||||
(optionsOrStream?: LoggerOptions | stream.Writable): Logger
|
||||
(options: LoggerOptions, stream: stream.Writable): Logger
|
||||
(optionsOrStream?: LoggerOptions | stream.Writable | stream.Readable): Logger
|
||||
(options: LoggerOptions, stream: stream.Writable | stream.Readable): Logger
|
||||
levels: {
|
||||
values: LevelLabelsToValues
|
||||
labels: LevelValuesToLabels
|
||||
|
||||
+63
-50
@@ -1,10 +1,6 @@
|
||||
/// <reference path="quill.d.ts" />
|
||||
/// <reference path="../requirejs/require.d.ts"/>
|
||||
|
||||
//export var Quill = require("quill");
|
||||
|
||||
function test_quill() {
|
||||
|
||||
var quillEditor = new Quill('#editor', {
|
||||
modules:
|
||||
{
|
||||
@@ -14,6 +10,31 @@ function test_quill() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_deleteText() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.deleteText(0, 10);
|
||||
}
|
||||
|
||||
function test_disable() {
|
||||
let quillEditor = new Quill('#Editor');
|
||||
quillEditor.disable();
|
||||
}
|
||||
|
||||
function test_enable() {
|
||||
let quillEditor = new Quill('#Editor');
|
||||
quillEditor.enable();
|
||||
}
|
||||
|
||||
function test_getContents() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
var delta: QuillJS.DeltaStatic = quillEditor.getContents();
|
||||
}
|
||||
|
||||
function test_getLength() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
var num: number = quillEditor.getLength();
|
||||
}
|
||||
|
||||
function test_getText() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
var strValue: string = quillEditor.getText();
|
||||
@@ -29,26 +50,11 @@ function test_getText_substring() {
|
||||
var strValue: string = quillEditor.getText(0, 10);
|
||||
}
|
||||
|
||||
function test_getLength() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
var num: number = quillEditor.getLength();
|
||||
}
|
||||
|
||||
function test_getContents() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
var delta: DeltaStatic = quillEditor.getContents();
|
||||
}
|
||||
|
||||
function test_insertText() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.insertText(0, "Hello World");
|
||||
}
|
||||
|
||||
function test_deleteText() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.deleteText(0, 10);
|
||||
}
|
||||
|
||||
function test_formatText() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.formatText(0, 5, 'bold', true);
|
||||
@@ -63,15 +69,28 @@ function test_formatText2() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_formatLine() {
|
||||
function test_formatLine1() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.formatLine(1, 3, 'api');
|
||||
}
|
||||
|
||||
function test_formatLine2() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.formatLine(1, 3, 'align', 'right');
|
||||
}
|
||||
|
||||
function test_formatLine3() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.formatLine(1, 3, {
|
||||
'align': 'right',
|
||||
'bold': false,
|
||||
});
|
||||
}
|
||||
|
||||
function test_insertEmbed() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
|
||||
quillEditor.insertEmbed(10, 'image', 'http://quilljs.com/images/cloud.png');
|
||||
quillEditor.insertEmbed(10, 'image', 'http://com/images/cloud.png');
|
||||
}
|
||||
|
||||
function test_updateContents() {
|
||||
@@ -96,12 +115,6 @@ function test_setContents() {
|
||||
]);
|
||||
}
|
||||
|
||||
function test_setHTML() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
|
||||
quillEditor.setHTML('<div>Hello</div>');
|
||||
}
|
||||
|
||||
function test_setText() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.setText('Hello\n');
|
||||
@@ -113,10 +126,10 @@ function test_getSelection() {
|
||||
|
||||
var range = quillEditor.getSelection();
|
||||
if (range) {
|
||||
if (range.start == range.end) {
|
||||
console.log('User cursor is at index', range.start);
|
||||
if (range.index == range.length) {
|
||||
console.log('User cursor is at index', range.index);
|
||||
} else {
|
||||
var text = quillEditor.getText(range.start, range.end);
|
||||
var text = quillEditor.getText(range.index, range.length);
|
||||
console.log('User has highlighted: ', text);
|
||||
}
|
||||
} else {
|
||||
@@ -129,11 +142,6 @@ function test_setSelection() {
|
||||
quillEditor.setSelection(0, 5);
|
||||
}
|
||||
|
||||
function test_prepareFormat() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.prepareFormat('bold', true);
|
||||
}
|
||||
|
||||
function test_focus() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.focus();
|
||||
@@ -144,14 +152,6 @@ function test_getBounds() {
|
||||
quillEditor.setText('Hello\nWorld\n');
|
||||
}
|
||||
|
||||
function test_addModule() {
|
||||
var quillEditor = new Quill('#editor');
|
||||
|
||||
var toolbar = quillEditor.addModule('toolbar', {
|
||||
container: '#toolbar-container'
|
||||
});
|
||||
}
|
||||
|
||||
function test_getModule()
|
||||
{
|
||||
var quillEditor = new Quill('#editor');
|
||||
@@ -159,15 +159,28 @@ function test_getModule()
|
||||
var toolbar = quillEditor.getModule('toolbar');
|
||||
}
|
||||
|
||||
|
||||
function test_addFormat()
|
||||
{
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.addFormat('strike', { tag: 'S', prepare: 'strikeThrough' });
|
||||
}
|
||||
|
||||
function test_addContainer()
|
||||
{
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.addContainer('ql-custom');
|
||||
}
|
||||
|
||||
function test_on_EventType1(){
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.on('text-change', (newDelta, oldDelta, source)=>{
|
||||
// happened
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function test_PasteHTML()
|
||||
{
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.pasteHTML('<h1>Quill Rocks</h1>');
|
||||
}
|
||||
|
||||
function test_PasteHTML2()
|
||||
{
|
||||
var quillEditor = new Quill('#editor');
|
||||
quillEditor.pasteHTML(5, '<h1>Quill Rocks</h1>');
|
||||
}
|
||||
|
||||
Vendored
+85
-108
@@ -1,118 +1,95 @@
|
||||
// Type definitions for Quill
|
||||
// Type definitions for Quill v1.0.3
|
||||
// Project: http://quilljs.com
|
||||
// Definitions by: Sumit <https://github.com/sumitkm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path="../eventemitter2/eventemitter2.d.ts" />
|
||||
declare namespace QuillJS {
|
||||
|
||||
declare interface DeltaStatic{
|
||||
ops? : Array<any>;
|
||||
retain?: any,
|
||||
delete?: any,
|
||||
insert?: any,
|
||||
attributes?: any
|
||||
export interface QuillOptionsStatic {
|
||||
debug?: string,
|
||||
modules?: { [key: string]: any },
|
||||
placeholder?: string,
|
||||
readOnly?: boolean,
|
||||
theme?: string
|
||||
}
|
||||
|
||||
export interface BoundsStatic {
|
||||
left: number,
|
||||
top: number,
|
||||
height: number,
|
||||
width: number
|
||||
}
|
||||
|
||||
export interface DeltaStatic {
|
||||
ops?: Array<any>;
|
||||
retain?: any,
|
||||
delete?: any,
|
||||
insert?: any,
|
||||
attributes?: any
|
||||
}
|
||||
|
||||
export interface RangeStatic {
|
||||
new (): RangeStatic;
|
||||
index: number;
|
||||
length: number;
|
||||
}
|
||||
|
||||
type sourceType = "api" | "user" | "silent";
|
||||
type formatsType = { [key: string]: any };
|
||||
|
||||
export interface QuillStatic {
|
||||
new (selector: string, options?: QuillOptionsStatic): QuillStatic;
|
||||
deleteText(start: number, end: number, source?: sourceType): void;
|
||||
disable(): void;
|
||||
enable(enabled?: boolean): void;
|
||||
getContents(start?: number, end?: number): DeltaStatic;
|
||||
getLength(): number;
|
||||
getText(start?: number, end?: number): string;
|
||||
insertEmbed(index: number, type: string, url: string, source?: sourceType): void;
|
||||
insertText(index: number, text: string, source?: sourceType): void;
|
||||
insertText(index: number, text: string, format: string, value: string, source?: sourceType): void;
|
||||
insertText(index: number, text: string, formats: formatsType, source?: sourceType): void;
|
||||
pasteHTML(index: number, html: string, source?:sourceType): string;
|
||||
pasteHTML(html:string, source?: sourceType): string;
|
||||
setContents(delta: DeltaStatic, source?: sourceType): void;
|
||||
setText(text: string, source?: sourceType): void;
|
||||
update(source?: string): void;
|
||||
updateContents(delta: DeltaStatic, source?: sourceType): void;
|
||||
|
||||
format(name: string, value: any, source?: sourceType): void;
|
||||
formatLine(index: number, length: number, source?: sourceType): void;
|
||||
formatLine(index: number, length: number, format: string, value: any, source?: sourceType): void;
|
||||
formatLine(index: number, length: number, formats: formatsType, source?: sourceType): void;
|
||||
formatText(index: number, length: number, source?: sourceType): void;
|
||||
formatText(index: number, length: number, format: string, value: any, source?: sourceType): void;
|
||||
formatText(index: number, length: number, formats: formatsType, source?: sourceType): void;
|
||||
getFormat(range?: RangeStatic): formatsType;
|
||||
getFormat(index: number, length?: number): formatsType;
|
||||
removeFormat(index: Number, length: Number, source?: sourceType): void;
|
||||
|
||||
blur(): void;
|
||||
focus(): void;
|
||||
getBounds(index: number, length?: number): BoundsStatic;
|
||||
getSelection(focus?: boolean): RangeStatic;
|
||||
hasFocus(): boolean;
|
||||
setSelection(index: number, length: number, source?: sourceType): void;
|
||||
setSelection(range: RangeStatic, source?: sourceType): void;
|
||||
|
||||
on(eventName: string, callback: (<T>(delta: T, oldContents: T, source: string) => void) |
|
||||
((name: string, ...args: any[]) => void)): QuillStatic;
|
||||
once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic;
|
||||
off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic;
|
||||
|
||||
debug(level: string): void;
|
||||
import(path: string): any;
|
||||
register(path: string, def: any, suppressWarning?: boolean): void;
|
||||
register(defs: formatsType, suppressWarning?: boolean): void;
|
||||
addContainer(className: string, refNode?: any): any;
|
||||
getModule(name: string): any
|
||||
}
|
||||
}
|
||||
|
||||
declare interface RangeStatic{
|
||||
new(): RangeStatic;
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
declare interface QuillStatic {
|
||||
new(selector: string, options?: Object):QuillStatic;
|
||||
|
||||
on(eventName: string, callback: (delta: DeltaStatic, source: string) => void): EventEmitter2;
|
||||
addModule(id: string, options: any) : Object;
|
||||
|
||||
getText(): string;
|
||||
getText(start: number): string;
|
||||
getText(start: number, end: number): string;
|
||||
|
||||
getLength(): number;
|
||||
|
||||
getContents(): DeltaStatic;
|
||||
getContents(start: number): DeltaStatic;
|
||||
getContents(start: number, end: number): DeltaStatic;
|
||||
|
||||
getHTML(): string;
|
||||
|
||||
insertText(index: number, text: string): void;
|
||||
insertText(index: number, text: string, name: string, value: string): void;
|
||||
insertText(index: number, text: string, formats: any): void;
|
||||
insertText(index: number, text: string, source: string) : void;
|
||||
insertText(index: number, text: string, name: string, value: string, source: string): void;
|
||||
insertText(index: number, text: string, formats: any, source: string): void;
|
||||
|
||||
deleteText(start: number, end: number): void;
|
||||
deleteText(start: number, end: number, source: string): void;
|
||||
|
||||
formatText(start: number, end: number): void;
|
||||
formatText(start: number, end: number, name: string, value: boolean): void;
|
||||
formatText(start: number, end: number, formats: any): void;
|
||||
formatText(start: number, end: number, source: string): void;
|
||||
formatText(start: number, end: number, name: string, value: string, source: string): void;
|
||||
formatText(start: number, end: number, formats: string, source: string): void;
|
||||
|
||||
|
||||
formatLine(start: number, end: number): void;
|
||||
formatLine(start: number, end: number, name: string, value: boolean): void;
|
||||
formatLine(start: number, end: number, formats: any): void;
|
||||
formatLine(start: number, end: number, source: string): void;
|
||||
formatLine(start: number, end: number, name: string, value: string, source: string): void;
|
||||
formatLine(start: number, end: number, formats: any, source: string): void;
|
||||
|
||||
|
||||
insertEmbed(index: number, type: string, url: string): void;
|
||||
insertEmbed(index: number, type: string, url: string, source: string): void;
|
||||
|
||||
updateContents(delta: DeltaStatic): void;
|
||||
|
||||
setContents(delta: DeltaStatic): void;
|
||||
|
||||
setHTML(html: string): void;
|
||||
|
||||
setText(text: string): void;
|
||||
|
||||
getSelection(): RangeStatic;
|
||||
|
||||
setSelection(start: number, end: number): void;
|
||||
setSelection(start: number, end: number, source: string): void;
|
||||
setSelection(range: RangeStatic): void;
|
||||
setSelection(range: RangeStatic, source: string): void;
|
||||
|
||||
prepareFormat(format: string, value: boolean): void;
|
||||
|
||||
focus(): void;
|
||||
|
||||
getBounds(index: number): any;
|
||||
|
||||
registerModule(name: string, callback: (quill: QuillStatic, options: any) => {}): any;
|
||||
|
||||
addModule(name: string, options: any): any;
|
||||
|
||||
getModule(name: string): any;
|
||||
|
||||
onModuleLoad(name: string, callback: (input: any) => {}): void;
|
||||
|
||||
addFormat(name: string, config: any): void;
|
||||
|
||||
addContainer(cssClass: string, before?: number): HTMLDivElement;
|
||||
}
|
||||
|
||||
declare module "Range"
|
||||
{
|
||||
var Range: RangeStatic;
|
||||
export = Range;
|
||||
}
|
||||
|
||||
declare var Delta: DeltaStatic;
|
||||
|
||||
declare module "Delta"{
|
||||
export = Delta;
|
||||
}
|
||||
|
||||
declare var Quill: QuillStatic;
|
||||
declare var Quill: QuillJS.QuillStatic;
|
||||
|
||||
declare module "Quill" {
|
||||
export = Quill;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
|
||||
import { Option, ReactSelectProps, ReactAsyncSelectProps, MenuRendererProps } from "react-select-props";
|
||||
import { Option, ReactSelectProps, ReactAsyncSelectProps, ReactCreatableSelectProps, MenuRendererProps } from "react-select-props";
|
||||
import Select = require("react-select");
|
||||
|
||||
const CustomOption = React.createClass({
|
||||
@@ -104,7 +104,6 @@ class SelectTest extends React.Component<React.Props<{}>, {}> {
|
||||
key: "1",
|
||||
options: options,
|
||||
optionRenderer: optionRenderer,
|
||||
allowCreate: true,
|
||||
autofocus: true,
|
||||
autosize: true,
|
||||
clearable: true,
|
||||
@@ -200,3 +199,28 @@ class SelectAsyncTest extends React.Component<React.Props<{}>, {}> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SelectCreatableTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
const options: Option[] = [{ label: "Foo", value: "bar" }];
|
||||
const onChange = (value: any) => console.log(value);
|
||||
|
||||
const creatableSelectProps: ReactCreatableSelectProps = {
|
||||
name: "test-creatable-select",
|
||||
value: "bar",
|
||||
options: options,
|
||||
onChange: onChange,
|
||||
isOptionUnique: () => { return true; },
|
||||
isValidNewOption: () => { return true; },
|
||||
newOptionCreator: () => { return { label: "NewFoo", value: "newBar" }; },
|
||||
promptTextCreator: () => { return ""; },
|
||||
shouldKeyDownEventCreateNewOption: () => { return true; }
|
||||
};
|
||||
|
||||
return <div>
|
||||
<Select.Creatable {...creatableSelectProps} />
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+34
-13
@@ -1,6 +1,6 @@
|
||||
// Type definitions for react-select v1.0.0
|
||||
// Project: https://github.com/JedWatson/react-select
|
||||
// Definitions by: ESQUIBET Hugo <https://github.com/Hesquibet/>, Gilad Gray <https://github.com/giladgray/>
|
||||
// Definitions by: ESQUIBET Hugo <https://github.com/Hesquibet/>, Gilad Gray <https://github.com/giladgray/>, Izaak Baker <https://github.com/iebaker/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
@@ -68,12 +68,6 @@ declare namespace ReactSelect {
|
||||
* @default 'Add "{label}"?'
|
||||
*/
|
||||
addLabelText?: string;
|
||||
/**
|
||||
* allow new options to be created in multi mode (displays an "Add <option> ?" item
|
||||
* when a value not already in the options array is entered)
|
||||
* @default false
|
||||
*/
|
||||
allowCreate?: boolean;
|
||||
/**
|
||||
* blurs the input element after a selection has been made. Handy for lowering the keyboard on mobile devices.
|
||||
* @default false
|
||||
@@ -202,11 +196,6 @@ declare namespace ReactSelect {
|
||||
* field name, for hidden `<input>` tag
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* factory to create new options when `allowCreate` is true
|
||||
* @default false
|
||||
*/
|
||||
newOptionCreator?: (input: string) => Option;
|
||||
/**
|
||||
* placeholder displayed when there are no matching search results or a falsy value to hide it
|
||||
* @default "No results found"
|
||||
@@ -401,10 +390,41 @@ declare namespace ReactSelect {
|
||||
searchingText?: string;
|
||||
}
|
||||
|
||||
interface ReactCreatableSelectProps extends ReactSelectProps {
|
||||
/**
|
||||
* Searches for any matching option within the set of options. This function prevents
|
||||
* duplicate options from being created.
|
||||
*/
|
||||
isOptionUnique?: (arg: { option: Option, options: Option[], labelKey: string, valueKey: string }) => boolean;
|
||||
|
||||
/**
|
||||
* Determines if the current input text represents a valid option.
|
||||
*/
|
||||
isValidNewOption?: (arg: { label: string }) => boolean;
|
||||
|
||||
/**
|
||||
* factory to create new options
|
||||
*/
|
||||
newOptionCreator?: (input: string) => Option;
|
||||
|
||||
/**
|
||||
* Creates prompt/placeholder for option text.
|
||||
*/
|
||||
promptTextCreator?: (filterText: string) => string;
|
||||
|
||||
/**
|
||||
* Decides if a keyDown event (eg its 'keyCode') should result in the creation of a new option.
|
||||
*/
|
||||
shouldKeyDownEventCreateNewOption?: (arg: { keyCode: number }) => boolean;
|
||||
}
|
||||
|
||||
class ReactSelectCreatableClass extends __React.Component<ReactCreatableSelectProps, {}> {
|
||||
}
|
||||
class ReactSelectAsyncClass extends __React.Component<ReactAsyncSelectProps, {}> {
|
||||
}
|
||||
class ReactSelectClass extends __React.Component<ReactSelectProps, {}> {
|
||||
static Async: ReactSelectAsyncClass;
|
||||
static Creatable: ReactSelectCreatableClass;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -419,6 +439,7 @@ declare module "react-select-props" {
|
||||
import MenuRendererProps = ReactSelect.MenuRendererProps;
|
||||
import ReactSelectProps = ReactSelect.ReactSelectProps;
|
||||
import ReactAsyncSelectProps = ReactSelect.ReactAsyncSelectProps;
|
||||
import ReactCreatableSelectProps = ReactSelect.ReactCreatableSelectProps;
|
||||
|
||||
export { MenuRendererProps, ReactSelectProps, ReactAsyncSelectProps, Option };
|
||||
export { MenuRendererProps, ReactSelectProps, ReactAsyncSelectProps, ReactCreatableSelectProps, Option };
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Andrew Fong <https://github.com/fongandrew>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
declare interface JQuery {}
|
||||
|
||||
declare namespace SegmentAnalytics {
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -47,7 +47,8 @@ interface SocketIOStatic {
|
||||
declare namespace SocketIO {
|
||||
|
||||
interface Server {
|
||||
|
||||
engine: { ws: any };
|
||||
|
||||
/**
|
||||
* A dictionary of all the namespaces currently on this Server
|
||||
*/
|
||||
|
||||
@@ -166,6 +166,8 @@ _.some({ a: 'a', b: 'B', c: 'C', d: 'd' }, l => l === l.toUpperCase());
|
||||
|
||||
_.contains([1, 2, 3], 3);
|
||||
|
||||
_.contains([1, 2, 3], 3, 1);
|
||||
|
||||
_.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
|
||||
|
||||
var stooges = [{ name: 'moe', age: 40 }, { name: 'larry', age: 50 }, { name: 'curly', age: 60 }];
|
||||
@@ -278,10 +280,12 @@ _.defer(function () { alert('deferred'); });
|
||||
var updatePosition = (param:string) => alert('updating position... Param: ' + param);
|
||||
var throttled = _.throttle(updatePosition, 100);
|
||||
$(window).scroll(throttled);
|
||||
throttled.cancel();
|
||||
|
||||
var calculateLayout = (param:string) => alert('calculating layout... Param: ' + param);
|
||||
var lazyLayout = _.debounce(calculateLayout, 300);
|
||||
$(window).resize(lazyLayout);
|
||||
lazyLayout.cancel();
|
||||
|
||||
var createApplication = (param:string) => alert('creating application... Param: ' + param);
|
||||
var initialize = _.once(createApplication);
|
||||
@@ -406,6 +410,7 @@ function useBoolean(arg: Boolean) {};
|
||||
function useDate(arg: Date) {};
|
||||
function useRegExp(arg: RegExp) {};
|
||||
function useArray<T>(arg: T[]) {};
|
||||
function useSymbol(arg: symbol) {};
|
||||
|
||||
var guardedType: {};
|
||||
if(_.isElement(guardedType)) useElement(guardedType);
|
||||
@@ -419,6 +424,7 @@ if(_.isNumber(guardedType)) useNumber(guardedType);
|
||||
if(_.isBoolean(guardedType)) useBoolean(guardedType);
|
||||
if(_.isDate(guardedType)) useDate(guardedType);
|
||||
if(_.isRegExp(guardedType)) useRegExp(guardedType);
|
||||
if(_.isSymbol(guardedType)) useSymbol(guardedType);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Vendored
+169
-18
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Underscore 1.7.0
|
||||
// Type definitions for Underscore 1.8.3
|
||||
// Project: http://underscorejs.org/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Josh Baldwin <https://github.com/jbaldwin/>, Christopher Currens <https://github.com/ccurrens/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -74,6 +74,10 @@ declare module _ {
|
||||
interface MemoObjectIterator<T, TResult> {
|
||||
(prev: TResult, curr: T, key: string, list: Dictionary<T>): TResult;
|
||||
}
|
||||
|
||||
interface Cancelable {
|
||||
cancel() : void;
|
||||
}
|
||||
}
|
||||
|
||||
interface UnderscoreStatic {
|
||||
@@ -458,10 +462,10 @@ interface UnderscoreStatic {
|
||||
object: _.Dictionary<T>,
|
||||
iterator?: _.ObjectIterator<T, boolean>,
|
||||
context?: any): boolean;
|
||||
|
||||
|
||||
any<T>(
|
||||
list: _.List<T>,
|
||||
value: T): boolean;
|
||||
value: T): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value is present in the list. Uses indexOf internally,
|
||||
@@ -472,7 +476,8 @@ interface UnderscoreStatic {
|
||||
**/
|
||||
contains<T>(
|
||||
list: _.List<T>,
|
||||
value: T): boolean;
|
||||
value: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
@@ -486,7 +491,8 @@ interface UnderscoreStatic {
|
||||
**/
|
||||
include<T>(
|
||||
list: _.Collection<T>,
|
||||
value: T): boolean;
|
||||
value: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
@@ -495,6 +501,21 @@ interface UnderscoreStatic {
|
||||
object: _.Dictionary<T>,
|
||||
value: T): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
**/
|
||||
includes<T>(
|
||||
list: _.Collection<T>,
|
||||
value: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
**/
|
||||
includes<T>(
|
||||
object: _.Dictionary<T>,
|
||||
value: T): boolean;
|
||||
|
||||
/**
|
||||
* Calls the method named by methodName on each value in the list. Any extra arguments passed to
|
||||
* invoke will be forwarded on to the method invocation.
|
||||
@@ -1055,6 +1076,14 @@ interface UnderscoreStatic {
|
||||
**/
|
||||
range(stop: number): number[];
|
||||
|
||||
/**
|
||||
* Split an **array** into several arrays containing **count** or less elements
|
||||
* of initial array.
|
||||
* @param array The array to split
|
||||
* @param count The maximum size of the inner arrays.
|
||||
*/
|
||||
chunk<T>(array: _.Collection<T>, count: number): (_.Collection<T>)[]
|
||||
|
||||
/*************
|
||||
* Functions *
|
||||
*************/
|
||||
@@ -3433,7 +3462,7 @@ interface UnderscoreStatic {
|
||||
throttle<T extends Function>(
|
||||
func: T,
|
||||
wait: number,
|
||||
options?: _.ThrottleSettings): T;
|
||||
options?: _.ThrottleSettings): T & _.Cancelable;
|
||||
|
||||
/**
|
||||
* Creates and returns a new debounced version of the passed function that will postpone its execution
|
||||
@@ -3452,7 +3481,7 @@ interface UnderscoreStatic {
|
||||
debounce<T extends Function>(
|
||||
fn: T,
|
||||
wait: number,
|
||||
immediate?: boolean): T;
|
||||
immediate?: boolean): T & _.Cancelable;
|
||||
|
||||
/**
|
||||
* Creates a version of the function that can only be called one time. Repeated calls to the modified
|
||||
@@ -3463,6 +3492,12 @@ interface UnderscoreStatic {
|
||||
**/
|
||||
once<T extends Function>(fn: T): T;
|
||||
|
||||
/**
|
||||
* Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html)
|
||||
* This accumulates the arguments passed into an array, after a given index.
|
||||
**/
|
||||
restArgs(func: Function, starIndex?: number) : Function;
|
||||
|
||||
/**
|
||||
* Creates a version of the function that will only be run after first being called count times. Useful
|
||||
* for grouping asynchronous responses, where you want to be sure that all the async calls have finished,
|
||||
@@ -3624,6 +3659,14 @@ interface UnderscoreStatic {
|
||||
destination: any,
|
||||
...source: any[]): any;
|
||||
|
||||
/**
|
||||
* Returns the first key on an object that passes a predicate test.
|
||||
* @param obj the object to search in
|
||||
* @param predicate Predicate function.
|
||||
* @param context `this` object in `iterator`, optional.
|
||||
*/
|
||||
findKey<T>(obj: _.Dictionary<T>, predicate: _.ObjectIterator<T, boolean>, context? : any): T
|
||||
|
||||
/**
|
||||
* Return a copy of the object, filtered to only have values for the whitelisted keys
|
||||
* (or array of valid keys).
|
||||
@@ -3677,6 +3720,16 @@ interface UnderscoreStatic {
|
||||
object: any,
|
||||
...defaults: any[]): any;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an object that inherits from the given prototype object.
|
||||
* If additional properties are provided then they will be added to the
|
||||
* created object.
|
||||
* @param prototype The prototype that the returned object will inherit from.
|
||||
* @param props Additional props added to the returned object.
|
||||
**/
|
||||
create(prototype: any, props?: Object): any;
|
||||
|
||||
/**
|
||||
* Create a shallow-copied clone of the object.
|
||||
* Any nested objects or arrays will be copied by reference, not duplicated.
|
||||
@@ -3710,6 +3763,14 @@ interface UnderscoreStatic {
|
||||
**/
|
||||
matches<T, TResult>(attrs: T): _.ListIterator<T, TResult>;
|
||||
|
||||
/**
|
||||
* Returns a predicate function that will tell you if a passed in object contains all of the key/value properties present in attrs.
|
||||
* @see _.matches
|
||||
* @param attrs Object with key values pair
|
||||
* @return Predicate function
|
||||
**/
|
||||
matcher<T, TResult>(attrs: T): _.ListIterator<T, TResult>;
|
||||
|
||||
/**
|
||||
* Returns a function that will itself return the key property of any passed-in object.
|
||||
* @param key Property of the object.
|
||||
@@ -3760,7 +3821,7 @@ interface UnderscoreStatic {
|
||||
* @param object Check if this object is an Array.
|
||||
* @return True if `object` is an Array, otherwise false.
|
||||
**/
|
||||
isArray(object: any): object is [];
|
||||
isArray(object: any): object is any[];
|
||||
|
||||
/**
|
||||
* Returns true if object is an Array.
|
||||
@@ -3769,6 +3830,13 @@ interface UnderscoreStatic {
|
||||
**/
|
||||
isArray<T>(object: any): object is T[];
|
||||
|
||||
/**
|
||||
* Returns true if object is a Symbol.
|
||||
* @param object Check if this object is a Symbol.
|
||||
* @return True if `object` is a Symbol, otherwise false.
|
||||
**/
|
||||
isSymbol(object: any): object is symbol;
|
||||
|
||||
/**
|
||||
* Returns true if value is an Object. Note that JavaScript arrays and functions are objects,
|
||||
* while (normal) strings and numbers are not.
|
||||
@@ -3935,11 +4003,10 @@ interface UnderscoreStatic {
|
||||
* a property matcher, or a propetery accessor.
|
||||
* @param string|Function|Object value The value to iterate over, usually the key.
|
||||
* @param any context
|
||||
* @param number argCount
|
||||
* @return Callback that can be applied to each element in a collection.
|
||||
**/
|
||||
iteratee(value: string): Function;
|
||||
iteratee(value: Function, context?: any, argCount?: number): Function;
|
||||
iteratee(value: Function, context?: any): Function;
|
||||
iteratee(value: Object): Function;
|
||||
|
||||
/**
|
||||
@@ -4178,13 +4245,19 @@ interface Underscore<T> {
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.contains
|
||||
**/
|
||||
contains(value: T): boolean;
|
||||
contains(value: T, fromIndex? : number): boolean;
|
||||
|
||||
/**
|
||||
* Alias for 'contains'.
|
||||
* @see contains
|
||||
**/
|
||||
include(value: T): boolean;
|
||||
include(value: T, fromIndex? : number): boolean;
|
||||
|
||||
/**
|
||||
* Alias for 'contains'.
|
||||
* @see contains
|
||||
**/
|
||||
includes(value: T, fromIndex? : number): boolean;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
@@ -4513,6 +4586,12 @@ interface Underscore<T> {
|
||||
**/
|
||||
range(): number[];
|
||||
|
||||
/**
|
||||
* Wrapped type any[][].
|
||||
* @see _.chunk
|
||||
**/
|
||||
chunk(): any[][];
|
||||
|
||||
/* ***********
|
||||
* Functions *
|
||||
************ */
|
||||
@@ -4562,13 +4641,13 @@ interface Underscore<T> {
|
||||
* Wrapped type `Function`.
|
||||
* @see _.throttle
|
||||
**/
|
||||
throttle(wait: number, options?: _.ThrottleSettings): Function;
|
||||
throttle(wait: number, options?: _.ThrottleSettings): Function & _.Cancelable;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.debounce
|
||||
**/
|
||||
debounce(wait: number, immediate?: boolean): Function;
|
||||
debounce(wait: number, immediate?: boolean): Function & _.Cancelable;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
@@ -4576,6 +4655,12 @@ interface Underscore<T> {
|
||||
**/
|
||||
once(): Function;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.once
|
||||
**/
|
||||
restArgs(starIndex?: number) : Function;
|
||||
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.after
|
||||
@@ -4657,6 +4742,12 @@ interface Underscore<T> {
|
||||
**/
|
||||
extend(...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.extend
|
||||
**/
|
||||
findKey(predicate: _.ObjectIterator<any, boolean>, context? : any): any
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.pick
|
||||
@@ -4679,6 +4770,12 @@ interface Underscore<T> {
|
||||
**/
|
||||
defaults(...defaults: any[]): any;
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.create
|
||||
**/
|
||||
create(props?: Object): any;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.clone
|
||||
@@ -4703,6 +4800,12 @@ interface Underscore<T> {
|
||||
**/
|
||||
matches<TResult>(): _.ListIterator<T, TResult>;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.matcher
|
||||
**/
|
||||
matcher<TResult>(): _.ListIterator<T, TResult>;
|
||||
|
||||
/**
|
||||
* Wrapped type `string`.
|
||||
* @see _.property
|
||||
@@ -4745,6 +4848,12 @@ interface Underscore<T> {
|
||||
**/
|
||||
isArray(): boolean;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isSymbol
|
||||
**/
|
||||
isSymbol(): boolean;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isObject
|
||||
@@ -4872,7 +4981,7 @@ interface Underscore<T> {
|
||||
* Wrapped type `string|Function|Object`.
|
||||
* @see _.iteratee
|
||||
**/
|
||||
iteratee(context?: any, argCount?: number): Function;
|
||||
iteratee(context?: any): Function;
|
||||
|
||||
/**
|
||||
* Wrapped type `string`.
|
||||
@@ -5096,13 +5205,19 @@ interface _Chain<T> {
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.contains
|
||||
**/
|
||||
contains(value: T): _ChainSingle<boolean>;
|
||||
contains(value: T, fromIndex?: number): _ChainSingle<boolean>;
|
||||
|
||||
/**
|
||||
* Alias for 'contains'.
|
||||
* @see contains
|
||||
**/
|
||||
include(value: T): _ChainSingle<boolean>;
|
||||
include(value: T, fromIndex?: number): _ChainSingle<boolean>;
|
||||
|
||||
/**
|
||||
* Alias for 'contains'.
|
||||
* @see contains
|
||||
**/
|
||||
includes(value: T, fromIndex?: number): _ChainSingle<boolean>;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
@@ -5431,6 +5546,12 @@ interface _Chain<T> {
|
||||
**/
|
||||
range(): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[][]`.
|
||||
* @see _.chunk
|
||||
**/
|
||||
chunk(): _Chain<T>;
|
||||
|
||||
/* ***********
|
||||
* Functions *
|
||||
************ */
|
||||
@@ -5494,6 +5615,12 @@ interface _Chain<T> {
|
||||
**/
|
||||
once(): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.once
|
||||
**/
|
||||
restArgs(startIndex? : number): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.after
|
||||
@@ -5575,6 +5702,12 @@ interface _Chain<T> {
|
||||
**/
|
||||
extend(...sources: any[]): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.extend
|
||||
**/
|
||||
findKey(predicate: _.ObjectIterator<any, boolean>, context? : any): _Chain<T>
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.pick
|
||||
@@ -5597,6 +5730,12 @@ interface _Chain<T> {
|
||||
**/
|
||||
defaults(...defaults: any[]): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.create
|
||||
**/
|
||||
create(props?: Object): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.clone
|
||||
@@ -5621,6 +5760,12 @@ interface _Chain<T> {
|
||||
**/
|
||||
matches<TResult>(): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.matcher
|
||||
**/
|
||||
matcher<TResult>(): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `string`.
|
||||
* @see _.property
|
||||
@@ -5663,6 +5808,12 @@ interface _Chain<T> {
|
||||
**/
|
||||
isArray(): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isSymbol
|
||||
**/
|
||||
isSymbol(): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isObject
|
||||
@@ -5790,7 +5941,7 @@ interface _Chain<T> {
|
||||
* Wrapped type `string|Function|Object`.
|
||||
* @see _.iteratee
|
||||
**/
|
||||
iteratee(context?: any, argCount?: number): _Chain<T>;
|
||||
iteratee(context?: any): _Chain<T>;
|
||||
|
||||
/**
|
||||
* Wrapped type `string`.
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
///<reference path="validate.js.d.ts"/>
|
||||
import Validator = ValidateJS.Validator;
|
||||
import Field = ValidateJS.Field;
|
||||
import Constraints = ValidateJS.Constraints;
|
||||
|
||||
let validator: Validator;
|
||||
validator = {};
|
||||
validator = {message: 'test'};
|
||||
validator = {message: (value: any, attribute: any, validatorOptions: any, attributes: any, globalOptions: any) => 'test'};
|
||||
|
||||
let date: Validator.Date;
|
||||
date = {};
|
||||
date = {
|
||||
earliest: 'a',
|
||||
latest: 'b',
|
||||
notValid: 'c',
|
||||
tooEarly: 'd',
|
||||
tooLate: 'e',
|
||||
message: 'test',
|
||||
};
|
||||
|
||||
let dateTime: Validator.DateTime;
|
||||
dateTime = {};
|
||||
dateTime = {
|
||||
dateOnly: true,
|
||||
earliest: 'a',
|
||||
latest: 'b',
|
||||
notValid: 'c',
|
||||
tooEarly: 'd',
|
||||
tooLate: 'e',
|
||||
message: 'test',
|
||||
};
|
||||
|
||||
let email: Validator.Email;
|
||||
email = {};
|
||||
email = {message: 'test'};
|
||||
|
||||
let equality: Validator.Equality;
|
||||
equality = {};
|
||||
equality = {
|
||||
attribute: 'a',
|
||||
comparator: (v1: any, v2: any) => true,
|
||||
message: 'test',
|
||||
};
|
||||
|
||||
let exclusion: Validator.Exclusion;
|
||||
exclusion = {
|
||||
within: ['a', 'b'],
|
||||
message: 'test',
|
||||
};
|
||||
exclusion = {
|
||||
within: {a: 'b', c: 'd'},
|
||||
};
|
||||
|
||||
let format: Validator.Format;
|
||||
format = {
|
||||
pattern: 'a',
|
||||
message: 'test',
|
||||
};
|
||||
format = {
|
||||
pattern: /a/g,
|
||||
};
|
||||
format = {
|
||||
pattern: new RegExp('a'),
|
||||
};
|
||||
|
||||
let inclusion: Validator.Inclusion;
|
||||
inclusion = {
|
||||
within: ['a', 'b'],
|
||||
message: 'test',
|
||||
};
|
||||
inclusion = {
|
||||
within: {a: 'b', c: 'd'},
|
||||
};
|
||||
|
||||
let _length: Validator.Length;
|
||||
_length = {};
|
||||
_length = {
|
||||
is: 1,
|
||||
notValid: 'a',
|
||||
wrongLength: 'b',
|
||||
message: 'test',
|
||||
tokenizer: (value: any[]) => [1, 2],
|
||||
};
|
||||
_length = {
|
||||
minimum: 2,
|
||||
maximum: 4,
|
||||
tooShort: 'a',
|
||||
tooLong: 'b',
|
||||
tokenizer: (value: string) => 'test',
|
||||
};
|
||||
|
||||
let numericality: Validator.Numericality;
|
||||
numericality = {};
|
||||
numericality = {
|
||||
onlyInteger: true,
|
||||
strict: true,
|
||||
equalTo: 8,
|
||||
divisibleBy: 4,
|
||||
even: true,
|
||||
notValid: 'a',
|
||||
notInteger: 'b',
|
||||
notEqualTo: 'c',
|
||||
notDivisibleBy: 'd',
|
||||
notEven: 'e',
|
||||
message: 'test',
|
||||
};
|
||||
numericality = {
|
||||
greaterThan: 4,
|
||||
lessThan: 10,
|
||||
odd: true,
|
||||
notGreaterThan: 'a',
|
||||
notLessThan: 'b',
|
||||
notOdd: 'c',
|
||||
};
|
||||
numericality = {
|
||||
greaterThanOrEqualTo: 4,
|
||||
lessThanOrEqualTo: 7,
|
||||
notGreaterThanOrEqualTo: 'a',
|
||||
notLessThanOrEqualTo: 'b',
|
||||
};
|
||||
|
||||
let presence: Validator.Presence;
|
||||
presence = {};
|
||||
presence = {message: 'test'};
|
||||
|
||||
let url: Validator.Url;
|
||||
url = {};
|
||||
url = {
|
||||
schemes: ['a', /b/g, new RegExp('c')],
|
||||
allowLocal: true,
|
||||
message: 'test',
|
||||
};
|
||||
|
||||
let field: Field;
|
||||
field = {};
|
||||
field = {
|
||||
date: {earliest: 'a'},
|
||||
datetime: {dateOnly: true},
|
||||
email: {message: 'test'},
|
||||
equality: {attribute: 'b'},
|
||||
exclusion: {within: ['c']},
|
||||
format: {pattern: 'd'},
|
||||
inclusion: {within: ['e']},
|
||||
length: {is: 4},
|
||||
numericality: {onlyInteger: true},
|
||||
presence: {message: 'test2'},
|
||||
url: {schemes: ['f']},
|
||||
};
|
||||
field = {
|
||||
date: true,
|
||||
datetime: true,
|
||||
email: true,
|
||||
equality: 'a',
|
||||
exclusion: ['b'],
|
||||
format: 'c',
|
||||
inclusion: ['d'],
|
||||
numericality: true,
|
||||
presence: true,
|
||||
url: true,
|
||||
};
|
||||
field = {
|
||||
format: /a/g,
|
||||
};
|
||||
field = {
|
||||
date: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({earliest: 'a'}),
|
||||
datetime: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({dateOnly: true}),
|
||||
email: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({message: 'test'}),
|
||||
equality: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({attribute: 'b'}),
|
||||
exclusion: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({within: ['c']}),
|
||||
format: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({pattern: 'd'}),
|
||||
inclusion: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({within: ['e']}),
|
||||
length: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({is: 4}),
|
||||
numericality: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({onlyInteger: true}),
|
||||
presence: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({message: 'test2'}),
|
||||
url: (value: any, attributes: any, attributeName: any, options: any, constraints: any) => ({schemes: ['f']}),
|
||||
};
|
||||
|
||||
let constraints: Constraints;
|
||||
constraints = {};
|
||||
constraints = {
|
||||
a: {date: true},
|
||||
b: (value: any, attribute: any, attributeName: any, options: any, constraints: any) => ({datetime: true}),
|
||||
};
|
||||
Vendored
+109
@@ -0,0 +1,109 @@
|
||||
// Type definitions for Validate.js
|
||||
// Project: https://github.com/ansman/validate.js
|
||||
// Definitions by: Travis Hill <https://github.com/HillTravis>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace ValidateJS {
|
||||
|
||||
export interface Validator {
|
||||
message?: string | ((value: any, attribute: any, validatorOptions: any, attributes: any, globalOptions: any) => string);
|
||||
}
|
||||
|
||||
namespace Validator {
|
||||
|
||||
export interface Date extends Validator {
|
||||
earliest?: string;
|
||||
latest?: string;
|
||||
|
||||
notValid?: string;
|
||||
tooEarly?: string;
|
||||
tooLate?: string;
|
||||
}
|
||||
|
||||
export interface DateTime extends Date {
|
||||
dateOnly?: boolean;
|
||||
}
|
||||
|
||||
export interface Email extends Validator {}
|
||||
|
||||
export interface Equality extends Validator {
|
||||
attribute?: string;
|
||||
comparator?: (v1: any, v2: any) => boolean;
|
||||
}
|
||||
|
||||
export interface Exclusion extends Validator {
|
||||
within: any[] | {[key: string]: any};
|
||||
}
|
||||
|
||||
export interface Format extends Validator {
|
||||
pattern: string | RegExp;
|
||||
flags?: string;
|
||||
}
|
||||
|
||||
export interface Inclusion extends Validator {
|
||||
within: any[] | {[key: string]: any};
|
||||
}
|
||||
|
||||
export interface Length extends Validator {
|
||||
is?: number;
|
||||
minimum?: number;
|
||||
maximum?: number;
|
||||
|
||||
notValid?: string;
|
||||
tooLong?: string;
|
||||
tooShort?: string;
|
||||
wrongLength?: string;
|
||||
|
||||
tokenizer?: (value: string | any[]) => string | any[];
|
||||
}
|
||||
|
||||
export interface Numericality extends Validator {
|
||||
onlyInteger?: boolean;
|
||||
strict?: boolean;
|
||||
greaterThan?: number;
|
||||
greaterThanOrEqualTo?: number;
|
||||
equalTo?: number;
|
||||
lessThanOrEqualTo?: number;
|
||||
lessThan?: number;
|
||||
divisibleBy?: number;
|
||||
odd?: boolean;
|
||||
even?: boolean;
|
||||
|
||||
notValid?: string;
|
||||
notInteger?: string;
|
||||
notGreaterThan?: string;
|
||||
notGreaterThanOrEqualTo?: string;
|
||||
notEqualTo?: string;
|
||||
notLessThanOrEqualTo?: string;
|
||||
notLessThan?: string;
|
||||
notDivisibleBy?: string;
|
||||
notOdd?: string;
|
||||
notEven?: string;
|
||||
}
|
||||
|
||||
export interface Presence extends Validator {}
|
||||
|
||||
export interface Url extends Validator {
|
||||
schemes?: [string | RegExp];
|
||||
allowLocal?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Field {
|
||||
date?: Validator.Date | boolean | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Date);
|
||||
datetime?: Validator.DateTime | boolean | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.DateTime);
|
||||
email?: Validator.Email | boolean | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Email);
|
||||
equality?: Validator.Equality | string | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Equality);
|
||||
exclusion?: Validator.Exclusion | any[] | {[key: string]: any} | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Exclusion);
|
||||
format?: Validator.Format | string | RegExp | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Format);
|
||||
inclusion?: Validator.Inclusion | any[] | {[key: string]: any} | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Inclusion);
|
||||
length?: Validator.Length | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Length);
|
||||
numericality?: Validator.Numericality | boolean | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Numericality);
|
||||
presence?: Validator.Presence | boolean | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Presence);
|
||||
url?: Validator.Url | boolean | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Validator.Url);
|
||||
}
|
||||
|
||||
export interface Constraints {
|
||||
[attribute: string]: Field | ((value: any, attributes: any, attributeName: any, options: any, constraints: any) => Field);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/// <reference path="webpack-dev-server.d.ts" />
|
||||
/// <reference path="../webpack/webpack.d.ts"/>
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
import * as WebpackDevServer from 'webpack-dev-server';
|
||||
var compiler = webpack({});
|
||||
|
||||
// basic example
|
||||
var server = new WebpackDevServer(compiler, {
|
||||
publicPath: "/assets/"
|
||||
});
|
||||
server.listen(8080);
|
||||
|
||||
// API example
|
||||
server = new WebpackDevServer(compiler, {
|
||||
// webpack-dev-server options
|
||||
contentBase: "/path/to/directory",
|
||||
// or: contentBase: "http://localhost/",
|
||||
|
||||
hot: true,
|
||||
// Enable special support for Hot Module Replacement
|
||||
// Page is no longer updated, but a "webpackHotUpdate" message is send to the content
|
||||
// Use "webpack/hot/dev-server" as additional module in your entry point
|
||||
// Note: this does _not_ add the `HotModuleReplacementPlugin` like the CLI option does.
|
||||
|
||||
// Set this as true if you want to access dev server from arbitrary url.
|
||||
// This is handy if you are using a html5 router.
|
||||
historyApiFallback: false,
|
||||
|
||||
// Set this if you want to enable gzip compression for assets
|
||||
compress: true,
|
||||
|
||||
// Set this if you want webpack-dev-server to delegate a single path to an arbitrary server.
|
||||
// Use "**" to proxy all paths to the specified server.
|
||||
// This is useful if you want to get rid of 'http://localhost:8080/' in script[src],
|
||||
// and has many other use cases (see https://github.com/webpack/webpack-dev-server/pull/127 ).
|
||||
proxy: {
|
||||
"**": "http://localhost:9090"
|
||||
},
|
||||
|
||||
setup: function (app) {
|
||||
// Here you can access the Express app object and add your own custom middleware to it.
|
||||
// For example, to define custom handlers for some paths:
|
||||
// app.get('/some/path', function(req, res) {
|
||||
// res.json({ custom: 'response' });
|
||||
// });
|
||||
},
|
||||
|
||||
// pass [static options](http://expressjs.com/en/4x/api.html#express.static) to inner express server
|
||||
staticOptions: {
|
||||
},
|
||||
|
||||
// webpack-dev-middleware options
|
||||
quiet: false,
|
||||
noInfo: false,
|
||||
lazy: true,
|
||||
filename: "bundle.js",
|
||||
watchOptions: {
|
||||
aggregateTimeout: 300,
|
||||
poll: 1000
|
||||
},
|
||||
// It's a required option.
|
||||
publicPath: "/assets/",
|
||||
headers: { "X-Custom-Header": "yes" },
|
||||
stats: { colors: true }
|
||||
});
|
||||
server.listen(8080, "localhost", function () { });
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for webpack-dev-server 1.12.1
|
||||
// Project: https://github.com/webpack/webpack-dev-server
|
||||
// Definitions by: maestroh <https://github.com/maestroh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../webpack/webpack.d.ts" />
|
||||
/// <reference path="../serve-static/serve-static.d.ts" />
|
||||
/// <reference path="../express-serve-static-core/express-serve-static-core.d.ts" />
|
||||
|
||||
declare module "webpack-dev-server" {
|
||||
import * as webpack from 'webpack';
|
||||
import * as core from 'express-serve-static-core';
|
||||
import * as serveStatic from 'serve-static';
|
||||
import * as http from 'http';
|
||||
|
||||
namespace WebpackDevServer {
|
||||
export interface Configuration {
|
||||
contentBase?: string;
|
||||
hot?: boolean;
|
||||
historyApiFallback?: boolean;
|
||||
compress?: boolean;
|
||||
proxy?: any;
|
||||
staticOptions?: any;
|
||||
quiet?: boolean;
|
||||
noInfo?: boolean;
|
||||
lazy?: boolean;
|
||||
filename?: string;
|
||||
watchOptions?: webpack.WatchOptions;
|
||||
publicPath: string;
|
||||
headers?: any;
|
||||
stats?: webpack.compiler.StatsToJsonOptions | webpack.compiler.StatsToStringOptions;
|
||||
|
||||
setup?(app: core.Express): void;
|
||||
}
|
||||
|
||||
export interface WebpackDevServer {
|
||||
new (
|
||||
webpack: webpack.compiler.Compiler,
|
||||
config: Configuration
|
||||
):WebpackDevServer;
|
||||
|
||||
listen(port: number,
|
||||
hostname: string,
|
||||
callback?: Function
|
||||
): http.Server;
|
||||
|
||||
listen(port: number,
|
||||
callback?: Function
|
||||
): http.Server;
|
||||
}
|
||||
}
|
||||
var wds: WebpackDevServer.WebpackDevServer;
|
||||
|
||||
export = wds;
|
||||
}
|
||||
Reference in New Issue
Block a user