mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -401,6 +401,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii)
|
||||
* [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000)
|
||||
* [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped)
|
||||
* [:link:](elasticsearch/elasticsearch.d.ts) [elasticsearch](https://www.elastic.co) by [Casper Skydt](https://github.com/CasperSkydt/DefinitelyTyped), [Blake Smith](https://github.com/bfsmith/DefinitelyTyped)
|
||||
* [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan)
|
||||
* [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io), [Milan Burda](https://github.com/miniak)
|
||||
* [:link:](electron-builder/electron-builder.d.ts) [electron-builder](https://github.com/loopline-systems/electron-builder) by [Maxime LUCE](https://github.com/SomaticIT)
|
||||
|
||||
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,
|
||||
|
||||
@@ -15,3 +15,18 @@ var $jwtInterceptor: ng.jwt.IJwtInterceptor;
|
||||
$jwtInterceptor.tokenGetter = () => {
|
||||
return expToken;
|
||||
}
|
||||
|
||||
|
||||
var authManager: ng.jwt.IAuthManagerServiceProvider;
|
||||
|
||||
// Indicate the user is authenticated
|
||||
authManager.authenticate();
|
||||
|
||||
// Indicate the user is unauthenticated
|
||||
authManager.unauthenticate();
|
||||
|
||||
// Keep the user authenticated
|
||||
authManager.checkAuthOnRefresh();
|
||||
|
||||
// Redirect the user on unauthorized requests
|
||||
authManager.redirectWhenUnauthenticated();
|
||||
Vendored
+7
@@ -27,4 +27,11 @@ declare namespace angular.jwt {
|
||||
interface IJwtInterceptor {
|
||||
tokenGetter(...params : any[]): string;
|
||||
}
|
||||
|
||||
interface IAuthManagerServiceProvider {
|
||||
authenticate(): void;
|
||||
unauthenticate(): void;
|
||||
checkAuthOnRefresh(): void;
|
||||
redirectWhenUnauthenticated(): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+3
-2
@@ -42,9 +42,10 @@ declare namespace angular.ui {
|
||||
*/
|
||||
topVisibleScope: ng.IRepeatScope;
|
||||
/**
|
||||
* calling this method reinitializes and reloads the scroller content.
|
||||
* calling this method reinitializes and reloads the scroller content.
|
||||
* @param startIndex is an integer indicating what item index the scroller will use to start the load process.
|
||||
*/
|
||||
reload(): void;
|
||||
reload(startIndex?: number): void;
|
||||
/**
|
||||
* Replaces the item in the buffer at the given index with the new items.
|
||||
*
|
||||
|
||||
Vendored
+14
-3
@@ -42,15 +42,20 @@ declare namespace angular.resource {
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
<T, U>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): U;
|
||||
actions?: IActionHash, options?: IResourceOptions): U;
|
||||
<T>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): IResourceClass<T>;
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<T>;
|
||||
}
|
||||
|
||||
// Hash of action descriptors allows custom action names
|
||||
interface IActionHash {
|
||||
[action: string]: IActionDescriptor
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
@@ -186,6 +191,12 @@ declare namespace angular {
|
||||
/** creating a resource service factory */
|
||||
factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
}
|
||||
|
||||
namespace auto {
|
||||
interface IInjectorService {
|
||||
get(name: '$resource'): ng.resource.IResourceService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Array<T>
|
||||
|
||||
Vendored
+12
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS 1.5
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Georgii Dolzhykov <http://github.com/thorn0>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -238,7 +239,6 @@ declare namespace angular {
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
directive(name: string, injectionFunction: Function): IModule;
|
||||
directive(object: Object): IModule;
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
@@ -1412,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 {
|
||||
|
||||
Vendored
+6
@@ -946,9 +946,14 @@ declare namespace AtomCore {
|
||||
registry: any;
|
||||
repository: Object;
|
||||
scopeName: string;
|
||||
tokenizeLines: (text: string) => any;
|
||||
// TBD
|
||||
|
||||
}
|
||||
|
||||
interface IGrammars {
|
||||
grammarForScopeName(scope: string): IGrammar;
|
||||
}
|
||||
|
||||
interface IPane /* extends Theorist.Model */ {
|
||||
itemForURI: (uri:string)=>IEditor;
|
||||
@@ -1302,6 +1307,7 @@ declare namespace AtomCore {
|
||||
deserializers:IDeserializerManager;
|
||||
config: IConfig;
|
||||
commands: ICommandRegistry;
|
||||
grammars: IGrammars;
|
||||
keymaps: IKeymapManager;
|
||||
keymap: IKeymapManager;
|
||||
packages: IPackageManager;
|
||||
|
||||
@@ -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
|
||||
@@ -4,55 +4,29 @@ import lambda = require('aws-lambda');
|
||||
|
||||
var str: string;
|
||||
var date: Date;
|
||||
var sns: lambda.SNS;
|
||||
var kinesis: lambda.Kinesis;
|
||||
var recordsList: lambda.Record[];
|
||||
var anyObj: any;
|
||||
var num: number;
|
||||
var identity: lambda.Identity;
|
||||
var identity: lambda.CognitoIdentity;
|
||||
var error: Error;
|
||||
|
||||
/* Records */
|
||||
var records: lambda.Records;
|
||||
|
||||
recordsList = records.Records;
|
||||
|
||||
/* Record */
|
||||
var record: lambda.Record;
|
||||
|
||||
str = record.EventVersion;
|
||||
str = record.EventSubscriptionArn;
|
||||
str = record.EnventSource;
|
||||
sns = record.Sns;
|
||||
kinesis = record.kinesis;
|
||||
|
||||
/* SNS */
|
||||
str = sns.Type;
|
||||
str = sns.MessageId;
|
||||
str = sns.TopicArn;
|
||||
str = sns.Subject;
|
||||
str = sns.Message;
|
||||
date = sns.Timestamp;
|
||||
|
||||
/* Kinesis */
|
||||
var kinesis: lambda.Kinesis;
|
||||
|
||||
str = kinesis.data;
|
||||
var b: boolean;
|
||||
var clientCtx: lambda.ClientContext;
|
||||
|
||||
/* Context */
|
||||
var context: lambda.Context;
|
||||
|
||||
context.log(str, anyObj);
|
||||
context.fail(str);
|
||||
context.succeed(str);
|
||||
context.succeed(anyObj);
|
||||
context.succeed(str, anyObj);
|
||||
b = context.callbackWaitsForEmptyEventLoop;
|
||||
str = context.functionName;
|
||||
str = context.functionVersion;
|
||||
str = context.invokedFunctionArn;
|
||||
num = context.memoryLimitInMB;
|
||||
str = context.awsRequestId;
|
||||
num = context.getRemainingTimeInMillis();
|
||||
str = context.logGroupName;
|
||||
str = context.logStreamName;
|
||||
identity = context.identity;
|
||||
clientCtx = context.clientContext;
|
||||
|
||||
/* Identity */
|
||||
var identity: lambda.Identity;
|
||||
/* CognitoIdentity */
|
||||
var identity: lambda.CognitoIdentity;
|
||||
|
||||
str = identity.cognitoIdentityId;
|
||||
str = identity.cognitoIdentityPoolId;
|
||||
|
||||
Vendored
+48
-35
@@ -1,55 +1,68 @@
|
||||
// Type definitions for AWS Lambda
|
||||
// Project: http://docs.aws.amazon.com/lambda
|
||||
// Definitions by: Michael Skarum <https://github.com/skarum>
|
||||
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "aws-lambda" {
|
||||
// Context
|
||||
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
|
||||
interface Context {
|
||||
// Properties
|
||||
callbackWaitsForEmptyEventLoop: boolean;
|
||||
functionName: string;
|
||||
functionVersion: string;
|
||||
invokedFunctionArn: string;
|
||||
memoryLimitInMB: number;
|
||||
awsRequestId: string;
|
||||
logGroupName: string;
|
||||
logStreamName: string;
|
||||
identity?: CognitoIdentity;
|
||||
clientContext?: ClientContext;
|
||||
|
||||
// Functions
|
||||
getRemainingTimeInMillis(): number;
|
||||
|
||||
export interface Records {
|
||||
Records: Record[];
|
||||
}
|
||||
interface Record {
|
||||
EventVersion: string;
|
||||
EventSubscriptionArn: string;
|
||||
EnventSource: string;
|
||||
Sns: SNS;
|
||||
kinesis: Kinesis;
|
||||
}
|
||||
interface SNS {
|
||||
Type: string;
|
||||
MessageId: string;
|
||||
TopicArn: string;
|
||||
Subject: string;
|
||||
Message: string;
|
||||
Timestamp: Date;
|
||||
}
|
||||
|
||||
interface Kinesis {
|
||||
data: string;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
// Functions for compatibility with earlier Node.js Runtime v0.10.42
|
||||
log(message: string, object: any): void;
|
||||
fail(message: string): void;
|
||||
succeed(message: string): void;
|
||||
succeed(object: any): void;
|
||||
succeed(message: string, object: any): void;
|
||||
awsRequestId: string;
|
||||
getRemainingTimeInMillis(): number;
|
||||
/** Information about the Amazon Cognito identity provider when invoked through the AWS Mobile SDK. It can be null. */
|
||||
identity?: Identity;
|
||||
succeed(message: string, object: any): void;
|
||||
}
|
||||
|
||||
interface Identity {
|
||||
|
||||
interface CognitoIdentity {
|
||||
cognitoIdentityId: string;
|
||||
cognitoIdentityPoolId: string;
|
||||
}
|
||||
|
||||
|
||||
interface ClientContext {
|
||||
client: ClientContextClient;
|
||||
Custom?: any;
|
||||
env: ClientContextEnv;
|
||||
}
|
||||
|
||||
interface ClientContextClient {
|
||||
installationId: string;
|
||||
appTitle: string;
|
||||
appVersionName: string;
|
||||
appVersionCode: string;
|
||||
appPackageName: string;
|
||||
}
|
||||
|
||||
interface ClientContextEnv {
|
||||
platformVersion: string;
|
||||
platform: string;
|
||||
make: string;
|
||||
model: string;
|
||||
locale: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional callback parameter.
|
||||
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
|
||||
*
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
*/
|
||||
export type Callback = (error?: Error, result?: any) => void;
|
||||
}
|
||||
Vendored
+7
-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;
|
||||
@@ -235,6 +235,12 @@ declare module "aws-sdk" {
|
||||
upload(params?: s3.PutObjectRequest, options?: s3.UploadOptions, callback?: (err: Error, data: any) => void): void;
|
||||
listObjects(params: s3.ListObjectRequest, callback: (err: Error, data: s3.ListObjectResponse) => void): void;
|
||||
listObjectsV2(params: s3.ListObjectV2Request, callback: (err: Error, data: s3.ListObjectV2Response) => void): void;
|
||||
waitFor(state: string, params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
|
||||
createMultipartUpload(params: any, callback: (err: Error, data: any) => void): void;
|
||||
uploadPart(params: any, callback: (err: Error, data: any) => void): void;
|
||||
listParts(params: any, callback: (err: Error, data: any) => void): void;
|
||||
completeMultipartUpload(params: any, callback: (err: Error, data: any) => void): void;
|
||||
}
|
||||
|
||||
export class STS {
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/// <reference path="axe-core.d.ts" />
|
||||
|
||||
var context:any = document
|
||||
var $fixture:any = {}
|
||||
|
||||
// axe.a11yCheck config
|
||||
axe.a11yCheck(context, {}, (results) => {
|
||||
// axe's results object
|
||||
console.log(results.passes.length)
|
||||
console.log(results.violations.length)
|
||||
});
|
||||
// axe.a11yCheck include/exclude
|
||||
axe.a11yCheck({include: [['#id1'], ['#id2']]}, {}, (results) => {
|
||||
console.log(results)
|
||||
})
|
||||
axe.a11yCheck({exclude: [$fixture[0]]}, {}, (results) => {
|
||||
console.log(results)
|
||||
})
|
||||
var tagConfigRunOnly: axe.RunOnly = {
|
||||
type: 'tag',
|
||||
values: ['wcag2a']
|
||||
}
|
||||
var tagConfig = {
|
||||
runOnly: tagConfigRunOnly
|
||||
}
|
||||
axe.a11yCheck(context, tagConfig, (results) => {
|
||||
console.log(results)
|
||||
})
|
||||
var includeExcludeTagsRunOnly: axe.RunOnly = {
|
||||
type: 'tags',
|
||||
value: {
|
||||
include: ['wcag2a', 'wcag2aa'],
|
||||
exclude: ['experimental']
|
||||
}
|
||||
}
|
||||
var includeExcludeTagsConfig = {
|
||||
runOnly: includeExcludeTagsRunOnly
|
||||
}
|
||||
axe.a11yCheck(context, includeExcludeTagsConfig, (results) => {
|
||||
console.log(results)
|
||||
})
|
||||
var someRulesConfig = {
|
||||
rules: {
|
||||
"color-contrast": {enabled: 'false'},
|
||||
"heading-order": {enabled: 'true'}
|
||||
}
|
||||
}
|
||||
axe.a11yCheck(context, someRulesConfig, (results) => {
|
||||
console.log(results)
|
||||
})
|
||||
|
||||
// axe.configure
|
||||
var spec: axe.Spec = {
|
||||
branding: {
|
||||
brand: 'foo',
|
||||
application: 'bar'
|
||||
},
|
||||
reporter: 'v1',
|
||||
checks: [{
|
||||
id: 'custom-check',
|
||||
evaluate: function() {
|
||||
return true
|
||||
}
|
||||
}],
|
||||
rules: [{
|
||||
id: 'custom-rule',
|
||||
any: ['custom-check']
|
||||
}]
|
||||
}
|
||||
axe.configure(spec)
|
||||
|
||||
axe.reset()
|
||||
|
||||
axe.getRules(['wcag2aa'])
|
||||
typeof axe.getRules() === 'object'
|
||||
|
||||
// Plugins
|
||||
var pluginSrc: axe.AxePlugin = {
|
||||
id: 'doStuff',
|
||||
run: (data:any, callback:Function) => {
|
||||
callback()
|
||||
},
|
||||
commands: [{
|
||||
id: 'run-doStuff',
|
||||
callback: (data:any, callback:Function) => {
|
||||
axe.plugins['doStuff'].run(data, callback)
|
||||
}
|
||||
}]
|
||||
}
|
||||
axe.registerPlugin(pluginSrc)
|
||||
axe.cleanup()
|
||||
Vendored
+159
@@ -0,0 +1,159 @@
|
||||
// Type definitions for axe-core 2.0.5
|
||||
// Project: https://github.com/dequelabs/axe-core
|
||||
// Definitions by: Marcy Sutton <https://github.com/marcysutton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace axe {
|
||||
|
||||
export type ImpactValue = "minor" | "moderate" | "serious" | "critical";
|
||||
|
||||
export type TagValue = "wcag2a" | "wcag2aa" | "section508" | "best-practice";
|
||||
|
||||
export type ReporterVersion = "v1" | "v2";
|
||||
|
||||
export type RunOnlyType = "rule" | "rules" | "tag" | "tags";
|
||||
|
||||
export interface ElementContext {
|
||||
node?: Object,
|
||||
selector?: string,
|
||||
include?: any[],
|
||||
exclude?: any[]
|
||||
}
|
||||
export interface RunOnly {
|
||||
type: RunOnlyType,
|
||||
value?: {
|
||||
include?: string[],
|
||||
exclude?: string[]
|
||||
}
|
||||
values?: TagValue[]
|
||||
}
|
||||
export interface AxeResults {
|
||||
url: string,
|
||||
timestamp: string,
|
||||
passes: Pass[],
|
||||
violations: Violation[]
|
||||
}
|
||||
export interface Pass {
|
||||
description: string,
|
||||
help: string,
|
||||
helpUrl: string,
|
||||
id: string,
|
||||
impact: ImpactValue,
|
||||
tags: TagValue[],
|
||||
nodes: NodeResult[]
|
||||
}
|
||||
export interface Violation {
|
||||
description: string,
|
||||
help: string,
|
||||
helpUrl: string,
|
||||
id: string,
|
||||
impact: ImpactValue,
|
||||
tags: TagValue[],
|
||||
nodes: NodeResult[]
|
||||
}
|
||||
export interface NodeResult {
|
||||
html: string,
|
||||
impact: ImpactValue,
|
||||
target: string[],
|
||||
any: CheckResult[],
|
||||
all: CheckResult[],
|
||||
none: CheckResult[]
|
||||
}
|
||||
export interface CheckResult {
|
||||
id: string,
|
||||
impact: string,
|
||||
message: string,
|
||||
data: any,
|
||||
relatedNodes?: RelatedNode[]
|
||||
}
|
||||
export interface RelatedNode {
|
||||
target: string[],
|
||||
html: string
|
||||
}
|
||||
export interface Spec {
|
||||
branding?: {
|
||||
brand: string,
|
||||
application: string
|
||||
},
|
||||
reporter?: ReporterVersion,
|
||||
checks?: Check[],
|
||||
rules?: Rule[]
|
||||
}
|
||||
export interface Check {
|
||||
id: string,
|
||||
evaluate: Function,
|
||||
after?: Function,
|
||||
options?: any,
|
||||
matches?: string,
|
||||
enabled?: boolean
|
||||
}
|
||||
export interface Rule {
|
||||
id: string,
|
||||
selector?: string,
|
||||
excludeHidden?: boolean,
|
||||
enabled?: boolean,
|
||||
pageLevel?: boolean,
|
||||
any?: string[],
|
||||
all?: string[],
|
||||
none?: string[],
|
||||
tags?: string[],
|
||||
matches?: string
|
||||
}
|
||||
export interface AxePlugin {
|
||||
id: string,
|
||||
run(...args:any[]): any,
|
||||
commands: {
|
||||
id: string,
|
||||
callback(...args:any[]): void
|
||||
}[],
|
||||
cleanup?(callback:Function): void
|
||||
}
|
||||
|
||||
export let plugins: any
|
||||
|
||||
/**
|
||||
* Starts analysis on the current document and its subframes
|
||||
*
|
||||
* @param {Object} context The `Context` specification object @see Context
|
||||
* @param {Array} options Options passed into rules or checks, temporarily modifyint them.
|
||||
* @param {Function} callback The function to invoke when analysis is complete.
|
||||
* @returns {Object} results The aXe results object
|
||||
*/
|
||||
export function a11yCheck(context: ElementContext, options: {runOnly?: RunOnly, rules?: Object}, callback: (results:AxeResults) => void): AxeResults
|
||||
|
||||
/**
|
||||
* Method for configuring the data format used by aXe. Helpful for adding new
|
||||
* rules, which must be registered with the library to execute.
|
||||
* @param {Spec} Spec Object with valid `branding`, `reporter`, `checks` and `rules` data
|
||||
*/
|
||||
export function configure(spec: Spec): void
|
||||
|
||||
/**
|
||||
* Searches and returns rules that contain a tag in the list of tags.
|
||||
* @param {Array} tags Optional array of tags
|
||||
* @return {Array} Array of rules
|
||||
*/
|
||||
export function getRules(tags?: string[]): Object[]
|
||||
|
||||
/**
|
||||
* Restores the default axe configuration
|
||||
*/
|
||||
export function reset(): void
|
||||
|
||||
/**
|
||||
* Function to register a plugin configuration in document and its subframes
|
||||
* @param {Object} plugin A plugin configuration object
|
||||
*/
|
||||
export function registerPlugin(plugin: AxePlugin): void
|
||||
|
||||
/**
|
||||
* Function to clean up plugin configuration in document and its subframes
|
||||
*/
|
||||
export function cleanup(): void
|
||||
|
||||
}
|
||||
|
||||
// axe is also available as a module
|
||||
declare module "axe-core" {
|
||||
export = axe;
|
||||
}
|
||||
@@ -72,6 +72,13 @@ table.read.use([function () {}, function () {}]);
|
||||
table.read.use(function () {}, function () {});
|
||||
table.use(function () {}).use(function () {}).read(function () {}).use(function () {})
|
||||
|
||||
table.access = undefined;
|
||||
table.access = 'authenticated';
|
||||
table.read.access = 'anonymous';
|
||||
table.update.access = 'disabled';
|
||||
table.delete.access = 'authenticated';
|
||||
table.insert.access = 'authenticated';
|
||||
|
||||
// Express.Table, instantiated from the static require('azure-mobile-apps').table()
|
||||
// This is going to be interesting if we ever support more than one provider
|
||||
var table2 = mobileApps.table();
|
||||
@@ -84,4 +91,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 () {} });
|
||||
|
||||
+20
-1
@@ -47,6 +47,7 @@ declare namespace Azure.MobileApps {
|
||||
|
||||
interface Table {
|
||||
authorize?: boolean;
|
||||
access?: AccessType;
|
||||
autoIncrement?: boolean;
|
||||
dynamicSchema?: boolean;
|
||||
name: string;
|
||||
@@ -66,8 +67,11 @@ declare namespace Azure.MobileApps {
|
||||
(operationHandler: (context: Context) => void): Table;
|
||||
use(...middleware: Middleware[]): Table;
|
||||
use(middleware: Middleware[]): Table;
|
||||
access: AccessType;
|
||||
}
|
||||
|
||||
type AccessType = 'anonymous' | 'authenticated' | 'disabled';
|
||||
|
||||
interface Tables {
|
||||
configuration: Configuration;
|
||||
add(name: string, definition?: Table | TableDefinition): void;
|
||||
@@ -215,7 +219,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 +227,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;
|
||||
|
||||
@@ -17,7 +17,7 @@ declare namespace Microsoft.WindowsAzure {
|
||||
login(provider: string, token: string): asyncPromise;
|
||||
login(provider: string, callback: (error: any, user: User) => void ): void;
|
||||
login(provider: string): asyncPromise;
|
||||
logout(): void;
|
||||
logout(): asyncPromise;
|
||||
getTable(tableName: string): MobileServiceTable;
|
||||
withFilter(serviceFilter: (request: any, next: (request: any, callback: (error: any, response: any) => void) => void, callback: (error: any, response: any) => void) => void): MobileServiceClient;
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/// <reference path="backlog-js.d.ts" />
|
||||
|
||||
import * as backlogjs from 'backlog-js';
|
||||
|
||||
const host = 'example.backlog.jp';
|
||||
const apiKey = 'apiKey';
|
||||
const clientId = 'clientId';
|
||||
const clientSecret = 'clientSecret';
|
||||
const redirectUri = 'redirectUri';
|
||||
const state = 'state';
|
||||
const code = 'code';
|
||||
const refreshToken = 'refreshToken';
|
||||
const configure = { host, apiKey }
|
||||
const credentials = { clientId, clientSecret }
|
||||
|
||||
const oauth2 = new backlogjs.OAuth2(credentials);
|
||||
oauth2.getAuthorizationURL({ host, redirectUri, state });
|
||||
oauth2.getAccessToken({ host, code, redirectUri }).then(data => {}).catch(err => {});
|
||||
oauth2.refreshAccessToken({ host, refreshToken }).then(data => {}).catch(err => {});
|
||||
|
||||
const backlog = new backlogjs.Backlog(configure);
|
||||
backlog.getSpace().then(data => { }).catch(err => { });
|
||||
backlog.getSpaceActivities({
|
||||
activityTypeId: [
|
||||
backlogjs.Option.ActivityType.IssueCreated,
|
||||
backlogjs.Option.ActivityType.IssueUpdated
|
||||
],
|
||||
minId: 1,
|
||||
maxId: 2,
|
||||
count: 3,
|
||||
order: "asc"
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.getSpaceDiskUsage().then(data => { }).catch(err => { });
|
||||
backlog.getSpaceIcon().then(data => { }).catch(err => { });
|
||||
backlog.postSpaceAttachment(new FormData()).then(data => { }).catch(err => { });
|
||||
backlog.getUsers().then(data => { }).catch(err => { });
|
||||
backlog.getUser(1).then(data => { }).catch(err => { });
|
||||
backlog.postUser({
|
||||
userId: 'string',
|
||||
password: 'string',
|
||||
name: 'string',
|
||||
mailAddress: 'string',
|
||||
roleType: backlogjs.Option.User.RoleType.Admin
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.patchUser(1, {
|
||||
password: 'string',
|
||||
name: 'string',
|
||||
mailAddress: 'string',
|
||||
roleType: backlogjs.Option.User.RoleType.Admin
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.deleteUser(1).then(data => { }).catch(err => { });
|
||||
backlog.getMyself().then(data => { }).catch(err => { });
|
||||
backlog.getUserActivities(1, {
|
||||
activityTypeId: [
|
||||
backlogjs.Option.ActivityType.IssueCreated,
|
||||
backlogjs.Option.ActivityType.IssueUpdated
|
||||
],
|
||||
minId: 1,
|
||||
maxId: 2,
|
||||
count: 3,
|
||||
order: "asc"
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.getUserStars(1, {
|
||||
minId: 1,
|
||||
maxId: 2,
|
||||
count: 3,
|
||||
order: "asc"
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.getUserStarsCount(1, {
|
||||
since: 'YYYY-MM-DD',
|
||||
until: 'YYYY-MM-DD'
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.getRecentlyViewedIssues({
|
||||
order: 'asc',
|
||||
offset: 1,
|
||||
count: 2
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.getRecentlyViewedProjects({
|
||||
order: 'asc',
|
||||
offset: 1,
|
||||
count: 2
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.getRecentlyViewedWikis({
|
||||
order: 'asc',
|
||||
offset: 1,
|
||||
count: 2
|
||||
}).then(data => { }).catch(err => { });
|
||||
backlog.getUserIcon(1).then(data => {}).catch(err => {});
|
||||
Vendored
+695
@@ -0,0 +1,695 @@
|
||||
// Type definitions for backlog-js 0.9.0
|
||||
// Project: https://github.com/nulab/backlog-js
|
||||
// Definitions by: Yuichi Watanabe <https://github.com/vvatanabe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../isomorphic-fetch/isomorphic-fetch.d.ts" />
|
||||
/// <reference path="../node_modules/typescript/lib/lib.es6.d.ts" />
|
||||
|
||||
declare module 'backlog-js' {
|
||||
|
||||
class Request {
|
||||
private configure;
|
||||
constructor(configure: {
|
||||
host: string;
|
||||
apiKey?: string;
|
||||
accessToken?: string;
|
||||
timeout?: number;
|
||||
});
|
||||
get<T>(path: string, params?: any): Promise<T>;
|
||||
post<T>(path: string, params?: any): Promise<T>;
|
||||
put<T>(path: string, params: any): Promise<T>;
|
||||
patch<T>(path: string, params: any): Promise<T>;
|
||||
delete<T>(path: string, params?: any): Promise<T>;
|
||||
request(options: {
|
||||
method: string;
|
||||
path: string;
|
||||
params?: Params | FormData;
|
||||
}): Promise<IResponse>;
|
||||
checkStatus(response: IResponse): Promise<IResponse>;
|
||||
parseJSON<T>(response: IResponse): Promise<T>;
|
||||
private toFormData(params);
|
||||
private toQueryString(params);
|
||||
webAppBaseURL: string;
|
||||
restBaseURL: string;
|
||||
}
|
||||
|
||||
type Params = {
|
||||
[index: string]: number | string | number[] | string[];
|
||||
};
|
||||
|
||||
export class Backlog extends Request {
|
||||
constructor(configure: {
|
||||
host: string;
|
||||
apiKey?: string;
|
||||
accessToken?: string;
|
||||
timeout?: number;
|
||||
});
|
||||
getSpace(): Promise<any>;
|
||||
getSpaceActivities(params: Option.Space.GetActivitiesParams): Promise<any>;
|
||||
getSpaceNotification(): Promise<any>;
|
||||
putSpaceNotification(params: Option.Space.PutSpaceNotificationParams): Promise<any>;
|
||||
getSpaceDiskUsage(): Promise<any>;
|
||||
getSpaceIcon(): Promise<Entity.File.FileData>;
|
||||
postSpaceAttachment(form: FormData): Promise<IResponse>;
|
||||
getUsers(): Promise<any>;
|
||||
getUser(userId: number): Promise<any>;
|
||||
postUser(params: Option.User.PostUserParams): Promise<any>;
|
||||
patchUser(userId: number, params: Option.User.PatchUserParams): Promise<any>;
|
||||
deleteUser(userId: number): Promise<any>;
|
||||
getMyself(): Promise<any>;
|
||||
getUserActivities(userId: number, params: Option.User.GetUserActivitiesParams): Promise<any>;
|
||||
getUserStars(userId: number, params: Option.User.GetUserStarsParams): Promise<any>;
|
||||
getUserStarsCount(userId: number, params: Option.User.GetUserStarsCountParams): Promise<any>;
|
||||
getRecentlyViewedIssues(params: Option.User.GetRecentlyViewedParams): Promise<any>;
|
||||
getRecentlyViewedProjects(params: Option.User.GetRecentlyViewedParams): Promise<any>;
|
||||
getRecentlyViewedWikis(params: Option.User.GetRecentlyViewedParams): Promise<any>;
|
||||
getUserIcon(userId: number): Promise<Entity.File.FileData>;
|
||||
getGroups(params: Option.Group.GetGroupsParams): Promise<any>;
|
||||
postGroups(params: Option.Group.PostGroupsParams): Promise<any>;
|
||||
getGroup(groupId: number): Promise<any>;
|
||||
patchGroup(groupId: number, params: Option.Group.PatchGroupParams): Promise<any>;
|
||||
deleteGroup(groupId: number): Promise<any>;
|
||||
getStatuses(): Promise<any>;
|
||||
getResolutions(): Promise<any>;
|
||||
getPriorities(): Promise<any>;
|
||||
postProject(params: Option.Project.PostProjectParams): Promise<any>;
|
||||
getProjects(params?: Option.Project.GetProjectsParams): Promise<any>;
|
||||
getProject(projectIdOrKey: string): Promise<any>;
|
||||
patchProject(projectIdOrKey: string, params: Option.Project.PatchProjectParams): Promise<any>;
|
||||
deleteProject(projectIdOrKey: string): Promise<any>;
|
||||
getProjectActivities(projectIdOrKey: string, params: Option.Space.GetActivitiesParams): Promise<any>;
|
||||
getProjectUsers(projectIdOrKey: string): Promise<any>;
|
||||
deleteProjectUsers(projectIdOrKey: string, params: Option.Project.DeleteProjectUsersParams): Promise<any>;
|
||||
postProjectAdministrators(projectIdOrKey: string, params: Option.Project.PostProjectAdministrators): Promise<any>;
|
||||
getProjectAdministrators(projectIdOrKey: string): Promise<any>;
|
||||
deleteProjectAdministrators(projectIdOrKey: string, params: Option.Project.DeleteProjectAdministrators): Promise<any>;
|
||||
getIssueTypes(projectIdOrKey: string): Promise<any>;
|
||||
postIssueType(projectIdOrKey: string, params: Option.Project.PostIssueTypeParams): Promise<any>;
|
||||
patchIssueType(projectIdOrKey: string, id: number, params: Option.Project.PatchIssueTypeParams): Promise<any>;
|
||||
deleteIssueType(projectIdOrKey: string, id: number, params: Option.Project.DeleteIssueTypeParams): Promise<any>;
|
||||
getCategories(projectIdOrKey: string): Promise<any>;
|
||||
postCategories(projectIdOrKey: string, params: Option.Project.PostCategoriesParams): Promise<any>;
|
||||
patchCategories(projectIdOrKey: string, id: number, params: Option.Project.PatchCategoriesParams): Promise<any>;
|
||||
deleteCategories(projectIdOrKey: string, id: number): Promise<any>;
|
||||
getVersions(projectIdOrKey: string): Promise<any>;
|
||||
postVersions(projectIdOrKey: string, params: Option.Project.PostVersionsParams): Promise<any>;
|
||||
patchVersions(projectIdOrKey: string, id: number, params: Option.Project.PatchVersionsParams): Promise<any>;
|
||||
deleteVersions(projectIdOrKey: string, id: number): Promise<any>;
|
||||
getCustomFields(projectIdOrKey: string): Promise<any>;
|
||||
postCustomField(projectIdOrKey: string, params: Option.Project.PostCustomFieldParams | Option.Project.PostCustomFieldWithNumericParams | Option.Project.PostCustomFieldWithDateParams | Option.Project.PostCustomFieldWithListParams): Promise<any>;
|
||||
patchCustomField(projectIdOrKey: string, id: number, params: Option.Project.PatchCustomFieldParams | Option.Project.PatchCustomFieldWithNumericParams | Option.Project.PatchCustomFieldWithDateParams | Option.Project.PatchCustomFieldWithListParams): Promise<any>;
|
||||
deleteCustomField(projectIdOrKey: string, id: number): Promise<any>;
|
||||
postCustomFieldItem(projectIdOrKey: string, id: number, params: Option.Project.PostCustomFieldItemParams): Promise<any>;
|
||||
patchCustomFieldItem(projectIdOrKey: string, id: number, itemId: number, params: Option.Project.PatchCustomFieldItemParams): Promise<any>;
|
||||
deleteCustomFieldItem(projectIdOrKey: string, id: number, params: Option.Project.PostCustomFieldItemParams): Promise<any>;
|
||||
getSharedFiles(projectIdOrKey: string, path: string, params: Option.Project.GetSharedFilesParams): Promise<any>;
|
||||
getProjectsDiskUsage(projectIdOrKey: string): Promise<any>;
|
||||
getWebhooks(projectIdOrKey: string): Promise<any>;
|
||||
postWebhook(projectIdOrKey: string, params: Option.Project.PostWebhookParams): Promise<any>;
|
||||
getWebhook(projectIdOrKey: string, webhookId: string): Promise<any>;
|
||||
patchWebhook(projectIdOrKey: string, webhookId: string, params: Option.Project.PatchWebhookParams): Promise<any>;
|
||||
deleteWebhook(projectIdOrKey: string, webhookId: string): Promise<any>;
|
||||
postIssue(params: Option.Issue.PostIssueParams): Promise<any>;
|
||||
patchIssue(issueIdOrKey: string, params: Option.Issue.PatchIssueParams): Promise<any>;
|
||||
getIssues(params?: Option.Issue.GetIssuesParams): Promise<any>;
|
||||
getIssue(issueIdOrKey: string): Promise<any>;
|
||||
getIssuesCount(params?: Option.Issue.GetIssuesParams): Promise<any>;
|
||||
deleteIssuesCount(issueIdOrKey: string): Promise<any>;
|
||||
getIssueComments(issueIdOrKey: string, params: Option.Issue.GetIssueCommentsParams): Promise<any>;
|
||||
postIssueComments(issueIdOrKey: string, params: Option.Issue.PostIssueCommentsParams): Promise<any>;
|
||||
getIssueCommentsCount(issueIdOrKey: string): Promise<any>;
|
||||
getIssueComment(issueIdOrKey: string, commentId: number): Promise<any>;
|
||||
patchIssueComment(issueIdOrKey: string, commentId: number, params: Option.Issue.PatchIssueCommentParams): Promise<any>;
|
||||
getIssueCommentNotifications(issueIdOrKey: string, commentId: number): Promise<any>;
|
||||
postIssueCommentNotifications(issueIdOrKey: string, commentId: number, prams: Option.Issue.IssueCommentNotifications): Promise<any>;
|
||||
getIssueAttachments(issueIdOrKey: string): Promise<any>;
|
||||
deleteIssueAttachment(issueIdOrKey: string, attachmentId: string): Promise<any>;
|
||||
getIssueSharedFiles(issueIdOrKey: string): Promise<any>;
|
||||
linkIssueSharedFiles(issueIdOrKey: string, params: Option.Issue.LinkIssueSharedFilesParams): Promise<any>;
|
||||
unlinkIssueSharedFile(issueIdOrKey: string, id: number): Promise<any>;
|
||||
getWikis(projectIdOrKey: number): Promise<any>;
|
||||
getWikisCount(projectIdOrKey: number): Promise<any>;
|
||||
getWikisTags(projectIdOrKey: number): Promise<any>;
|
||||
postWiki(params: Option.Wiki.PostWikiParams): Promise<any>;
|
||||
getWiki(wikiId: number): Promise<any>;
|
||||
patchWiki(wikiId: number, params: Option.Wiki.PatchWikiParams): Promise<any>;
|
||||
deleteWiki(wikiId: number, mailNotify: boolean): Promise<any>;
|
||||
getWikisAttachments(wikiId: number): Promise<any>;
|
||||
postWikisAttachments(wikiId: number, attachmentId: number[]): Promise<any>;
|
||||
deleteWikisAttachments(wikiId: number, attachmentId: number): Promise<any>;
|
||||
getWikisSharedFiles(wikiId: number): Promise<any>;
|
||||
linkWikisSharedFiles(wikiId: number, fileId: number[]): Promise<any>;
|
||||
unlinkWikisSharedFiles(wikiId: number, id: number): Promise<any>;
|
||||
getWikisHistory(wikiId: number, params: Option.Wiki.GetWikisHistoryParams): Promise<any>;
|
||||
getWikisStars(wikiId: number): Promise<any>;
|
||||
postStar(params: Option.Project.PostStarParams): Promise<any>;
|
||||
getNotifications(params: Option.Notification.GetNotificationsParams): Promise<any>;
|
||||
getNotificationsCount(params: Option.Notification.GetNotificationsCountParams): Promise<any>;
|
||||
resetNotificationsMarkAsRead(): Promise<any>;
|
||||
markAsReadNotification(id: number): Promise<any>;
|
||||
getGitRepositories(projectIdOrKey: string): Promise<any>;
|
||||
getGitRepository(projectIdOrKey: string, repoIdOrName: string): Promise<any>;
|
||||
getPullRequests(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.GetPullRequestsParams): Promise<any>;
|
||||
getPullRequestsCount(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.GetPullRequestsParams): Promise<any>;
|
||||
postPullRequest(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.PostPullRequestParams): Promise<any>;
|
||||
getPullRequest(projectIdOrKey: string, repoIdOrName: string, number: number): Promise<any>;
|
||||
patchPullRequest(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.PatchPullRequestParams): Promise<any>;
|
||||
getPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.GetPullRequestCommentsParams): Promise<any>;
|
||||
postPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.PostPullRequestCommentsParams): Promise<any>;
|
||||
getPullRequestCommentsCount(projectIdOrKey: string, repoIdOrName: string, number: number): Promise<any>;
|
||||
patchPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, commentId: number, params: Option.PullRequest.PatchPullRequestCommentsParams): Promise<any>;
|
||||
getPullRequestAttachments(projectIdOrKey: string, repoIdOrName: string, number: number): Promise<any>;
|
||||
deletePullRequestAttachment(projectIdOrKey: string, repoIdOrName: string, number: number, attachmentId: number): Promise<any>;
|
||||
getProjectIcon(projectIdOrKey: string): Promise<Entity.File.FileData>;
|
||||
getSharedFile(projectIdOrKey: string, sharedFileId: number): Promise<Entity.File.FileData>;
|
||||
getIssueAttachment(issueIdOrKey: string, attachmentId: number): Promise<Entity.File.FileData>;
|
||||
getWikiAttachment(wikiId: number, attachmentId: number): Promise<Entity.File.FileData>;
|
||||
getPullRequestAttachment(projectIdOrKey: string, repoIdOrName: string, number: number, attachmentId: number): Promise<Entity.File.FileData>;
|
||||
private download(path);
|
||||
private upload(path, params);
|
||||
private parseFileData(response);
|
||||
}
|
||||
|
||||
export class OAuth2 {
|
||||
private credentials;
|
||||
private timeout;
|
||||
constructor(credentials: Option.OAuth2.Credentials, timeout?: number);
|
||||
getAuthorizationURL(options: {
|
||||
host: string;
|
||||
redirectUri?: string;
|
||||
state?: string;
|
||||
}): string;
|
||||
getAccessToken(options: {
|
||||
host: string;
|
||||
code: string;
|
||||
redirectUri?: string;
|
||||
}): Promise<Entity.OAuth2.AccessToken>;
|
||||
refreshAccessToken(options: {
|
||||
host: string;
|
||||
refreshToken: string;
|
||||
}): Promise<Entity.OAuth2.AccessToken>;
|
||||
}
|
||||
|
||||
import { PassThrough } from 'stream';
|
||||
export namespace Entity {
|
||||
export namespace File {
|
||||
export type FileData = NodeFileData | BrowserFileData;
|
||||
export interface NodeFileData {
|
||||
body: PassThrough;
|
||||
url: string;
|
||||
filename: string;
|
||||
}
|
||||
export interface BrowserFileData {
|
||||
body: any;
|
||||
url: string;
|
||||
blob?: () => Promise<Blob>;
|
||||
}
|
||||
}
|
||||
export namespace OAuth2 {
|
||||
export interface AccessToken {
|
||||
access_token: string;
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
refresh_token: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export namespace Option {
|
||||
export type Order = "asc" | "desc";
|
||||
export enum ActivityType {
|
||||
Undefined = -1,
|
||||
IssueCreated = 1,
|
||||
IssueUpdated = 2,
|
||||
IssueCommented = 3,
|
||||
IssueDeleted = 4,
|
||||
WikiCreated = 5,
|
||||
WikiUpdated = 6,
|
||||
WikiDeleted = 7,
|
||||
FileAdded = 8,
|
||||
FileUpdated = 9,
|
||||
FileDeleted = 10,
|
||||
SvnCommitted = 11,
|
||||
GitPushed = 12,
|
||||
GitRepositoryCreated = 13,
|
||||
IssueMultiUpdated = 14,
|
||||
ProjectUserAdded = 15,
|
||||
ProjectUserRemoved = 16,
|
||||
NotifyAdded = 17,
|
||||
PullRequestAdded = 18,
|
||||
PullRequestUpdated = 19,
|
||||
PullRequestCommented = 20,
|
||||
PullRequestMerged = 21,
|
||||
}
|
||||
export namespace Notification {
|
||||
export interface GetNotificationsParams {
|
||||
minId?: number;
|
||||
maxId?: number;
|
||||
count?: number;
|
||||
order?: Order;
|
||||
}
|
||||
export interface GetNotificationsCountParams {
|
||||
alreadyRead: boolean;
|
||||
resourceAlreadyRead: boolean;
|
||||
}
|
||||
}
|
||||
export namespace Space {
|
||||
export interface GetActivitiesParams {
|
||||
activityTypeId?: ActivityType[];
|
||||
minId?: number;
|
||||
maxId?: number;
|
||||
count?: number;
|
||||
order?: Order;
|
||||
}
|
||||
export interface PutSpaceNotificationParams {
|
||||
content: string;
|
||||
}
|
||||
}
|
||||
export namespace User {
|
||||
export interface PostUserParams {
|
||||
userId: string;
|
||||
password: string;
|
||||
name: string;
|
||||
mailAddress: string;
|
||||
roleType: RoleType;
|
||||
}
|
||||
export interface PatchUserParams {
|
||||
password?: string;
|
||||
name?: string;
|
||||
mailAddress?: string;
|
||||
roleType?: RoleType;
|
||||
}
|
||||
export enum RoleType {
|
||||
Admin = 1,
|
||||
User = 2,
|
||||
Reporter = 3,
|
||||
Viewer = 4,
|
||||
GuestReporter = 5,
|
||||
GuestViewer = 6,
|
||||
}
|
||||
export interface GetUserActivitiesParams {
|
||||
activityTypeId?: ActivityType[];
|
||||
minId?: number;
|
||||
maxId?: number;
|
||||
count?: number;
|
||||
order?: Order;
|
||||
}
|
||||
export interface GetUserStarsParams {
|
||||
minId?: number;
|
||||
maxId?: number;
|
||||
count?: number;
|
||||
order?: Order;
|
||||
}
|
||||
export interface GetUserStarsCountParams {
|
||||
since?: string;
|
||||
until?: string;
|
||||
}
|
||||
export interface GetRecentlyViewedParams {
|
||||
order?: Order;
|
||||
offset?: number;
|
||||
count?: number;
|
||||
}
|
||||
}
|
||||
export namespace Group {
|
||||
export interface GetGroupsParams {
|
||||
order?: Order;
|
||||
offset?: number;
|
||||
count?: number;
|
||||
}
|
||||
export interface PostGroupsParams {
|
||||
name: string;
|
||||
members?: string[];
|
||||
}
|
||||
export interface PatchGroupParams {
|
||||
name?: string;
|
||||
members?: string[];
|
||||
}
|
||||
}
|
||||
export namespace Project {
|
||||
export type TextFormattingRule = "backlog" | "markdown";
|
||||
export interface PostProjectParams {
|
||||
name: string;
|
||||
key: string;
|
||||
chartEnabled: boolean;
|
||||
projectLeaderCanEditProjectLeader?: boolean;
|
||||
subtaskingEnabled: boolean;
|
||||
textFormattingRule: TextFormattingRule;
|
||||
}
|
||||
export interface PatchProjectParams {
|
||||
name?: string;
|
||||
key?: string;
|
||||
chartEnabled?: boolean;
|
||||
subtaskingEnabled?: boolean;
|
||||
projectLeaderCanEditProjectLeader?: boolean;
|
||||
textFormattingRule?: TextFormattingRule;
|
||||
archived?: boolean;
|
||||
}
|
||||
export interface GetProjectsParams {
|
||||
archived?: boolean;
|
||||
all?: boolean;
|
||||
}
|
||||
export interface DeleteProjectUsersParams {
|
||||
userId: number;
|
||||
}
|
||||
export interface PostProjectAdministrators {
|
||||
userId: number;
|
||||
}
|
||||
export interface DeleteProjectAdministrators {
|
||||
userId: number;
|
||||
}
|
||||
export type IssueTypeColor = "#e30000" | "#990000" | "#934981" | "#814fbc" | "#2779ca" | "#007e9a" | "#7ea800" | "#ff9200" | "#ff3265" | "#666665";
|
||||
export interface PostIssueTypeParams {
|
||||
name: string;
|
||||
color: IssueTypeColor;
|
||||
}
|
||||
export interface PatchIssueTypeParams {
|
||||
name?: string;
|
||||
color?: IssueTypeColor;
|
||||
}
|
||||
export interface DeleteIssueTypeParams {
|
||||
substituteIssueTypeId: number;
|
||||
}
|
||||
export interface PostCategoriesParams {
|
||||
name: string;
|
||||
}
|
||||
export interface PatchCategoriesParams {
|
||||
name: string;
|
||||
}
|
||||
export interface PostVersionsParams {
|
||||
name: string;
|
||||
description: string;
|
||||
startDate: string;
|
||||
releaseDueDate: string;
|
||||
}
|
||||
export interface PatchVersionsParams {
|
||||
name: string;
|
||||
description?: string;
|
||||
startDate?: string;
|
||||
releaseDueDate?: string;
|
||||
archived?: boolean;
|
||||
}
|
||||
export interface PostCustomFieldParams {
|
||||
typeId: FieldType;
|
||||
name: string;
|
||||
applicableIssueTypes?: number[];
|
||||
description?: string;
|
||||
required?: boolean;
|
||||
}
|
||||
export interface PostCustomFieldWithNumericParams extends PostCustomFieldParams {
|
||||
min?: number;
|
||||
max?: number;
|
||||
initialValue?: number;
|
||||
unit?: string;
|
||||
}
|
||||
export interface PostCustomFieldWithDateParams extends PostCustomFieldParams {
|
||||
min?: string;
|
||||
max?: string;
|
||||
initialValueType?: number;
|
||||
initialDate?: string;
|
||||
initialShift?: number;
|
||||
}
|
||||
export interface PostCustomFieldWithListParams extends PostCustomFieldParams {
|
||||
items?: string[];
|
||||
allowInput?: boolean;
|
||||
allowAddItem?: boolean;
|
||||
}
|
||||
export interface PatchCustomFieldParams {
|
||||
name?: string;
|
||||
applicableIssueTypes?: number[];
|
||||
description?: string;
|
||||
required?: boolean;
|
||||
}
|
||||
export interface PatchCustomFieldWithNumericParams extends PatchCustomFieldParams {
|
||||
min?: number;
|
||||
max?: number;
|
||||
initialValue?: number;
|
||||
unit?: string;
|
||||
}
|
||||
export interface PatchCustomFieldWithDateParams extends PatchCustomFieldParams {
|
||||
min?: string;
|
||||
max?: string;
|
||||
initialValueType?: number;
|
||||
initialDate?: string;
|
||||
initialShift?: number;
|
||||
}
|
||||
export interface PatchCustomFieldWithListParams extends PatchCustomFieldParams {
|
||||
items?: string[];
|
||||
allowInput?: boolean;
|
||||
allowAddItem?: boolean;
|
||||
}
|
||||
export interface PostCustomFieldItemParams {
|
||||
name: string;
|
||||
}
|
||||
export interface PatchCustomFieldItemParams {
|
||||
name: string;
|
||||
}
|
||||
export interface GetSharedFilesParams {
|
||||
order?: Order;
|
||||
offset?: number;
|
||||
count?: number;
|
||||
}
|
||||
export interface PostWebhookParams {
|
||||
name?: string;
|
||||
description?: string;
|
||||
hookUrl?: string;
|
||||
allEvent?: boolean;
|
||||
activityTypeIds?: number[];
|
||||
}
|
||||
export interface PatchWebhookParams {
|
||||
name?: string;
|
||||
description?: string;
|
||||
hookUrl?: string;
|
||||
allEvent?: boolean;
|
||||
activityTypeIds?: number[];
|
||||
}
|
||||
export enum FieldType {
|
||||
Text = 1,
|
||||
TextArea = 2,
|
||||
Numeric = 3,
|
||||
Date = 4,
|
||||
SingleList = 5,
|
||||
MultipleList = 6,
|
||||
CheckBox = 7,
|
||||
Radio = 8,
|
||||
}
|
||||
export interface PostStarParams {
|
||||
issueId?: number;
|
||||
commentId?: number;
|
||||
wikiId?: number;
|
||||
pullRequestId?: number;
|
||||
pullRequestCommentId?: number;
|
||||
}
|
||||
}
|
||||
export namespace Issue {
|
||||
export interface PostIssueParams {
|
||||
projectId: number;
|
||||
summary: string;
|
||||
priorityId: number;
|
||||
issueTypeId: number;
|
||||
parentIssueId?: number;
|
||||
description?: string;
|
||||
startDate?: string;
|
||||
dueDate?: string;
|
||||
estimatedHours?: number;
|
||||
actualHours?: number;
|
||||
categoryId?: number[];
|
||||
versionId?: number[];
|
||||
milestoneId?: number[];
|
||||
assigneeId?: number;
|
||||
notifiedUserId?: number[];
|
||||
attachmentId?: number[];
|
||||
[customField_: string]: any;
|
||||
}
|
||||
export interface PatchIssueParams {
|
||||
summary?: string;
|
||||
parentIssueId?: number;
|
||||
description?: string;
|
||||
statusId?: number;
|
||||
resolutionId?: number;
|
||||
startDate?: string;
|
||||
dueDate?: string;
|
||||
estimatedHours?: number;
|
||||
actualHours?: number;
|
||||
issueTypeId?: number;
|
||||
categoryId?: number[];
|
||||
versionId?: number[];
|
||||
milestoneId?: number[];
|
||||
priorityId?: number;
|
||||
assigneeId?: number;
|
||||
notifiedUserId?: number[];
|
||||
attachmentId?: number[];
|
||||
comment?: string;
|
||||
[customField_: string]: any;
|
||||
}
|
||||
export interface GetIssuesParams {
|
||||
projectId?: number[];
|
||||
issueTypeId?: number[];
|
||||
categoryId?: number[];
|
||||
versionId?: number[];
|
||||
milestoneId?: number[];
|
||||
statusId?: number[];
|
||||
priorityId?: number[];
|
||||
assigneeId?: number[];
|
||||
createdUserId?: number[];
|
||||
resolutionId?: number[];
|
||||
parentChild?: ParentChildType;
|
||||
attachment?: boolean;
|
||||
sharedFile?: boolean;
|
||||
sort?: SortKey;
|
||||
order?: Order;
|
||||
offset?: number;
|
||||
count?: number;
|
||||
createdSince?: string;
|
||||
createdUntil?: string;
|
||||
updatedSince?: string;
|
||||
updatedUntil?: string;
|
||||
startDateSince?: string;
|
||||
startDateUntil?: string;
|
||||
dueDateSince?: string;
|
||||
dueDateUntil?: string;
|
||||
id?: number[];
|
||||
parentIssueId?: number[];
|
||||
keyword: string;
|
||||
[customField_: string]: any;
|
||||
}
|
||||
export enum ParentChildType {
|
||||
All = 0,
|
||||
NotChild = 1,
|
||||
Child = 2,
|
||||
NotChildNotParent = 3,
|
||||
Parent = 4,
|
||||
}
|
||||
export type SortKey = "issueType" | "category" | "version" | "milestone" | "summary" | "status" | "priority" | "attachment" | "sharedFile" | "created" | "createdUser" | "updated" | "updatedUser" | "assignee" | "startDate" | "dueDate" | "estimatedHours" | "actualHours" | "childIssue";
|
||||
export interface GetIssueCommentsParams {
|
||||
minId?: number;
|
||||
maxId?: number;
|
||||
count?: number;
|
||||
order?: Order;
|
||||
}
|
||||
export interface PostIssueCommentsParams {
|
||||
content: string;
|
||||
notifiedUserId?: number[];
|
||||
attachmentId?: number[];
|
||||
}
|
||||
export interface PatchIssueCommentParams {
|
||||
content: string;
|
||||
}
|
||||
export interface IssueCommentNotifications {
|
||||
notifiedUserId: number[];
|
||||
}
|
||||
export interface LinkIssueSharedFilesParams {
|
||||
fileId: number[];
|
||||
}
|
||||
}
|
||||
export namespace PullRequest {
|
||||
export interface GetPullRequestsParams {
|
||||
statusId?: number[];
|
||||
assigneeId?: number[];
|
||||
issueId?: number[];
|
||||
createdUserId?: number[];
|
||||
offset?: number;
|
||||
count?: number;
|
||||
}
|
||||
export interface PostPullRequestParams {
|
||||
summary: string;
|
||||
description: string;
|
||||
base: string;
|
||||
branch: string;
|
||||
issueId?: number;
|
||||
assigneeId?: number;
|
||||
notifiedUserId?: number[];
|
||||
attachmentId?: number[];
|
||||
}
|
||||
export interface PatchPullRequestParams {
|
||||
summary?: string;
|
||||
description?: string;
|
||||
issueId?: number;
|
||||
assigneeId?: number;
|
||||
notifiedUserId?: number[];
|
||||
comment?: string[];
|
||||
}
|
||||
export interface GetPullRequestCommentsParams {
|
||||
minId?: number;
|
||||
maxId?: number;
|
||||
count?: number;
|
||||
order?: Order;
|
||||
}
|
||||
export interface PostPullRequestCommentsParams {
|
||||
content: string;
|
||||
notifiedUserId?: number[];
|
||||
}
|
||||
export interface PatchPullRequestCommentsParams {
|
||||
content: string;
|
||||
}
|
||||
}
|
||||
export namespace Wiki {
|
||||
export interface PostWikiParams {
|
||||
projectId: number;
|
||||
name: string;
|
||||
content: string;
|
||||
mailNotify?: boolean;
|
||||
}
|
||||
export interface PatchWikiParams {
|
||||
name?: string;
|
||||
content?: string;
|
||||
mailNotify?: boolean;
|
||||
}
|
||||
export interface GetWikisHistoryParams {
|
||||
minId?: number;
|
||||
maxId?: number;
|
||||
count?: number;
|
||||
order?: Order;
|
||||
}
|
||||
}
|
||||
export namespace OAuth2 {
|
||||
export interface Credentials {
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Error {
|
||||
export class BacklogError extends global.Error {
|
||||
private _name;
|
||||
private _url;
|
||||
private _status;
|
||||
private _body;
|
||||
private _response;
|
||||
constructor(name: BacklogErrorNameType, response: IResponse, body?: {
|
||||
errors: BacklogErrorMessage[];
|
||||
});
|
||||
name: BacklogErrorNameType;
|
||||
url: string;
|
||||
status: number;
|
||||
body: {
|
||||
errors: BacklogErrorMessage[];
|
||||
};
|
||||
response: IResponse;
|
||||
}
|
||||
export class BacklogApiError extends BacklogError {
|
||||
constructor(response: IResponse, body?: {
|
||||
errors: BacklogErrorMessage[];
|
||||
});
|
||||
}
|
||||
export class BacklogAuthError extends BacklogError {
|
||||
constructor(response: IResponse, body?: {
|
||||
errors: BacklogErrorMessage[];
|
||||
});
|
||||
}
|
||||
export class UnexpectedError extends BacklogError {
|
||||
constructor(response: IResponse);
|
||||
}
|
||||
export interface BacklogErrorMessage {
|
||||
message: string;
|
||||
code: number;
|
||||
errorInfo: string;
|
||||
moreInfo: string;
|
||||
}
|
||||
export type BacklogErrorNameType = 'BacklogApiError' | 'BacklogAuthError' | 'UnexpectedError';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,6 +82,7 @@ var voidProm: Promise<void>;
|
||||
|
||||
var fooProm: Promise<Foo>;
|
||||
var barProm: Promise<Bar>;
|
||||
var barOrVoidProm: Promise<Bar | void>;
|
||||
var fooOrBarProm: Promise<Foo|Bar>;
|
||||
var bazProm: Promise<Baz>;
|
||||
|
||||
@@ -221,12 +222,12 @@ barProm = fooProm.then((value: Foo) => {
|
||||
}, (reason: any) => {
|
||||
return barProm;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
barOrVoidProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
barOrVoidProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return voidProm;
|
||||
|
||||
Vendored
+4
-2
@@ -47,8 +47,10 @@ class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R> {
|
||||
/**
|
||||
* Promises/A+ `.then()`. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
*/
|
||||
then<U>(onFulfill: (value: R) => U | Bluebird.Thenable<U>, onReject?: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U>;
|
||||
then<U>(onFulfill: (value: R) => U | Bluebird.Thenable<U>, onReject?: (error: any) => void | Bluebird.Thenable<void>): Bluebird<U>;
|
||||
then<U1, U2>(onFulfill: (value: R) => U1 | Bluebird.Thenable<U1>, onReject: (error: any) => U2 | Bluebird.Thenable<U2>): Bluebird<U1 | U2>;
|
||||
then<U>(onFulfill: (value: R) => U | Bluebird.Thenable<U>, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U>;
|
||||
then<U>(onFulfill: (value: R) => U | Bluebird.Thenable<U>): Bluebird<U>;
|
||||
then(): Bluebird<R>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
|
||||
@@ -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
@@ -0,0 +1,36 @@
|
||||
/// <reference path="bunnymq.d.ts"/>
|
||||
|
||||
import * as bunnymq from "bunnymq";
|
||||
|
||||
// Basic usage
|
||||
var instance = bunnymq({ host: 'amqp://localhost' });
|
||||
|
||||
// Publisher
|
||||
instance.producer.produce('queue:name', 'Hello World!');
|
||||
// Subscriber
|
||||
instance.consumer.consume('queue:name', message => { });
|
||||
|
||||
// RPC Support
|
||||
instance.producer.produce('queue:name', { message: 'content' }, { rpc: true })
|
||||
.then(function (consumerResponse) {
|
||||
console.log(consumerResponse);
|
||||
});
|
||||
|
||||
// Routing keys
|
||||
instance.producer.produce('queue:name', { message: 'content' }, { routingKey: 'my-routing-key' });
|
||||
|
||||
// Config
|
||||
var custom = bunnymq({
|
||||
host: 'amqp://localhost',
|
||||
//number of fetched messages at once on the channel
|
||||
prefetch: 5,
|
||||
//requeue put back message into the broker if consumer crashes/trigger exception
|
||||
requeue: true,
|
||||
//time between two reconnect (ms)
|
||||
timeout: 1000,
|
||||
consumerSuffix: '',
|
||||
//generate a hostname so we can track this connection on the broker (rabbitmq management plugin)
|
||||
hostname: "",
|
||||
//the transport to use to debug. if provided, bunnymq will show some logs
|
||||
transport: new Object()
|
||||
});
|
||||
Vendored
+120
@@ -0,0 +1,120 @@
|
||||
// Type definitions for node-bunnymq 2.2.1
|
||||
// Project: https://github.com/dial-once/node-bunnymq
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bunnymq" {
|
||||
namespace bunnymq {
|
||||
export type ConsumerCallback = (message: Object) => void;
|
||||
|
||||
/**
|
||||
* Consumer.
|
||||
* @interface
|
||||
*/
|
||||
export interface Consumer {
|
||||
/**
|
||||
* Handle messages from a named queue.
|
||||
* @param {string} queue A named queue.
|
||||
* @param {ConsumerCallback} callback A callback.
|
||||
*/
|
||||
consume(queue: string, callback: ConsumerCallback): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* bunnymq instance.
|
||||
* @interface
|
||||
*/
|
||||
export interface Instance {
|
||||
/**
|
||||
* Consumer.
|
||||
* @type {Consumer}
|
||||
*/
|
||||
consumer: Consumer;
|
||||
|
||||
/**
|
||||
* Producer.
|
||||
* @type {Producer}
|
||||
*/
|
||||
producer: Producer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options.
|
||||
* @interface
|
||||
*/
|
||||
export interface Options {
|
||||
/**
|
||||
* Consumer suffix.
|
||||
* @type {string}
|
||||
*/
|
||||
consumerSuffix?: string;
|
||||
|
||||
/**
|
||||
* Host.
|
||||
* @type {string}
|
||||
*/
|
||||
host?: string;
|
||||
|
||||
/**
|
||||
* Hostname.
|
||||
* @type {string}
|
||||
*/
|
||||
hostname?: string;
|
||||
|
||||
/**
|
||||
* Number of fetched messages at once on the channel.
|
||||
* @type {number}
|
||||
*/
|
||||
prefetch?: number;
|
||||
|
||||
/**
|
||||
* Requeue put back message into the broker if consumer crashes/trigger exception.
|
||||
* @type {boolean}
|
||||
*/
|
||||
requeue?: boolean;
|
||||
|
||||
/**
|
||||
* Time between two reconnect (in milliseconds).
|
||||
* @type {number}
|
||||
*/
|
||||
timeout?: number;
|
||||
|
||||
/**
|
||||
* Transport.
|
||||
* @type {any}
|
||||
*/
|
||||
transport?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Producer.
|
||||
* @inteface
|
||||
*/
|
||||
export interface Producer {
|
||||
/**
|
||||
* Send messages to a named queue.
|
||||
* @param {string} queue A named queue.
|
||||
* @param {Object} message A message.
|
||||
* @return {Object} The consumer response.
|
||||
*/
|
||||
produce(queue: string, message: Object, options?: ProducerOptions): PromiseLike<Object>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for producer.
|
||||
* @interface
|
||||
*/
|
||||
export interface ProducerOptions {
|
||||
routingKey?: string;
|
||||
rpc?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param {Options} [options] Options.
|
||||
* @return {Instance} A instance of bunnymq.
|
||||
*/
|
||||
function bunnymq(options?: bunnymq.Options): bunnymq.Instance;
|
||||
export = bunnymq;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path="busboy.d.ts"/>
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import * as Busboy from 'busboy';
|
||||
import * as http from 'http';
|
||||
import * as util from 'util';
|
||||
|
||||
function serverFn(req: http.ServerRequest, res: http.ServerResponse) {
|
||||
if (req.method === 'POST') {
|
||||
var busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
|
||||
console.log('File [' + fieldname + ']: filename: ' + filename + ', encoding: ' + encoding + ', mimetype: ' + mimetype);
|
||||
file.on('data', function(data: Buffer) {
|
||||
console.log('File [' + fieldname + '] got ' + data.length + ' bytes');
|
||||
});
|
||||
file.on('end', function() {
|
||||
console.log('File [' + fieldname + '] Finished');
|
||||
});
|
||||
});
|
||||
busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) {
|
||||
console.log('Field [' + fieldname + ']: value: ' + util.inspect(val));
|
||||
});
|
||||
busboy.on('finish', function() {
|
||||
console.log('Done parsing form!');
|
||||
res.writeHead(303, { Connection: 'close', Location: '/' });
|
||||
res.end();
|
||||
});
|
||||
req.pipe(busboy);
|
||||
} else if (req.method === 'GET') {
|
||||
res.writeHead(200, { Connection: 'close' });
|
||||
res.end('<html><head></head><body>\
|
||||
<form method="POST" enctype="multipart/form-data">\
|
||||
<input type="text" name="textfield"><br />\
|
||||
<input type="file" name="filefield"><br />\
|
||||
<input type="submit">\
|
||||
</form>\
|
||||
</body></html>');
|
||||
}
|
||||
}
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for busboy v0.2.13
|
||||
// Project: https://www.npmjs.com/package/busboy
|
||||
// Definitions by: Jacob Baskin <https://github.com/jacobbaskin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare namespace busboy {
|
||||
interface Options {
|
||||
headers: any;
|
||||
}
|
||||
|
||||
interface BusboyConfig {
|
||||
headers?: any;
|
||||
highWaterMark?: number;
|
||||
fileHwm?: number;
|
||||
defCharset?: string;
|
||||
preservePath?: boolean;
|
||||
limits?: {
|
||||
fieldNameSize?: number;
|
||||
fieldSize?: number;
|
||||
fields?: number;
|
||||
fileSize?: number;
|
||||
files?: number;
|
||||
parts?: number;
|
||||
headerPairs?: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface Busboy extends NodeJS.WritableStream {
|
||||
on(event: 'field',
|
||||
listener: (
|
||||
fieldname: string,
|
||||
val: any,
|
||||
fieldnameTruncated: boolean,
|
||||
valTruncated: boolean,
|
||||
encoding: string,
|
||||
mimetype: string) => void): this;
|
||||
on(event: 'file',
|
||||
listener: (
|
||||
fieldname: string,
|
||||
file: NodeJS.ReadableStream,
|
||||
filename: string,
|
||||
encoding: string,
|
||||
mimetype: string) => void): this;
|
||||
on(event: 'finish', callback: () => void): this;
|
||||
on(event: 'partsLimit', callback: () => void): this;
|
||||
on(event: 'filesLimit', callback: () => void): this;
|
||||
on(event: 'fieldsLimit', callback: () => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
|
||||
interface BusboyConstructor {
|
||||
new (options: BusboyConfig): Busboy;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'busboy' {
|
||||
const temp: busboy.BusboyConstructor;
|
||||
export = temp;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="canvas-gauges.d.ts" />
|
||||
|
||||
import {
|
||||
LinearGaugeOptions,
|
||||
RadialGaugeOptions,
|
||||
LinearGauge,
|
||||
RadialGauge
|
||||
} from 'canvas-gauges';
|
||||
|
||||
let linearOptions: LinearGaugeOptions = {
|
||||
renderTo: document.createElement('canvas')
|
||||
};
|
||||
let radialOptions: RadialGaugeOptions = {
|
||||
renderTo: 'gauge-id'
|
||||
};
|
||||
|
||||
new LinearGauge(linearOptions);
|
||||
new RadialGauge(radialOptions);
|
||||
|
||||
console.log(document.gauges.length);
|
||||
Vendored
+263
@@ -0,0 +1,263 @@
|
||||
// Type definitions for canvas-gauges
|
||||
// Project: https://github.com/Mikhus/canvas-gauges
|
||||
// Definitions by: Mikhus <https://github.com/Mikhus>
|
||||
// Definitions: https://github.com/Mikhus/DefinitelyTyped
|
||||
|
||||
declare namespace CanvasGauges {
|
||||
export type RenderTarget = string|HTMLElement;
|
||||
|
||||
export interface AnimationRule {
|
||||
(percent: number): number;
|
||||
}
|
||||
|
||||
export interface Highlight {
|
||||
from: number,
|
||||
to: number,
|
||||
color: string
|
||||
}
|
||||
|
||||
export type MajorTicks = string[]|number[];
|
||||
|
||||
export interface GenericOptions {
|
||||
renderTo: RenderTarget,
|
||||
width?: number,
|
||||
height?: number,
|
||||
minValue?: number,
|
||||
maxValue?: number,
|
||||
value?: number,
|
||||
units?: string|boolean,
|
||||
majorTicks?: MajorTicks,
|
||||
minorTicks?: number,
|
||||
strokeTicks?: boolean,
|
||||
animatedValue?: boolean,
|
||||
title?: string|boolean,
|
||||
borders?: boolean,
|
||||
valueInt?: number,
|
||||
valueDec?: number,
|
||||
majorTicksInt?: number,
|
||||
majorTicksDec?: number,
|
||||
animation?: boolean,
|
||||
animationDuration?: number,
|
||||
animationRule?: string|AnimationRule,
|
||||
colorPlate?: string,
|
||||
colorMajorTicks?: string,
|
||||
colorMinorTicks?: string,
|
||||
colorTitle?: string,
|
||||
colorUnits?: string,
|
||||
colorNumbers?: string,
|
||||
colorNeedle?: string,
|
||||
colorNeedleEnd?: string,
|
||||
colorValueText?: string,
|
||||
colorValueTextShadow?: string,
|
||||
colorBorderShadow?: string,
|
||||
colorBorderOuter?: string,
|
||||
colorBorderOuterEnd?: string,
|
||||
colorBorderMiddle?: string,
|
||||
colorBorderMiddleEnd?: string,
|
||||
colorBorderInner?: string,
|
||||
colorBorderInnerEnd?: string,
|
||||
colorValueBoxRect?: string,
|
||||
colorValueBoxRectEnd?: string,
|
||||
colorValueBoxBackground?: string,
|
||||
colorValueBoxShadow?: string,
|
||||
colorNeedleShadowUp?: string,
|
||||
colorNeedleShadowDown?: string,
|
||||
needle?: boolean,
|
||||
needleShadow?: boolean,
|
||||
needleType?: string,
|
||||
needleStart?: number,
|
||||
needleEnd?: number,
|
||||
needleWidth?: number,
|
||||
borderOuterWidth?: number,
|
||||
borderMiddleWidth?: number,
|
||||
borderInnerWidth?: number,
|
||||
borderShadowWidth?: number,
|
||||
valueBox?: boolean,
|
||||
valueBoxStroke?: number,
|
||||
valueText?: string,
|
||||
valueTextShadow?: boolean,
|
||||
valueBoxBorderRadius?: number,
|
||||
highlights?: Highlight[],
|
||||
fontNumbers?: string,
|
||||
fontTitle?: string,
|
||||
fontUnits?: string,
|
||||
fontValue?: string,
|
||||
fontTitleSize?: number,
|
||||
fontValueSize?: number,
|
||||
fontUnitsSize?: number,
|
||||
fontNumbersSize?: number
|
||||
}
|
||||
|
||||
export interface RadialGaugeOptions extends GenericOptions {
|
||||
ticksAngle?: number,
|
||||
startAngle?: number,
|
||||
colorNeedleCircleOuter?: string,
|
||||
colorNeedleCircleOuterEnd?: string,
|
||||
colorNeedleCircleInner?: string,
|
||||
colorNeedleCircleInnerEnd?: string,
|
||||
needleCircleSize?: number,
|
||||
needleCircleInner?: boolean,
|
||||
needleCircleOuter?: boolean,
|
||||
animationTarget?: string
|
||||
}
|
||||
|
||||
export interface LinearGaugeOptions extends GenericOptions {
|
||||
borderRadius?: number,
|
||||
barBeginCircle?: number,
|
||||
barWidth?: number,
|
||||
barStrokeWidth?: number,
|
||||
barProgress?: boolean,
|
||||
colorBar?: string,
|
||||
colorBarEnd?: string,
|
||||
colorBarStroke?: string,
|
||||
colorBarProgress?: string,
|
||||
colorBarProgressEnd?: string,
|
||||
tickSide?: string,
|
||||
needleSide?: string,
|
||||
numberSide?: string,
|
||||
ticksWidth?: number,
|
||||
ticksWidthMinor?: number,
|
||||
ticksPadding?: number,
|
||||
barLength?: number
|
||||
}
|
||||
|
||||
export interface DrawEventCallback {
|
||||
(percent: number): any;
|
||||
}
|
||||
|
||||
export interface EndEventCallback {
|
||||
(): any;
|
||||
}
|
||||
|
||||
export interface rules {
|
||||
linear: AnimationRule,
|
||||
quad: AnimationRule,
|
||||
dequad: AnimationRule,
|
||||
quint: AnimationRule,
|
||||
dequint: AnimationRule,
|
||||
cycle: AnimationRule,
|
||||
decycle: AnimationRule,
|
||||
bounce: AnimationRule,
|
||||
debounce: AnimationRule,
|
||||
elastic: AnimationRule,
|
||||
delastic: AnimationRule
|
||||
}
|
||||
|
||||
export class Animation {
|
||||
public duration: number;
|
||||
public rule: string|AnimationRule;
|
||||
public draw: DrawEventCallback;
|
||||
public end: EndEventCallback;
|
||||
|
||||
public static rules: rules;
|
||||
|
||||
constructor(rule?: string|AnimationRule, duration?: number,
|
||||
draw?: DrawEventCallback, end?: EndEventCallback);
|
||||
|
||||
public animate(draw?: DrawEventCallback, end?: EndEventCallback): any;
|
||||
public destroy(): any;
|
||||
}
|
||||
|
||||
export class SmartCanvas {
|
||||
public element: HTMLCanvasElement;
|
||||
public elementClone: HTMLCanvasElement;
|
||||
public context: CanvasRenderingContext2D;
|
||||
public contextClone: CanvasRenderingContext2D;
|
||||
public drawWidth: number;
|
||||
public drawHeight: number;
|
||||
public drawX: number;
|
||||
public drawY: number;
|
||||
public minSide: number;
|
||||
public width: number;
|
||||
public height: number;
|
||||
|
||||
constructor(element: HTMLCanvasElement,
|
||||
width?: number,
|
||||
height?: number);
|
||||
|
||||
public init(): any;
|
||||
public onRedraw(): any;
|
||||
public destroy(): any;
|
||||
public commit(): SmartCanvas;
|
||||
public redraw(): SmartCanvas;
|
||||
|
||||
public pixelRatio: number;
|
||||
public static redraw(): any;
|
||||
public static collection: Array<SmartCanvas>;
|
||||
}
|
||||
|
||||
export class DomObserver {
|
||||
public Type: BaseGauge;
|
||||
public mutationsObserved: boolean;
|
||||
public isObservable: boolean;
|
||||
public options: GenericOptions;
|
||||
public element: string;
|
||||
public type: string;
|
||||
|
||||
constructor(options: GenericOptions,
|
||||
element: string,
|
||||
type: string);
|
||||
|
||||
public isValidNode(node: Node|HTMLElement): boolean;
|
||||
public traverse(): any;
|
||||
public observe(records: MutationRecord[]): any;
|
||||
public process(node: Node|HTMLElement): BaseGauge;
|
||||
|
||||
public static parse(value: any): any;
|
||||
public static toDashed(camelCase: string): string;
|
||||
public static toAttributeName(str: string): string;
|
||||
static domReady(handler: Function): any;
|
||||
}
|
||||
|
||||
export abstract class BaseGauge {
|
||||
public type: BaseGauge;
|
||||
public options: GenericOptions;
|
||||
public canvas: SmartCanvas;
|
||||
public animation: Animation;
|
||||
public value: number;
|
||||
|
||||
constructor(options: GenericOptions);
|
||||
|
||||
public update(options: GenericOptions): BaseGauge;
|
||||
public destroy(): any;
|
||||
public abstract draw(): BaseGauge;
|
||||
|
||||
public static initialize(type: string, options: GenericOptions): any;
|
||||
}
|
||||
|
||||
export class RadialGauge extends BaseGauge {
|
||||
public type: RadialGauge;
|
||||
public options: RadialGaugeOptions;
|
||||
|
||||
constructor(options: RadialGaugeOptions);
|
||||
|
||||
public draw(): RadialGauge;
|
||||
}
|
||||
|
||||
export class LinearGauge extends BaseGauge {
|
||||
public type: LinearGauge;
|
||||
public options: LinearGaugeOptions;
|
||||
|
||||
constructor(options: LinearGaugeOptions);
|
||||
|
||||
public draw(): LinearGauge;
|
||||
}
|
||||
|
||||
export interface Collection extends Array<BaseGauge> {
|
||||
get: (id: number | string) => BaseGauge;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'canvas-gauges' {
|
||||
export = CanvasGauges;
|
||||
}
|
||||
|
||||
interface Document {
|
||||
gauges: CanvasGauges.Collection;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
BaseGauge: CanvasGauges.BaseGauge;
|
||||
RadialGauge: CanvasGauges.RadialGauge;
|
||||
LinearGauge: CanvasGauges.LinearGauge;
|
||||
}
|
||||
@@ -18,9 +18,19 @@ function test_somethingSyntax() {
|
||||
array.should.include.something.with.property('b', 2);
|
||||
array.should.not.include.something.with.property('b', 3);
|
||||
|
||||
chai.expect(array).to.include.something();
|
||||
chai.expect(array).to.include.something.that.deep.equals({ b: 2 });
|
||||
chai.expect(array).to.include.something.that.not.deep.equals({ b: 2 });
|
||||
chai.expect(array).not.to.include.something.that.deep.equals({ c: 3 });
|
||||
chai.expect(array).to.include.something.that.not.deep.equals({ c: 3 });
|
||||
chai.expect(array).to.include.something.with.property('b', 2);
|
||||
chai.expect(array).not.to.include.something.with.property('b', 3);
|
||||
|
||||
var array2 = [{ a: 'b' }, { a: 'b' }];
|
||||
array2.should.include.something.that.have.property("a");
|
||||
array2.should.include.something.that.have.property("a").not.equal("d");
|
||||
chai.expect(array2).to.include.something.that.have.property("a");
|
||||
chai.expect(array2).to.include.something.that.have.property("a").not.equal("d");
|
||||
}
|
||||
|
||||
function test_somethingVariantsSyntax() {
|
||||
@@ -35,6 +45,16 @@ function test_somethingVariantsSyntax() {
|
||||
array.should.include.one.that.deep.equals({ b: 2 });
|
||||
array.should.include.some();
|
||||
array.should.include.some.that.deep.equal({ b: 2 });
|
||||
|
||||
chai.expect(array).to.include.a.thing();
|
||||
chai.expect(array).to.include.a.thing.that.deep.equals({ b: 2 });
|
||||
chai.expect(array).to.include.an.item();
|
||||
chai.expect(array).to.include.an.item.that.deep.equals({ b: 2 });
|
||||
chai.expect(array).to.include.one.that.deep.equals({ b: 2 });
|
||||
chai.expect(array).to.include.some();
|
||||
chai.expect(array).to.include.some.that.deep.equal({ b: 2 });
|
||||
chai.expect(array).to.contain.a.thing();
|
||||
chai.expect(array).to.contain.a.thing.with.property('a', 1);
|
||||
}
|
||||
|
||||
function test_allSyntax() {
|
||||
|
||||
Vendored
+9
@@ -23,6 +23,15 @@ declare namespace Chai {
|
||||
any: Anything;
|
||||
}
|
||||
|
||||
interface Include {
|
||||
(item: any): any;
|
||||
a: Item;
|
||||
an: Item;
|
||||
one: Something;
|
||||
some: Something;
|
||||
something: Something;
|
||||
}
|
||||
|
||||
interface Anything extends Assertion {
|
||||
(): any;
|
||||
that: Assertion;
|
||||
|
||||
Vendored
+8
@@ -114,8 +114,16 @@ declare namespace Chance {
|
||||
capitalize(str: string): string;
|
||||
mixin(desc: MixinDescriptor): any;
|
||||
pad(num: number, width: number, padChar?: string): string;
|
||||
/**
|
||||
* @deprecated Use pickone
|
||||
*/
|
||||
pick<T>(arr: T[]): T;
|
||||
pickone<T>(arr: T[]): T;
|
||||
/**
|
||||
* @deprecated Use pickset
|
||||
*/
|
||||
pick<T>(arr: T[], count: number): T[];
|
||||
pickset<T>(arr: T[], count: number): T[];
|
||||
set: Setter;
|
||||
shuffle<T>(arr: T[]): T[];
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -73,7 +73,7 @@ interface ChartOptions {
|
||||
onClick?: (any?: any) => any;
|
||||
title?: ChartTitleOptions;
|
||||
legend?: ChartLegendOptions;
|
||||
tooltip?: ChartTooltipOptions;
|
||||
tooltips?: ChartTooltipOptions;
|
||||
hover?: ChartHoverOptions;
|
||||
animation?: ChartAnimationOptions;
|
||||
elements?: ChartElementsOptions;
|
||||
|
||||
@@ -3,9 +3,17 @@
|
||||
|
||||
import colors = require("colors");
|
||||
|
||||
colors.enabled = true;
|
||||
|
||||
console.log(colors.black.underline('test'));
|
||||
console.log(colors.rainbow.black.blue.gray('test'));
|
||||
console.log(colors.random.reset.bgWhite.dim('test'));
|
||||
console.log(colors.random.reset.bgWhite.strip('test'));
|
||||
console.log('test'.black.underline);
|
||||
console.log('test'.rainbow.black.blue.gray);
|
||||
console.log('test'.random.reset.bgWhite.dim);
|
||||
console.log('test'.random.reset.bgWhite.dim.stripColors);
|
||||
|
||||
colors.enabled = false;
|
||||
|
||||
console.log(colors.black.underline('test'));
|
||||
|
||||
Vendored
+11
@@ -7,6 +7,9 @@ declare module "colors" {
|
||||
interface Color {
|
||||
(text: string): string;
|
||||
|
||||
strip: Color;
|
||||
stripColors: Color;
|
||||
|
||||
black: Color;
|
||||
red: Color;
|
||||
green: Color;
|
||||
@@ -47,6 +50,11 @@ declare module "colors" {
|
||||
namespace e {
|
||||
export function setTheme(theme:any): void;
|
||||
|
||||
export var enabled: boolean;
|
||||
|
||||
export var strip: Color;
|
||||
export var stripColors: Color;
|
||||
|
||||
export var black: Color;
|
||||
export var red: Color;
|
||||
export var green: Color;
|
||||
@@ -88,6 +96,9 @@ declare module "colors" {
|
||||
}
|
||||
|
||||
interface String {
|
||||
strip: string;
|
||||
stripColors: string;
|
||||
|
||||
black: string;
|
||||
red: string;
|
||||
green: string;
|
||||
|
||||
Vendored
+2
-2
@@ -1889,7 +1889,7 @@ declare module "core-js/fn/number/max-safe-integer" {
|
||||
var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER;
|
||||
export = MAX_SAFE_INTEGER;
|
||||
}
|
||||
declare module "core-js/fn/number/min-safe-interger" {
|
||||
declare module "core-js/fn/number/min-safe-integer" {
|
||||
var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER;
|
||||
export = MIN_SAFE_INTEGER;
|
||||
}
|
||||
@@ -2668,7 +2668,7 @@ declare module "core-js/library/fn/number/max-safe-integer" {
|
||||
var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER;
|
||||
export = MAX_SAFE_INTEGER;
|
||||
}
|
||||
declare module "core-js/library/fn/number/min-safe-interger" {
|
||||
declare module "core-js/library/fn/number/min-safe-integer" {
|
||||
var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER;
|
||||
export = MIN_SAFE_INTEGER;
|
||||
}
|
||||
|
||||
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,30 +1,32 @@
|
||||
/// <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;
|
||||
|
||||
|
||||
hook.Before(function(scenario, callback){
|
||||
scenario.isFailed() && callback.pending();
|
||||
})
|
||||
|
||||
|
||||
hook.Around(function(scenario, runScenario) {
|
||||
scenario.isFailed() && runScenario(null, function(){
|
||||
console.log('finish tasks');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
hook.registerHandler('AfterFeatures', function (event, callback) {
|
||||
callback();
|
||||
});
|
||||
|
||||
|
||||
step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback:Callback) {
|
||||
this.visit('https://github.com/cucumber/cucumber-js', callback);
|
||||
});
|
||||
|
||||
step.When(/^I go to the README file$/, function(title:string, callback:Callback) {
|
||||
callback.pending();
|
||||
callback(null, 'pending');
|
||||
});
|
||||
|
||||
step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback:Callback) {
|
||||
@@ -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
+11
-2
@@ -7,11 +7,20 @@ declare namespace cucumber {
|
||||
|
||||
export interface CallbackStepDefinition{
|
||||
pending : () => PromiseLike<any>;
|
||||
(errror?:any):void;
|
||||
(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
+5
-3
@@ -297,7 +297,7 @@ declare namespace d3 {
|
||||
* @param value the function to compute data for each node
|
||||
*/
|
||||
datum<NewDatum>(value: (datum: Datum, index: number, outerIndex: number) => NewDatum): Update<NewDatum>;
|
||||
|
||||
|
||||
/**
|
||||
* Set the data item for each node in the selection.
|
||||
* @param value the constant element to use for each node
|
||||
@@ -415,7 +415,7 @@ declare namespace d3 {
|
||||
|
||||
select(name: (datum: Datum, index: number, outerIndex: number) => EventTarget): Selection<Datum>;
|
||||
call(func: (selection: Enter<Datum>, ...args: any[]) => any, ...args: any[]): Enter<Datum>;
|
||||
|
||||
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ declare namespace d3 {
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T>(array: T[], accessor: (datum: T, index: number) => string): [string, string];
|
||||
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
@@ -2928,6 +2928,8 @@ declare namespace d3 {
|
||||
|
||||
start(): Force<Link, Node>;
|
||||
|
||||
tick(): Force<Link, Node>;
|
||||
|
||||
alpha(): number;
|
||||
alpha(value: number): Force<Link, Node>;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="date-fns.d.ts" />
|
||||
|
||||
import {addDays, closestIndexTo, differenceInCalendarWeeks, max, isDate} from 'date-fns';
|
||||
import * as addHours from 'date-fns/add_hours';
|
||||
|
||||
function test() {
|
||||
|
||||
addDays(new Date(), 5);
|
||||
closestIndexTo(new Date(), [new Date(), new Date()]);
|
||||
addHours(new Date(), 5);
|
||||
differenceInCalendarWeeks(new Date(), new Date());
|
||||
differenceInCalendarWeeks(new Date(), new Date(), {weekStartsOn: 1});
|
||||
max(new Date(), new Date());
|
||||
isDate({});
|
||||
|
||||
}
|
||||
Vendored
+1195
File diff suppressed because it is too large
Load Diff
Vendored
+17
-1
@@ -5686,7 +5686,23 @@ declare namespace dojo {
|
||||
* @param dest The object to which to copy/add all properties contained in source. If dest is falsy, thena new object is manufactured before copying/adding properties begins.
|
||||
* @param sources One of more objects from which to draw all properties to copy into dest. sources are processedleft-to-right and if more than one of these objects contain the same property name, the right-mostvalue "wins".
|
||||
*/
|
||||
mixin(dest: Object, source: Object, sources?: Object[]): Object;
|
||||
mixin<T>(dest: T): T;
|
||||
mixin<T, U>(
|
||||
dest: T,
|
||||
source: U
|
||||
): T & U;
|
||||
mixin<T, U, V>(
|
||||
dest: T,
|
||||
source1: U,
|
||||
source2: V
|
||||
): T & U & V;
|
||||
mixin<T, U, V, W>(
|
||||
dest: T,
|
||||
source1: U,
|
||||
source2: V,
|
||||
source3: W
|
||||
): T & U & V & W;
|
||||
mixin<T>(dest: Object, ...sources: Object[]): T;
|
||||
/**
|
||||
* similar to hitch() except that the scope object is left to be
|
||||
* whatever the execution context eventually becomes.
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="./dva.d.ts" />
|
||||
|
||||
import React = __React;
|
||||
|
||||
import dva from 'dva';
|
||||
import { connect } from 'dva';
|
||||
import { Router, Route } from 'dva/router';
|
||||
|
||||
// 1. Initialize
|
||||
const app = dva();
|
||||
|
||||
// 2. Model
|
||||
app.model({
|
||||
namespace: 'count',
|
||||
state: 0,
|
||||
reducers: {
|
||||
add(count: number) {
|
||||
return count + 1
|
||||
},
|
||||
minus(count: number) {
|
||||
return count - 1
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// 3. View
|
||||
const App = connect(({ count }) => ({
|
||||
count
|
||||
}))(function ({ count, dispatch }) {
|
||||
return (
|
||||
<div>
|
||||
<h2>{ count }</h2>
|
||||
<button key="add" onClick={() => { dispatch({type: 'count/add'})}}>+</button>
|
||||
<button key="minus" onClick={() => { dispatch({type: 'count/minus'})}}>-</button>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
// 4. Router
|
||||
app.router(({ history }) =>
|
||||
<Router history={history}>
|
||||
<Route path="/" component={App}/>
|
||||
</Router>
|
||||
);
|
||||
|
||||
// 5. Start
|
||||
const countApp = app.start();
|
||||
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
// Type definitions for dva v1.0.0
|
||||
// Project: https://github.com/dvajs/dva
|
||||
// Definitions by: nikogu <https://github.com/nikogu/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
declare module 'dva' {
|
||||
/** connecting Container Components */
|
||||
export function connect(maps:Object):Function;
|
||||
|
||||
export default function dva(opts?:Object):{
|
||||
|
||||
/** dva plugin */
|
||||
use: (hooks:Object)=>void,
|
||||
|
||||
/** dva bootstrap */
|
||||
start: (selector?:String|HTMLElement)=>void,
|
||||
|
||||
/** dva add model */
|
||||
model: (model:Object)=>void,
|
||||
|
||||
/** dva setting router */
|
||||
router: (router:Object)=>Object|JSX.Element,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/reactjs/react-router
|
||||
*/
|
||||
declare module 'dva/router' {
|
||||
import React = __React;
|
||||
|
||||
interface RouterProps {
|
||||
history?: Object
|
||||
}
|
||||
export class Router extends React.Component<RouterProps, {}> {
|
||||
render():JSX.Element
|
||||
}
|
||||
|
||||
|
||||
interface RouteProps {
|
||||
path?: string,
|
||||
component?: React.ReactNode
|
||||
}
|
||||
export class Route extends React.Component<RouteProps, {}> {
|
||||
render():JSX.Element
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/reactjs/react-router-redux
|
||||
*/
|
||||
export class routerRedux {}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/fis-components/whatwg-fetch
|
||||
*/
|
||||
declare module 'dva/fetch' {
|
||||
export default Function;
|
||||
}
|
||||
Vendored
+210
-210
File diff suppressed because it is too large
Load Diff
@@ -45,4 +45,44 @@ client.create({
|
||||
index: 'index',
|
||||
type: 'type'
|
||||
}, (err, repsonse, status) => {
|
||||
});
|
||||
|
||||
client.cluster.getSettings({
|
||||
masterTimeout: 100
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
client.cluster.health({
|
||||
masterTimeout: 100
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
client.cluster.pendingTasks({
|
||||
ignore: 1
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
client.cluster.putSettings({
|
||||
ignore: 1
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
client.cluster.putSettings({
|
||||
ignore: 1
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
client.cluster.reroute({
|
||||
ignore: 1
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
client.cluster.state({
|
||||
ignore: 1
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
client.cluster.stats({
|
||||
ignore: 1
|
||||
}, (err, response) => {
|
||||
});
|
||||
Vendored
+89
-1
@@ -1,12 +1,14 @@
|
||||
// Type definitions for elasticsearch
|
||||
// Project: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html
|
||||
// Definitions by: Casper Skydt <https://github.com/CasperSkydt/DefinitelyTyped>
|
||||
// Definitions by: Casper Skydt <https://github.com/CasperSkydt/DefinitelyTyped>, Blake Smith <https://github.com/bfsmith/DefinitelyTyped>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module Elasticsearch {
|
||||
export class Client {
|
||||
constructor(params: ConfigOptions);
|
||||
indices: Indices;
|
||||
cluster: Cluster;
|
||||
cat: Cat;
|
||||
bulk(params: BulkIndexDocumentsParams): PromiseLike<any>;
|
||||
bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void;
|
||||
create(params: CreateDocumentParams): PromiseLike<any>;
|
||||
@@ -230,6 +232,7 @@ declare module Elasticsearch {
|
||||
scroll?: string;
|
||||
search_type?: string;
|
||||
fields?: string[];
|
||||
from?: number;
|
||||
size?: number;
|
||||
sort?: string | string[] | boolean;
|
||||
_source?: string | string[] | boolean;
|
||||
@@ -333,6 +336,91 @@ declare module Elasticsearch {
|
||||
body: string | any;
|
||||
index: string | string[] | boolean;
|
||||
}
|
||||
|
||||
export interface Cat {
|
||||
health(params: CatHealthOptions, callback: (error: any, response: any) => void): void;
|
||||
health(params: CatHealthOptions): PromiseLike<any>
|
||||
}
|
||||
|
||||
export interface CatHealthOptions extends GenericParams {
|
||||
local?: boolean;
|
||||
masterTimeout?: number | Date;
|
||||
h?: string | string[] | boolean;
|
||||
help?: boolean;
|
||||
ts?: boolean;
|
||||
v?: boolean;
|
||||
}
|
||||
|
||||
export interface Cluster {
|
||||
getSettings(params: ClusterGetSettingsOptions, callback: (error: any, response: any) => void): void;
|
||||
getSettings(params: ClusterGetSettingsOptions): PromiseLike<any>;
|
||||
health(params: ClusterHealthOptions, callback: (error: any, response: any) => void): void;
|
||||
health(params: ClusterHealthOptions): PromiseLike<any>;
|
||||
pendingTasks(params: ClusterPendingTasksOptions, callback: (error: any, response: any) => void): void;
|
||||
pendingTasks(params: ClusterPendingTasksOptions): PromiseLike<any>;
|
||||
putSettings(params: ClusterPutSettingsOptions, callback: (error: any, response: any) => void): void;
|
||||
putSettings(params: ClusterPutSettingsOptions): PromiseLike<any>;
|
||||
reroute(params: ClusterRerouteOptions, callback: (error: any, response: any) => void): void;
|
||||
reroute(params: ClusterRerouteOptions): PromiseLike<any>;
|
||||
state(params: ClusterStateOptions, callback: (error: any, response: any) => void): void;
|
||||
state(params: ClusterStateOptions): PromiseLike<any>;
|
||||
stats(params: ClusterStatsOptions, callback: (error: any, response: any) => void): void;
|
||||
stats(params: ClusterStatsOptions): PromiseLike<any>;
|
||||
}
|
||||
|
||||
export interface ClusterGetSettingsOptions extends GenericParams {
|
||||
flatSettings?: boolean;
|
||||
masterTimeout?: number | Date;
|
||||
timeout?: number | Date;
|
||||
}
|
||||
|
||||
export interface ClusterHealthOptions extends GenericParams {
|
||||
level?: string; // cluster, indices, shards
|
||||
local?: boolean;
|
||||
masterTimeout?: number | Date;
|
||||
waitForActiveShards?: number;
|
||||
waitForNodes?: string;
|
||||
waitForRelocatingShards?: number;
|
||||
waitForStatus?: string; // green, yellow, red
|
||||
index?: string | string[] | boolean;
|
||||
}
|
||||
|
||||
export interface ClusterPendingTasksOptions extends GenericParams {
|
||||
local?: boolean;
|
||||
masterTimeout?: number | Date;
|
||||
}
|
||||
|
||||
export interface ClusterPutSettingsOptions extends GenericParams {
|
||||
flatSettings?: boolean;
|
||||
masterTimeout?: number | Date;
|
||||
timeout?: number | Date;
|
||||
}
|
||||
|
||||
export interface ClusterRerouteOptions extends GenericParams {
|
||||
dryRun?: boolean;
|
||||
explain?: boolean;
|
||||
metric?: string | string[] | boolean;
|
||||
masterTimeout?: number | Date;
|
||||
timeout?: number | Date;
|
||||
}
|
||||
|
||||
export interface ClusterStateOptions extends GenericParams {
|
||||
local?: boolean;
|
||||
masterTimeout?: number | Date;
|
||||
flatSettings?: boolean;
|
||||
ignoreUnavailable?: boolean;
|
||||
allowNoIndices?: boolean;
|
||||
expandWildcards?: string; // open, closed, none, all (default open)
|
||||
index?: string | string[] | boolean;
|
||||
metric?: string | string[] | boolean;
|
||||
}
|
||||
|
||||
export interface ClusterStatsOptions extends GenericParams {
|
||||
flatSettings?: boolean;
|
||||
human?: boolean;
|
||||
timeout?: number | Date;
|
||||
nodeId?: string | string[] | boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "elasticsearch" {
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
Vendored
+2
-1
@@ -79,8 +79,9 @@ declare module "fs-extra" {
|
||||
export interface CopyOptions {
|
||||
clobber?: boolean
|
||||
preserveTimestamps?: boolean
|
||||
dereference?: boolean
|
||||
dereference?: boolean
|
||||
filter?: CopyFilter
|
||||
recursive?: boolean
|
||||
}
|
||||
|
||||
export interface OpenOptions {
|
||||
|
||||
Vendored
+9
-7
@@ -25,15 +25,17 @@ declare namespace FullCalendar {
|
||||
end: moment.Moment;
|
||||
}
|
||||
|
||||
export interface Header {
|
||||
left: string;
|
||||
center: string;
|
||||
right: string;
|
||||
}
|
||||
|
||||
export interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions {
|
||||
// General display - http://fullcalendar.io/docs/display/
|
||||
|
||||
header?: {
|
||||
left: string;
|
||||
center: string;
|
||||
right: string;
|
||||
}
|
||||
theme?: boolean
|
||||
header?: boolean | Header;
|
||||
theme?: boolean;
|
||||
buttonIcons?: {
|
||||
prev: string;
|
||||
next: string;
|
||||
@@ -50,7 +52,7 @@ declare namespace FullCalendar {
|
||||
contentHeight?: number;
|
||||
aspectRatio?: number;
|
||||
handleWindowResize?: boolean;
|
||||
views?: ViewSpecificOptions;
|
||||
views?: ViewSpecificOptions;
|
||||
viewRender?: (view: ViewObject, element: JQuery) => void;
|
||||
viewDestroy?: (view: ViewObject, element: JQuery) => void;
|
||||
dayRender?: (date: Date, cell: HTMLTableDataCellElement) => void;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/// <reference path="geojson2osm.d.ts" />
|
||||
/// <reference path="../geojson/geojson.d.ts" />
|
||||
|
||||
import { geojson2osm } from 'geojson2osm'
|
||||
|
||||
const features: GeoJSON.FeatureCollection<any> = {
|
||||
type: 'FeatureCollection',
|
||||
features: [{
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
'building:colour': '#9F8169',
|
||||
'building:levels': 21,
|
||||
building: 'yes',
|
||||
height: 57,
|
||||
},
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: [
|
||||
[
|
||||
[
|
||||
-434.2249470949173,
|
||||
-13.15996269397843,
|
||||
],
|
||||
[
|
||||
-434.2249470949173,
|
||||
-13.159751140560356,
|
||||
],
|
||||
[
|
||||
-434.2242631316185,
|
||||
-13.159751140560356,
|
||||
],
|
||||
[
|
||||
-434.2242631316185,
|
||||
-13.15996269397843,
|
||||
],
|
||||
[
|
||||
-434.2249470949173,
|
||||
-13.15996269397843,
|
||||
],
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
geojson2osm(features)
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// Type definitions for geojson2osm 0.0.5
|
||||
// Project: https://github.com/Rub21/geojson2osm
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../geojson/geojson.d.ts" />
|
||||
|
||||
declare module 'geojson2osm' {
|
||||
/**
|
||||
* Converts GeoJSON features to OpenStreetMap XML.
|
||||
* @param features Input features
|
||||
* @returns OpenStreetMap XML
|
||||
*/
|
||||
export function geojson2osm(features: GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any>): any
|
||||
}
|
||||
@@ -240,6 +240,63 @@ app.setUserTasks([
|
||||
}
|
||||
]);
|
||||
app.setUserTasks([]);
|
||||
|
||||
app.setJumpList([
|
||||
{
|
||||
type: 'custom',
|
||||
name: 'Recent Projects',
|
||||
items: [
|
||||
{ type: 'file', path: 'C:\\Projects\\project1.proj' },
|
||||
{ type: 'file', path: 'C:\\Projects\\project2.proj' }
|
||||
]
|
||||
},
|
||||
{ // has a name so type is assumed to be "custom"
|
||||
name: 'Tools',
|
||||
items: [
|
||||
{
|
||||
type: 'task',
|
||||
title: 'Tool A',
|
||||
program: process.execPath,
|
||||
args: '--run-tool-a',
|
||||
iconPath: process.execPath,
|
||||
iconIndex: 0,
|
||||
description: 'Runs Tool A'
|
||||
},
|
||||
{
|
||||
type: 'task',
|
||||
title: 'Tool B',
|
||||
program: process.execPath,
|
||||
args: '--run-tool-b',
|
||||
iconPath: process.execPath,
|
||||
iconIndex: 0,
|
||||
description: 'Runs Tool B'
|
||||
}]
|
||||
},
|
||||
{
|
||||
type: 'frequent'
|
||||
},
|
||||
{ // has no name and no type so type is assumed to be "tasks"
|
||||
items: [
|
||||
{
|
||||
type: 'task',
|
||||
title: 'New Project',
|
||||
program: process.execPath,
|
||||
args: '--new-project',
|
||||
description: 'Create a new project.'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
type: 'task',
|
||||
title: 'Recover Project',
|
||||
program: process.execPath,
|
||||
args: '--recover-project',
|
||||
description: 'Recover Project'
|
||||
}]
|
||||
}
|
||||
]);
|
||||
|
||||
if (app.isUnityRunning()) {
|
||||
}
|
||||
if (app.isAccessibilitySupportEnabled()) {
|
||||
|
||||
Vendored
+114
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Electron v1.3.4
|
||||
// Type definitions for Electron v1.3.5
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -199,7 +199,7 @@ declare namespace Electron {
|
||||
* All windows will be closed immediately without asking user
|
||||
* and the before-quit and will-quit events will not be emitted.
|
||||
*/
|
||||
exit(exitCode: number): void;
|
||||
exit(exitCode?: number): void;
|
||||
/**
|
||||
* Relaunches the app when current instance exits.
|
||||
*
|
||||
@@ -333,6 +333,19 @@ declare namespace Electron {
|
||||
* Note: This API is only available on Windows.
|
||||
*/
|
||||
setUserTasks(tasks: Task[]): boolean;
|
||||
/**
|
||||
* Note: This API is only available on Windows.
|
||||
*/
|
||||
getJumpListSettings(): JumpListSettings;
|
||||
/**
|
||||
* Sets or removes a custom Jump List for the application.
|
||||
*
|
||||
* If categories is null the previously set custom Jump List (if any) will be replaced
|
||||
* by the standard Jump List for the app (managed by Windows).
|
||||
*
|
||||
* Note: This API is only available on Windows.
|
||||
*/
|
||||
setJumpList(categories: JumpListCategory[]): SetJumpListResult;
|
||||
/**
|
||||
* This method makes your application a Single Instance Application instead of allowing
|
||||
* multiple instances of your app to run, this will ensure that only a single instance
|
||||
@@ -560,6 +573,89 @@ declare namespace Electron {
|
||||
iconIndex?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* ok - Nothing went wrong.
|
||||
* error - One or more errors occured, enable runtime logging to figure out the likely cause.
|
||||
* invalidSeparatorError - An attempt was made to add a separator to a custom category in the Jump List.
|
||||
* Separators are only allowed in the standard Tasks category.
|
||||
* fileTypeRegistrationError - An attempt was made to add a file link to the Jump List
|
||||
* for a file type the app isn't registered to handle.
|
||||
* customCategoryAccessDeniedError - Custom categories can't be added to the Jump List
|
||||
* due to user privacy or group policy settings.
|
||||
*/
|
||||
type SetJumpListResult = 'ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError';
|
||||
|
||||
interface JumpListSettings {
|
||||
/**
|
||||
* The minimum number of items that will be shown in the Jump List.
|
||||
*/
|
||||
minItems: number;
|
||||
/**
|
||||
* Items that the user has explicitly removed from custom categories in the Jump List.
|
||||
*/
|
||||
removedItems: JumpListItem[];
|
||||
}
|
||||
|
||||
interface JumpListCategory {
|
||||
/**
|
||||
* tasks - Items in this category will be placed into the standard Tasks category.
|
||||
* frequent - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.
|
||||
* recent - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows.
|
||||
* custom - Displays tasks or file links, name must be set by the app.
|
||||
*/
|
||||
type?: 'tasks' | 'frequent' | 'recent' | 'custom';
|
||||
/**
|
||||
* Must be set if type is custom, otherwise it should be omitted.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Array of JumpListItem objects if type is tasks or custom, otherwise it should be omitted.
|
||||
*/
|
||||
items?: JumpListItem[];
|
||||
}
|
||||
|
||||
interface JumpListItem {
|
||||
/**
|
||||
* task - A task will launch an app with specific arguments.
|
||||
* separator - Can be used to separate items in the standard Tasks category.
|
||||
* file - A file link will open a file using the app that created the Jump List.
|
||||
*/
|
||||
type: 'task' | 'separator' | 'file';
|
||||
/**
|
||||
* Path of the file to open, should only be set if type is file.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* Path of the program to execute, usually you should specify process.execPath which opens the current program.
|
||||
* Should only be set if type is task.
|
||||
*/
|
||||
program?: string;
|
||||
/**
|
||||
* The command line arguments when program is executed. Should only be set if type is task.
|
||||
*/
|
||||
args?: string;
|
||||
/**
|
||||
* The text to be displayed for the item in the Jump List. Should only be set if type is task.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Description of the task (displayed in a tooltip). Should only be set if type is task.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary
|
||||
* resource file that contains an icon (e.g. .ico, .exe, .dll).
|
||||
* You can usually specify process.execPath to show the program icon.
|
||||
*/
|
||||
iconPath?: string;
|
||||
/**
|
||||
* The index of the icon in the resource file. If a resource file contains multiple icons
|
||||
* this value can be used to specify the zero-based index of the icon that should be displayed
|
||||
* for this task. If a resource file contains only one icon, this property should be set to zero.
|
||||
*/
|
||||
iconIndex?: number;
|
||||
}
|
||||
|
||||
interface LoginItemSettings {
|
||||
/**
|
||||
* True if the app is set to open at login.
|
||||
@@ -3595,7 +3691,7 @@ declare namespace Electron {
|
||||
|
||||
interface WebContentsStatic {
|
||||
/**
|
||||
* @returns An array of all web contents. This will contain web contents for all windows,
|
||||
* @returns An array of all WebContents instances. This will contain web contents for all windows,
|
||||
* webviews, opened devtools, and devtools extension background pages.
|
||||
*/
|
||||
getAllWebContents(): WebContents[];
|
||||
@@ -3603,6 +3699,10 @@ declare namespace Electron {
|
||||
* @returns The web contents that is focused in this application, otherwise returns null.
|
||||
*/
|
||||
getFocusedWebContents(): WebContents;
|
||||
/**
|
||||
* Find a WebContents instance according to its ID.
|
||||
*/
|
||||
fromId(id: number): WebContents;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4971,6 +5071,17 @@ declare namespace Electron {
|
||||
* See webContents.sendInputEvent for detailed description of event object.
|
||||
*/
|
||||
sendInputEvent(event: SendInputEvent): void
|
||||
/**
|
||||
* Changes the zoom factor to the specified factor.
|
||||
* Zoom factor is zoom percent divided by 100, so 300% = 3.0.
|
||||
*/
|
||||
setZoomFactor(factor: number): void;
|
||||
/**
|
||||
* Changes the zoom level to the specified level.
|
||||
* The original size is 0 and each increment above or below represents
|
||||
* zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.
|
||||
*/
|
||||
setZoomLevel(level: number): void;
|
||||
/**
|
||||
* Shows pop-up dictionary that searches the selected word on the page.
|
||||
* Note: This API is available only on macOS.
|
||||
|
||||
Vendored
+2
-1
@@ -61,6 +61,7 @@ declare namespace google.maps {
|
||||
backgroundColor?: string;
|
||||
center?: LatLng|LatLngLiteral;
|
||||
disableDefaultUI?: boolean;
|
||||
clickableIcons?: boolean;
|
||||
disableDoubleClickZoom?: boolean;
|
||||
draggable?: boolean;
|
||||
draggableCursor?: string;
|
||||
@@ -755,7 +756,7 @@ declare namespace google.maps {
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
export interface PolyMouseEvent {
|
||||
export interface PolyMouseEvent extends MouseEvent {
|
||||
edge?: number;
|
||||
path?: number;
|
||||
vertex?: number;
|
||||
|
||||
Vendored
+4
-2
@@ -5,9 +5,11 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../orchestrator/orchestrator.d.ts" />
|
||||
/// <reference path="../vinyl/vinyl.d.ts" />
|
||||
|
||||
declare module "gulp" {
|
||||
import Orchestrator = require("orchestrator");
|
||||
import VinylFile = require("vinyl");
|
||||
|
||||
namespace gulp {
|
||||
interface Gulp extends Orchestrator {
|
||||
@@ -92,7 +94,7 @@ declare module "gulp" {
|
||||
* @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance.
|
||||
* @param opt
|
||||
*/
|
||||
(outFolder: string|((file: string) => string), opt?: DestOptions): NodeJS.ReadWriteStream;
|
||||
(outFolder: string|((file: VinylFile) => string), opt?: DestOptions): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface SrcMethod {
|
||||
@@ -149,7 +151,7 @@ declare module "gulp" {
|
||||
* Note that an explicit dot in a portion of the pattern will always match dot files.
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Set to match only fles, not directories. Set this flag to prevent copying empty directories
|
||||
*/
|
||||
|
||||
Vendored
+312
-3
@@ -1073,6 +1073,125 @@ declare namespace H {
|
||||
*/
|
||||
resizeToCenter(center: H.geo.IPoint, opt_out?: H.geo.Rect): H.geo.Rect;
|
||||
}
|
||||
|
||||
/**
|
||||
* A strip is a flat list of latitude, longitude, altitude tuples in a fixed order.
|
||||
*/
|
||||
export class Strip {
|
||||
/**
|
||||
* Constructor
|
||||
* @param opt_latLngAlts {Array<number>=} - An optional array of latitude, longitude and altitude triples to initialize the strip with.
|
||||
* @param opt_ctx {H.geo.AltitudeContext=} - An optional altitude context for all altitudes contained in this strip.
|
||||
*/
|
||||
constructor(opt_latLngAlts?: Array<number>, opt_ctx?: H.geo.AltitudeContext);
|
||||
|
||||
/**
|
||||
* This method pushes a lat, lng, alt to the end of this strip.
|
||||
* @param lat {H.geo.Latitude}
|
||||
* @param lng {H.geo.Longitude}
|
||||
* @param alt {H.geo.Altitude}
|
||||
*/
|
||||
pushLatLngAlt(lat: H.geo.Latitude, lng: H.geo.Longitude, alt: H.geo.Altitude): void;
|
||||
|
||||
/**
|
||||
* This method splices the strip at the provided index, removing the specified number of items at that index and inserting the lat, lng, alt array.
|
||||
* @param index {number} - The index at which to splice
|
||||
* @param opt_nRemove {number=} - The number of lat, lng, alt values to remove
|
||||
* @param opt_latLngAlts {Array<number>=} - The lat, lng, alt values to add
|
||||
* @returns {Array<number>} - an array of removed elements
|
||||
*/
|
||||
spliceLatLngAlts(index: number, opt_nRemove?: number, opt_latLngAlts?: Array<number>): Array<number>;
|
||||
|
||||
/**
|
||||
* This method inserts one set of lat, lng, alt values into the strip at the specified index.
|
||||
* @param index {number} - the index at which to add the element
|
||||
* @param lat {H.geo.Latitude} - the latitude to insert
|
||||
* @param lng {H.geo.Longitude} - the longitude to insert
|
||||
* @param alt {H.geo.Altitude} - the altitude to insert
|
||||
*/
|
||||
insertLatLngAlt(index: number, lat: H.geo.Latitude, lng: H.geo.Longitude, alt: H.geo.Altitude): void;
|
||||
|
||||
/**
|
||||
* This method removes one set of lat, lng, alt values from the strip at the specified index.
|
||||
* @param index {number}
|
||||
*/
|
||||
removeLatLngAlt(index: number): void;
|
||||
|
||||
/**
|
||||
* This method pushes the lat, lng, alt values of a H.geo.Point to the end of this strip.
|
||||
* @param geoPoint {H.geo.IPoint}
|
||||
*/
|
||||
pushPoint(geoPoint: H.geo.IPoint): void;
|
||||
|
||||
/**
|
||||
* This method inserts the lat, lng, alt values of a H.geo.Point into the list at the specified index.
|
||||
* @param pointIndex {number}
|
||||
* @param geoPoint {H.geo.IPoint}
|
||||
*/
|
||||
insertPoint(pointIndex: number, geoPoint: H.geo.IPoint): void;
|
||||
|
||||
/**
|
||||
* This method removes one set of lat, lng, alt values from this strip at the virtual point index specified.
|
||||
* @param pointIndex {number} - the virtual point index
|
||||
*/
|
||||
removePoint(pointIndex: number): void;
|
||||
|
||||
/**
|
||||
* This method extracts a H.geo.Point from this strip at the virtual point index. If the extracted point has an alt value, the strip's altitude context will be supplied to the point.
|
||||
* @param pointIndex {number} - the virtual point index in the strip
|
||||
* @param opt_out {H.geo.Point=} - an optional point object to store the lat, lng, alt values
|
||||
* @returns {H.geo.Point} - returns either the 'opt_out' point object or a new point object.
|
||||
*/
|
||||
extractPoint(pointIndex: number, opt_out?: H.geo.Point): H.geo.Point;
|
||||
|
||||
/**
|
||||
* This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each 3 elements passing lat, lng and alt and the virtual point index as arguments.
|
||||
* @param eachFn {function(H.geo.Latitude, H.geo.Longitude, H.geo.Altitude, number)} - the function to be called for each 3 elements
|
||||
* @param opt_start {number=} - an optional start index to iterate from
|
||||
* @param opt_end {number=} - an optional end index to iterate to
|
||||
*/
|
||||
eachLatLngAlt(eachFn: (lat: H.geo.Latitude, lng: H.geo.Longitude, alt: H.geo.Altitude, n: number) => void, opt_start?: number, opt_end?: number): void;
|
||||
|
||||
/**
|
||||
* This method returns the number of times that legs in this strip cross the date border.
|
||||
* @param opt_closed {boolean=} - indicates whether the strip is closed (i.e. whether the strip's last and first coordinates form the closing leg of a polygon)
|
||||
* @returns {number} - the amount of times this strip crosses the date border.
|
||||
*/
|
||||
getDBCs(opt_closed?: boolean): number;
|
||||
|
||||
/**
|
||||
* This method return the number of points stored in this strip.
|
||||
* @returns {number} - the number of points in this strip
|
||||
*/
|
||||
getPointCount(): number;
|
||||
|
||||
/**
|
||||
* This method returns the internal array keeping the lat, lng, alt values. Modifying this array directly can destroy the integrity of this strip. Use it only for read access.
|
||||
* @returns {Array<number>} - returns the raw lat, lng, alt values of this strip
|
||||
*/
|
||||
getLatLngAltArray(): Array<number>;
|
||||
|
||||
/**
|
||||
* This method returns the bounding box of this strip.
|
||||
* @returns {?H.geo.Rect} - this strip's bounding rectangle
|
||||
*/
|
||||
getBounds(): H.geo.Rect;
|
||||
|
||||
/**
|
||||
* This method checks whether two longitudes form a leg which crosses the date border.
|
||||
* @param lng1 {H.geo.Longitude} - the start longitude of the leg
|
||||
* @param lng2 {H.geo.Longitude} - the end longitude of the leg
|
||||
* @returns {boolean} - true if the leg crosses the date border, otherwise false
|
||||
*/
|
||||
static isDBC(lng1: H.geo.Longitude, lng2: H.geo.Longitude): boolean;
|
||||
|
||||
/**
|
||||
* This method initializes a new strip with an array of lat, lng values. Arrays are expected to have an even length with the format [lat, lng, lat, lng, ...].
|
||||
* @param latLngs {Array<number>} - the array of lat, lng value.
|
||||
* @returns {H.geo.Strip} - the strip containing the lat, lng values
|
||||
*/
|
||||
static fromLatLngArray(latLngs: Array<number>): H.geo.Strip;
|
||||
}
|
||||
}
|
||||
|
||||
/***** lang *****/
|
||||
@@ -1173,6 +1292,78 @@ declare namespace H {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Polygon with a circular shape.
|
||||
*/
|
||||
export class Circle extends H.map.Polygon {
|
||||
/**
|
||||
* Constructor
|
||||
* @param center {H.geo.IPoint} - The geographical coordinates of the circle's center
|
||||
* @param radius {number} - The radius of the circle in meters
|
||||
* @param opt_options {H.map.Circle.Options=} - An object that specifies circle options and their initial values (among these, precision has a significant impact on the shape of the circle - please see
|
||||
*/
|
||||
constructor(center: H.geo.IPoint, radius: number, opt_options?: H.map.Circle.Options);
|
||||
|
||||
/**
|
||||
* To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point you must not modify this Point instance without calling setCenter immediately afterwards.
|
||||
* @param center {H.geo.IPoint}
|
||||
*/
|
||||
setCenter(center: H.geo.IPoint): void;
|
||||
|
||||
/**
|
||||
* To get the center point of this circle You must not modify the returned Point instance without calling setCenter immediately afterwards.
|
||||
* @returns {H.geo.Point}
|
||||
*/
|
||||
getCenter(): H.geo.Point;
|
||||
|
||||
/**
|
||||
* To set the length of the radius of the circle in meters. The value is clamped to the of {@code[0 ... 20015089.27787877]} (half WGS84 mean circumference)
|
||||
* @param radius {number}
|
||||
*/
|
||||
setRadius(radius: number): void;
|
||||
|
||||
/**
|
||||
* To get the length of the radius of the circle in meters.
|
||||
* @returns {number}
|
||||
*/
|
||||
getRadius(): number;
|
||||
|
||||
/**
|
||||
* To set the precision of this circle {@see H.map.Circle.Options#precision}
|
||||
* @param precision {number}
|
||||
*/
|
||||
setPrecision(precision: number): void;
|
||||
|
||||
/**
|
||||
* To get the precision value of this circle
|
||||
* @returns {number}
|
||||
*/
|
||||
getPrecision(): number;
|
||||
}
|
||||
|
||||
export module Circle {
|
||||
/**
|
||||
* @property style {H.map.SpatialStyle=} - the style to be used when tracing the polyline
|
||||
* @property visibility {boolean=} - An optional boolean value indicating whether this map object is visible, default is true
|
||||
* @property precision {number=} - The precision of a circle as a number of segments to be used when rendering the circle. The value is clamped to the range between [4 ... 360], where 60 is the default. Note that the lower the value the more angular and the less circle-like the shape appears and, conversely, the higher the value the smoother and more rounded the result. Thus, starting at the extreme low end of the possible values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears increasingly angular as the zoom level increases (as you zoom in), and finally 360 produces a smooth circle.
|
||||
* @property zIndex {number=} - The z-index value of the circle, default is 0
|
||||
* @property min {number=} - The minimum zoom level for which the circle is visible, default is -Infinity
|
||||
* @property max {number=} - The maximum zoom level for which the circle is visible, default is Infinity
|
||||
* @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object.
|
||||
* @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData
|
||||
*/
|
||||
export interface Options {
|
||||
style?: H.map.SpatialStyle | H.map.SpatialStyle.Options;
|
||||
visibility?: boolean;
|
||||
precision?: number;
|
||||
zIndex?: number;
|
||||
min?: number;
|
||||
max?: number;
|
||||
provider?: H.map.provider.Provider;
|
||||
data?: any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The class represents data model of the map. It holds list of layers that are rendered by map's RenderEngine. The class listens to 'update' events from layers and dispatches them to the RenderEngine.
|
||||
*/
|
||||
@@ -1242,6 +1433,38 @@ declare namespace H {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a spatial shape in geographic space. It is defined by a path containing the vertices of the shape (lat, lng, alt values).
|
||||
*/
|
||||
export class GeoShape extends H.map.Spatial {
|
||||
/**
|
||||
* Constructor
|
||||
* @param isClosed {boolean} - Indicates whether this geographical shape is closed (a polygon)
|
||||
* @param strip {H.geo.Strip} - The strip describing the shape of the spatial object
|
||||
* @param options {H.map.Spatial.Options} - The options to apply
|
||||
*/
|
||||
constructor(isClosed: boolean, strip: H.geo.Strip, options: H.map.Spatial.Options);
|
||||
|
||||
/**
|
||||
* This method returns the strip which represents the shape of the spatial object.
|
||||
* @returns {H.geo.Strip} - the strip
|
||||
*/
|
||||
getStrip(): H.geo.Strip;
|
||||
|
||||
/**
|
||||
* This method sets the geo-information for the spatial object
|
||||
* @param strip {?H.geo.Strip} - The strip which represents the shape of the spatial object.
|
||||
* @returns {H.map.GeoShape} - the Spatial instance itself
|
||||
*/
|
||||
setStrip(strip: H.geo.Strip): H.map.GeoShape;
|
||||
|
||||
/**
|
||||
* This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle which encloses all points of the spatial object.
|
||||
* @returns {H.geo.Rect}
|
||||
*/
|
||||
getBounds(): H.geo.Rect;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a map object which can contain other map objects. It's visibility, zIndex and object-order influences the contained map objects
|
||||
*/
|
||||
@@ -1855,6 +2078,92 @@ declare namespace H {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo shape object (lat, lng, alt values) and a pen to use when rendering the polyline. Polygon represents a closed plane defined by the list of verticies, projected on the map display. List of vericies which define the polygon are is a list of geo coordinates encapsulated by the strip object H.geo.Strip
|
||||
*/
|
||||
export class Polygon extends H.map.GeoShape {
|
||||
/**
|
||||
* Constructor
|
||||
* @param strip {H.geo.Strip} - the strip describing this polygon's vertices
|
||||
* @param opt_options {H.map.Spatial.Options=} - optional initialization parameters
|
||||
*/
|
||||
constructor(strip: H.geo.Strip, opt_options?: H.map.Spatial.Options);
|
||||
|
||||
/**
|
||||
* To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines arround the world on longitude axis (for example a circle whose center is one of the poles). In this case a additional information is needed to know if the southern or northern part of the world should be covered by the poygon.
|
||||
* @param flag {boolean} - A value of true means it covers the north pole, false means south pole
|
||||
* @returns {H.map.Polygon} - the Polygon instance itself
|
||||
*/
|
||||
setNorthPoleCovering(flag: boolean): H.map.Polygon;
|
||||
|
||||
/**
|
||||
* See H.map.Polygon#setNorthPoleCovering
|
||||
* @returns {boolean}
|
||||
*/
|
||||
getNorthPoleCovering(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a polyline in geo-space. It is defined by a path containing the vertices of a polyline (lat, lng, alt values) and a pen to use when tracing the path on the map.
|
||||
*/
|
||||
export class Polyline extends H.map.GeoShape {
|
||||
/**
|
||||
* Constructor
|
||||
* @param strip {H.geo.Strip} - the strip describing this polygon's vertices
|
||||
* @param opt_options {H.map.Polyline.Options=} - optional initialization parameters
|
||||
*/
|
||||
constructor(strip: H.geo.Strip, opt_options?: H.map.Polyline.Options);
|
||||
|
||||
/**
|
||||
* This method clips this polyline against a rectangular area and returns the intersecting sub-lines.
|
||||
* @param geoRect {H.geo.Rect}
|
||||
* @returns {Array<Array<number>>}
|
||||
*/
|
||||
clip(geoRect: H.geo.Rect): Array<Array<number>>;
|
||||
}
|
||||
|
||||
export module Polyline {
|
||||
/**
|
||||
* Options which are used to initialize a polyline
|
||||
* @property style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - the style to be used when tracing the polyline
|
||||
* @property arrows {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} - The arrows style to be used when rendering the polyline.
|
||||
* @property visibility {boolean=} - An optional boolean value indicating whether this map object is visible, default is true
|
||||
* @property zIndex {number=} - The z-index value of the map object, default is 0
|
||||
* @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity
|
||||
* @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity
|
||||
* @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object.
|
||||
* @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData
|
||||
*/
|
||||
export interface Options {
|
||||
style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options);
|
||||
arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options);
|
||||
visibility?: boolean;
|
||||
zIndex?: number;
|
||||
min?: number;
|
||||
max?: number;
|
||||
provider?: H.map.provider.Provider;
|
||||
data?: any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Polygon with a rectangular shape.
|
||||
*/
|
||||
export class Rect extends H.map.Polygon {
|
||||
/**
|
||||
* Constructor
|
||||
* @param bounds {H.geo.Rect} - The geographical bounding box for this rectangle
|
||||
* @param opt_options {H.map.Spatial.Options=}
|
||||
*/
|
||||
constructor(bounds: H.geo.Rect, opt_options?: H.map.Spatial.Options);
|
||||
|
||||
/**
|
||||
* To set the bounds of this rectangle.
|
||||
* @param bounds {H.geo.Rect}
|
||||
*/
|
||||
setBounds(bounds: H.geo.Rect): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a spatial map object which provides its projected geometry.
|
||||
*/
|
||||
@@ -1985,8 +2294,8 @@ declare namespace H {
|
||||
miterLimit: number;
|
||||
lineDash: Array<number>;
|
||||
lineDashOffset: number;
|
||||
MAX_LINE_WIDTH: number;
|
||||
DEFAULT_STYLE: H.map.SpatialStyle;
|
||||
static MAX_LINE_WIDTH: number;
|
||||
static DEFAULT_STYLE: H.map.SpatialStyle;
|
||||
}
|
||||
|
||||
export module SpatialStyle {
|
||||
@@ -2018,7 +2327,7 @@ declare namespace H {
|
||||
lineCap?: H.map.SpatialStyle.LineCap;
|
||||
lineJoin?: H.map.SpatialStyle.LineJoin;
|
||||
miterLimit?: number;
|
||||
lineDash: Array<number>;
|
||||
lineDash?: Array<number>;
|
||||
lineDashOffset?: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ class IonicTestController {
|
||||
var currentStateName: string = this.$ionicHistory.currentStateName();
|
||||
|
||||
this.$ionicHistory.goBack(5);
|
||||
this.$ionicHistory.removeBackView();
|
||||
this.$ionicHistory.clearHistory();
|
||||
this.$ionicHistory.clearCache().then(() => console.log("done clearing cache!"));
|
||||
this.$ionicHistory.nextViewOptions({
|
||||
|
||||
Vendored
+1
@@ -213,6 +213,7 @@ declare namespace ionic {
|
||||
currentStateName(): string;
|
||||
|
||||
goBack(backCount?: number): void;
|
||||
removeBackView(): void;
|
||||
clearHistory(): void;
|
||||
clearCache(): angular.IPromise<any>;
|
||||
nextViewOptions(options: IonicHistoryNextViewOptions): void;
|
||||
|
||||
Vendored
+4
@@ -197,6 +197,8 @@ declare module IORedis {
|
||||
hmget(...args: any[]): any;
|
||||
hincrby(args: any[], callback?: ResCallbackT<any>): any;
|
||||
hincrby(...args: any[]): any;
|
||||
hincrbyfloat(args: any[], callback?: ResCallbackT<any>): any;
|
||||
hincrbyfloat(...args: any[]): any;
|
||||
hdel(args: any[], callback?: ResCallbackT<any>): any;
|
||||
hdel(...args: any[]): any;
|
||||
hlen(args: any[], callback?: ResCallbackT<any>): any;
|
||||
@@ -478,6 +480,8 @@ declare module IORedis {
|
||||
hmget(...args: any[]): Pipeline;
|
||||
hincrby(args: any[], callback?: ResCallbackT<any>): Pipeline;
|
||||
hincrby(...args: any[]): Pipeline;
|
||||
hincrbyfloat(args: any[], callback?: ResCallbackT<any>): Pipeline;
|
||||
hincrbyfloat(...args: any[]): Pipeline;
|
||||
hdel(args: any[], callback?: ResCallbackT<any>): Pipeline;
|
||||
hdel(...args: any[]): Pipeline;
|
||||
hlen(args: any[], callback?: ResCallbackT<any>): Pipeline;
|
||||
|
||||
@@ -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
+1
@@ -44,6 +44,7 @@ declare namespace jest {
|
||||
interface Matchers {
|
||||
not: Matchers;
|
||||
toThrow(expected?: any): boolean;
|
||||
toThrowError(expected?: any): boolean;
|
||||
toBe(expected: any): boolean;
|
||||
toEqual(expected: any): boolean;
|
||||
toBeFalsy(): boolean;
|
||||
|
||||
@@ -752,6 +752,10 @@ schema = Joi.alternatives(schema, anySchema, boolSchema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.lazy(() => schema)
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
Joi.validate(value, obj);
|
||||
Joi.validate(value, schema);
|
||||
Joi.validate(value, schema, validOpts);
|
||||
|
||||
Vendored
+7
@@ -816,6 +816,13 @@ declare module 'joi' {
|
||||
export function alternatives(): AlternativesSchema;
|
||||
export function alternatives(types: Schema[]): AlternativesSchema;
|
||||
export function alternatives(type1: Schema, type2: Schema, ...types: Schema[]): AlternativesSchema;
|
||||
|
||||
/**
|
||||
* Generates a placeholder schema for a schema that you would provide with the fn.
|
||||
* Supports the same methods of the any() type.
|
||||
* This is mostly useful for recursive schemas
|
||||
*/
|
||||
export function lazy(cb: () => Schema): Schema;
|
||||
|
||||
/**
|
||||
* Validates a value using the given schema and options.
|
||||
|
||||
@@ -9,7 +9,7 @@ class Tests {
|
||||
run(): void {
|
||||
const self = this;
|
||||
|
||||
var t = QUnit.test;
|
||||
let t = QUnit.test;
|
||||
|
||||
QUnit.begin(() => {
|
||||
|
||||
@@ -36,7 +36,7 @@ class Tests {
|
||||
responseText: 'Hello Word'
|
||||
});
|
||||
|
||||
var xhr = $.ajax({
|
||||
let xhr = $.ajax({
|
||||
url: '/xmlhttprequest',
|
||||
complete: () => { }
|
||||
});
|
||||
@@ -67,7 +67,7 @@ class Tests {
|
||||
});
|
||||
|
||||
t('Intercept asynchronized proxy calls', (assert) => {
|
||||
var done = assert.async();
|
||||
let done = assert.async();
|
||||
$.mockjax({
|
||||
url: '/proxy',
|
||||
proxy: 'test_proxy.json'
|
||||
@@ -85,7 +85,7 @@ class Tests {
|
||||
});
|
||||
|
||||
t('Intercept and proxy (sub-ajax request)', (assert) => {
|
||||
var done = assert.async();
|
||||
let done = assert.async();
|
||||
|
||||
$.mockjax({
|
||||
url: '/proxy',
|
||||
@@ -104,7 +104,7 @@ class Tests {
|
||||
});
|
||||
|
||||
t('Proxy type specification', (assert) => {
|
||||
var done = assert.async();
|
||||
let done = assert.async();
|
||||
|
||||
$.mockjax({
|
||||
url: '/proxy',
|
||||
@@ -124,7 +124,7 @@ class Tests {
|
||||
});
|
||||
|
||||
t('Support 1.5 $.ajax(url, settings) signature.', (assert) => {
|
||||
var done = assert.async();
|
||||
let done = assert.async();
|
||||
|
||||
$.mockjax({
|
||||
url: '/resource',
|
||||
@@ -141,9 +141,9 @@ class Tests {
|
||||
});
|
||||
|
||||
t('Dynamic response callback', (assert) => {
|
||||
var done = assert.async();
|
||||
let done = assert.async();
|
||||
|
||||
var settings: MockJaxSettings = {
|
||||
let settings: MockJaxSettings = {
|
||||
url: '/response-callback',
|
||||
response: (settings) => {
|
||||
settings.responseText = settings.data.response + ' 2';
|
||||
@@ -165,8 +165,36 @@ class Tests {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
t('Asyncronous response callback', (assert) => {
|
||||
let done = assert.async();
|
||||
|
||||
let settings: MockJaxSettings = {
|
||||
url: '/async-response-callback',
|
||||
response: (settings, completed) => {
|
||||
setTimeout(() => {
|
||||
settings.responseText = settings.data.response + ' 3';
|
||||
completed();
|
||||
}, 10);
|
||||
}
|
||||
};
|
||||
|
||||
$.mockjax(settings);
|
||||
|
||||
$.ajax({
|
||||
url: '/async-response-callback',
|
||||
dataType: 'text',
|
||||
data: {
|
||||
response: 'Hello world'
|
||||
},
|
||||
error: self._noErrorCallbackExpected,
|
||||
complete: (xhr) => {
|
||||
assert.equal(xhr.responseText, 'Hello world 3', 'Response Text matches');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var tests = new Tests();
|
||||
tests.run();
|
||||
new Tests().run();
|
||||
|
||||
Vendored
+1
-1
@@ -22,7 +22,7 @@ interface MockJaxSettings {
|
||||
isTimeout?: boolean;
|
||||
dataType?: string;
|
||||
contentType?: string;
|
||||
response?: (settings: any) => void;
|
||||
response?: (settings: any, done?: Function) => void;
|
||||
responseText?: string | Object;
|
||||
responseXml?: string;
|
||||
proxy?: string;
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/// <reference path="./../axios/axios.d.ts" />
|
||||
/// <reference path="js-data-http.d.ts" />
|
||||
|
||||
import * as axios from 'axios';
|
||||
|
||||
var adapter = new DSHttpAdapter();
|
||||
var store = new JSData.DS();
|
||||
store.registerAdapter('http', adapter, { default: true });
|
||||
|
||||
adapter.defaults.basePath = '/api';
|
||||
adapter.http = axios;
|
||||
|
||||
var ADocument:JSData.DSResourceDefinition<any> = store.defineResource<any>('document');
|
||||
|
||||
ADocument.inject({ id: 5, author: 'John' });
|
||||
|
||||
Vendored
+5
@@ -15,6 +15,8 @@ declare namespace JSData {
|
||||
forceTrailingSlash?: boolean;
|
||||
log?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
error?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
basePath?: string;
|
||||
verbsUseBasePath?: string;
|
||||
}
|
||||
|
||||
interface DSHttpAdapterPromiseResolveType {
|
||||
@@ -28,6 +30,9 @@ declare namespace JSData {
|
||||
|
||||
new(options?:DSHttpAdapterOptions):DSHttpAdapter;
|
||||
|
||||
defaults: DSHttpAdapterOptions;
|
||||
http: any;
|
||||
|
||||
// DSHttpAdapter uses axios so options are axios config objects.
|
||||
HTTP(options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
DEL(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
|
||||
@@ -600,3 +600,5 @@ customActionResource.emit("DS.change", customActionResource, customActionResourc
|
||||
customActionResourceInstance.on("DS.change", myEvtHandler);
|
||||
customActionResourceInstance.off("DS.change", myEvtHandler);
|
||||
customActionResourceInstance.emit("DS.change", customActionResource, customActionResourceInstance);
|
||||
|
||||
JSData.DSUtils.Promise = Promise;
|
||||
Vendored
+1
@@ -342,6 +342,7 @@ declare namespace JSData {
|
||||
declare var JSData:{
|
||||
DS: JSData.DS;
|
||||
DSErrors: JSData.DSErrors;
|
||||
DSUtils: any;
|
||||
};
|
||||
|
||||
//Support node require
|
||||
|
||||
Vendored
+1
@@ -68,6 +68,7 @@ declare module "jsdom" {
|
||||
export function createCookieJar(): CookieJar;
|
||||
export function nodeLocation(node: Node): any;
|
||||
export function reconfigureWindow(window: Window, newProps: WindowProperties): void;
|
||||
export function changeURL(window: Window, url: string): void;
|
||||
|
||||
export function jQueryify(window: Window, jqueryUrl: string, callback: (window: Window, jquery: JQuery) => any): void;
|
||||
|
||||
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
/// <reference path="jsts.d.ts" />
|
||||
|
||||
import * as jsts from 'jsts';
|
||||
|
||||
var str: string;
|
||||
var n: number;
|
||||
var bool: boolean;
|
||||
@@ -142,4 +145,4 @@ obj = gjw.write(g);
|
||||
|
||||
var wr: jsts.io.WKTReader = new jsts.io.WKTReader();
|
||||
g = wr.read(str);
|
||||
wr.reducePrecision(g);
|
||||
wr.reducePrecision(g);
|
||||
|
||||
Vendored
+4
@@ -1664,3 +1664,7 @@ declare namespace jsts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "jsts" {
|
||||
export = jsts;
|
||||
}
|
||||
|
||||
Vendored
+9
-2
@@ -61,8 +61,10 @@ interface KnockoutSubscription {
|
||||
}
|
||||
|
||||
interface KnockoutSubscribable<T> extends KnockoutSubscribableFunctions<T> {
|
||||
subscribe(callback: (newValue: T) => void, target?: any, event?: string): KnockoutSubscription;
|
||||
subscribe(callback: (newValue: T) => void, target: any, event: "beforeChange"): KnockoutSubscription;
|
||||
subscribe(callback: (newValue: T) => void, target?: any, event?: "change"): KnockoutSubscription;
|
||||
subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription;
|
||||
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutSubscribable<T>;
|
||||
getSubscriptionsCount(): number;
|
||||
}
|
||||
@@ -91,6 +93,11 @@ interface KnockoutObservableArrayStatic {
|
||||
}
|
||||
|
||||
interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> {
|
||||
subscribe(callback: (newValue: KnockoutArrayChange<T>[]) => void, target: any, event: "arrayChange"): KnockoutSubscription;
|
||||
subscribe(callback: (newValue: T[]) => void, target: any, event: "beforeChange"): KnockoutSubscription;
|
||||
subscribe(callback: (newValue: T[]) => void, target?: any, event?: "change"): KnockoutSubscription;
|
||||
subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription;
|
||||
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservableArray<T>;
|
||||
}
|
||||
|
||||
@@ -325,7 +332,7 @@ interface KnockoutUtils {
|
||||
}
|
||||
|
||||
interface KnockoutArrayChange<T> {
|
||||
status: string;
|
||||
status: "added" | "deleted";
|
||||
value: T;
|
||||
index: number;
|
||||
moved?: number;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="./knockout.d.ts" />
|
||||
|
||||
import ko = require("knockout");
|
||||
import ko = require("knockout");
|
||||
|
||||
var myArray = ko.observableArray([1, 2, 3]);
|
||||
|
||||
|
||||
@@ -680,3 +680,38 @@ function test_tasks() {
|
||||
setTimeout(callback, 0);
|
||||
};
|
||||
}
|
||||
|
||||
function observableEventsTests() {
|
||||
var observable = ko.observable(1);
|
||||
observable.subscribe(value => {
|
||||
var num: number = value;
|
||||
});
|
||||
observable.subscribe(value => {
|
||||
var num: number = value;
|
||||
}, null, "change");
|
||||
observable.subscribe(value => {
|
||||
var num: number = value;
|
||||
}, null, "beforeChange");
|
||||
}
|
||||
|
||||
function observableArrayEventsTests() {
|
||||
var observableArray = ko.observableArray([1, 2, 3, 4]);
|
||||
observableArray.subscribe(array => {
|
||||
var arr: number[] = array;
|
||||
});
|
||||
observableArray.subscribe(array => {
|
||||
var arr: number[] = array;
|
||||
}, null, "change");
|
||||
observableArray.subscribe(array => {
|
||||
var arr: number[] = array;
|
||||
}, null, "beforeChange");
|
||||
var count = 0;
|
||||
observableArray.subscribe(changes => {
|
||||
changes.forEach(change => {
|
||||
if (change.status == "added")
|
||||
count++;
|
||||
else if (change.status == "deleted")
|
||||
count--;
|
||||
});
|
||||
}, null, "arrayChange");
|
||||
}
|
||||
Vendored
+1
@@ -37,5 +37,6 @@ declare module "koa-compress" {
|
||||
*/
|
||||
function compress(options?: CompressOptions): { (ctx: Koa.Context, next?: () => any): any };
|
||||
|
||||
namespace compress {}
|
||||
export = compress;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -31,5 +31,6 @@ declare module "koa-favicon" {
|
||||
|
||||
}): { (ctx: Koa.Context, next?: () => any): any };
|
||||
|
||||
namespace favicon {}
|
||||
export = favicon;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="../koa/koa.d.ts" />
|
||||
/// <reference path="koa-json-error.d.ts" />
|
||||
/// <reference path="../lodash/lodash.d.ts" />
|
||||
|
||||
import * as Koa from "koa";
|
||||
import * as error from "koa-json-error";
|
||||
import { assign } from "lodash";
|
||||
|
||||
const app = new Koa();
|
||||
|
||||
app.use(error({
|
||||
preFormat: err => assign({}, err)
|
||||
}));
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for koa-json-error v3.x
|
||||
// Project: https://github.com/koajs/json-error
|
||||
// Definitions by: Mudkip <https://github.com/mudkipme>
|
||||
// Definitions: https://github.com/mudkipme/DefinitelyTyped
|
||||
|
||||
/// <reference path="../koa/koa.d.ts" />
|
||||
|
||||
declare module "koa-json-error" {
|
||||
|
||||
import * as Koa from "koa";
|
||||
|
||||
interface JSONErrorOptions {
|
||||
/**
|
||||
* Perform some task before calling `options.format`. Must be a function with the original err as its only argument.
|
||||
*/
|
||||
preFormat?: { (err: Error): any };
|
||||
|
||||
/**
|
||||
* Runs inmediatly after `options.preFormat`. It receives two arguments: the original `err` and the output of `options.preFormat`. It should `return` a newly formatted error.
|
||||
*/
|
||||
format?: { (err: Error, obj: any): any };
|
||||
|
||||
/**
|
||||
* Runs inmediatly after `options.format`. It receives two arguments: the original `err` and the output of `options.format`. It should `return` a newly formatted error.
|
||||
*/
|
||||
postFormat?: { (err: Error, obj: any): any };
|
||||
}
|
||||
|
||||
/**
|
||||
* Error handler for pure Koa 2.0.0+ JSON apps
|
||||
*/
|
||||
function jsonError(options?: JSONErrorOptions) : { (ctx: Koa.Context, next?: () => any): any };
|
||||
|
||||
namespace jsonError {}
|
||||
export = jsonError;
|
||||
}
|
||||
@@ -23,11 +23,11 @@ router
|
||||
.put('/users/:id', function (ctx, next) {
|
||||
ctx.body = ctx.params.id;
|
||||
})
|
||||
.del('/users/:id', function (ctx, next) {
|
||||
.del('/users/:id', function () {
|
||||
// ...
|
||||
});
|
||||
|
||||
router.get('user', '/users/:id', function (ctx, next) {
|
||||
router.get('user', '/users/:id', function (ctx) {
|
||||
ctx.body = "sdsd";
|
||||
});
|
||||
|
||||
|
||||
Vendored
+26
-28
@@ -49,11 +49,11 @@ declare module "koa-router" {
|
||||
}
|
||||
|
||||
export interface IMiddleware {
|
||||
(ctx: Router.IRouterContext, next?: () => any): any;
|
||||
(ctx: Router.IRouterContext, next: () => Promise<any>): any;
|
||||
}
|
||||
|
||||
export interface IParamMiddleware {
|
||||
(param: string, ctx: Router.IRouterContext, next?: () => any): any;
|
||||
(param: string, ctx: Router.IRouterContext, next: () => Promise<any>): any;
|
||||
}
|
||||
|
||||
export interface IRouterAllowedMethodsOptions {
|
||||
@@ -83,10 +83,8 @@ declare module "koa-router" {
|
||||
regexp: RegExp;
|
||||
path: string;
|
||||
|
||||
constructor(path: string, methods: string[], middleware: Router.IMiddleware, opts?: Layer.ILayerOptions);
|
||||
constructor(path: string, methods: string[], middleware: Array<Router.IMiddleware>, opts?: Layer.ILayerOptions);
|
||||
constructor(path: RegExp, methods: string[], middleware: Router.IMiddleware, opts?: Layer.ILayerOptions);
|
||||
constructor(path: RegExp, methods: string[], middleware: Array<Router.IMiddleware>, opts?: Layer.ILayerOptions);
|
||||
constructor(path: string | RegExp, methods: string[], middleware: Router.IMiddleware, opts?: Layer.ILayerOptions);
|
||||
constructor(path: string | RegExp, methods: string[], middleware: Array<Router.IMiddleware>, opts?: Layer.ILayerOptions);
|
||||
|
||||
/**
|
||||
* Returns whether request `path` matches route.
|
||||
@@ -96,7 +94,7 @@ declare module "koa-router" {
|
||||
/**
|
||||
* Returns map of URL parameters for given `path` and `paramNames`.
|
||||
*/
|
||||
params(path: string, captures: string[], existingParams?: Object): Object;
|
||||
params(path: string | RegExp, captures: string[], existingParams?: Object): Object;
|
||||
|
||||
/**
|
||||
* Returns array of regexp url path captures.
|
||||
@@ -138,61 +136,61 @@ declare module "koa-router" {
|
||||
* "down" the middleware stack.
|
||||
*/
|
||||
use(...middleware: Array<Router.IMiddleware>): Router;
|
||||
use(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
use(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* HTTP get method
|
||||
*/
|
||||
get(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
get(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
get(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
get(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* HTTP post method
|
||||
*/
|
||||
post(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
post(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
post(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
post(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* HTTP put method
|
||||
*/
|
||||
put(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
put(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
put(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
put(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* HTTP delete method
|
||||
*/
|
||||
delete(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
delete(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
delete(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
delete(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* Alias for `router.delete()` because delete is a reserved word
|
||||
*/
|
||||
del(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
del(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
del(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
del(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* HTTP head method
|
||||
*/
|
||||
head(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
head(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
head(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
head(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* HTTP options method
|
||||
*/
|
||||
options(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
options(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
options(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
options(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* HTTP path method
|
||||
*/
|
||||
patch(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
patch(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
patch(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
patch(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* Register route with all methods.
|
||||
*/
|
||||
all(name: string, path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
all(path: string, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
all(name: string, path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
all(path: string | RegExp, ...middleware: Array<Router.IMiddleware>): Router;
|
||||
|
||||
/**
|
||||
* Set the path prefix for a Router instance that was already initialized.
|
||||
@@ -226,7 +224,7 @@ declare module "koa-router" {
|
||||
/**
|
||||
* Create and register a route.
|
||||
*/
|
||||
register(path: string, methods: string[], middleware: Router.IMiddleware, opts?: Object): Layer;
|
||||
register(path: string | RegExp, methods: string[], middleware: Router.IMiddleware, opts?: Object): Layer;
|
||||
|
||||
/**
|
||||
* Lookup route with given `name`.
|
||||
@@ -254,7 +252,7 @@ declare module "koa-router" {
|
||||
/**
|
||||
* Generate URL from url pattern and given `params`.
|
||||
*/
|
||||
static url(path: string, params: Object): string;
|
||||
static url(path: string | RegExp, params: Object): string;
|
||||
}
|
||||
|
||||
export = Router;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,48 +1,48 @@
|
||||
// test file for masonry-layout.d.ts
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="./masonry-layout.d.ts" />
|
||||
|
||||
//import {Masonry} from "./masonry-layout.d.ts";
|
||||
|
||||
// responsive layouts
|
||||
function testResponsiveLayouts() {
|
||||
$('.grid').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
percentPosition: true
|
||||
});
|
||||
}
|
||||
|
||||
// recommended Options
|
||||
function testRecommendedOptions() {
|
||||
$('.grid').masonry({
|
||||
columnWidth: 200,
|
||||
itemSelector: '.grid-item'
|
||||
});
|
||||
|
||||
var msnry = new Masonry.Masonry('.grid', {
|
||||
columnWidth: 200,
|
||||
itemSelector: '.grid-item'
|
||||
});
|
||||
}
|
||||
|
||||
// extended Options
|
||||
function testExtendedOptions() {
|
||||
var msnry = new Masonry.Masonry('.grid', {
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
percentPosition: true,
|
||||
gutter: '.gutter-sizer',
|
||||
stamp: '.stamp',
|
||||
fitWidth: true,
|
||||
originLeft: true,
|
||||
originTop: true,
|
||||
containerStyle: {
|
||||
position: 'relative'
|
||||
},
|
||||
transitionDuration: '0.4s',
|
||||
resize: true,
|
||||
initLayout: true
|
||||
});
|
||||
}
|
||||
// test file for masonry-layout.d.ts
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="./masonry-layout.d.ts" />
|
||||
|
||||
//import {Masonry} from "./masonry-layout.d.ts";
|
||||
|
||||
// responsive layouts
|
||||
function testResponsiveLayouts() {
|
||||
$('.grid').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
percentPosition: true
|
||||
});
|
||||
}
|
||||
|
||||
// recommended Options
|
||||
function testRecommendedOptions() {
|
||||
$('.grid').masonry({
|
||||
columnWidth: 200,
|
||||
itemSelector: '.grid-item'
|
||||
});
|
||||
|
||||
var msnry = new Masonry.Masonry('.grid', {
|
||||
columnWidth: 200,
|
||||
itemSelector: '.grid-item'
|
||||
});
|
||||
}
|
||||
|
||||
// extended Options
|
||||
function testExtendedOptions() {
|
||||
var msnry = new Masonry.Masonry('.grid', {
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
percentPosition: true,
|
||||
gutter: '.gutter-sizer',
|
||||
stamp: '.stamp',
|
||||
fitWidth: true,
|
||||
originLeft: true,
|
||||
originTop: true,
|
||||
containerStyle: {
|
||||
position: 'relative'
|
||||
},
|
||||
transitionDuration: '0.4s',
|
||||
resize: true,
|
||||
initLayout: true
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+70
-70
@@ -1,70 +1,70 @@
|
||||
// Type definitions for Masonry 4.0.0
|
||||
// Project: https://github.com/desandro/masonry
|
||||
// Definitions by: Mark Wilson <https://github.com/m-a-wilson>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
// Modified from original definitions by:
|
||||
// Travis Brown < https://github.com/warriorrocker>
|
||||
|
||||
declare module Masonry {
|
||||
|
||||
class Masonry implements MasonryGrid {
|
||||
constructor(options?: MasonryOptions);
|
||||
constructor(selector: string, options?: MasonryOptions);
|
||||
}
|
||||
|
||||
interface MasonryGrid {
|
||||
masonry?(): void;
|
||||
masonry?(eventName: string, listener: any): void;
|
||||
|
||||
// layout
|
||||
layout?(): void;
|
||||
layoutItems?(items: Array<any>, isStill?: boolean): void;
|
||||
stamp?(elements: Array<any>): void;
|
||||
unstamp?(elements: Array<any>): void;
|
||||
|
||||
// add and remove items
|
||||
appended?(elements: Array<any>): void;
|
||||
prepended?(elements: Array<any>): void;
|
||||
addItems?(elements: Array<any>): void;
|
||||
remove?(elements: Array<any>): void;
|
||||
|
||||
// events
|
||||
on?(eventName: string, listener: any): void;
|
||||
off?(eventName: string, listener: any): void;
|
||||
once?(eventName: string, listener: any): void;
|
||||
|
||||
// utilities
|
||||
reloadItems?(): void;
|
||||
destroy?(): void;
|
||||
getItemElements?(): Array<any>;
|
||||
data?(element: Element): Masonry;
|
||||
}
|
||||
|
||||
interface MasonryOptions {
|
||||
|
||||
// layout
|
||||
itemSelector?: string;
|
||||
columnWidth?: any;
|
||||
percentPosition?: boolean;
|
||||
gutter?: any;
|
||||
stamp?: string;
|
||||
fitWidth?: boolean;
|
||||
originLeft?: boolean;
|
||||
originTop?: boolean;
|
||||
|
||||
// setup
|
||||
containerStyle?: Object;
|
||||
transitionDuration?: any;
|
||||
resize?: boolean;
|
||||
initLayout?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
masonry(options?: Masonry.MasonryOptions): JQuery;
|
||||
}
|
||||
|
||||
|
||||
// Type definitions for Masonry 4.0.0
|
||||
// Project: https://github.com/desandro/masonry
|
||||
// Definitions by: Mark Wilson <https://github.com/m-a-wilson>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
// Modified from original definitions by:
|
||||
// Travis Brown < https://github.com/warriorrocker>
|
||||
|
||||
declare module Masonry {
|
||||
|
||||
class Masonry implements MasonryGrid {
|
||||
constructor(options?: MasonryOptions);
|
||||
constructor(selector: string, options?: MasonryOptions);
|
||||
}
|
||||
|
||||
interface MasonryGrid {
|
||||
masonry?(): void;
|
||||
masonry?(eventName: string, listener: any): void;
|
||||
|
||||
// layout
|
||||
layout?(): void;
|
||||
layoutItems?(items: Array<any>, isStill?: boolean): void;
|
||||
stamp?(elements: Array<any>): void;
|
||||
unstamp?(elements: Array<any>): void;
|
||||
|
||||
// add and remove items
|
||||
appended?(elements: Array<any>): void;
|
||||
prepended?(elements: Array<any>): void;
|
||||
addItems?(elements: Array<any>): void;
|
||||
remove?(elements: Array<any>): void;
|
||||
|
||||
// events
|
||||
on?(eventName: string, listener: any): void;
|
||||
off?(eventName: string, listener: any): void;
|
||||
once?(eventName: string, listener: any): void;
|
||||
|
||||
// utilities
|
||||
reloadItems?(): void;
|
||||
destroy?(): void;
|
||||
getItemElements?(): Array<any>;
|
||||
data?(element: Element): Masonry;
|
||||
}
|
||||
|
||||
interface MasonryOptions {
|
||||
|
||||
// layout
|
||||
itemSelector?: string;
|
||||
columnWidth?: any;
|
||||
percentPosition?: boolean;
|
||||
gutter?: any;
|
||||
stamp?: string;
|
||||
fitWidth?: boolean;
|
||||
originLeft?: boolean;
|
||||
originTop?: boolean;
|
||||
|
||||
// setup
|
||||
containerStyle?: Object;
|
||||
transitionDuration?: any;
|
||||
resize?: boolean;
|
||||
initLayout?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
masonry(options?: Masonry.MasonryOptions): JQuery;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -513,8 +513,8 @@ declare namespace __MaterialUI {
|
||||
iconClassNameRight?: string;
|
||||
iconElementLeft?: React.ReactElement<any>;
|
||||
iconElementRight?: React.ReactElement<any>;
|
||||
iconStyleRight?: string;
|
||||
iconStyleLeft?: string;
|
||||
iconStyleRight?: React.CSSProperties;
|
||||
iconStyleLeft?: React.CSSProperties;
|
||||
onLeftIconButtonTouchTap?: TouchTapEventHandler;
|
||||
onRightIconButtonTouchTap?: TouchTapEventHandler;
|
||||
onTitleTouchTap?: TouchTapEventHandler;
|
||||
@@ -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,52 @@
|
||||
/// <reference path="./mongoose-sequence.d.ts" />
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
/**
|
||||
* Based on the examples on: https://github.com/ramiel/mongoose-sequence
|
||||
* Created by Linus Brolin <https://github.com/linusbrolin/>.
|
||||
*/
|
||||
|
||||
import { SequenceDocument, SequenceOptions, SequenceSchema, Document, Schema, Model, model } from 'mongoose';
|
||||
import * as mongooseSequence from 'mongoose-sequence';
|
||||
|
||||
//#region Test Models
|
||||
interface User extends SequenceDocument {
|
||||
name: string;
|
||||
country: string;
|
||||
city: string;
|
||||
inhabitant_number: number;
|
||||
}
|
||||
|
||||
const UserSchema: SequenceSchema = new Schema({
|
||||
name: String,
|
||||
country: String,
|
||||
city: String,
|
||||
inhabitant_number: Number
|
||||
});
|
||||
|
||||
let seqOpts: SequenceOptions = { id: 'inhabitant_seq', inc_field: 'inhabitant_number', reference_fields: ['country', 'city'] };
|
||||
UserSchema.plugin(mongooseSequence, seqOpts);
|
||||
|
||||
let UserModel: Model<User> = model<User>('User', UserSchema);
|
||||
//#endregion
|
||||
|
||||
//#region Test Sequence
|
||||
let user: User = new UserModel({
|
||||
name: 'Patrice',
|
||||
country: 'France',
|
||||
city: 'Paris'
|
||||
});
|
||||
user.save();
|
||||
console.log(user.inhabitant_number);
|
||||
|
||||
user.setNext('inhabitant_seq', function(err: any, user: User) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
if (user) {
|
||||
console.log(user.inhabitant_number);
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user