Rebase aginst current master, resolve conflicts

This commit is contained in:
Karol Janyst
2017-03-25 18:25:03 +09:00
14009 changed files with 66505 additions and 47356 deletions
-20
View File
@@ -1,22 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 6.9.2
- node
sudo: false
-1
View File
@@ -1 +0,0 @@
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) at [definitelytyped.org](http://definitelytyped.org/guides/contributing.html) for information on how to contribute to DefinitelyTyped.
-1893
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -157,7 +157,7 @@ If a package was never on DefinitelyTyped, it does not need to be added to `notN
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "../tslint.json" }`. All new packages must be linted.
If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
```json
```js
{
"extends": "../tslint.json",
"rules": {
@@ -255,6 +255,10 @@ transitively `react-router-bootstrap` (which depends on `react-router`) also add
Also, `/// <reference types=".." />` will not work with path mapping, so dependencies must use `import`.
#### The file history in GitHub looks incomplete.
GitHub doesn't [support](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) file history for renamed files. Use [`git log --follow`](https://www.git-scm.com/docs/git-log) instead.
## License
-44
View File
@@ -1,44 +0,0 @@
interface StringCallback { (err: Error, result: string): void; }
interface AsyncStringGetter { (callback: StringCallback): void; }
var taskArray: AsyncStringGetter[] = [
function (callback) {
setTimeout(function () {
callback(null, 'one');
}, 200);
},
function (callback) {
setTimeout(function () {
callback(null, 'two');
}, 100);
},
];
async.series(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallel(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallelLimit(taskArray, 3, function (err, results) { console.log(results[0].match(/o/)) });
interface Lookup<T> { [key: string]: T; }
interface NumberCallback { (err: Error, result: number): void; }
interface AsyncNumberGetter { (callback: NumberCallback): void; }
var taskDict: Lookup<AsyncNumberGetter> = {
one: function(callback){
setTimeout(function(){
callback(null, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
callback(null, 2);
}, 100);
}
}
async.series(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallel(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallelLimit(taskDict, 3, function(err, results) { console.log(results['one'].toFixed(1)) });
-55
View File
@@ -1,55 +0,0 @@
var input = document.getElementById("myinput");
new Awesomplete(input, {list: "#mylist"});
new Awesomplete(input, {list: document.querySelector("#mylist")});
new Awesomplete(input, {
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
});
var awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
new Awesomplete(input, {
list: [
{ label: "Belarus", value: "BY" },
{ label: "China", value: "CN" },
{ label: "United States", value: "US" }
]
});
// Same with arrays:
new Awesomplete(input, {
list: [
[ "Belarus", "BY" ],
[ "China", "CN" ],
[ "United States", "US" ]
]
});
new Awesomplete('input[type="email"]', {
list: ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com", "google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", "live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"],
data: function (text: string, input: any) {
return input.slice(0, input.indexOf("@")) + "@" + text;
},
filter: Awesomplete.FILTER_STARTSWITH
});
new Awesomplete('input[data-multiple]', {
filter: function(text: string, input: any) {
return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]);
},
replace: function(text: string) {
var before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
});
var ajax = new XMLHttpRequest();
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
ajax.onload = function() {
var list = JSON.parse(ajax.responseText).map(function(i: any) { return i.name; });
new Awesomplete(document.querySelector("#ajax-example input"),{ list: list });
};
ajax.send();
-49
View File
@@ -1,49 +0,0 @@
// Type definitions for Awesomplete v1.1.0
// Project: https://leaverou.github.io/awesomplete/
// Definitions by: webbiesdk <https://github.com/webbiesdk/>, Ben Dixon <https://github.com/bmdixon/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Awesomplete {
constructor(input: Element | HTMLElement | string, o?: AwesompleteOptions);
static all: Array<any>;
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
create: (tag: string, o: any) => HTMLElement;
fire: (target: EventTarget, type: string, properties: any) => any;
siblingIndex: (el: Element) => number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
static SORT_BYLENGTH: (a: number | any[], b: number | any[]) => number;
static REPLACE: (text: any) => void;
next: () => void;
container: HTMLElement;
select: (selected?: HTMLElement, originalTarget?: HTMLElement) => void;
previous: () => void;
index: number;
opened: number;
list: string | string[] | Element | { label: string, value: any }[] | [string, string][];
input: HTMLElement | string;
goto: (i: number) => void;
ul: HTMLElement;
close: () => void;
evaluate: () => void;
selected: boolean;
open: () => void;
status: HTMLElement;
}
interface AwesompleteOptions {
list?: string | string[] | Element | { label: string, value: any }[] | [string, string][];
minChars?: Number;
maxItems?: Number;
autoFirst?: boolean;
data?: Function;
filter?: Function;
sort?: Function;
item?: Function;
replace?: Function;
}
-445
View File
@@ -1,445 +0,0 @@
var x: BigNumber.BigNumber = new BigNumber(9)
var y = new BigNumber(x)
BigNumber(435.345)
new BigNumber('5032485723458348569331745.33434346346912144534543')
new BigNumber('4.321e+4')
new BigNumber('-735.0918e-430')
new BigNumber(Infinity)
new BigNumber(NaN)
new BigNumber('.5')
new BigNumber('+2')
new BigNumber(-10110100.1, 2)
new BigNumber(-0b10110100)
new BigNumber('123412421.234324', 5)
new BigNumber('ff.8', 16)
new BigNumber('0xff.8')
new BigNumber(9, 2)
new BigNumber(96517860459076817.4395)
new BigNumber('blurgh')
BigNumber.config({ DECIMAL_PLACES: 5 })
new BigNumber(1.23456789)
new BigNumber(1.23456789, 10)
BigNumber.config({ DECIMAL_PLACES: 5 })
var BN = BigNumber.another({ DECIMAL_PLACES: 9 })
x = new BigNumber(1)
y = new BN(1)
x.div(3)
y.div(3)
BN = BigNumber.another()
BN.config({ DECIMAL_PLACES: 9 })
BigNumber.config({ DECIMAL_PLACES: 5 })
BigNumber.set({ DECIMAL_PLACES: 5 })
BigNumber.config(5)
BigNumber.config({ ROUNDING_MODE: 0 })
BigNumber.config(undefined, BigNumber.ROUND_UP)
BigNumber.config({ EXPONENTIAL_AT: 2 })
new BigNumber(12.3)
new BigNumber(123)
new BigNumber(0.123)
new BigNumber(0.0123)
BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
new BigNumber(123456789)
new BigNumber(0.000000123)
BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
BigNumber.config({ EXPONENTIAL_AT: 0 })
BigNumber.config({ RANGE: 500 })
BigNumber.config().RANGE
new BigNumber('9.999e499')
new BigNumber('1e500')
new BigNumber('1e-499')
new BigNumber('1e-500')
BigNumber.config({ RANGE: [-3, 4] })
new BigNumber(99999)
new BigNumber(100000)
new BigNumber(0.001)
new BigNumber(0.0001)
BigNumber.config({ ERRORS: false })
BigNumber.config({ CRYPTO: true })
BigNumber.config().CRYPTO
BigNumber.random()
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
BigNumber.config({ MODULO_MODE: 9 })
BigNumber.config({ POW_PRECISION: 100 })
BigNumber.config({
FORMAT: {
decimalSeparator: '.',
groupSeparator: ',',
groupSize: 3,
secondaryGroupSize: 0,
fractionGroupSeparator: ' ',
fractionGroupSize: 0
}
});
BigNumber.config({
DECIMAL_PLACES: 40,
ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
EXPONENTIAL_AT: [-10, 20],
RANGE: [-500, 500],
ERRORS: true,
CRYPTO: true,
MODULO_MODE: BigNumber.ROUND_FLOOR,
POW_PRECISION: 80,
FORMAT: {
groupSize: 3,
groupSeparator: ' ',
decimalSeparator: ','
}
});
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80)
var obj = BigNumber.config();
obj.ERRORS
obj.RANGE
x = new BigNumber('3257869345.0378653')
BigNumber.max(4e9, x, '123456789.9')
var arr = [12, '13', new BigNumber(14)]
BigNumber.max(arr)
x = new BigNumber('3257869345.0378653')
BigNumber.min(4e9, x, '123456789.9')
arr = [2, new BigNumber(-14), '-15.9999', -12]
BigNumber.min(arr)
BigNumber.config({ DECIMAL_PLACES: 10 })
BigNumber.random()
BigNumber.random(20)
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL })
BigNumber.config({ ROUNDING_MODE: 2 })
x = new BigNumber(-0.8)
y = x.absoluteValue()
var z = y.abs()
x = new BigNumber(1.3)
x.ceil()
y = new BigNumber(-1.8)
y.ceil()
x = new BigNumber(Infinity)
y = new BigNumber(5)
x.comparedTo(y)
x.comparedTo(x.minus(1))
y.cmp(NaN)
y.cmp('110', 2)
x = new BigNumber(123.45)
x.decimalPlaces()
y = new BigNumber('9.9e-101')
y.dp()
x = new BigNumber(355)
y = new BigNumber(113)
x.dividedBy(y)
x.div(5)
x.div(47, 16)
x = new BigNumber(5)
y = new BigNumber(3)
x.dividedToIntegerBy(y)
x.divToInt(0.7)
x.divToInt('0.f', 16)
0 === 1e-324
x = new BigNumber(0)
x.equals('1e-324')
BigNumber(-0).eq(x)
BigNumber(255).eq('ff', 16)
y = new BigNumber(NaN)
y.equals(NaN)
x = new BigNumber(1.8)
x.floor()
y = new BigNumber(-1.3)
y.floor()
0.1 > (0.3 - 0.2)
x = new BigNumber(0.1)
x.greaterThan(BigNumber(0.3).minus(0.2))
BigNumber(0).gt(x)
BigNumber(11, 3).gt(11.1, 2)
x = new BigNumber(0.3).minus(0.2)
x.greaterThanOrEqualTo(0.1)
BigNumber(1).gte(x)
BigNumber(10, 18).gte('i', 36)
x = new BigNumber(1)
x.isFinite()
y = new BigNumber(Infinity)
y.isFinite()
x = new BigNumber(1)
x.isInteger()
y = new BigNumber(123.456)
y.isInt()
x = new BigNumber(NaN)
x.isNaN()
y = new BigNumber('Infinity')
y.isNaN()
x = new BigNumber(-0)
x.isNegative()
y = new BigNumber(2)
y.isNeg()
x = new BigNumber(-0)
x.isZero() && x.isNeg()
y = new BigNumber(Infinity)
y.isZero()
x = new BigNumber(0.3).minus(0.2)
x.lessThan(0.1)
BigNumber(0).lt(x)
BigNumber(11.1, 2).lt(11, 3)
x = new BigNumber(0.1)
x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2))
BigNumber(-1).lte(x)
BigNumber(10, 18).lte('i', 36)
x = new BigNumber(0.3)
x.minus(0.1)
x.sub(0.6, 20)
x = new BigNumber(1)
x.modulo(0.9)
y = new BigNumber(33)
y.mod('a', 33)
x = new BigNumber(1.8)
x.negated()
y = new BigNumber(-1.3)
y.neg()
x = new BigNumber(0.1)
y = x.plus(0.2)
BigNumber(0.7).plus(x).add(y)
x.plus('0.1', 8)
x = new BigNumber(1.234)
x.precision()
y = new BigNumber(987000)
y.sd()
y.sd(true)
y = new BigNumber(x)
y.round()
y.round(1)
y.round(2)
y.round(10)
y.round(0, 1)
y.round(0, 6)
y.round(1, 1)
y.round(1, BigNumber.ROUND_HALF_EVEN)
y
x = new BigNumber(1.23)
x.shift(3)
x.shift(-3)
x = new BigNumber(16)
x.squareRoot()
y = new BigNumber(3)
y.sqrt()
x = new BigNumber(0.6)
y = x.times(3)
BigNumber('7e+500').times(y)
x.times('-a', 16)
BigNumber.config({ DECIMAL_PLACES: 5, ROUNDING_MODE: 4 })
x = new BigNumber(9876.54321)
x.toDigits()
x.toDigits(6)
x.toDigits(6, BigNumber.ROUND_UP)
x.toDigits(2)
x.toDigits(2, 1)
x
y = new BigNumber(45.6)
y.toExponential()
y.toExponential(0)
y.toExponential(1)
y.toExponential(1, 1)
y.toExponential(3)
y = new BigNumber(3.456)
y.toFixed()
y.toFixed(0)
y.toFixed(2)
y.toFixed(2, 1)
y.toFixed(5)
var format = {
decimalSeparator: '.',
groupSeparator: ',',
groupSize: 3,
secondaryGroupSize: 0,
fractionGroupSeparator: ' ',
fractionGroupSize: 0
}
BigNumber.config({ FORMAT: format })
x = new BigNumber('123456789.123456789')
x.toFormat()
x.toFormat(1)
format.groupSeparator = ' '
format.fractionGroupSize = 5
x.toFormat()
BigNumber.config({
FORMAT: {
decimalSeparator: ',',
groupSeparator: '.',
groupSize: 3,
secondaryGroupSize: 2
}
})
x.toFormat(6)
x = new BigNumber(1.75)
x.toFraction()
var pi = new BigNumber('3.14159265358')
pi.toFraction()
pi.toFraction(100000)
pi.toFraction(10000)
pi.toFraction(100)
pi.toFraction(10)
pi.toFraction(1)
x = new BigNumber('177.7e+457')
y = new BigNumber(235.4325)
z = new BigNumber('0.0098074')
var str = JSON.stringify([x, y, z])
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val))
x = new BigNumber(456.789)
x.toNumber()
{ +x }
y = new BigNumber('45987349857634085409857349856430985')
y.toNumber()
z = new BigNumber(-0)
1 / +z
1 / z.toNumber()
x = new BigNumber(0.7)
x.toPower(2)
BigNumber(3).pow(-2)
y = new BigNumber(45.6)
x.toPrecision()
y.toPrecision()
x.toPrecision(1)
y.toPrecision(1)
y.toPrecision(2, 0)
y.toPrecision(2, 1)
x.toPrecision(5)
y.toPrecision(5)
x = new BigNumber(750000)
x.toString()
BigNumber.config({ EXPONENTIAL_AT: 5 })
x.toString()
y = new BigNumber(362.875)
y.toString(2)
y.toString(9)
y.toString(32)
BigNumber.config({ DECIMAL_PLACES: 4 });
z = new BigNumber('1.23456789')
z.toString()
z.toString(10)
x = new BigNumber(123.456)
x.truncated()
y = new BigNumber(-12.3)
y.trunc()
x = new BigNumber('-0')
x.toString()
x.valueOf()
y = new BigNumber('1.777e+457')
y.valueOf()
x = new BigNumber(0.123)
x.toExponential()
x.c
x.e
x.s
z = new BigNumber('-123.4567000e+2')
z.toExponential()
z.c
z.e
z.s
x = new BigNumber(3)
x instanceof BigNumber
x.isBigNumber
BN = BigNumber.another();
y = new BN(3)
y instanceof BigNumber
y.isBigNumber
y = new BigNumber(-0)
y.c
y.e
y.s
try {
// ...
} catch (e) {
if (e instanceof Error && e.name == 'BigNumber Error') {
// ...
}
}
x = new BigNumber("1.0")
y = new BigNumber("1.1000")
z = x.add(y)
x = new BigNumber("1.20")
y = new BigNumber("3.45000")
z = x.mul(y)
-6
View File
@@ -1,6 +0,0 @@
import blueimp = require('blueimp-md5');
function hash(): boolean {
return blueimp.md5('hello world') === '5eb63bbbe01eeed093cb22bb8f5acdc3';
}
-6
View File
@@ -1,6 +0,0 @@
// Type definitions for blueimp-md5 v1.1.0
// Project: https://github.com/blueimp/JavaScript-MD5
// Definitions by: Ray Martone <https://github.com/rmartone>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export declare function md5(value: string, key?: string, raw?: boolean): string;
-118
View File
@@ -1,118 +0,0 @@
// Type definitions for node-bunyan
// Project: https://github.com/trentm/node-bunyan
// Definitions by: Alex Mikhalev <https://github.com/amikhalev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { EventEmitter } from 'events';
declare class Logger extends EventEmitter {
constructor(options: Logger.LoggerOptions);
addStream(stream: Logger.Stream): void;
addSerializers(serializers: Logger.Serializers | Logger.StdSerializers): void;
child(options: Logger.LoggerOptions, simple?: boolean): Logger;
child(obj: Object, simple?: boolean): Logger;
reopenFileStreams(): void;
level(): string | number;
level(value: number | string): void;
levels(name: number | string, value: number | string): void;
fields: any;
src: boolean;
trace(error: Error, format?: any, ...params: any[]): void;
trace(buffer: Buffer, format?: any, ...params: any[]): void;
trace(obj: Object, format?: any, ...params: any[]): void;
trace(format: string, ...params: any[]): void;
debug(error: Error, format?: any, ...params: any[]): void;
debug(buffer: Buffer, format?: any, ...params: any[]): void;
debug(obj: Object, format?: any, ...params: any[]): void;
debug(format: string, ...params: any[]): void;
info(error: Error, format?: any, ...params: any[]): void;
info(buffer: Buffer, format?: any, ...params: any[]): void;
info(obj: Object, format?: any, ...params: any[]): void;
info(format: string, ...params: any[]): void;
warn(error: Error, format?: any, ...params: any[]): void;
warn(buffer: Buffer, format?: any, ...params: any[]): void;
warn(obj: Object, format?: any, ...params: any[]): void;
warn(format: string, ...params: any[]): void;
error(error: Error, format?: any, ...params: any[]): void;
error(buffer: Buffer, format?: any, ...params: any[]): void;
error(obj: Object, format?: any, ...params: any[]): void;
error(format: string, ...params: any[]): void;
fatal(error: Error, format?: any, ...params: any[]): void;
fatal(buffer: Buffer, format?: any, ...params: any[]): void;
fatal(obj: Object, format?: any, ...params: any[]): void;
fatal(format: string, ...params: any[]): void;
}
declare namespace Logger {
const TRACE: number;
const DEBUG: number;
const INFO: number;
const WARN: number;
const ERROR: number;
const FATAL: number;
const stdSerializers: StdSerializers;
function createLogger(options: LoggerOptions): Logger;
function safeCycles(): (key: string, value: any) => any;
function resolveLevel(value: number | string): number;
interface Stream {
type?: string;
level?: number | string;
path?: string;
stream?: NodeJS.WritableStream | Stream;
closeOnExit?: boolean;
period?: string;
count?: number;
}
interface LoggerOptions {
name: string;
streams?: Stream[];
level?: string | number;
stream?: NodeJS.WritableStream;
serializers?: Serializers | StdSerializers;
src?: boolean;
[custom: string]: any;
}
interface Serializer {
(input:any): any;
}
interface Serializers {
[key: string]: Serializer
}
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
}
interface RingBufferOptions {
limit?: number;
}
class RingBuffer extends EventEmitter {
constructor(options: RingBufferOptions);
writable: boolean;
records: any[];
write(record: any): void;
end(record?: any): void;
destroy(): void;
destroySoon(): void;
}
}
export = Logger;
-47
View File
@@ -1,47 +0,0 @@
import fs = require('fs');
import chokidar = require('chokidar');
var watcher = chokidar.watch('file, dir, or glob', {
ignored: /[\/\\]\./, persistent: true
});
var log = console.log.bind(console);
let str: string;
let any: any;
let stats: fs.Stats;
watcher
.on('add', path => { str = path; })
.on('addDir', path => { str = path; })
.on('change', path => { str = path; })
.on('unlink', path => { str = path; })
.on('unlinkDir', path => { str = path; })
.on('error', (error) => { any = error; })
.on('ready', () => { })
.on('raw', (event, path, details) => { str = event; str = path; any = details; })
// 'add', 'addDir' and 'change' events also receive stat() results as second
// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats
watcher.on('change', (path, _stats) => {
str = path;
stats = _stats;
});
// Watch new files.
watcher.add('new-file');
watcher.add(['new-file-2', 'new-file-3', '**/other-file*']);
// Un-watch some files.
watcher.unwatch('new-file*');
// Only needed if watching is `persistent: true`.
watcher.close();
// One-liner
chokidar.watch('.', {ignored: /[\/\\]\./}).on('all', (event, path) => {
str = event;
str = path;
});
-49
View File
@@ -1,49 +0,0 @@
// Type definitions for chokidar 1.4.3
// Project: https://github.com/paulmillr/chokidar
// Definitions by: Stefan Steinhart <https://github.com/reppners/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare module "chokidar"
{
export class FSWatcher
{
constructor(options?: WatchOptions);
add(fileDirOrGlob:string):void;
add(filesDirsOrGlobs:Array<string>):void;
unwatch(fileDirOrGlob:string):void;
unwatch(filesDirsOrGlobs:Array<string>):void;
getWatched():any;
on(event: 'add', fn: (path: string, stats?: fs.Stats) => void): this;
on(event: 'change', fn: (path: string, stats?: fs.Stats) => void): this;
on(event: 'unlink', fn: (path: string) => void): this;
on(event: 'raw', fn: (event: string, path:string, details:any) => void): this;
on(event: 'all', fn: (event: string, path: string) => void): this;
on(event: string, fn: (path: string) => void): this;
close(): this;
}
interface WatchOptions
{
persistent?:boolean;
ignored?:any;
ignoreInitial?:boolean;
followSymlinks?:boolean;
cwd?:string;
usePolling?:boolean;
useFsEvents?:boolean;
alwaysStat?:boolean;
depth?:number;
interval?:number;
binaryInterval?:number;
ignorePermissionErrors?:boolean;
atomic?:boolean;
awaitWriteFinish?:any;
}
import fs = require("fs");
export function watch(fileDirOrGlob:string, options?:WatchOptions):FSWatcher;
export function watch(filesDirsOrGlobs:Array<string>, options?:WatchOptions):FSWatcher;
}
-1
View File
@@ -1 +0,0 @@
/// <reference types="cliff" />
-28
View File
@@ -1,28 +0,0 @@
// Type definitions for cookie v0.1.2
// Project: https://github.com/jshttp/cookie
// Definitions by: Pine Mizune <https://github.com/pine613>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface CookieSerializeOptions {
encode?: (val: string) => string;
path?: string;
expires?: Date;
maxAge?: number;
domain?: string;
secure?: boolean;
httpOnly?: boolean;
}
interface CookieParseOptions {
decode?: (val: string) => string;
}
interface CookieStatic {
serialize(name: string, val: string, options?: CookieSerializeOptions): string;
parse(str: string, options?: CookieParseOptions): { [key: string]: string };
}
declare module "cookie" {
var cookie: CookieStatic;
export = cookie;
}
-16
View File
@@ -1,16 +0,0 @@
// Type definitions for cordova-plugin-app-version v0.1.7
// Project: https://github.com/whiteoctober/cordova-plugin-app-version
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
/// <reference types="q" />
interface Cordova {
getAppVersion: {
getAppName: () => Q.IPromise<string> & JQueryPromise<string>;
getPackageName: () => Q.IPromise<string> & JQueryPromise<string>;
getVersionCode: () => Q.IPromise<string> & JQueryPromise<string>;
getVersionNumber: () => Q.IPromise<string> & JQueryPromise<string>;
};
}
-97
View File
@@ -1,97 +0,0 @@
// Type definitions for cordova-plugin-ibeacon v3.3.0
// Project: https://github.com/petermetz/cordova-plugin-ibeacon
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
interface CordovaPlugins {
locationManager: BeaconPlugin.LocationManager;
}
declare namespace BeaconPlugin {
/**
* Beacon Plugin.
*/
export interface LocationManager {
delegate: Delegate;
BeaconRegion: BeaconRegion;
Region: Region;
onDomDelegateReady(): Q.Promise<void>;
startMonitoringForRegion(region: Region): Q.Promise<void>;
stopMonitoringForRegion(region: Region): Q.Promise<void>;
requestStateForRegion(region: Region): Q.Promise<void>;
startRangingBeaconsInRegion(region: Region): Q.Promise<void>;
stopRangingBeaconsInRegion(region: Region): Q.Promise<void>;
getAuthorizationStatus(): Q.Promise<PluginResult>;
requestWhenInUseAuthorization(): Q.Promise<void>;
requestAlwaysAuthorization(): Q.Promise<void>;
getMonitoredRegions(): Q.Promise<Region[]>;
getRangedRegions(): Q.Promise<Region[]>;
isRangingAvailable(): Q.Promise<boolean>;
isMonitoringAvailableForClass(region: Region): Q.Promise<boolean>;
startAdvertising(region: Region, measuredPower: boolean): Q.Promise<void>;
stopAdvertising(): Q.Promise<void>;
isAdvertisingAvailable(): Q.Promise<boolean>;
isAdvertising(): Q.Promise<boolean>;
disableDebugLogs(): Q.Promise<void>;
enableDebugNotifications(): Q.Promise<void>;
disableDebugNotifications(): Q.Promise<void>;
enableDebugLogs(): Q.Promise<void>;
isBluetoothEnabled(): Q.Promise<boolean>;
enableBluetooth(): Q.Promise<void>;
disableBluetooth(): Q.Promise<void>;
appendToDeviceLog(message: string): Q.Promise<string>;
}
export interface PluginResult {
eventType: string;
region: Region;
beacons: Beacon[];
authorizationStatus: string;
state: string;
error: string;
}
export interface Delegate {
didDetermineStateForRegion(pluginResult: PluginResult): void;
didStartMonitoringForRegion(pluginResult: PluginResult): void;
didExitRegion(pluginResult: PluginResult): void;
didEnterRegion(pluginResult: PluginResult): void;
didRangeBeaconsInRegion(pluginResult: PluginResult): void;
peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void;
peripheralManagerDidUpdateState(pluginResult: PluginResult): void;
didChangeAuthorizationStatus(authorizationStatus: string): void;
monitoringDidFailForRegionWithError(pluginResult: PluginResult): void;
}
export interface Region {
identifier: string;
new (identifier: string): Region;
}
export interface BeaconRegion extends Region {
uuid: string;
major: string;
minor: string;
notifyEntryStateOnDisplay: boolean;
new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion;
}
export interface CircularRegion extends Region {
latitude: number;
longitude: number;
radius: number;
new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion;
}
export interface Beacon {
uuid: string;
major: string;
minor: string;
proximity: string;
tx: number;
rssi: number;
accuracy: number;
}
}
-136
View File
@@ -1,136 +0,0 @@
// Type definitions for csv-parse 1.1.0
// Project: https://github.com/wdavidw/node-csv-parse
// Definitions by: David Muller <https://github.com/davidm77>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare module "csv-parse/types" {
interface callbackFn {
(err: any, output: any): void
}
interface nameCallback {
(line1: any[]): boolean | string[]
}
interface options {
/***
* Set the field delimiter. One character only, defaults to comma.
*/
delimiter?: string;
/***
* String used to delimit record rows or a special value; special constants are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified).
*/
rowDelimiter?: string;
/***
* Optional character surrounding a field, one character only, defaults to double quotes.
*/
quote?: string
/***
* Set the escape character, one character only, defaults to double quotes.
*/
escape?: string
/***
* List of fields as an array, a user defined callback accepting the first line and returning the column names or true if autodiscovered in the first CSV line, default to null, affect the result data set in the sense that records will be objects instead of arrays.
*/
columns?: any[]|boolean|nameCallback;
/***
* Treat all the characters after this one as a comment, default to '' (disabled).
*/
comment?: string
/***
* Name of header-record title to name objects by.
*/
objname?: string
/***
* Preserve quotes inside unquoted field.
*/
relax?: boolean
/***
* Discard inconsistent columns count, default to false.
*/
relax_column_count?: boolean
/***
* Dont generate empty values for empty lines.
*/
skip_empty_lines?: boolean
/***
* Maximum numer of characters to be contained in the field and line buffers before an exception is raised, used to guard against a wrong delimiter or rowDelimiter, default to 128000 characters.
*/
max_limit_on_data_read?: number
/***
* If true, ignore whitespace immediately around the delimiter, defaults to false. Does not remove whitespace in a quoted field.
*/
trim?: boolean
/***
* If true, ignore whitespace immediately following the delimiter (i.e. left-trim all fields), defaults to false. Does not remove whitespace in a quoted field.
*/
ltrim?: boolean
/***
* If true, ignore whitespace immediately preceding the delimiter (i.e. right-trim all fields), defaults to false. Does not remove whitespace in a quoted field.
*/
rtrim?: boolean
/***
* If true, the parser will attempt to convert read data types to native types.
*/
auto_parse?: boolean
/***
* If true, the parser will attempt to convert read data types to dates. It requires the "auto_parse" option.
*/
auto_parse_date?: boolean
}
import * as stream from "stream";
interface Parser extends stream.Transform {
__push(line: any): any ;
__write(chars: any, end: any, callback: any): any;
}
interface ParserConstructor {
new (options: options): Parser;
}
interface ParserStream extends NodeJS.ReadWriteStream {
read(size?: number): any & string[];
}
interface parse {
(input: string, options?: options, callback?: callbackFn): any;
(options: options, callback: callbackFn): any;
(callback: callbackFn): any;
(options?: options): ParserStream;
Parser: ParserConstructor;
}
}
declare module "csv-parse" {
import { parse as parseIntf } from "csv-parse/types";
let parse: parseIntf;
export = parse;
}
declare module "csv-parse/lib/sync" {
import { options } from "csv-parse/types";
function parse (input: string, options?: options): any;
export = parse;
}
-134
View File
@@ -1,134 +0,0 @@
import * as assert from "power-assert";
import cucumber = require("cucumber");
function StepSample() {
type Callback = cucumber.CallbackStepDefinition;
type Table = cucumber.TableDefinition;
type HookScenario = cucumber.HookScenario;
type Hooks = cucumber.Hooks;
var step = <cucumber.StepDefinitions>this;
var hook = <cucumber.Hooks>this;
hook.setWorldConstructor(function() {
this.visit = function(url: string, callback: Callback) {
callback(null, 'pending');
}
})
hook.Before(function(scenario: HookScenario, callback: Callback){
scenario.isFailed() && callback.pending();
});
hook.Around(function(scenario: HookScenario, runScenario: (error:string, callback?:Function)=>void) {
scenario.isFailed() && runScenario(null, function(){
console.log('finish tasks');
});
});
hook.registerHandler('AfterFeatures', function (event:any, callback:Function) {
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(null, 'pending');
});
step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback:Callback) {
var pageTitle = this.browser.text('title');
if (title === pageTitle) {
callback();
} else {
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)
});
cucumber.defineSupportCode(function(step: cucumber.StepDefinitions){
step.Given( /^a variable set to (\d+)$/, (x:string) => {
console.log("the number is: " + x);
} );
});
cucumber.defineSupportCode(function(step: Hooks){
step.After((scenario: HookScenario, callback?: Callback) => {
console.log("After");
callback();
} )
});
cucumber.defineSupportCode(function(hook: cucumber.Hooks){
hook.addTransform({
captureGroupRegexps: ['red|blue|green'],
transformer: (arg: string) => arg,
typeName: 'color'
});
});
cucumber.defineSupportCode(function({After, Given}) {
Given( /^a variable set to (\d+)$/, (x:string) => {
console.log("the number is: " + x);
});
After((scenario: HookScenario, callback?: Callback) => {
console.log("After");
callback();
});
});
let fns : cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns()
cucumber.clearSupportCodeFns();
}
function registerListener(): cucumber.EventListener {
let listener = Object.assign(cucumber.Listener(), {
handleBeforeScenarioEvent: (scenario: cucumber.events.ScenarioPayload, callback: () => void) => {
// do some interesting stuff ...
callback();
}
});
return listener;
}
-224
View File
@@ -1,224 +0,0 @@
// Type definitions for cucumber-js
// Project: https://github.com/cucumber/cucumber-js
// Definitions by: Abraão Alves <https://github.com/abraaoalves>, Jan Molak <https://github.com/jan-molak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = cucumber;
declare namespace cucumber {
export interface CallbackStepDefinition{
pending : () => PromiseLike<any>;
(error?:any, pending?: string):void;
}
export interface TableDefinition{
raw: () => Array<any>;
rows: () => Array<any>;
rowsHash: () => {};
hashes: () => {};
}
type StepDefinitionParam = string | CallbackStepDefinition | TableDefinition;
interface StepDefinitionCode {
(...stepArgs: Array<StepDefinitionParam>): PromiseLike<any> | any | void;
}
interface StepDefinitionOptions{
timeout?: number;
}
export interface StepDefinitions {
Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
Given(pattern: RegExp | string, code: StepDefinitionCode): void;
When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
When(pattern: RegExp | string, code: StepDefinitionCode): void;
Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
Then(pattern: RegExp | string, code: StepDefinitionCode): void;
setDefaultTimeout(time:number): void;
}
interface HookScenario{
getKeyword():string;
getName():string;
getDescription():string;
getUri():string;
getLine():number;
getTags():string[];
getException():Error;
getAttachments():any[];
attach(data:any, mimeType?:string, callback?:(err?:any) => void):void;
isSuccessful():boolean;
isFailed():boolean;
isPending():boolean;
isUndefined():boolean;
isSkipped():boolean;
}
interface HookCode {
(scenario: HookScenario, callback?: CallbackStepDefinition): void;
}
interface AroundCode{
(scenario: HookScenario, runScenario?: (error:string, callback?:Function)=>void): void;
}
interface Transform {
captureGroupRegexps: Array<RegExp | string>;
transformer: (arg: string) => any;
typeName: string;
}
export interface Hooks {
Before(code: HookCode): void;
After(code: HookCode): void;
Around(code: AroundCode):void;
setDefaultTimeout(time:number): void;
setWorldConstructor(world: () => void): void;
registerHandler(handlerOption:string, code:(event:any, callback:CallbackStepDefinition) =>void): void;
registerListener(listener: EventListener): void;
addTransform(transform: Transform): void;
}
export class EventListener {
hear(event: events.Event, callback: ()=>void): void;
hasHandlerForEvent(event: events.Event): boolean;
buildHandlerNameForEvent(event: events.Event): string;
getHandlerForEvent(event: events.Event): EventHook;
buildHandlerName(shortName: string): string;
setHandlerForEvent(shortName: string, handler: EventListener): void;
}
export function Listener(): EventListener;
export namespace events {
interface Event {
getName(): string;
getPayloadItem(name: string): EventPayload;
}
interface EventPayload {
}
interface FeaturesPayload extends EventPayload {
getFeatures(): any[]; // https://github.com/cucumber/cucumber-js/blob/dc698bf5bc10d591fa7adeec5fa21b2d90dc9679/lib/cucumber/runtime.js#L34
}
interface FeaturesResultPayload extends EventPayload {
getDuration(): any;
getScenarioCounts(): any;
getStepCounts(): any;
isSuccessful(): boolean;
}
interface FeaturePayload extends EventPayload {
getStepKeywordByLines(): any;
getScenarioKeyword(): string;
getKeyword(): string;
getName(): string;
getDescription(): string;
getUri(): string;
getLine(): number;
getTags(): Tag[];
getScenarios(): ScenarioPayload[];
getPayloadItem(): FeaturePayload;
}
interface ScenarioPayload extends EventPayload {
getName(): string;
getKeyword(): string;
getDescription(): string;
getFeature(): FeaturePayload;
getUri(): string;
getUris(): string[];
getLine(): number;
getLines(): number[];
getTags(): Tag[];
getSteps(): any[];
getPayloadItem(): ScenarioPayload;
}
interface ScenarioResultPayload extends EventPayload {
getFailureException(): Error;
getScenario(): any;
getStatus(): any;
}
interface StepPayload extends EventPayload {
isHidden(): boolean;
isOutlineStep(): boolean;
getKeyword(): string;
getName(): string;
hasUri(): boolean;
getUri(): string;
getLine(): number;
getPreviousStep(): any;
hasPreviousStep(): boolean;
getAttachment(): any;
getAttachmentContents(): any;
getDocString(): string;
getDataTable(): any;
hasAttachment(): boolean;
hasDocString(): boolean;
hasDataTable(): boolean;
ensureDataTableIsAttached(): void;
isOutcomeStep(): boolean;
isEventStep(): boolean;
hasOutcomeStepKeyword(): boolean;
hasEventStepKeyword(): boolean;
isRepeatingOutcomeStep(): boolean;
isRepeatingEventStep(): boolean;
hasRepeatStepKeyword(): boolean;
isPrecededByOutcomeStep(): boolean;
isPrecededByEventStep(): boolean;
}
interface StepResultPayload extends EventPayload {
getAmbiguousStepDefinitions(): any[];
getAttachments(): any[];
getDuration(): any;
getFailureException(): Error;
getStep(): any;
getStepDefinition(): any;
getStatus(): any;
hasAttachments(): boolean;
}
}
interface Tag {
getName(): string;
getLine(): number;
}
export interface Scenario {
getKeyword(): string;
getName(): string;
getDescription(): string;
getUri(): string;
getLine(): number;
getTags(): Tag[];
getException(): Error;
getAttachments(): any[];
attach(data: any, mimeType?: string, callback?: (err?: any) => void): void;
isSuccessful(): boolean;
isFailed(): boolean;
isPending(): boolean;
isUndefined(): boolean;
isSkipped(): boolean;
}
interface EventHook {
(event: events.Event, callback?: ()=>void): void;
}
export interface SupportCodeConsumer {
(stepDefinitions:StepDefinitions & Hooks):void;
}
export function defineSupportCode(consumer:SupportCodeConsumer): void;
export function getSupportCodeFns(): SupportCodeConsumer[];
export function clearSupportCodeFns(): void;
}
-42
View File
@@ -1,42 +0,0 @@
/// <reference types="d3" />
interface ICompTextSize{
text:string;
size:number;
x?:number;
y?:number;
rotate?:number;
}
var fill = d3.scale.category20<number>();
d3.layout.cloud().size([300, 300])
.words([
"Hello", "world", "normally", "you", "want", "more", "words",
"than", "this"].map(function(d:string) {
return {text: d, size: 10 + Math.random() * 90};
}))
.padding(5)
.rotate(function() { return ~~(Math.random() * 2) * 90; })
.font("Impact")
.fontSize(function(d:ICompTextSize) { return d.size; })
.on("end", draw)
.start();
function draw(words:ICompTextSize[]) {
d3.select("body").append("svg")
.attr("width", 300)
.attr("height", 300)
.append("g")
.attr("transform", "translate(150,150)")
.selectAll("text")
.data(words)
.enter().append("text")
.style("font-size", function(d:ICompTextSize) { return d.size + "px"; })
.style("font-family", "Impact")
.style("fill", function(d:ICompTextSize, i:number) { return fill(i); })
.attr("text-anchor", "middle")
.attr("transform", function(d:ICompTextSize) {
return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")";
})
.text(function(d:ICompTextSize) { return d.text; });
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "../tslint.json" }
-126
View File
@@ -1,126 +0,0 @@
// Type definitions for fetch.io 3.1
// Project: https://github.com/haoxins/fetch.io
// Definitions by: newraina <https://github.com/newraina>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="whatwg-fetch" />
type TUrl = string;
type TMethod = 'delete' | 'get' | 'head' | 'options' | 'post' | 'put';
interface Query {
[key: string]: number | boolean | string;
}
interface Header {
[key: string]: string;
}
interface Options extends RequestInit {
prefix?: string;
query?: Query;
header?: Header;
beforeRequest?(url: TUrl, body: BodyInit): boolean;
afterResponse?(res: Response): void;
afterJSON?(body: any): void;
}
declare namespace FetchIo {
class Request {
constructor(method: TMethod, url: TUrl, options: Options)
/**
* HTTP delete method
*/
delete: (url: TUrl) => this;
/**
* HTTP get method
*/
get: (url: TUrl) => this;
/**
* HTTP head method
*/
head: (url: TUrl) => this;
/**
* HTTP options method
*/
options: (url: TUrl) => this;
/**
* HTTP post method
*/
post: (url: TUrl) => this;
/**
* HTTP put method
*/
put: (url: TUrl) => this;
/**
* Set Options
*/
config(key: string, value: any): this
config(opts: {[key: string]: any}): this
/**
* Set Header
*/
set(key: string, value: any): this
set(opts: {[key: string]: any}): this
/**
* Set Content-Type
*/
type(type: 'json' | 'form' | 'urlencoded'): this
/**
* Add query string
*/
query(object: {[key: string]: any}): this
/**
* Send data
*/
send(data: {[key: string]: any}): this
/**
* ppend formData
*/
append(key: string, value: string): this
/**
* Get Response directly
*/
then(resolve: (value?: Response) => void, reject?: (reason?: any) => void): Promise<any>
/**
* Make Response to JSON
*/
json(strict?: boolean): Promise<any>
/**
* Make Response to string
*/
text(): Promise<string>
}
class Fetch extends Request {
constructor(options?: Options)
}
}
export default FetchIo.Fetch;
-346
View File
@@ -1,346 +0,0 @@
// Type definitions for FineUploader for 5.11
// Project: http://fineuploader.com/
// Definitions by: Bradford Wagner <https://github.com/bradfordwagner/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace qq {
interface BlobsOptions {
defaultName?: string;
}
interface CameraOptions {
button?: HTMLElement;
ios?: boolean;
}
interface ChunkingOptions {
concurrent?: ChunkingConcurrentOptions;
enabled?: boolean; // default false
mandatory?: boolean; // default false
partSize?: number; // default 2,000,000
paramNames?: ChunkingParamNames;
success?: ChunkingSuccess;
}
interface ChunkingConcurrentOptions {
enabled?: boolean; // default false
}
interface ChunkingParamNames {
chunkSize?: string; // default: qqchunksize
partByteOffset?: string; // default: qqpartbyteoffset
partIndex?: string; // default: qqpartindex
totalParts?: string; // default: qqtotalparts
}
interface ChunkingSuccess {
endpoint?: string | null; // default: null
}
interface CorsOptions {
allowXdr?: boolean; // default: false
expected?: boolean; // default: false
sendCredentials: boolean; // default: false
}
interface DeleteFileOptions<H, P> {
customHeader?: H; // default: {}
enabled?: boolean; // default false
endpoint?: string; // default: /server/upload
method?: string; // default: DELETE
params?: P; // default: {}
}
interface ExtraButtonsOptions<V> {
element: HTMLElement | undefined; // default: undefined
fileInputTitle?: string; // default: file input
folders?: boolean; // default: false
multiple?: boolean; // default: true
validation?: V; // default: 'validation'
}
interface FormOptions {
element?: string | HTMLElement; // default: qq-form
autoUpload?: boolean; // default: false
interceptSubmit?: boolean; // default: true
}
interface MessagesOptions {
emptyError?: string; // default: {file} is empty, please select files again without it.
maxHeightImageError?: string; // default: Image is too tall.
maxWidthImageError?: string; // default: Image is too wide.
minHeightImageError?: string; // default: Image is not tall enough.
minWidthImageError?: string; // default: Image is not wide enough.
minSizeError?: string; // default: {file} is too small, minimum file size is {minSizeLimit}.
noFilesError?: string; // default: No files to upload.
onLeave?: string; // default: The files are being uploaded, if you leave now the upload will be canceled.
retryFailTooManyItemsError?: string; // default: Too many items ({netItems}) would be uploaded. Item limit is {itemLimit}.
typeError?: string; // default: {file} has an invalid extension. Valid extension(s): {extensions}.
// tslint:disable-next-line:max-line-length
unsupportedBrowserIos8Safari?: string; // default: Unrecoverable error - this browser does not permit file uploading of any kind due to serious bugs in iOS8 Safari. Please use iOS8 Chrome until Apple fixes these issues.
}
interface PasteOptions {
defaultName?: string; // default: pasted_image
targetElement?: HTMLElement | null; // default: null
}
interface ResumeOptions {
recordsExpireIn?: number; // default: 7
enabled?: boolean; // default: false
paramNames?: ResumeParamNameOptions;
}
interface ResumeParamNameOptions {
resuming: string; // default: qqresume
}
interface RetryOptions {
autoAttemptDelay?: number; // default: 5
enableAuto?: boolean; // default: false
maxAutoAttempts?: number; // default: 3
preventRetryResponseProperty?: string; // default: preventRetry
}
interface RequestOptions <H, P> {
customHeaders?: H; // default: {}
endpoint?: string; // default: /server/upload
filenameParam?: string; // default: qqfilename
forceMultipart?: boolean; // default: true
inputName?: string; // default: qqfile
method?: string; // default: POST
params?: P; // default: {}
paramsInBody?: boolean; // default: true
uuid?: string; // default: qquuid
totalFileSizeName?: string; // default: qqtotalfilesize
}
interface ScalingOptions {
customResizer?: (
blob: File | Blob,
height: number,
image: HTMLImageElement,
sourceCanvas: HTMLCanvasElement,
targetCanvas: HTMLCanvasElement,
width: number) => Promise<File | Blob> | undefined; // default: undefined
defaultQuality?: number; // default: 80
defaultType?: string | null; // default: null
failureText?: string; // default: Failed to scale
includeExif?: boolean; // default: false
orient?: boolean; // default: true
sendOriginal?: boolean; // default: false
sizes?: Size[]; // default: []
}
/**
* From Documentation:
* An array containing size objects that describe scaled versions of each submitted image that should be generated and uploaded.
* A size object should usually contain a name String property (which will be appended to the file name of the scaled file), and must always contain a maxSize integer property.
* A type MIME string property is optional.
*/
interface Size {
name: string;
maxSize: number;
type?: string;
}
interface SessionOptions<H, P> {
customHeaders?: H; // default: {}
endpoint?: string | null; // default: null
params?: P; // default: {}
refreshOnReset?: boolean; // default: true
}
interface TextOptions {
defaultResponseError?: string; // default: Upload failure reason unknown
fileInputTitle?: string; // default: file input
sizeSymbols?: string[]; // default: ['kB', 'MB', 'GB', 'TB', 'PB', 'EB']
}
interface ValidationOptions {
acceptFiles?: MimeType[] | null; // default: null
allowedExtensions?: string[]; // default: []
itemLimit?: number; // default: 0
minSizeLimit?: number; // default: 0
sizeLimit?: number; // default: 0
stopOnFirstInvalidFile?: boolean; // default: true
image?: ValidationImageOptions;
}
interface ValidationImageOptions {
maxHeight?: number; // default: 0
maxWidth?: number; // default: 0
minWidth?: number; // default: 0
minHeight?: number; // default: 0
}
interface WorkaroundOptions {
iosEmptyVideos?: boolean; // default: true
ios8BrowserCrash?: boolean; // default: false
ios8SafariUploads?: boolean; // default: true
}
interface ChunkData {
partIndex: number;
startByte: number;
endByte: number;
totalParts: number;
}
interface ValidateMetadata {
name: string;
size?: number;
}
interface CallbackOptions {
onAutoRetry?: (id: number, name: string, attemptNumber: number) => void;
onCancel?: (id: number, name: string) => void;
onComplete?: <T>(id: number, name: string, responseJSON: T, xhr: XMLHttpRequest) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript
onAllComplete?: (succeeded: number[], failed: number[]) => void;
onDelete?: (id: number) => void;
onDeleteComplete?: (id: number, xhr: XMLHttpRequest, isError: boolean) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript
onError?: (id: number, name: string, errorReason: string, xhr: XMLHttpRequest) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript
onManualRetry?: (id: number, name: string) => boolean; // return false to prevent this and all future retries
onPasteReceived?: (blob: Blob) => void;
onProgress?: (id: number, name: string, uploadedBytes: number, totalBytes: number) => void;
onResume?: <T>(id: number, name: string, chunkData: T) => void;
onSessionRequestComplete?: <T>(response: T[], success: boolean, xhrOrXdr: XMLHttpRequest) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript
onStatusChange?: (id: number, oldStatus: string, newStatus: string) => void;
onSubmit?: (id: number, name: string) => void;
onSubmitDelete?: (id: number) => void;
onSubmitted?: (id: number, name: string) => void;
onTotalProgress?: (totalUploadedBytes: number, totalBytes: number) => void;
onUpload?: (id: number, name: string) => void;
onUploadChunk?: (id: number, name: string, chunkData: ChunkData) => void;
// ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript
onUploadChunkSuccess?: <T>(id: number, chunkData: ChunkData, responseJSON: T, xhr: XMLHttpRequest) => void;
onValidate?: (data: ValidateMetadata, buttonContainer: HTMLElement) => void;
onValidateBatch?: (fileOrBlobDataArray: ValidateMetadata[], buttomContainer: HTMLElement) => void;
}
interface BasicOptions {
// core options
autoUpload?: boolean; // default true
button?: HTMLElement;
debug?: boolean;
disableCancelForFormUploads?: boolean;
formatFileName?: (rawFileName: string) => string; // rawFilename to display filename
maxConnections?: number;
multiple?: boolean;
blobs?: BlobsOptions;
camera?: CameraOptions;
chunking?: ChunkingOptions;
cors?: CorsOptions;
deleteFile?: DeleteFileOptions<any, any>;
extraButtons?: ExtraButtonsOptions<any>;
form?: FormOptions;
messages?: MessagesOptions;
paste?: PasteOptions;
resume?: ResumeOptions;
retry?: RetryOptions;
request?: RequestOptions<any, any>;
scaling?: ScalingOptions;
session?: SessionOptions<any, any>;
text?: TextOptions;
validation?: ValidationOptions;
workarounds?: WorkaroundOptions;
callbacks?: CallbackOptions;
}
interface BlobWrapper {
blob: Blob;
name: string;
}
interface CanvasWrapper {
canvas: HTMLCanvasElement;
name: string;
quality: number; // 1-100
type: MimeType;
}
interface ResizeInfo {
blob: File | Blob;
height: number;
image: HTMLImageElement;
sourceCanvas: HTMLCanvasElement;
targetCanvas: HTMLCanvasElement;
width: number;
}
interface ResumableItem {
name: string;
uuid: string;
partIdx: number;
}
interface FilterOption {
id?: number;
uuid?: string;
originalName?: string;
name?: string;
status?: string;
size?: number;
}
interface ScaleImageOptions {
maxSize: number;
orient?: boolean; // default: true
type?: string; // default: type or reference image
quality?: number; // 0-100 - default: 80
includeExif?: boolean; // default: false
customResizer?: (resizeInfo: ResizeInfo) => Promise<File | Blob>;
}
class FineUploaderBasic {
constructor(options: BasicOptions)
addFiles<T>(files: File[] | HTMLInputElement[] | Blob[] | BlobWrapper[] | HTMLCanvasElement[] | CanvasWrapper[] | FileList, params: T, endpoint: string): void;
addInitialFiles<T>(initialFiles: T[]): void;
cancel(id: number): void;
cancelAll(): void;
clearStoredFiles(): void;
continueUpload(id: number): boolean; // true if successful
deleteFile(id: number): void;
/**
* TODO: need someone who has used this to update the returned promise related fields
*/
drawThumbnail(id: number, targetContainer: HTMLElement, maxSize: number, fromServer: boolean, customResizer: (resizeInfo: ResizeInfo) => Promise<File | Blob>): Promise<any>
getButton(id: number): HTMLElement;
getFile(id: number): File | Blob;
getInProgress(): number;
getName(id: number): string;
getParentId(scaledFileId: number): number;
getRemainingAllowedItems(): number;
getResumableFilesData(): ResumableItem[];
getSize(id: number): number;
getUploads<T>(filter: FilterOption): T | T[];
getUuid(id: number): string;
log(message: string, level: string): void;
pauseUpload(id: number): boolean; // true if successful
reset(): void;
retry(id: number): void;
scaleImage(id: number, options: ScaleImageOptions): Promise<Blob>;
setCustomHeaders<H>(customHeaders: H, id: number): void;
setEndpoint(path: string, identifier: number | HTMLElement): void;
setDeleteFileCustomHeaders<H>(customHeaders: H, id: number): void;
setDeleteFileEndpoint(path: string, identifier: number | HTMLElement): void;
setDeleteFileParams<P>(params: P, id: number): void;
setItemLimit(newItemLimit: number): void;
setForm(formElementOrId: HTMLFormElement | string): void;
setName(id: number, name: string): void;
setParams<P>(params: P, id: number): void;
setUuid(id: number, uuid: string): void;
uploadStoredFiles(): void; // throws NoFilesError
// ui
addExtraDropzone(element: HTMLElement): void;
getDropTarget(id: number): HTMLElement;
getId(element: HTMLElement): number;
getItemByFileId(id: number): HTMLElement;
removeExtraDropzone(element: HTMLElement): void;
}
}
-9
View File
@@ -1,9 +0,0 @@
function testBlob() {
const config: qq.BasicOptions = {
blobs: {
defaultName: "hi.png"
}
};
const uploader = new qq.FineUploaderBasic(config);
}
-59
View File
@@ -1,59 +0,0 @@
class CallbacksTest {
constructor(private opts: qq.CallbackOptions) {
}
testCallbacks() {
const opts = this.opts;
interface CustomType {
myTypeOfClass: string;
}
opts.onAutoRetry = (id, name, attemptNumber) => {};
opts.onCancel = (id, name) => {};
opts.onComplete = (id: number, name: string, responseJSON: CustomType, xhr: XMLHttpRequest) => {};
opts.onAllComplete = (succeeded, failed) => {};
opts.onDelete = (id) => {};
opts.onDeleteComplete = (id, xhr, isError) => {};
opts.onError = (id, name, errorReason, xhr) => {};
opts.onManualRetry = (id, name) => {
return true;
};
opts.onPasteReceived = (blob) => {};
opts.onProgress = (id, name, uploadedBytes, totalBytes) => {};
opts.onResume = (id: number, name: string, chunkData: CustomType) => {};
opts.onSessionRequestComplete = (response: CustomType[], success: boolean, xhrOrXdr: XMLHttpRequest) => {};
opts.onStatusChange = (id, oldStatus, newStatus) => {};
opts.onSubmit = (id, name) => {};
opts.onSubmitDelete = (id) => {};
opts.onSubmitted = (id, name) => {};
opts.onTotalProgress = (totalUploadedBytes, totalBytes) => {};
opts.onUpload = (id, name) => {};
opts.onUploadChunk = (id, name, chunkData) => {};
opts.onUploadChunkSuccess = (id: number, chunkData: qq.ChunkData, responseJSON: CustomType, xhr: XMLHttpRequest) => {};
opts.onValidate = (data, buttonContainer) => {};
opts.onValidateBatch = (fileOrBlobDataArray, buttonContaine) => {};
}
}
-14
View File
@@ -1,14 +0,0 @@
function cameraTest() {
const cameraButton = new HTMLButtonElement();
const cameraOptions: qq.CameraOptions = {
button: cameraButton,
ios: false
};
const config: qq.BasicOptions = {
camera: cameraOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-26
View File
@@ -1,26 +0,0 @@
function chunkingTest() {
const chunkingOptions: qq.ChunkingOptions = {
concurrent: {
enabled: false
},
enabled: true,
mandatory: true,
partSize: 1000000,
paramNames: {
chunkSize: "chunkSize",
partByteOffset: "partByteOffset",
partIndex: "partIndex",
totalParts: "totalParts"
},
success: {
endpoint: "/some/web/endpoint/yaySuccesss"
}
};
const config: qq.BasicOptions = {
chunking: chunkingOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-17
View File
@@ -1,17 +0,0 @@
function testCore() {
const button: HTMLElement = new HTMLButtonElement();
const config: qq.BasicOptions = {
autoUpload: true,
button,
debug: true,
disableCancelForFormUploads: true,
formatFileName: (rawFileName: string) => {
return "hi";
},
maxConnections: 10,
multiple: true
};
const uploader = new qq.FineUploaderBasic(config);
}
-13
View File
@@ -1,13 +0,0 @@
function corsTest() {
const corsOptions: qq.CorsOptions = {
allowXdr: true,
expected: true,
sendCredentials: true
};
const config: qq.BasicOptions = {
cors: corsOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-28
View File
@@ -1,28 +0,0 @@
function deleteFileTest() {
interface CustomHeader {
myOption: string;
}
interface CustomParams {
myParam: string;
}
const deleteFileOptions: qq.DeleteFileOptions<CustomHeader, CustomParams> = {
customHeader: {
myOption: "ewwww"
},
enabled: true,
endpoint: "/my/server/location/delete",
method: "POST",
params: {
myParam: "u"
}
};
const config: qq.BasicOptions = {
deleteFile: deleteFileOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-23
View File
@@ -1,23 +0,0 @@
function extraButtons() {
interface Validation {
myValue: string;
}
const element: HTMLElement = new HTMLElement();
const extraButtonOptions: qq.ExtraButtonsOptions<Validation> = {
element,
fileInputTitle: "inputTitle",
folders: true,
multiple: false,
validation: {
myValue: "ew"
}
};
const config: qq.BasicOptions = {
extraButtons: extraButtonOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-13
View File
@@ -1,13 +0,0 @@
function formTest() {
const formOptions: qq.FormOptions = {
element: "qq-form",
autoUpload: true,
interceptSubmit: true
};
const config: qq.BasicOptions = {
form: formOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-21
View File
@@ -1,21 +0,0 @@
function messageTest() {
const messageOptions: qq.MessagesOptions = {
emptyError: "emptyError",
maxHeightImageError: "maxHeightImageError",
maxWidthImageError: "error occurred",
minHeightImageError: "error occurred",
minWidthImageError: "error occurred",
minSizeError: "error occurred",
noFilesError: "error occurred",
onLeave: "error occurred",
retryFailTooManyItemsError: "error occurred",
typeError: "error occurred",
unsupportedBrowserIos8Safari: "error occurred"
};
const config: qq.BasicOptions = {
messages: messageOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-140
View File
@@ -1,140 +0,0 @@
class TestMethods {
constructor(private uploader: qq.FineUploaderBasic) {
}
testAddFiles() {
interface ParamType {
field: string;
}
const params: ParamType = {
field: 'hiiiii'
};
this.uploader.addFiles(
new FileList(),
params,
"/my/happy/endpoint"
);
}
testAddInitialFiles() {
interface InitialFiles {
myField: number;
}
const initialFiles: InitialFiles[] = [{
myField: 1324
}];
this.uploader.addInitialFiles(initialFiles);
}
testDrawThumbnail() {
const promise: Promise<any> = this.uploader.drawThumbnail(
1234,
new HTMLElement(),
1234565,
false,
(resizeInfo) => {
return new Promise<File | Blob>(() => {
return new Blob();
});
}
);
}
testGetUploads() {
interface ResponseType {
hi: string;
}
const response: ResponseType | ResponseType[] = this.uploader.getUploads<ResponseType>({
status: "proggresssssssesees"
});
}
testSetCustomHeaders() {
interface CustomHeader {
customField: number;
}
this.uploader.setCustomHeaders<CustomHeader>({
customField: 1234
}, 1234);
}
testSetDeleteCustomHeaders() {
interface CustomHeader {
customField: number;
}
this.uploader.setDeleteFileCustomHeaders<CustomHeader>({
customField: 1234
}, 1234);
}
testSetDeleteFileParams() {
interface CustomParams {
paramField: boolean;
}
this.uploader.setDeleteFileParams<CustomParams>({
paramField: false
}, 1234);
}
testSetParams() {
interface CustomParams {
customParams: number;
}
this.uploader.setParams<CustomParams>({
customParams: 1234
}, 1234);
}
bulkTests() {
this.uploader.cancel(1);
this.uploader.cancelAll();
this.uploader.clearStoredFiles();
const shouldContinue: boolean = this.uploader.continueUpload(1234);
this.uploader.deleteFile(1234);
const elem: HTMLElement = this.uploader.getButton(1234);
const fileOrBlob: File | Blob = this.uploader.getFile(1234);
let num: number = this.uploader.getInProgress();
let s: string = this.uploader.getName(1234);
num = this.uploader.getParentId(1234);
num = this.uploader.getRemainingAllowedItems();
const resumables: qq.ResumableItem[] = this.uploader.getResumableFilesData();
num = this.uploader.getSize(1234);
s = this.uploader.getUuid(1234);
this.uploader.log("why am i doing this?", "info");
const b: boolean = this.uploader.pauseUpload(1234);
this.uploader.reset();
this.uploader.retry(1234);
const blobPromise: Promise<Blob> = this.uploader.scaleImage(1234, {
maxSize: 20,
orient: false,
type: "png",
quality: 10,
includeExif: false,
});
this.uploader.setEndpoint("/my/path/is/my/own", 1234);
this.uploader.setEndpoint("/my/path/is/my/own", new HTMLElement());
this.uploader.setDeleteFileEndpoint("/some/path", 1234);
this.uploader.setDeleteFileEndpoint("/some/path", new HTMLElement());
this.uploader.setItemLimit(1234);
this.uploader.setForm(new HTMLFormElement());
this.uploader.setForm("myFormElement");
this.uploader.setName(1234, "myCustomName");
this.uploader.setUuid(1234, "12341234");
this.uploader.uploadStoredFiles();
}
uiTests() {
this.uploader.addExtraDropzone(new HTMLElement());
let elem: HTMLElement = this.uploader.getDropTarget(1234);
const n: number = this.uploader.getId(elem);
elem = this.uploader.getItemByFileId(n);
this.uploader.removeExtraDropzone(elem);
}
}
-14
View File
@@ -1,14 +0,0 @@
function pasteTest() {
const targetElement: HTMLElement = new HTMLElement();
const pasteOptions: qq.PasteOptions = {
defaultName: "pasted_image",
targetElement
};
const config: qq.BasicOptions = {
paste: pasteOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-32
View File
@@ -1,32 +0,0 @@
function requestTest() {
interface CustomHeader {
customHeader: string;
}
interface CustomParam {
customParam: boolean;
}
const requestOptions: qq.RequestOptions<CustomHeader, CustomParam> = {
customHeaders: {
customHeader: "my custom header hehehehee"
},
endpoint: "/my/custom/endpoint",
filenameParam: "newFilenameParam",
forceMultipart: true,
inputName: "filenameParamMapping",
method: "POST",
params: {
customParam: false
},
paramsInBody: false,
uuid: "asdf123456",
totalFileSizeName: "totalFileSize"
};
const config: qq.BasicOptions = {
request: requestOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-15
View File
@@ -1,15 +0,0 @@
function resumeTest() {
const resumeOptions: qq.ResumeOptions = {
recordsExpireIn: 10,
enabled: true,
paramNames: {
resuming: "ew you"
}
};
const config: qq.BasicOptions = {
resume: resumeOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-15
View File
@@ -1,15 +0,0 @@
function retryTest() {
const retryOptions: qq.RetryOptions = {
autoAttemptDelay: 1,
enableAuto: true,
maxAutoAttempts: 32,
preventRetryResponseProperty: "preventRetry"
};
const config: qq.BasicOptions = {
retry: retryOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-29
View File
@@ -1,29 +0,0 @@
function scalingTest() {
const scalingOptions: qq.ScalingOptions = {
customResizer: (blob, height, image, sourceCanvas, targetCanvas, width) => {
const promise = new Promise<File|Blob>(() => {
return blob;
});
return promise;
},
defaultQuality: 10,
defaultType: "JPEG",
failureText: "you have failed me for the last time",
includeExif: true,
orient: false,
sendOriginal: true,
sizes: [
{
maxSize: 10,
name: "i am added to name",
type: "mime type"
}
]
};
const config: qq.BasicOptions = {
scaling: scalingOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-26
View File
@@ -1,26 +0,0 @@
function sessionTest() {
interface CustomHeader {
customHeader: string;
}
interface CustomParam {
customParam: boolean;
}
const sessionOptions: qq.SessionOptions<CustomHeader, CustomParam> = {
customHeaders: {
customHeader: "customHeader"
},
endpoint: "/mysession/endpoint",
params: {
customParam: false
},
refreshOnReset: false
};
const config: qq.BasicOptions = {
session: sessionOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-13
View File
@@ -1,13 +0,0 @@
function textTest() {
const textOptions: qq.TextOptions = {
defaultResponseError: "you have failed me for the last time",
fileInputTitle: "file input title",
sizeSymbols: ['kb']
};
const config: qq.BasicOptions = {
text: textOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-22
View File
@@ -1,22 +0,0 @@
function validationTest() {
const validationOptions: qq.ValidationOptions = {
acceptFiles: [new MimeType()],
allowedExtensions: ['csv, xls'],
itemLimit: 5,
sizeLimit: 10000000,
stopOnFirstInvalidFile: false,
image: {
maxHeight: 10,
maxWidth: 10,
minHeight: 1,
minWidth: 1
}
};
const config: qq.BasicOptions = {
validation: validationOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-13
View File
@@ -1,13 +0,0 @@
function workaroundsTest() {
const workaroundOptions: qq.WorkaroundOptions = {
iosEmptyVideos: false,
ios8BrowserCrash: false,
ios8SafariUploads: false
};
const config: qq.BasicOptions = {
workarounds: workaroundOptions
};
const uploader = new qq.FineUploaderBasic(config);
}
-42
View File
@@ -1,42 +0,0 @@
{
"files": [
"index.d.ts",
"test/blobs.ts",
"test/camera.ts",
"test/chunking.ts",
"test/core.ts",
"test/cors.ts",
"test/deleteFile.ts",
"test/extraButtons.ts",
"test/form.ts",
"test/message.ts",
"test/paste.ts",
"test/resume.ts",
"test/retry.ts",
"test/request.ts",
"test/scaling.ts",
"test/session.ts",
"test/text.ts",
"test/validation.ts",
"test/workarounds.ts",
"test/method.ts",
"test/callbacks.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
-61
View File
@@ -1,61 +0,0 @@
function test_init(){
var auth = gapi.auth2.init({
client_id: 'my-id',
cookie_policy: 'single_host_origin',
scope: 'https://www.googleapis.com/auth/plus.login',
fetch_basic_profile: true
});
}
function test_getAuthInstance(){
gapi.auth2.init({
client_id: 'my-id',
cookie_policy: 'single_host_origin',
scope: 'https://www.googleapis.com/auth/plus.login',
fetch_basic_profile: true
});
var auth = gapi.auth2.getAuthInstance();
}
function test_signIn(){
gapi.auth2.getAuthInstance().signIn({
scope: 'email profile',
prompt: 'content'
});
}
function test_signInOptionsBuild(){
var options = new gapi.auth2.SigninOptionsBuilder();
options.setAppPackageName('com.example.app');
options.setFetchBasicProfile(true);
options.setPrompt('select_account');
options.setScope('profile').setScope('email');
gapi.auth2.getAuthInstance().signIn(options);
}
function test_getAuthResponse(){
var user = gapi.auth2.getAuthInstance().currentUser.get();
var authResponse = user.getAuthResponse();
var authResponseWithAuth = user.getAuthResponse(true);
}
function test_render(){
var success = (googleUser: gapi.auth2.GoogleUser): void => {
console.log(googleUser);
};
var failure = (): void => {
console.log('Failure callback');
};
gapi.signin2.render('testId', {
scope: 'https://www.googleapis.com/auth/plus.login',
width: 250,
height: 50,
longtitle: true,
theme: 'dark',
onsuccess: success,
onfailure: failure
});
}
-139
View File
@@ -1,139 +0,0 @@
import * as jspb from "google-protobuf";
/* This is a typescript version of a simple generated class from a proto file that is shown below. In order to make
this ES5 JS file into TypeScript there have been quite a few modifications, but the same calls are made to the library
classes.
// FILE: simple.proto
syntax = "proto3";
package examplecom;
message MySimple {
string my_string = 1;
bool my_bool = 2;
repeated string some_labels = 3;
}
*/
class MySimple extends jspb.Message {
constructor(opt_data?: any) {
super(); // This isn't actually called in the JS version of this file, but it's required by TS
jspb.Message.initialize(this, opt_data, 0, -1, MySimple.repeatedFields_, null);
};
static repeatedFields_ = [3];
toObject(opt_includeInstance: boolean): {} {
return MySimple.toObject(opt_includeInstance, this);
};
static toObject(includeInstance: boolean, msg: MySimple): {} {
const obj: {} = {
myString: jspb.Message.getFieldWithDefault(msg, 1, ""),
myBool: jspb.Message.getFieldWithDefault(msg, 2, false),
someLabelsList: jspb.Message.getField(msg, 3),
};
if (includeInstance) {
// This is commented out because it's not valid in TS, but it's a simple append to an object
// obj['$jspbMessageInstance'] = msg;
}
return obj;
};
static deserializeBinary(bytes: Uint8Array) {
const reader = new jspb.BinaryReader(bytes);
const msg = new MySimple();
return MySimple.deserializeBinaryFromReader(msg, reader);
};
static deserializeBinaryFromReader(msg: MySimple, reader: jspb.BinaryReader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
const field = reader.getFieldNumber();
switch (field) {
case 1:
const value1 = (reader.readString());
msg.setMyString(value1);
break;
case 2:
const value2 = (reader.readBool());
msg.setMyBool(value2);
break;
case 3:
const value3 = (reader.readString());
msg.addSomeLabels(value3);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
serializeBinary(): Uint8Array {
const writer = new jspb.BinaryWriter();
MySimple.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
static serializeBinaryToWriter(message: MySimple, writer: jspb.BinaryWriter) {
let f1 = message.getMyString();
if (f1.length > 0) {
writer.writeString(
1,
f1,
);
}
const f2 = message.getMyBool();
if (f2) {
writer.writeBool(
2,
f2,
);
}
const f3 = message.getSomeLabelsList();
if (f3.length > 0) {
writer.writeRepeatedString(
3,
f3,
);
}
}
getMyString(): string {
return jspb.Message.getFieldWithDefault(this, 1, "");
}
setMyString(value: string) {
jspb.Message.setField(this, 1, value);
}
getMyBool(): boolean {
return jspb.Message.getFieldWithDefault(this, 2, false);
}
setMyBool(value: boolean) {
jspb.Message.setField(this, 2, value);
}
getSomeLabelsList(): string[] {
return jspb.Message.getField(this, 3);
}
setSomeLabelsList(value: string[]) {
jspb.Message.setField(this, 3, value || []);
}
addSomeLabels(value: string, opt_index?: number) {
jspb.Message.addToRepeatedField(this, 3, value, opt_index);
}
clearSomeLabelsList() {
this.setSomeLabelsList([]);
}
}
-687
View File
@@ -1,687 +0,0 @@
// Type definitions for google-protobuf 3.2
// Project: https://github.com/google/google-protobuf
// Definitions by: Marcus Longmuir <https://github.com/marcuslongmuir/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type ByteSource = ArrayBuffer|Uint8Array|number[]|string;
type ScalarFieldType = boolean|number|string;
type RepeatedFieldType = ScalarFieldType[] | Uint8Array[];
type AnyFieldType = ScalarFieldType | RepeatedFieldType | Uint8Array;
type FieldValue = (string|number|boolean|Uint8Array|any/*This should be Array<FieldValue>, but that isn't allowed*/|undefined)
export abstract class Message {
getJsPbMessageId(): (string | undefined);
static initialize(msg: Message,
data: Message.MessageArray,
messageId: (string | number),
suggestedPivot: number,
repeatedFields: number[],
oneofFields?: number[][] | null): void;
static toObjectList<T extends Message>(field: T[],
toObjectFn: (includeInstance: boolean,
data: T) => {},
includeInstance?: boolean): {}[];
static toObjectExtension(msg: Message,
obj: {},
extensions: {[key: number]: ExtensionFieldInfo<Message>},
getExtensionFn: (fieldInfo: ExtensionFieldInfo<Message>) => Message,
includeInstance?: boolean): void;
serializeBinaryExtensions(proto: Message,
writer: BinaryWriter,
extensions: {[key: number]: ExtensionFieldBinaryInfo<Message>},
getExtensionFn: <T>(fieldInfo: ExtensionFieldInfo<T>) => T): void
readBinaryExtension(proto: Message,
reader: BinaryReader,
extensions: {[key: number]: ExtensionFieldBinaryInfo<Message>},
setExtensionFn: <T>(fieldInfo: ExtensionFieldInfo<T>,
val: T) => void): void
static getField(msg: Message,
fieldNumber: number): FieldValue|null;
static getOptionalFloatingPointField(msg: Message,
fieldNumber: number): (number | undefined);
static getRepeatedFloatingPointField(msg: Message,
fieldNumber: number): number[];
static bytesAsB64(bytes: Uint8Array): string;
static bytesAsU8(str: string): Uint8Array;
static bytesListAsB64(bytesList: Uint8Array[]): string[];
static bytesListAsU8(strList: string[]): Uint8Array[];
static getFieldWithDefault<T>(msg: Message,
fieldNumber: number,
defaultValue: T): T;
static getMapField(msg: Message,
fieldNumber: number,
noLazyCreate: boolean,
valueCtor: typeof Message): Map<any, any>;
static setField(msg: Message,
fieldNumber: number,
value: FieldValue): void;
static addToRepeatedField(msg: Message,
fieldNumber: number,
value: any,
index?: number): void;
static setOneofField(msg: Message,
fieldNumber: number,
oneof: number[],
value: FieldValue): void;
static computeOneofCase(msg: Message,
oneof: number[]): number;
static getWrapperField(msg: Message,
ctor: typeof Message,
fieldNumber: number,
required?: number): Message;
static getRepeatedWrapperField(msg: Message,
ctor: typeof Message,
fieldNumber: number): Message[];
static setWrapperField(msg: Message,
fieldNumber: number,
value?: (Message|Map<any, any>)): void;
static setOneofWrapperField(msg: Message,
fieldNumber: number,
oneof: number[],
value: any): void;
static setRepeatedWrapperField(msg: Message,
fieldNumber: number,
value: any): void;
static addToRepeatedWrapperField(msg: Message,
fieldNumber: number,
value: any,
ctor: typeof Message,
index: number): any;
static toMap(field: any[],
mapKeyGetterFn: (field: any) => string,
toObjectFn?: Message.StaticToObject,
includeInstance?: boolean): void;
toArray(): Message.MessageArray;
toString(): string;
getExtension<T>(fieldInfo: ExtensionFieldInfo<T>): T;
setExtension<T>(fieldInfo: ExtensionFieldInfo<T>,
value: T): void;
static difference<T extends Message>(m1: T,
m2: T): T;
static equals(m1: Message,
m2: Message): boolean;
static compareExtensions(extension1: {},
extension2: {}): boolean;
static compareFields(field1: any,
field2: any): boolean;
cloneMessage(): Message;
clone(): Message;
static clone<T extends Message>(msg: T): T;
static cloneMessage<T extends Message>(msg: T): T;
static copyInto(fromMessage: Message,
toMessage: Message): void;
static registerMessageType(id: number,
constructor: typeof Message): void;
abstract serializeBinary(): Uint8Array;
abstract toObject(includeInstance?: boolean): {};
// These are `abstract static`, but that isn't allowed. Subclasses of Message will have these methods and properties
// and not having them on Message makes using this class for its intended purpose quite difficult.
static deserializeBinary(bytes: Uint8Array): Message;
static deserializeBinaryFromReader(message: Message, reader: BinaryReader): Message;
static serializeBinaryToWriter(message: Message, writer: BinaryWriter): void;
static toObject(includeInstance: boolean, msg: Message): {};
static extensions: {[key: number]: ExtensionFieldInfo<Message>};
static extensionsBinary: {[key: number]: ExtensionFieldBinaryInfo<Message>};
}
export namespace Message {
export type MessageArray = any[]; // This type needs to reference itself
interface StaticToObject {
(includeInstance: boolean,
msg: Message): {};
}
}
export class ExtensionFieldInfo<T> {
fieldIndex: number;
fieldName: number;
ctor: typeof Message;
toObjectFn: Message.StaticToObject;
isRepeated: number;
constructor(fieldIndex: number,
fieldName: {[key: string]: number},
ctor: typeof Message,
toObjectFn: Message.StaticToObject,
isRepeated: number);
isMessageType(): boolean;
}
export class ExtensionFieldBinaryInfo<T> {
fieldInfo: ExtensionFieldInfo<T>;
binaryReaderFn: BinaryRead;
binaryWriterFn: BinaryWrite;
opt_binaryMessageSerializeFn: (msg: Message,
writer: BinaryWriter) => void;
opt_binaryMessageDeserializeFn: (msg: Message,
reader: BinaryReader) => Message;
opt_isPacked: boolean;
constructor(fieldInfo: ExtensionFieldInfo<T>,
binaryReaderFn: BinaryRead,
binaryWriterFn: BinaryWrite,
opt_binaryMessageSerializeFn: (msg: Message,
writer: BinaryWriter) => void,
opt_binaryMessageDeserializeFn: (msg: Message,
reader: BinaryReader) => Message,
opt_isPacked: boolean);
}
export class Map<K, V> {
constructor(arr: Array<[K, V]>,
valueCtor?: {new(init: any): V});
toArray(): Array<[K, V]>;
toObject(includeInstance: boolean,
valueToObject: (includeInstance: boolean) => any): Array<[K, V]>;
static fromObject<K, V>(entries: Array<[K, V]>,
valueCtor: any,
valueFromObject: any): Map<K, V>;
getLength(): number;
clear(): void;
del(key: K): boolean;
getEntryList(): Array<[K, V]>;
entries(): Map.Iterator<[K, V]>;
keys(): Map.Iterator<K>;
forEach(callback: (entry: V,
key: K) => void,
thisArg?: {}): void;
set(key: K,
value: V): void;
get(key: K): (V | undefined);
has(key: K): boolean;
}
export namespace Map {
// This is implemented by jspb.Map.ArrayIteratorIterable_, but that class shouldn't be exported
interface Iterator<T> {
next(): IteratorResult<T>;
}
type IteratorResult<T> = {
done: boolean,
value: T,
}
}
interface BinaryReadReader {
(msg: any,
binaryReader: BinaryReader): void;
}
interface BinaryRead {
(msg: any,
reader: BinaryReadReader): void;
}
interface BinaryWriteCallback {
(value: any,
binaryWriter: BinaryWriter): void;
}
interface BinaryWrite {
(fieldNumber: number,
value: any,
writerCallback: BinaryWriteCallback): void;
}
export class BinaryReader {
constructor(bytes?: ByteSource,
start?: number,
length?: number);
static alloc(bytes?: ByteSource,
start?: number,
length?: number): BinaryReader;
alloc(bytes?: ByteSource,
start?: number,
length?: number): BinaryReader;
free(): void;
getFieldCursor(): number;
getCursor(): number;
getBuffer(): Uint8Array;
getFieldNumber(): number;
getWireType(): BinaryConstants.WireType;
isEndGroup(): boolean;
getError(): boolean;
setBlock(bytes?: ByteSource,
start?: number,
length?: number): void;
reset(): void;
advance(count: number): void;
nextField(): boolean;
unskipHeader(): void;
skipMatchingFields(): void;
skipVarintField(): void;
skipDelimitedField(): void;
skipFixed32Field(): void;
skipFixed64Field(): void;
skipGroup(): void;
skipField(): void;
registerReadCallback(callbackName: string,
callback: (binaryReader: BinaryReader) => any): void;
runReadCallback(callbackName: string): any;
readAny(fieldType: BinaryConstants.FieldType): AnyFieldType;
readMessage: BinaryRead;
readGroup(field: number,
message: Message,
reader: BinaryReadReader): void;
getFieldDecoder(): BinaryDecoder;
readInt32(): number;
readInt32String(): string;
readInt64(): number;
readInt64String(): string;
readUint32(): number;
readUint32String(): string;
readUint64(): number;
readUint64String(): string;
readSint32(): number;
readSint64(): number;
readSint64String(): string;
readFixed32(): number;
readFixed64(): number;
readFixed64String(): string;
readSfixed32(): number;
readSfixed32String(): string;
readSfixed64(): number;
readSfixed64String(): string;
readFloat(): number;
readDouble(): number;
readBool(): boolean;
readEnum(): number;
readString(): string;
readBytes(): Uint8Array;
readVarintHash64(): string;
readFixedHash64(): string;
readPackedInt32(): number[];
readPackedInt32String(): string[];
readPackedInt64(): number[];
readPackedInt64String(): string[];
readPackedUint32(): number[];
readPackedUint32String(): string[];
readPackedUint64(): number[];
readPackedUint64String(): string[];
readPackedSint32(): number[];
readPackedSint64(): number[];
readPackedSint64String(): string[];
readPackedFixed32(): number[];
readPackedFixed64(): number[];
readPackedFixed64String(): string[];
readPackedSfixed32(): number[];
readPackedSfixed64(): number[];
readPackedSfixed64String(): string[];
readPackedFloat(): number[];
readPackedDouble(): number[];
readPackedBool(): boolean[];
readPackedEnum(): number[];
readPackedVarintHash64(): string[];
readPackedFixedHash64(): string[];
}
export class BinaryWriter {
constructor();
writeSerializedMessage(bytes: Uint8Array,
start: number,
end: number): void;
maybeWriteSerializedMessage(bytes?: Uint8Array,
start?: number,
end?: number): void;
reset(): void;
getResultBuffer(): Uint8Array;
getResultBase64String(): string;
beginSubMessage(field: number): void;
endSubMessage(field: number): void;
writeAny(fieldType: BinaryConstants.FieldType,
field: number,
value: AnyFieldType): void;
writeInt32(field: number,
value?: number): void;
writeInt32String(field: number,
value?: string): void;
writeInt64(field: number,
value?: number): void;
writeInt64String(field: number,
value?: string): void;
writeUint32(field: number,
value?: number): void;
writeUint32String(field: number,
value?: string): void;
writeUint64(field: number,
value?: number): void;
writeUint64String(field: number,
value?: string): void;
writeSint32(field: number,
value?: number): void;
writeSint64(field: number,
value?: number): void;
writeSint64String(field: number,
value?: string): void;
writeFixed32(field: number,
value?: number): void;
writeFixed64(field: number,
value?: number): void;
writeFixed64String(field: number,
value?: string): void;
writeSfixed32(field: number,
value?: number): void;
writeSfixed64(field: number,
value?: number): void;
writeSfixed64String(field: number,
value?: string): void;
writeFloat(field: number,
value?: number): void;
writeDouble(field: number,
value?: number): void;
writeBool(field: number,
value?: boolean): void;
writeEnum(field: number,
value?: number): void;
writeString(field: number,
value?: string): void;
writeBytes(field: number,
value?: ByteSource): void;
writeMessage: BinaryWrite;
writeGroup(field: number,
value: any,
writeCallback: BinaryWriteCallback): void;
writeFixedHash64(field: number,
value?: string): void;
writeVarintHash64(field: number,
value?: string): void;
writeRepeatedInt32(field: number,
value?: number[]): void;
writeRepeatedInt32String(field: number,
value?: string[]): void;
writeRepeatedInt64(field: number,
value?: number[]): void;
writeRepeatedInt64String(field: number,
value?: string[]): void;
writeRepeatedUint32(field: number,
value?: number[]): void;
writeRepeatedUint32String(field: number,
value?: string[]): void;
writeRepeatedUint64(field: number,
value?: number[]): void;
writeRepeatedUint64String(field: number,
value?: string[]): void;
writeRepeatedSint32(field: number,
value?: number[]): void;
writeRepeatedSint64(field: number,
value?: number[]): void;
writeRepeatedSint64String(field: number,
value?: string[]): void;
writeRepeatedFixed32(field: number,
value?: number[]): void;
writeRepeatedFixed64(field: number,
value?: number[]): void;
writeRepeatedFixed64String(field: number,
value?: string[]): void;
writeRepeatedSfixed32(field: number,
value?: number[]): void;
writeRepeatedSfixed64(field: number,
value?: number[]): void;
writeRepeatedSfixed64String(field: number,
value?: string[]): void;
writeRepeatedFloat(field: number,
value?: number[]): void;
writeRepeatedDouble(field: number,
value?: number[]): void;
writeRepeatedBool(field: number,
value?: boolean[]): void;
writeRepeatedEnum(field: number,
value?: number[]): void;
writeRepeatedString(field: number,
value?: string[]): void;
writeRepeatedBytes(field: number,
value?: ByteSource[]): void;
writeRepeatedMessage(field: number,
value: Message[],
writerCallback: BinaryWriteCallback): void;
writeRepeatedGroup(field: number,
value: Message[],
writerCallback: BinaryWriteCallback): void;
writeRepeatedFixedHash64(field: number,
value?: string[]): void;
writeRepeatedVarintHash64(field: number,
value?: string[]): void;
writePackedInt32(field: number,
value?: number[]): void;
writePackedInt32String(field: number,
value?: string[]): void;
writePackedInt64(field: number,
value?: number[]): void;
writePackedInt64String(field: number,
value?: string[]): void;
writePackedUint32(field: number,
value?: number[]): void;
writePackedUint32String(field: number,
value?: string[]): void;
writePackedUint64(field: number,
value?: number[]): void;
writePackedUint64String(field: number,
value?: string[]): void;
writePackedSint32(field: number,
value?: number[]): void;
writePackedSint64(field: number,
value?: number[]): void;
writePackedSint64String(field: number,
value?: string[]): void;
writePackedFixed32(field: number,
value?: number[]): void;
writePackedFixed64(field: number,
value?: number[]): void;
writePackedFixed64String(field: number,
value?: string[]): void;
writePackedSfixed32(field: number,
value?: number[]): void;
writePackedSfixed64(field: number,
value?: number[]): void;
writePackedSfixed64String(field: number,
value?: string[]): void;
writePackedFloat(field: number,
value?: number[]): void;
writePackedDouble(field: number,
value?: number[]): void;
writePackedBool(field: number,
value?: boolean[]): void;
writePackedEnum(field: number,
value?: number[]): void;
writePackedFixedHash64(field: number,
value?: string[]): void;
writePackedVarintHash64(field: number,
value?: string[]): void;
}
export class BinaryEncoder {
constructor();
length(): number;
end(): number[];
writeSplitVarint64(lowBits: number,
highBits: number): void;
writeSplitFixed64(lowBits: number,
highBits: number): void;
writeUnsignedVarint32(value: number): void;
writeSignedVarint32(value: number): void;
writeUnsignedVarint64(value: number): void;
writeSignedVarint64(value: number): void;
writeZigzagVarint32(value: number): void;
writeZigzagVarint64(value: number): void;
writeZigzagVarint64String(value: string): void;
writeUint8(value: number): void;
writeUint16(value: number): void;
writeUint32(value: number): void;
writeUint64(value: number): void;
writeInt8(value: number): void;
writeInt16(value: number): void;
writeInt32(value: number): void;
writeInt64(value: number): void;
writeInt64String(value: string): void;
writeFloat(value: number): void;
writeDouble(value: number): void;
writeBool(value: boolean): void;
writeEnum(value: number): void;
writeBytes(bytes: Uint8Array): void;
writeVarintHash64(hash: string): void;
writeFixedHash64(hash: string): void;
writeString(value: string): number;
}
export class BinaryDecoder {
constructor(bytes?: ByteSource,
start?: number,
length?: number)
static alloc(bytes?: ByteSource,
start?: number,
length?: number): BinaryDecoder;
free(): void;
clone(): BinaryDecoder;
clear(): void;
getBuffer(): Uint8Array;
setBlock(data: ByteSource,
start?: number,
length?: number): void;
getEnd(): number;
setEnd(end: number): void;
reset(): void;
getCursor(): number;
setCursor(cursor: number): void;
advance(count: number): void;
atEnd(): boolean;
pastEnd(): boolean;
getError(): boolean;
skipVarint(): void;
unskipVarint(value: number): void;
readUnsignedVarint32(): number;
readSignedVarint32(): number;
readUnsignedVarint32String(): number;
readSignedVarint32String(): number;
readZigzagVarint32(): number;
readUnsignedVarint64(): number;
readUnsignedVarint64String(): number;
readSignedVarint64(): number;
readSignedVarint64String(): number;
readZigzagVarint64(): number;
readZigzagVarint64String(): number;
readUint8(): number;
readUint16(): number;
readUint32(): number;
readUint64(): number;
readUint64String(): string;
readInt8(): number;
readInt16(): number;
readInt32(): number;
readInt64(): number;
readInt64String(): string;
readFloat(): number;
readDouble(): number;
readBool(): boolean;
readEnum(): number;
readString(length: number): string;
readStringWithLength(): string;
readBytes(length: number): Uint8Array;
readVarintHash64(): string;
readFixedHash64(): string;
}
export class BinaryIterator {
constructor(decoder?: BinaryDecoder,
next?: () => number|boolean|string|null,
elements?: Array<number|boolean|string>)
static alloc(decoder?: BinaryDecoder,
next?: () => number|boolean|string|null,
elements?: Array<number|boolean|string>): BinaryIterator;
free(): void;
clear(): void;
get(): (ScalarFieldType | null);
atEnd(): boolean;
next(): (ScalarFieldType | null);
}
export namespace BinaryConstants {
export enum FieldType {
INVALID = -1,
DOUBLE = 1,
FLOAT = 2,
INT64 = 3,
UINT64 = 4,
INT32 = 5,
FIXED64 = 6,
FIXED32 = 7,
BOOL = 8,
STRING = 9,
GROUP = 10,
MESSAGE = 11,
BYTES = 12,
UINT32 = 13,
ENUM = 14,
SFIXED32 = 15,
SFIXED64 = 16,
SINT32 = 17,
SINT64 = 18,
FHASH64 = 30,
VHASH64 = 31,
}
export enum WireType {
INVALID = -1,
VARINT = 0,
FIXED64 = 1,
DELIMITED = 2,
START_GROUP = 3,
END_GROUP = 4,
FIXED32 = 5,
}
const FieldTypeToWireType: (fieldType: FieldType) => WireType;
const INVALID_FIELD_NUMBER: number;
const FLOAT32_EPS: number;
const FLOAT32_MIN: number;
const FLOAT32_MAX: number;
const FLOAT64_EPS: number;
const FLOAT64_MIN: number;
const FLOAT64_MAX: number;
const TWO_TO_20: number;
const TWO_TO_23: number;
const TWO_TO_31: number;
const TWO_TO_32: number;
const TWO_TO_52: number;
const TWO_TO_63: number;
const TWO_TO_64: number;
const ZERO_HASH: string;
}
export namespace arith {
export class UInt64 {
lo: number;
hi: number;
constructor(lo: number,
hi: number);
cmp(other: UInt64): number;
rightShift(): UInt64;
leftShift(): UInt64;
msb(): boolean;
lsb(): boolean;
zero(): boolean;
add(other: UInt64): UInt64;
sub(other: UInt64): UInt64;
static mul32x32(a: number,
b: number): UInt64;
mul(a: number): UInt64;
div(divisor: number): [UInt64, UInt64];
toString(): string;
static fromString(str: string): UInt64;
clone(): UInt64;
}
export class Int64 {
lo: number;
hi: number;
constructor(lo: number,
hi: number);
add(other: Int64): Int64;
sub(other: Int64): Int64;
clone(): Int64;
toString(): string;
static fromString(str: string): Int64;
}
}
// jspb.utils package excluded as it likely shouldn't be called by user code
-106
View File
@@ -1,106 +0,0 @@
// Type definitions for Google Analytics (Classic and Universal)
// Project: https://developers.google.com/analytics/devguides/collection/gajs/, https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference
// Definitions by: Ronnie Haakon Hegelund <http://ronniehegelund.blogspot.dk>, Pat Kujawa <http://patkujawa.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Tracker {
_trackPageview(): void;
_getName(): string;
_getAccount(): string;
_getVersion(): string;
_getVisitorCustomVar(index: number): string;
_setAccount(): string;
_setCustomVar(index: number, name: string, value: string, opt_scope?: number): boolean;
_setSampleRate(newRate: string): void;
_setSessionCookieTimeout(cookieTimeoutMillis: number): void;
_setSiteSpeedSampleRate(sampleRate: number): void;
_setVisitorCookieTimeout(milliseconds: number): void;
_trackPageLoadTime(): void;
}
interface GoogleAnalyticsCode {
push(commandArray: string[]): void;
push(func: Function): void;
}
interface GoogleAnalyticsTracker {
_getTracker(account: string): Tracker;
_createTracker(opt_account: string, opt_name?: string): Tracker;
_getTrackerByName(opt_name?: string): Tracker;
_anonymizeIp(): void;
}
interface GoogleAnalytics {
type: string;
src: string;
async: boolean;
}
declare namespace UniversalAnalytics {
// https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference
enum HitType {
'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'
}
interface ga {
l: number;
q: any[];
(command: 'send', hitType: 'event', eventCategory: string, eventAction: string,
eventLabel?: string, eventValue?: number, fieldsObject?: {}): void;
(command: 'send', hitType: 'event', fieldsObject: {
eventCategory: string,
eventAction: string,
eventLabel?: string,
eventValue?: number,
nonInteraction?: boolean}): void;
(command: 'send', fieldsObject: {
hitType: HitType, // 'event'
eventCategory: string,
eventAction: string,
eventLabel?: string,
eventValue?: number,
nonInteraction?: boolean}): void;
(command: 'send', hitType: 'pageview', page: string): void;
(command: 'send', hitType: 'social',
socialNetwork: string, socialAction: string, socialTarget: string): void;
(command: 'send', hitType: 'social',
fieldsObject: {socialNetwork: string, socialAction: string, socialTarget: string}): void;
(command: 'send', hitType: 'timing',
timingCategory: string, timingVar: string, timingValue: number): void;
(command: 'send', hitType: 'timing',
fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void;
(command: 'send', fieldsObject: {}): void;
(command: string, hitType: HitType, ...fields: any[]): void;
(command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void;
(command: 'remove'): void;
(command: string, ...fields: any[]): void;
(readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void;
create(trackingId: string, cookieDomain: string, name: string, fieldsObject?: {}): UniversalAnalytics.Tracker;
create(trackingId: string, cookieDomain: string, fieldsObject?: {}): UniversalAnalytics.Tracker;
create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker;
getAll(): UniversalAnalytics.Tracker[];
getByName(name: string): UniversalAnalytics.Tracker;
remove(name: string): void;
}
interface Tracker {
get<T>(fieldName: string): T;
send(hitType: string, opt_fieldObject?: {}): void;
set(fieldName: string, value: string): void;
set(fieldName: string, value: {}): void;
set(fieldName: string, value: number): void;
set(fieldName: string, value: boolean): void;
}
}
declare var gaClassic: GoogleAnalytics;
declare var ga: UniversalAnalytics.ga;
declare var _gaq: GoogleAnalyticsCode;
declare var _gat: GoogleAnalyticsTracker;
-8
View File
@@ -1,8 +0,0 @@
function test_NoDataToDisplay() {
var chart = $("#container").highcharts();
var chartHasData = chart.hasData();
chart.hideNoData();
chart.showNoData("Custom no data message");
}
HighchartsNoDataToDisplay(Highcharts);
-17
View File
@@ -1,17 +0,0 @@
import { HTMLHint, RuleSet } from "htmlhint";
const htmlHintRules: RuleSet = {
"tagname-lowercase": true,
"attr-lowercase": true,
"attr-value-double-quotes": true,
"doctype-first": true,
"tag-pair": true,
"spec-char-escape": true,
"id-unique": true,
"src-not-empty": true,
"attr-no-duplication": true,
"title-require": true
};
const result = HTMLHint.verify('<span></span>', htmlHintRules);
const formatted = HTMLHint.format(result, { indent: 2 });
-67
View File
@@ -1,67 +0,0 @@
// Type definitions for http-codes 1.0
// Project: https://github.com/flesler/node-http-codes
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export declare const ACCEPTED: number;
export declare const ALREADY_REPORTED: number;
export declare const BAD_GATEWAY: number;
export declare const BAD_REQUEST: number;
export declare const BANDWIDTH_LIMIT_EXCEEDED: number;
export declare const CONFLICT: number;
export declare const CONTINUE: number;
export declare const CREATED: number;
export declare const EXPECTATION_FAILED: number;
export declare const FAILED_DEPENDENCY: number;
export declare const FORBIDDEN: number;
export declare const FOUND: number;
export declare const GATEWAY_TIMEOUT: number;
export declare const GONE: number;
export declare const HTTP_VERSION_NOT_SUPPORTED: number;
export declare const IM_A_TEAPOT: number;
export declare const IM_USED: number;
export declare const INSUFFICIENT_STORAGE: number;
export declare const INTERNAL_SERVER_ERROR: number;
export declare const LENGTH_REQUIRED: number;
export declare const LOCKED: number;
export declare const LOOP_DETECTED: number;
export declare const METHOD_NOT_ALLOWED: number;
export declare const MISDIRECTED_REQUEST: number;
export declare const MOVED_PERMANENTLY: number;
export declare const MULTIPLE_CHOICES: number;
export declare const MULTI_STATUS: number;
export declare const NETWORK_AUTHENTICATION_REQUIRED: number;
export declare const NON_AUTHORITATIVE_INFORMATION: number;
export declare const NOT_ACCEPTABLE: number;
export declare const NOT_EXTENDED: number;
export declare const NOT_FOUND: number;
export declare const NOT_IMPLEMENTED: number;
export declare const NOT_MODIFIED: number;
export declare const NO_CONTENT: number;
export declare const OK: number;
export declare const PARTIAL_CONTENT: number;
export declare const PAYLOAD_TOO_LARGE: number;
export declare const PAYMENT_REQUIRED: number;
export declare const PERMANENT_REDIRECT: number;
export declare const PRECONDITION_FAILED: number;
export declare const PRECONDITION_REQUIRED: number;
export declare const PROCESSING: number;
export declare const PROXY_AUTHENTICATION_REQUIRED: number;
export declare const RANGE_NOT_SATISFIABLE: number;
export declare const REQUEST_HEADER_FIELDS_TOO_LARGE: number;
export declare const REQUEST_TIMEOUT: number;
export declare const RESET_CONTENT: number;
export declare const SEE_OTHER: number;
export declare const SERVICE_UNAVAILABLE: number;
export declare const SWITCHING_PROTOCOLS: number;
export declare const TEMPORARY_REDIRECT: number;
export declare const TOO_MANY_REQUESTS: number;
export declare const UNAUTHORIZED: number;
export declare const UNAVAILABLE_FOR_LEGAL_REASONS: number;
export declare const UNORDERED_COLLECTION: number;
export declare const UNPROCESSABLE_ENTITY: number;
export declare const UNSUPPORTED_MEDIA_TYPE: number;
export declare const UPGRADE_REQUIRED: number;
export declare const URI_TOO_LONG: number;
export declare const USE_PROXY: number;
export declare const VARIANT_ALSO_NEGOTIATES: number;
-148
View File
@@ -1,148 +0,0 @@
// Type definitions for dragula v2.1.2
// Project: https://bitbucket.org/igor_sechyn/hystrixjs
// Definitions by: Igor Sechyn <https://github.com/igorsechyn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference types="q"/>
///<reference types="rx"/>
declare namespace HystrixJS {
interface HystrixProperties {
"hystrix.force.circuit.open"?: boolean,
"hystrix.force.circuit.closed"?: boolean,
"hystrix.circuit.sleepWindowInMilliseconds"?:number,
"hystrix.circuit.errorThresholdPercentage"?: number,
"hystrix.circuit.volumeThreshold"?:number,
"hystrix.circuit.volumeThreshold.forceOverride"?: boolean,
"hystrix.circuit.volumeThreshold.override"?: number,
"hystrix.execution.timeoutInMilliseconds"?: number,
"hystrix.metrics.statistical.window.timeInMilliseconds"?: number,
"hystrix.metrics.statistical.window.bucketsNumber"?: number,
"hystrix.metrics.percentile.window.timeInMilliseconds"?: number,
"hystrix.metrics.percentile.window.bucketsNumber"?: number,
"hystrix.request.volume.rejectionThreshold"?: number
}
interface HystrixConfig {
metricsPercentileWindowBuckets(): number;
circuitBreakerForceClosed(): boolean;
circuitBreakerForceOpened(): boolean;
circuitBreakerSleepWindowInMilliseconds(): number;
circuitBreakerErrorThresholdPercentage(): number;
circuitBreakerRequestVolumeThreshold(): number;
circuitBreakerRequestVolumeThresholdForceOverride(): boolean;
circuitBreakerRequestVolumeThresholdOverride(): number;
executionTimeoutInMilliseconds(): number;
metricsStatisticalWindowBuckets(): number;
metricsStatisticalWindowInMilliseconds(): number;
metricsPercentileWindowInMilliseconds(): number;
metricsPercentileWindowBuckets(): number;
requestVolumeRejectionThreshold(): number;
resetProperties(): void;
init(properties: HystrixProperties): void;
}
interface Command {
execute(...args: any[]): Q.Promise<any>;
}
interface CommandBuilder {
circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilder;
errorHandler(value: (error: any) => boolean): CommandBuilder;
timeout(value: number): CommandBuilder;
circuitBreakerRequestVolumeThreshold(value: number): CommandBuilder;
requestVolumeRejectionThreshold(value: number): CommandBuilder;
circuitBreakerForceOpened(value: boolean): CommandBuilder;
circuitBreakerForceClosed(value: boolean): CommandBuilder;
statisticalWindowNumberOfBuckets(value: number): CommandBuilder;
statisticalWindowLength(value: number): CommandBuilder;
percentileWindowNumberOfBuckets(value: number): CommandBuilder;
percentileWindowLength(value: number): CommandBuilder;
circuitBreakerErrorThresholdPercentage(value: number): CommandBuilder;
run(value: (args: any) => Q.Promise<any>): CommandBuilder;
fallbackTo(value: (...args: any[]) => Q.Promise<any>): CommandBuilder;
context(value: any): CommandBuilder;
build(): Command;
}
interface CommandFactory {
getOrCreate(commandKey: string, commandGroup?: string): CommandBuilder;
resetCache(): void;
}
interface HealthCounts {
totalCount: number;
errorCount: number;
errorPercentage: number;
}
interface CommandMetrics {
markSuccess(): void;
markRejected(): void;
markFailure(): void;
markTimeout(): void;
markShortCircuited(): void;
incrementExecutionCount(): void;
decrementExecutionCount(): void;
getCurrentExecutionCount(): number;
addExecutionTime(value: number): void;
getRollingCount(type: any): number;
getExecutionTime(percentile: any): number;
getHealthCounts(): HealthCounts;
reset(): void;
}
interface MetricsProperties {
commandKey: string,
commandGroup: string,
statisticalWindowTimeInMilliSeconds?: number,
statisticalWindowNumberOfBuckets?: number,
percentileWindowTimeInMilliSeconds?: number,
percentileWindowNumberOfBuckets?: number
}
interface MetricsFactory {
getOrCreate(config: MetricsProperties): CommandMetrics;
resetCache(): void;
getAllMetrics(): Array<CommandMetrics>;
}
interface CirctuiBreakerConfig {
circuitBreakerSleepWindowInMilliseconds: number,
commandKey: string,
circuitBreakerErrorThresholdPercentage: number,
circuitBreakerRequestVolumeThreshold: number,
commandGroup: string,
circuitBreakerForceClosed: boolean,
circuitBreakerForceOpened: boolean
}
interface CircuitBreaker {
allowRequest(): boolean;
allowSingleTest(): boolean;
isOpen(): boolean;
markSuccess(): void;
}
interface CircuitFactory {
getOrCreate(config: CirctuiBreakerConfig): CircuitBreaker;
getCache(): Array<CircuitBreaker>;
resetCache(): void;
}
interface HystrixSSEStream {
toObservable(): Rx.Observable<any>
}
}
declare var hystrixjs: {
commandFactory: HystrixJS.CommandFactory,
metricsFactory: HystrixJS.MetricsFactory,
circuitFactory: HystrixJS.CircuitFactory,
hystrixSSEStream: HystrixJS.HystrixSSEStream,
hystrixConfig: HystrixJS.HystrixConfig
};
declare module "hystrixjs" {
export = hystrixjs;
}
-93
View File
@@ -1,93 +0,0 @@
// Type definitions for jasmine-expect 2.0
// Project: https://github.com/JamieMason/Jasmine-Matchers
// Definitions by: UserPixel <https://github.com/UserPixel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="jasmine" />
declare namespace jasmine {
interface Matchers {
// These functions are written in the order defined in the src directory of jasmine-matchers
// The type system is used smartly whenever it can provide value (by looking at the code of every matcher)
toBeAfter(otherDate: Date): boolean; //
toBeArray(): boolean; //
toBeArrayOfBooleans(): boolean; //
toBeArrayOfNumbers(): boolean;
toBeArrayOfObjects(): boolean;
toBeArrayOfSize(size: number): boolean;
toBeArrayOfStrings(): boolean;
toBeBefore(otherDate: Date): boolean; //
toBeBoolean(): boolean;
toBeCalculable(): boolean;
toBeDate(): boolean;
toBeEmptyArray(): boolean;
toBeEmptyObject(): boolean;
toBeEmptyString(): boolean;
toBeEvenNumber(): boolean;
toBeFalse(): boolean;
toBeFunction(): boolean;
toBeHtmlString(): boolean;
toBeIso8601(): boolean;
toBeJsonString(): boolean;
toBeLongerThan(other: string): boolean;
toBeNonEmptyArray(): boolean;
toBeNonEmptyObject(): boolean;
toBeNonEmptyString(): boolean;
toBeNumber(): boolean;
toBeObject(): boolean;
toBeOddNumber(): boolean;
toBeSameLengthAs(other: string): boolean;
toBeShorterThan(other: string): boolean;
toBeString(): boolean;
toBeTrue(): boolean;
toBeWhitespace(): boolean;
toBeWholeNumber(): boolean;
toBeWithinRange(floor: number, ceiling: number): boolean;
toEndWith(subString: string): boolean;
toHaveArray(key: string): boolean;
toHaveArrayOfBooleans(key: string): boolean;
toHaveArrayOfNumbers(key: string): boolean;
toHaveArrayOfObjects(key: string): boolean;
toHaveArrayOfSize(key: string, size?: number): boolean;
toHaveArrayOfStrings(key: string): boolean;
toHaveBoolean(key: string): boolean;
toHaveCalculable(key: string): boolean;
toHaveDate(key: string): boolean;
toHaveDateAfter(key: string, otherDate: Date): boolean;
toHaveDateBefore(key: string, otherDate: Date): boolean;
toHaveEmptyArray(key: string): boolean;
toHaveEmptyObject(key: string): boolean;
toHaveEmptyString(key: string): boolean;
toHaveEvenNumber(key: string): boolean;
toHaveFalse(key: string): boolean;
toHaveHtmlString(key: string): boolean;
toHaveIso8601(key: string): boolean;
toHaveJsonString(key: string): boolean;
toHaveMember(key: string): boolean;
toHaveMethod(key: string): boolean;
toHaveNonEmptyArray(key: string): boolean;
toHaveNonEmptyObject(key: string): boolean;
toHaveNonEmptyString(key: string): boolean;
toHaveNumber(key: string): boolean;
toHaveNumberWithinRange(key: string, floor: number, ceiling: number): boolean;
toHaveObject(key: string): boolean;
toHaveOddNumber(key: string): boolean;
toHaveString(key: string): boolean;
toHaveStringLongerThan(key: string, other: string): boolean;
toHaveStringSameLengthAs(key: string, other: string): boolean;
toHaveStringShorterThan(key: string, other: string): boolean;
toHaveTrue(key: string): boolean;
toHaveWhitespaceString(key: string): boolean;
toHaveWholeNumber(key: string): boolean;
toImplement(api: {}): boolean;
toStartWith(subString: string): boolean;
toThrowAnyError(): boolean;
toThrowErrorOfType(type: string): boolean;
}
}
-5
View File
@@ -1,5 +0,0 @@
{
"dependencies": {
"typescript": ">=2.1.4"
}
}
-896
View File
@@ -1,896 +0,0 @@
// Type definitions for Joint JS 1.0.1
// Project: http://www.jointjs.com/
// Definitions by: Aidan Reel <http://github.com/areel>, David Durman <http://github.com/DavidDurman>, Ewout Van Gossum <https://github.com/DenEwout>, Federico Caselli <https://github.com/CaselIT>, Chris Moran <https://github.com/ChrisMoran>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// typings: https://github.com/CaselIT/typings-jointjs
/// <reference types="backbone" />
declare namespace joint {
export var g: any;
export var V: any;
namespace dia {
interface Size {
width: number;
height: number;
}
interface Point {
x: number;
y: number;
}
interface BBox extends Point, Size { }
interface TranslateOptions {
restrictedArea?: BBox;
transition?: TransitionOptions;
}
interface TransitionOptions {
delay?: number;
duration?: number;
timingFunction?: (t: number) => number;
valueFunction?: (a: any, b: any) => (t: number) => any;
}
interface DfsBfsOptions {
inbound?: boolean;
outbound?: boolean;
deep?: boolean;
}
interface ExploreOptions {
breadthFirst?: boolean;
deep?: boolean;
}
class Graph extends Backbone.Model {
constructor(attributes?: any, options?: { cellNamespace: any });
addCell(cell: Cell | Cell[]): this;
addCells(cells: Cell[]): this;
resetCells(cells: Cell[], options?: any): this;
getCell(id: string): Cell;
getElements(): Element[];
getLinks(): Link[];
getCells(): Cell[];
getFirstCell(): Cell;
getLastCell(): Cell;
getConnectedLinks(element: Cell, options?: { inbound?: boolean, outbound?: boolean, deep?: boolean }): Link[];
disconnectLinks(cell: Cell, options?: any): void;
removeLinks(cell: Cell, options?: any): void;
translate(tx: number, ty?: number, options?: TranslateOptions): void;
cloneCells(cells: Cell[]): { [id: string]: Cell };
getSubgraph(cells: Cell[], options?: { deep?: boolean }): Cell[];
cloneSubgraph(cells: Cell[], options?: { deep?: boolean }): { [id: string]: Cell };
dfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions, visited?: Object, distance?: number): void;
bfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions): void;
search(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: { breadthFirst?: boolean }): void;
getSuccessors(element: Element, options?: ExploreOptions): Element[];
getPredecessors(element: Element, options?: ExploreOptions): Element[];
isSuccessor(elementA: Element, elementB: Element): boolean;
isPredecessor(elementA: Element, elementB: Element): boolean;
isSource(element: Element): boolean;
isSink(element: Element): boolean;
getSources(): Element[];
getSinks(): Element[];
getNeighbors(element: Element, options?: DfsBfsOptions): Element[];
isNeighbor(elementA: Element, elementB: Element, options?: { inbound?: boolean, outbound?: boolean; }): boolean;
getCommonAncestor(...cells: Cell[]): Element;
toJSON(): any;
fromJSON(json: any, options?: any): this;
clear(options?: any): this;
findModelsFromPoint(rect: BBox): Element[];
findModelsUnderElement(element: Element, options?: { searchBy?: 'bbox' | 'center' | 'origin' | 'corner' | 'topRight' | 'bottomLeft' }): Element[];
getBBox(elements: Element[], options?: any): BBox;
toGraphLib(): any; // graphlib graph object
findModelsInArea(rect: BBox, options?: any): BBox | boolean;
getCellsBBox(cells: Cell[], options?: any): BBox;
getInboundEdges(node: string): Object;
getOutboundEdges(node: string): Object;
hasActiveBatch(name?: string): number | boolean;
maxZIndex(): number;
removeCells(cells: Cell[], options?: any): this;
resize(width: number, height: number, options?: number): this;
resizeCells(width: number, height: number, cells: Cell[], options?: number): this;
set(key: Object | string, value: any, options?: any): this;
startBatch(name: string, data?: Object): any;
stopBatch(name: string, data?: Object): any;
}
class Cell extends Backbone.Model {
id: string;
toJSON(): any;
remove(options?: { disconnectLinks?: boolean }): this;
toFront(options?: { deep?: boolean }): this;
toBack(options?: { deep?: boolean }): this;
getAncestors(): Cell[];
isEmbeddedIn(element: Element, options?: { deep: boolean }): boolean;
prop(key: string): any;
prop(object: any): this;
prop(key: string, value: any, options?: any): this;
removeProp(path: string, options?: any): this;
attr(key: string): any;
attr(object: SVGAttributes): this;
attr(key: string, value: any): this;
clone(): Cell;
clone(opt: { deep?: boolean }): Cell | Cell[];
removeAttr(path: string | string[], options?: any): this;
transition(path: string, value?: any, options?: TransitionOptions, delim?: string): number;
getTransitions(): string[];
stopTransitions(path?: string, delim?: string): this;
addTo(graph: Graph, options?: any): this;
isLink(): boolean;
embed(cell: Cell, options?: any): this;
findView(paper: Paper): CellView;
getEmbeddedCells(options?: any): Cell[];
initialize(options?: any): void;
isElement(): boolean;
isEmbedded(): boolean;
processPorts(): void;
startBatch(name: string, options?: any): this;
stopBatch(name: string, options?: any): this;
unembed(cell: Cell, options?: any): this;
}
type Padding = number | {
top?: number;
right?: number;
bottom?: number;
left?: number
};
class Element extends Cell {
translate(tx: number, ty?: number, options?: TranslateOptions): this;
position(options?: { parentRelative: boolean }): Point;
position(x: number, y: number, options?: { parentRelative?: boolean }): this;
resize(width: number, height: number, options?: { direction?: 'left' | 'right' | 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right' }): this;
rotate(deg: number, absolute?: boolean, origin?: Point): this;
embed(cell: Cell): this;
unembed(cell: Cell): this;
getEmbeddedCells(options?: ExploreOptions): Cell[];
fitEmbeds(options?: { deep?: boolean, padding?: Padding }): this;
getBBox(options?: any): BBox;
findView(paper: Paper): ElementView;
isElement(): boolean;
scale(scaleX: number, scaleY: number, origin?: Point, options?: any): this;
addPort(port: any, opt?: any): this;
addPorts(ports: any[], opt?: any): this;
removePort(port: any, opt?: any): this;
hasPorts(): boolean;
hasPort(id: string): boolean;
getPorts(): any[];
getPort(id: string): any;
getPortIndex(port: any): number;
portProp(portId: string, path: any, value?: any, opt?: any): joint.dia.Element;
}
interface CSSSelector {
[key: string]: string | number | Object; // Object added to support special attributes like filter http://jointjs.com/api#SpecialAttributes:filter
}
interface SVGAttributes {
[selector: string]: CSSSelector;
}
interface CellAttributes {
[key: string]: any;
}
interface TextAttrs extends SVGAttributes {
text?: {
[key: string]: string | number;
text?: string;
};
}
interface Label {
position: number;
attrs?: TextAttrs;
}
interface LinkAttributes extends CellAttributes {
source?: Point | { id: string, selector?: string, port?: string };
target?: Point | { id: string, selector?: string, port?: string };
labels?: Label[];
vertices?: Point[];
smooth?: boolean;
attrs?: TextAttrs;
z?: number;
}
class Link extends Cell {
markup: string;
labelMarkup: string;
toolMakup: string;
vertexMarkup: string;
arrowHeadMarkup: string;
constructor(attributes?: LinkAttributes, options?: Object);
disconnect(): this;
label(index?: number): any;
label(index: number, value: Label): this;
reparent(options?: any): Element;
findView(paper: Paper): LinkView;
getSourceElement(): Element;
getTargetElement(): Element;
hasLoop(options?: { deep?: boolean }): boolean;
applyToPoints(fn: Function, options?: any): this;
getRelationshipAncestor(): Element;
isLink(): boolean;
isRelationshipEmbeddedIn(element: Element): boolean;
scale(sx: number, sy: number, origin: Point, optionts?: any): this;
translate(tx: number, ty: number, options?: any): this;
}
interface ManhattanRouterArgs {
excludeTypes?: string[];
excludeEnds?: 'source' | 'target';
startDirections?: ['left' | 'right' | 'top' | 'bottom'];
endDirections?: ['left' | 'right' | 'top' | 'bottom'];
}
interface PaperOptions extends Backbone.ViewOptions<Graph> {
el?: string | JQuery | HTMLElement;
width?: number;
height?: number;
origin?: Point;
gridSize?: number;
perpendicularLinks?: boolean;
elementView?: (element: Element) => ElementView | ElementView;
linkView?: (link: Link) => LinkView | LinkView;
defaultLink?: ((cellView: CellView, magnet: SVGElement) => Link) | Link;
defaultRouter?: ((vertices: Point[], args: Object, linkView: LinkView) => Point[]) | { name: string, args?: ManhattanRouterArgs };
defaultConnector?: ((sourcePoint: Point, targetPoint: Point, vertices: Point[], args: Object, linkView: LinkView) => string) | { name: string, args?: { radius?: number } };
interactive?: ((cellView: CellView, event: string) => boolean) | boolean | { vertexAdd?: boolean, vertexMove?: boolean, vertexRemove?: boolean, arrowheadMove?: boolean };
validateMagnet?: (cellView: CellView, magnet: SVGElement) => boolean;
validateConnection?: (cellViewS: CellView, magnetS: SVGElement, cellViewT: CellView, magnetT: SVGElement, end: 'source' | 'target', linkView: LinkView) => boolean;
linkConnectionPoint?: (linkView: LinkView, view: ElementView, magnet: SVGElement, reference: Point) => Point;
snapLinks?: boolean | { radius: number };
linkPinning?: boolean;
markAvailable?: boolean;
async?: boolean | { batchZise: number };
embeddingMode?: boolean;
validateEmbedding?: (childView: ElementView, parentView: ElementView) => boolean;
restrictTranslate?: ((elementView: ElementView) => BBox) | boolean;
guard?: (evt: Event, view: CellView) => boolean;
multiLinks?: boolean;
cellViewNamespace?: Object;
/** useful undocumented option */
clickThreshold?: number;
highlighting?: any;
}
interface ScaleContentOptions {
padding?: number;
preserveAspectRatio?: boolean;
minScale?: number;
minScaleX?: number;
minScaleY?: number;
maxScale?: number;
maxScaleX?: number;
maxScaleY?: number;
scaleGrid?: number;
fittingBBox?: BBox;
}
interface FitToContentOptions {
gridWidth?: number;
gridHeight?: number;
padding?: Padding;
allowNewOrigin?: 'negative' | 'positive' | 'any';
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
}
class Paper extends Backbone.View<Graph> {
constructor(options?: PaperOptions);
options: PaperOptions;
svg: SVGElement;
viewport: SVGGElement;
defs: SVGDefsElement;
setDimensions(width: number, height: number): void;
setOrigin(x: number, y: number): void;
scale(sx: number, sy?: number, ox?: number, oy?: number): this;
findView(element: any): CellView;
findViewByModel(model: Cell | string): CellView;
findViewsFromPoint(point: Point): ElementView[];
findViewsInArea(rect: BBox, options?: { strict?: boolean }): CellView[];
fitToContent(options?: FitToContentOptions): void;
scaleContentToFit(options?: ScaleContentOptions): void;
getContentBBox(): BBox;
clientToLocalPoint(p: Point): Point;
rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already
afterRenderViews(): void;
asyncRenderViews(cells: Cell[], options?: any): void;
beforeRenderViews(cells: Cell[]): Cell[];
cellMouseout(evt: Event): void;
cellMouseover(evt: Event): void;
clearGrid(): this;
contextmenu(evt: Event): void;
createViewForModel(cell: Cell): CellView;
drawGrid(options?: any): this;
fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, options?: any): void;
getArea(): BBox;
getDefaultLink(cellView: CellView, magnet: HTMLElement): Link;
getModelById(id: string): Cell;
getRestrictedArea(): BBox;
guard(evt: Event, view: CellView): boolean;
linkAllowed(linkViewOrModel: LinkView | Link): boolean;
mouseclick(evt: Event): void;
mousedblclick(evt: Event): void;
mousewheel(evt: Event): void;
onCellAdded(cell: Cell, graph: Graph, options: Object): void;
onCellHighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void;
onCellUnhighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void;
onRemove(): void;
pointerdown(evt: Event): void;
pointermove(evt: Event): void;
pointerup(evt: Event): void;
remove(): this;
removeView(cell: Cell): CellView;
removeViews(): void;
renderView(cell: Cell): CellView;
resetViews(cellsCollection: Cell[], options: any): void;
resolveHighlighter(options?: any): boolean | Object;
setGridSize(gridSize: number): this;
setInteractivity(value: any): void;
snapToGrid(p: Point): Point;
sortViews(): void;
}
interface GradientOptions {
type: 'linearGradient' | 'radialGradient';
stops: Array<{
offset: string;
color: string;
opacity?: number;
}>;
}
class CellViewGeneric<T extends Backbone.Model> extends Backbone.View<T> {
getBBox(options?: { useModelGeometry?: boolean }): BBox;
highlight(el?: any, options?: any): this;
unhighlight(el?: any, options?: any): this;
applyFilter(selector: string | HTMLElement, filter: Object): void;
applyGradient(selector: string | HTMLElement, attr: 'fill' | 'stroke', gradient: GradientOptions): void;
can(feature: string): boolean;
findBySelector(selector: string): JQuery;
findMagnet(el: any): HTMLElement;
getSelector(el: HTMLElement, prevSelector: string): string;
getStrokeBBox(el: any): BBox; // string|HTMLElement|Vectorizer
mouseout(evt: Event): void;
mouseover(evt: Event): void;
mousewheel(evt: Event, x: number, y: number, delta: number): void
notify(eventName: string): void;
onChangeAttrs(cell: Cell, attrs: Backbone.ViewOptions<T>, options?: any): this;
onSetTheme(oldTheme: string, newTheme: string): void;
pointerclick(evt: Event, x: number, y: number): void;
pointerdblclick(evt: Event, x: number, y: number): void;
pointerdown(evt: Event, x: number, y: number): void;
pointermove(evt: Event, x: number, y: number): void;
pointerup(evt: Event, x: number, y: number): void;
remove(): this;
setInteractivity(value: any): void;
setTheme(theme: string, options?: any): this;
}
class CellView extends CellViewGeneric<Cell> { }
interface ElementViewAttributes {
style?: string;
text?: string;
html?: string;
"ref-x"?: string | number;
"ref-y"?: string | number;
"ref-dx"?: number;
"ref-dy"?: number;
"ref-width"?: string | number;
"ref-height"?: string | number;
ref?: string;
"x-alignment"?: 'middle' | 'right' | number;
"y-alignment"?: 'middle' | 'bottom' | number;
port?: string;
}
class ElementView extends CellViewGeneric<Element> {
scale(sx: number, sy: number): void; // @todo Documented in source but not released
finalizeEmbedding(options?: any): void;
getBBox(options?: any): BBox;
pointerdown(evt: Event, x: number, y: number): void;
pointermove(evt: Event, x: number, y: number): void;
pointerup(evt: Event, x: number, y: number): void;
positionRelative(vel: any, bbox: BBox, attributes: ElementViewAttributes, nodesBySelector?: Object): void; // Vectorizer
prepareEmbedding(options?: any): void;
processEmbedding(options?: any): void;
render(): this;
renderMarkup(): void;
resize(): void;
rotate(): void;
translate(model: Backbone.Model, changes?: any, options?: any): void;
update(cell: Cell, renderingOnlyAttrs?: Object): void;
}
class LinkView extends CellViewGeneric<Link> {
options: {
shortLinkLength?: number,
doubleLinkTools?: boolean,
longLinkLength?: number,
linkToolsOffset?: number,
doubleLinkToolsOffset?: number,
sampleInterval: number
};
getConnectionLength(): number;
sendToken(token: SVGElement, duration?: number, callback?: () => void): void;
addVertex(vertex: Point): number;
getPointAtLength(length: number): Point; // Marked as public api in source but not in the documents
createWatcher(endType: { id: string }): Function;
findRoute(oldVertices: Point[]): Point[];
getConnectionPoint(end: 'source' | 'target', selectorOrPoint: Element | Point, referenceSelectorOrPoint: Element | Point): Point;
getPathData(vertices: Point[]): any;
onEndModelChange(endType: 'source' | 'target', endModel?: Element, opt?: any): void;
onLabelsChange(): void;
onSourceChange(cell: Cell, sourceEnd: { id: string }, options: any): void;
onTargetChange(cell: Cell, targetEnd: { id: string }, options: any): void;
onToolsChange(): void;
onVerticesChange(cell: Cell, changed: any, options: any): void;
pointerdown(evt: Event, x: number, y: number): void;
pointermove(evt: Event, x: number, y: number): void;
pointerup(evt: Event, x: number, y: number): void;
removeVertex(idx: number): this;
render(): this;
renderArrowheadMarkers(): this;
renderLabels(): this;
renderTools(): this;
renderVertexMarkers(): this;
startArrowheadMove(end: 'source' | 'target', options?: any): void;
startListening(): void;
update(model: any, attributes: any, options?: any): this;
updateArrowheadMarkers(): this;
updateAttributes(): void;
updateConnection(options?: any): void;
updateLabelPositions(): this;
updateToolsPosition(): this;
}
}
namespace ui { }
namespace shapes {
interface GenericAttributes<T> extends dia.CellAttributes {
position?: dia.Point;
size?: dia.Size;
angle?: number;
attrs?: T;
}
interface ShapeAttrs extends dia.CSSSelector {
fill?: string;
stroke?: string;
r?: string | number;
rx?: string | number;
ry?: string | number;
cx?: string | number;
cy?: string | number;
height?: string | number;
width?: string | number;
transform?: string;
points?: string;
'stroke-width'?: string | number;
'ref-x'?: string | number;
'ref-y'?: string | number;
ref?: string
}
namespace basic {
class Generic extends dia.Element {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
interface RectAttrs extends dia.TextAttrs {
rect?: ShapeAttrs;
}
class Rect extends Generic {
constructor(attributes?: GenericAttributes<RectAttrs>, options?: Object);
}
class Text extends Generic {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
interface CircleAttrs extends dia.TextAttrs {
circle?: ShapeAttrs;
}
class Circle extends Generic {
constructor(attributes?: GenericAttributes<CircleAttrs>, options?: Object);
}
interface EllipseAttrs extends dia.TextAttrs {
ellipse?: ShapeAttrs;
}
class Ellipse extends Generic {
constructor(attributes?: GenericAttributes<EllipseAttrs>, options?: Object);
}
interface PolygonAttrs extends dia.TextAttrs {
polygon?: ShapeAttrs;
}
class Polygon extends Generic {
constructor(attributes?: GenericAttributes<PolygonAttrs>, options?: Object);
}
interface PolylineAttrs extends dia.TextAttrs {
polyline?: ShapeAttrs;
}
class Polyline extends Generic {
constructor(attributes?: GenericAttributes<PolylineAttrs>, options?: Object);
}
class Image extends Generic {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
interface PathAttrs extends dia.TextAttrs {
path?: ShapeAttrs;
}
class Path extends Generic {
constructor(attributes?: GenericAttributes<PathAttrs>, options?: Object);
}
interface RhombusAttrs extends dia.TextAttrs {
path?: ShapeAttrs;
}
class Rhombus extends Generic {
constructor(attributes?: GenericAttributes<RhombusAttrs>, options?: Object);
}
interface TextBlockAttrs extends dia.TextAttrs {
rect?: ShapeAttrs;
}
class TextBlock extends Generic {
constructor(attributes?: GenericAttributes<TextBlockAttrs>, options?: Object);
updateSize(cell: dia.Cell, size: dia.Size): void;
updateContent(cell: dia.Cell, content: string): void;
}
}
namespace chess {
class KingWhite extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class KingBlack extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class QueenWhite extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class QueenBlack extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class RookWhite extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class RookBlack extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class BishopWhite extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class BishopBlack extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class KnightWhite extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class KnightBlack extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class PawnWhite extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class PawnBlack extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
}
namespace devs {
interface ModelAttributes extends GenericAttributes<dia.SVGAttributes> {
inPorts?: string[];
outPorts?: string[];
ports?: Object;
}
class Model extends basic.Generic {
constructor(attributes?: ModelAttributes, options?: Object);
changeInGroup(properties: any, opt?: any): boolean;
changeOutGroup(properties: any, opt?: any): boolean;
createPortItem(group: string, port: string): any;
createPortItems(group: string, ports: string[]): any[];
addOutPort(port: string, opt?: any): this;
addInPort(port: string, opt?: any): this;
removeOutPort(port: string, opt?: any): this;
removeInPort(port: string, opt?: any): this;
}
class Coupled extends Model {
constructor(attributes?: ModelAttributes, options?: Object);
}
class Atomic extends Model {
constructor(attributes?: ModelAttributes, options?: Object);
}
class Link extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
}
namespace erd {
class Entity extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
class WeakEntity extends Entity {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
class Relationship extends dia.Element {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
class IdentifyingRelationship extends Relationship {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
interface AttributeAttrs extends dia.TextAttrs {
ellipse?: ShapeAttrs;
}
class Attribute extends dia.Element {
constructor(attributes?: GenericAttributes<AttributeAttrs>, options?: Object);
}
class Multivalued extends Attribute {
constructor(attributes?: GenericAttributes<AttributeAttrs>, options?: Object);
}
class Derived extends Attribute {
constructor(attributes?: GenericAttributes<AttributeAttrs>, options?: Object);
}
class Key extends Attribute {
constructor(attributes?: GenericAttributes<AttributeAttrs>, options?: Object);
}
class Normal extends Attribute {
constructor(attributes?: GenericAttributes<AttributeAttrs>, options?: Object);
}
interface ISAAttrs extends dia.Element {
polygon?: ShapeAttrs;
}
class ISA extends dia.Element {
constructor(attributes?: GenericAttributes<ISAAttrs>, options?: Object);
}
class Line extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
cardinality(value: string | number): void;
}
}
namespace fsa {
class State extends basic.Circle {
constructor(attributes?: GenericAttributes<basic.CircleAttrs>, options?: Object);
}
class StartState extends dia.Element {
constructor(attributes?: GenericAttributes<basic.CircleAttrs>, options?: Object);
}
class EndState extends dia.Element {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class Arrow extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
}
namespace logic {
interface LogicAttrs extends ShapeAttrs {
ref?: string;
'ref-x'?: number | string;
'ref-dx'?: number | string;
'ref-y'?: number | string;
'ref-dy'?: number | string;
magnet?: boolean;
'class'?: string;
port?: string;
}
interface IOAttrs extends dia.TextAttrs {
circle?: LogicAttrs;
}
class Gate extends basic.Generic {
constructor(attributes?: GenericAttributes<IOAttrs>, options?: Object);
}
class IO extends Gate {
constructor(attributes?: GenericAttributes<IOAttrs>, options?: Object);
}
class Input extends IO {
constructor(attributes?: GenericAttributes<IOAttrs>, options?: Object);
}
class Output extends IO {
constructor(attributes?: GenericAttributes<IOAttrs>, options?: Object);
}
class Gate11 extends Gate {
constructor(attributes?: GenericAttributes<IOAttrs>, options?: Object);
}
class Gate21 extends Gate {
constructor(attributes?: GenericAttributes<IOAttrs>, options?: Object);
}
interface Image {
'xlink:href'?: string;
}
interface ImageAttrs extends LogicAttrs {
image?: Image;
}
class Repeater extends Gate11 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input: any): any;
}
class Note extends Gate11 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input: any): boolean;
}
class Or extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class And extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Nor extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Nand extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Xor extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Xnor extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
interface WireArgs extends dia.LinkAttributes {
router?: Object;
connector?: Object;
}
class Wire extends dia.Link {
constructor(attributes?: WireArgs, options?: Object);
}
}
namespace org {
interface MemberAttrs {
rect?: ShapeAttrs;
image?: ShapeAttrs;
}
class Member extends dia.Element {
constructor(attributes?: GenericAttributes<MemberAttrs>, options?: Object);
}
class Arrow extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
}
namespace pn {
class Place extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class PlaceView extends dia.ElementView {
renderTokens(): void;
}
class Transition extends basic.Generic {
constructor(attributes?: GenericAttributes<basic.RectAttrs>, options?: Object);
}
class Link extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
}
namespace uml {
interface ClassAttributes extends GenericAttributes<basic.RectAttrs> {
name: string[];
attributes: string[];
methods: string[];
}
class Class extends basic.Generic {
constructor(attributes?: ClassAttributes, options?: Object);
getClassName(): string[];
updateRectangles(): void;
}
class ClassView extends dia.ElementView {
}
class Abstract extends Class {
constructor(attributes?: ClassAttributes, options?: Object);
}
class AbstractView extends ClassView {
constructor(attributes?: ClassAttributes, options?: Object);
}
class Interface extends Class {
constructor(attributes?: ClassAttributes, options?: Object);
}
class InterfaceView extends ClassView {
constructor(attributes?: ClassAttributes, options?: Object);
}
class Generalization extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
class Implementation extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
class Aggregation extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
class Composition extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
class Association extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
interface StateAttributes extends GenericAttributes<ShapeAttrs> {
events?: string[];
}
class State extends basic.Generic {
constructor(attributes?: GenericAttributes<basic.CircleAttrs>, options?: Object);
updateName(): void;
updateEvents(): void;
updatePath(): void;
}
class StartState extends basic.Circle {
constructor(attributes?: GenericAttributes<basic.CircleAttrs>, options?: Object);
}
class EndState extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
class Transition extends dia.Link {
constructor(attributes?: dia.LinkAttributes, options?: Object);
}
}
}
namespace util {
namespace format {
export function number(specifier: string, value: number): string;
}
export function uuid(): string;
export function guid(obj?: Object): string;
export function nextFrame(callback: () => void, context?: Object): number;
export function cancelFrame(requestId: number): void;
export function flattenObject(object: Object, delim: string, stop: (node: any) => boolean): any;
export function getByPath(object: Object, path: string, delim: string): any;
export function setByPath(object: Object, path: string, value: Object, delim: string): any;
export function unsetByPath(object: Object, path: string, delim: string): any;
export function breakText(text: string, size: dia.Size, attrs?: dia.SVGAttributes, options?: { svgDocument?: SVGElement }): string;
export function normalizeSides(box: number | { x?: number, y?: number, height?: number, width?: number }): dia.BBox;
export function getElementBBox(el: Element): dia.BBox;
export function setAttributesBySelector(el: Element, attrs: dia.SVGAttributes): void;
export function sortElements(elements: Element[] | string | JQuery, comparator: (a: Element, b: Element) => number): Element[];
export function shapePerimeterConnectionPoint(linkView: dia.LinkView, view: dia.ElementView, magnet: SVGElement, ref: dia.Point): dia.Point;
export function imageToDataUri(url: string, callback: (err: Error, dataUri: string) => void): void;
// Not documented but used in examples
/** @deprecated use lodash _.defaultsDeep */
export function deepSupplement(objects: any, defaultIndicator?: any): any;
// Private functions
/** @deprecated use lodash _.assign */
export function mixin(objects: any[]): any;
/** @deprecated use lodash _.defaults */
export function supplement(objects: any[]): any;
/** @deprecated use lodash _.mixin */
export function deepMixin(objects: any[]): any;
}
namespace layout {
interface LayoutOptions {
nodeSep?: number;
edgeSep?: number;
rankSep?: number;
rankDir?: 'TB' | 'BT' | 'LR' | 'RL';
marginX?: number;
marginY?: number;
resizeCluster?: boolean;
setPosition?: (element: dia.Element, position: dia.BBox) => void;
setLinkVertices?: (link: dia.Link, vertices: Position[]) => void;
}
export class DirectedGraph {
static layout(graph: dia.Graph | dia.Cell[], options?: LayoutOptions): dia.BBox;
}
}
}
@@ -1,18 +0,0 @@
// Type definitions for jquery.are-you-sure.js
// Project: https://github.com/codedance/jquery.AreYouSure
// Definitions by: Jon Egerton <https://github.com/jonegerton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery"/>
//Use defaults
$("test").areYouSure();
//Use all settings
$("test").areYouSure({
message: "Oops - sure you wanna leave?",
dirtyClass: "soiled",
fieldSelector: "input[type='text']",
change: function () { alert("changed");},
silent: true
})
-31
View File
@@ -1,31 +0,0 @@
/// <reference types="jquery" />
// Create the timer
$("body").timer(
function () {
console.log("This function just got called");
}, 10000, true
);
$("body").timer.set({ time: 5000 }); // Change the time from 10000 millseconds to 5000 milliseconds
$("body").timer.toggle(false); // Reset the timer
$("body").timer.stop(); // Stop the timer
$("body").timer.play(); // Start / play the timer
// #region Outputting if timer is active or not
var isTimerActive = $("body").timer.isActive; // Define boolean isActive as isTimerActive
if (isTimerActive == true){
console.log("Timer is active!");
}
else{
console.log("Timer is not active!");
}
// #endregion
// #region Get time remaining
console.log("Time remaining on timer: " + $("body").timer.remaining.toString);
// #endregion
$("body").timer.stop(); // Stop the timer once more for the purpose of the tests (to test once())
$("body").timer.once(1000); // Run the timer ONCE in 1 second
-16
View File
@@ -1,16 +0,0 @@
// Type definitions for jump.js 1.0
// Project: https://github.com/callmecavs/jump.js
// Definitions by: rhysd <https://rhysd.github.io>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare type TransitionFunc = (t: number, b: number, c: number, d: number) => number;
declare interface JumpOptions {
duration?: number;
offset?: number;
callback?: () => void;
easing?: TransitionFunc;
a11y?: boolean;
}
declare type Jump = (target: string | Element | number, opts?: JumpOptions) => void;
declare const jump: Jump;
export = jump;
-99
View File
@@ -1,99 +0,0 @@
function main() {
Kii.initializeWithSite("abc", "def", KiiSite.JP);
var user = KiiUser.userWithUsername("name", "password");
user.register({
success(user: KiiUser) {
},
failure(user: KiiUser, message: string) {
}
});
user.register({
success: (user: KiiUser) => 123,
failure: (user: KiiUser, message: string) => 456
});
user.register()
.then(function (user: KiiUser) {
});
user.pushInstallation().getMqttEndpoint("")
.then(function (endpoint: KiiCloud.KiiMqttEndpoint) {
endpoint.installationID;
});
user.setLocale("en");
var locale: string = user.getLocale();
var anotherUser: KiiUser = KiiUserBuilder
.builderWithIdentifier("id", "password")
.setEmailAddress("mail@example.org")
.build();
var bucket = Kii.bucketWithName("foo");
var clause1 = KiiClause.lessThan("x", 1);
var clause2 = KiiClause.greaterThan("y", 1);
var clause3 = KiiClause.and(clause1, clause2);
var query = KiiQuery.queryWithClause(clause3);
bucket.executeQuery(query, {
success: function (query: KiiQuery,
results: KiiObject[],
nextQuery: KiiQuery) {
},
failure: function (bucket: KiiBucket, message: string) {
}
});
bucket.executeQuery<KiiObject>(query)
.then(function (params: [KiiQuery, KiiObject[], KiiQuery]) {
var [query, results, nextQuery] = params;
});
var object = bucket.createObject();
object.set("foo", 1);
object.save();
KiiGroup.registerGroupWithID("Group ID", "Group Name", [user], {
success: function(theSavedGroup: KiiGroup) {
theSavedGroup.saveWithOwner("user ID");
},
failure: function(theGroup: KiiGroup,
anErrorString: String,
addMembersArray: KiiUser[],
removeMembersArray: KiiUser[]) {
}
});
Kii.authenticateAsThing("thing id", "password", {
success: function (thingAuthContext: KiiThingContext) {
thingAuthContext.bucketWithName("");
},
failure: function (error) {
}
})
.then(function (thingAuthContext: KiiThingContext) {
});
Kii.authenticateAsThingWithToken("thing id", "token", {
success: function (thingAuthContext: KiiThingContext) {
thingAuthContext.bucketWithName("");
},
failure: function (error) {
}
})
.then(function (thingAuthContext: KiiThingContext) {
});
KiiThing.loadWithVendorThingID("thing ID")
.then(function (thing) {
var isOnline: boolean = thing.isOnline();
var onlineStatusModifiedAt: Date = thing.getOnlineStatusModifiedAt();
});
}
-33
View File
@@ -1,33 +0,0 @@
/// <reference types="knockout" />
namespace KoGridTests
{
export interface IGridItem {
name: string;
}
export class Tests {
public items: KnockoutObservableArray<IGridItem>;
public selectedItems: KnockoutObservableArray<IGridItem>;
public gridOptionsAlarms: kg.GridOptions<IGridItem>;
constructor() {
this.items = ko.observableArray<IGridItem>();
this.selectedItems = ko.observableArray<IGridItem>();
this.gridOptionsAlarms = this.createDefaultGridOptions(this.items, this.selectedItems);
}
public createDefaultGridOptions<Type>(dataArray: KnockoutObservableArray<Type>, selectedItems: KnockoutObservableArray<Type>): kg.GridOptions<Type> {
return {
data: dataArray,
displaySelectionCheckbox: false,
footerVisible: false,
multiSelect: false,
showColumnMenu: false,
plugins: null,
selectedItems: selectedItems
};
}
}
}
-17
View File
@@ -1,17 +0,0 @@
import compose = require('koa-compose');
var fn1: compose.Middleware<any> = function(context: any, next: () => Promise<void>): Promise<any> {
return Promise
.resolve(console.log('in fn1'))
.then(() => next());
};
var fn2: compose.Middleware<any> = function(context: any, next: () => Promise<void>): Promise<any> {
return Promise
.resolve(console.log('in fn2'))
.then(() => next());
};
var fn = compose([fn1, fn2]);
-27
View File
@@ -1,27 +0,0 @@
// Type definitions for leaflet-imageoverlay-rotated 0.1
// Project: https://github.com/IvanSanchez/Leaflet.ImageOverlay.Rotated
// Definitions by: Thomas Kleinke <https://github.com/tkleinke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="leaflet" />
declare namespace L {
namespace ImageOverlay {
export interface Rotated extends L.ImageOverlay {
reposition(topleft: L.LatLngExpression,
topright: L.LatLngExpression,
bottomleft: L.LatLngExpression): void;
}
}
namespace imageOverlay {
export function rotated(imgSrc: string | HTMLImageElement | HTMLCanvasElement,
topleft: L.LatLngExpression,
topright: L.LatLngExpression,
bottomleft: L.LatLngExpression,
options?: L.ImageOverlayOptions): L.ImageOverlay.Rotated;
}
}
@@ -1,10 +0,0 @@
var topleft = L.latLng(40.52256691873593, -3.7743186950683594);
var topright = L.latLng(40.5210255066156, -3.7734764814376835);
var bottomleft = L.latLng(40.52180437272552, -3.7768453359603886);
var overlay = L.imageOverlay.rotated("image.jpg", topleft, topright, bottomleft, {
opacity: 0.5,
interactive: true
});
overlay.reposition(topleft, topright, bottomleft);
-115
View File
@@ -1,115 +0,0 @@
// Type definitions for Mozilla's localForage
// Project: https://github.com/mozilla/localforage
// Definitions by: yuichi david pichsenmeister <https://github.com/3x14159265>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface LocalForageOptions {
driver?: string | LocalForageDriver | LocalForageDriver[];
name?: string;
size?: number;
storeName?: string;
version?: number;
description?: string;
}
interface LocalForageDbMethods {
getItem<T>(key: string): Promise<T>;
getItem<T>(key: string, callback: (err: any, value: T) => void): void;
setItem<T>(key: string, value: T): Promise<T>;
setItem<T>(key: string, value: T, callback: (err: any, value: T) => void): void;
removeItem(key: string): Promise<void>;
removeItem(key: string, callback: (err: any) => void): void;
clear(): Promise<void>;
clear(callback: (err: any) => void): void;
length(): Promise<number>;
length(callback: (err: any, numberOfKeys: number) => void): void;
key(keyIndex: number): Promise<string>;
key(keyIndex: number, callback: (err: any, key: string) => void): void;
keys(): Promise<string[]>;
keys(callback: (err: any, keys: string[]) => void): void;
iterate(iteratee: (value: any, key: string, iterationNumber: number) => any): Promise<any>;
iterate(iteratee: (value: any, key: string, iterationNumber: number) => any,
callback: (err: any, result: any) => void): void;
}
interface LocalForageDriverSupportFunc {
(): Promise<boolean>;
}
interface LocalForageDriver extends LocalForageDbMethods {
_driver: string;
_initStorage(options: LocalForageOptions): void;
_support?: boolean | LocalForageDriverSupportFunc;
}
interface LocalForageSerializer {
serialize<T>(value: T | ArrayBuffer | Blob, callback: (value: string, error: any) => void): void;
deserialize<T>(value: string): T | ArrayBuffer | Blob;
stringToBuffer(serializedString: string): ArrayBuffer;
bufferToString(buffer: ArrayBuffer): string;
}
interface LocalForage extends LocalForageDbMethods {
LOCALSTORAGE: string;
WEBSQL: string;
INDEXEDDB: string;
/**
* Set and persist localForage options. This must be called before any other calls to localForage are made, but can be called after localForage is loaded.
* If you set any config values with this method they will persist after driver changes, so you can call config() then setDriver()
* @param {LocalForageOptions} options?
*/
config(options: LocalForageOptions): boolean;
/**
* Create a new instance of localForage to point to a different store.
* All the configuration options used by config are supported.
* @param {LocalForageOptions} options
*/
createInstance(options: LocalForageOptions): LocalForage;
driver(): string;
/**
* Force usage of a particular driver or drivers, if available.
* @param {string} driver
*/
setDriver(driver: string | string[]): Promise<void>;
setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void;
defineDriver(driver: LocalForageDriver): Promise<void>;
defineDriver(driver: LocalForageDriver, callback: () => void, errorCallback: (error: any) => void): void;
/**
* Return a particular driver
* @param {string} driver
*/
getDriver(driver: string): Promise<LocalForageDriver>;
getSerializer(): Promise<LocalForageSerializer>;
getSerializer(callback: (serializer: LocalForageSerializer) => void): void;
supports(driverName: string): boolean;
ready(callback: () => void): void;
ready(): Promise<void>;
}
declare module "localforage" {
let localforage: LocalForage;
export = localforage;
}
-117
View File
@@ -1,117 +0,0 @@
declare let localForage: LocalForage;
namespace LocalForageTest {
localForage.clear((err: any) => {
let newError: any = err;
});
localForage.iterate((str: string, key: string, num: number) => {
let newStr: string = str;
let newKey: string = key;
let newNum: number = num;
});
localForage.length((err: any, num: number) => {
let newError: any = err;
let newNumber: number = num;
});
localForage.length().then((num: number) => {
var newNumber: number = num;
});
localForage.key(0, (err: any, value: string) => {
let newError: any = err;
let newValue: string = value;
});
localForage.keys((err: any, keys: Array<string>) => {
let newError: any = err;
let newArray: Array<string> = keys;
});
localForage.keys().then((keys: Array<string>) => {
var newArray: Array<string> = keys;
});
localForage.getItem("key",(err: any, str: string) => {
let newError: any = err;
let newStr: string = str
});
localForage.getItem<string>("key").then((str: string) => {
let newStr: string = str;
});
localForage.setItem("key", "value",(err: any, str: string) => {
let newError: any = err;
let newStr: string = str
});
localForage.setItem("key", "value").then((str: string) => {
let newStr: string = str;
});
localForage.removeItem("key",(err: any) => {
let newError: any = err;
});
localForage.removeItem("key").then(() => {
});
localForage.getDriver("CustomDriver").then((result: LocalForageDriver) => {
var driver: LocalForageDriver = result;
// we need to use a variable for proper type guards before TS 2.0
var _support = driver._support;
if (typeof _support === "function") {
// _support = _support.bind(driver);
_support().then((result: boolean) => {
let doesSupport: boolean = result;
});
} else if (typeof _support === "boolean") {
let doesSupport: boolean = _support;
}
});
{
let config: boolean;
config = localForage.config({
name: "testyo",
driver: localForage.LOCALSTORAGE
});
}
{
let store: LocalForage;
store = localForage.createInstance({
name: "da instance",
driver: localForage.LOCALSTORAGE
});
}
{
let testSerializer: LocalForageSerializer;
localForage.getSerializer()
.then((serializer: LocalForageSerializer) => {
testSerializer = serializer;
});
localForage.getSerializer((serializer: LocalForageSerializer) => {
testSerializer = serializer;
});
}
{
let store: LocalForage;
store.ready()
.then(() => {});
store.ready(() => {});
}
}
-11
View File
@@ -1,11 +0,0 @@
// Type definitions for Masked Input plugin for jQuery
// Project: http://digitalbush.com/projects/masked-input-plugin
// Definitions by: Lokesh Peta <https://github.com/lokeshpeta/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference types="jquery" />
$("#test").mask("9:000");
$("#test").mask("9:000", { numeric: true });
var alies = $.mask.defaults.aliases;
-2970
View File
File diff suppressed because it is too large Load Diff
-178
View File
@@ -1,178 +0,0 @@
// Type definitions for mobservable 0.6
// Project: https://mweststrate.github.io/mobservable
// Definitions by: Michel Weststrate <https://github.com/mweststrate/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Mobservable {
interface Static extends MakeReactive {
/**
* Turns an object, array or function into a reactive structure.
* @param value the value which should become observable.
*/
makeReactive: MakeReactive;
/**
* Extends an object with reactive capabilities.
* @param target the object to which reactive properties should be added
* @param properties the properties that should be added and made reactive
* @returns targer
*/
extendReactive(target: Object, properties: Object): Object;
/**
* Returns true if the provided value is reactive.
* @param value object, function or array
* @param propertyName if propertyName is specified, checkes whether value.propertyName is reactive.
*/
isReactive(value: any, propertyName?: string): boolean;
/**
* Can be used in combination with makeReactive / extendReactive.
* Enforces that a reference to 'value' is stored as property,
* but that 'value' itself is not turned into something reactive.
* Future assignments to the same property will inherit this behavior.
* @param value initial value of the reactive property that is being defined.
*/
asReference<T>(value: any): {value: T};
/**
* ES6 / Typescript decorator which can to make class properties and getter functions reactive.
*/
observable(target: Object, key: string): any; // decorator / annotation
/**
* Creates a reactive view and keeps it alive, so that the view is always
* updated if one of the dependencies changes, even when the view is not further used by something else.
* @param func The reactive view
* @param scope (optional)
* @returns disposer function, which can be used to stop the view from being updated in the future.
*/
observe(func: Mobservable.Lambda, scope?: any): Mobservable.Lambda;
/**
* Deprecated, use mobservable.observe instead.
*/
sideEffect(func: Mobservable.Lambda, scope?: any): Mobservable.Lambda;
/**
* Similar to 'observer', observes the given predicate until it returns true.
* Once it returns true, the 'effect' function is invoked an the observation is cancelled.
* @param predicate
* @param effect
* @param scope (optional)
* @returns disposer function to prematurely end the observer.
*/
observeUntil(predicate: () => boolean, effect: Mobservable.Lambda, scope?: any): Mobservable.Lambda;
/**
* During a transaction no views are updated until the end of the transaction.
* The transaction will be run synchronously nonetheless.
* @param action a function that updates some reactive state
* @returns any value that was returned by the 'action' parameter.
*/
transaction<T>(action: () => T): T;
/**
* Converts a reactive structure into a non-reactive structure.
* Basically a deep-clone.
*/
toJSON<T>(value: T): T;
/**
* Sets the reporting level Defaults to 1. Use 0 for production or 2 for increased verbosity.
*/
logLevel: number; // 0 = production, 1 = development, 2 = debugging
extras: {
getDependencyTree(thing: any, property?: string): Mobservable.DependencyTree;
getObserverTree(thing: any, property?: string): Mobservable.ObserverTree;
trackTransitions(extensive?: boolean, onReport?: (lines: Mobservable.TransitionEvent) => void): Mobservable.Lambda;
};
}
interface MakeReactive {
<T>(value: T[], opts?: Mobservable.MakeReactiveOptions): Mobservable.ObservableArray<T>;
<T>(value: () => T, opts?: Mobservable.MakeReactiveOptions): Mobservable.ObservableValue<T>;
<T extends string|number|boolean|Date|RegExp|Function|undefined>(value: T, opts?: Mobservable.MakeReactiveOptions): Mobservable.ObservableValue<T>;
<T extends Object>(value: Object, opts?: Mobservable.MakeReactiveOptions): T;
}
interface MakeReactiveOptions {
as?: string; /* "auto" | "reference" | TODO: see #8 "structure" */
scope?: Object;
context?: Object;
recurse?: boolean;
name?: string;
// protected: boolean TODO: see #9
}
type ContextInfo = { object: Object; name: string } | string;
interface Lambda {
(): void;
name?: string;
}
interface Observable {
observe(callback: (...args: any[]) => void, fireImmediately?: boolean): Lambda;
}
interface ObservableValue<T> extends Observable {
(): T;
(value: T): void;
observe(callback: (newValue: T, oldValue: T) => void, fireImmediately?: boolean): Lambda;
}
interface ObservableArray<T> extends Observable, Array<T> {
spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[];
observe(listener: (changeData: ArrayChange<T>|ArraySplice<T>) => void, fireImmediately?: boolean): Lambda;
clear(): T[];
replace(newItems: T[]): T[];
find(predicate: (item: T, index: number, array: ObservableArray<T>) => boolean, thisArg?: any, fromIndex?: number): T;
remove(value: T): boolean;
}
interface ArrayChange<T> {
type: string; // Always: 'update'
object: ObservableArray<T>;
index: number;
oldValue: T;
}
interface ArraySplice<T> {
type: string; // Always: 'splice'
object: ObservableArray<T>;
index: number;
removed: T[];
addedCount: number;
}
interface DependencyTree {
id: number;
name: string;
context: any;
dependencies?: DependencyTree[];
}
interface ObserverTree {
id: number;
name: string;
context: any;
observers?: ObserverTree[];
listeners?: number; // amount of functions manually attached using an .observe method
}
interface TransitionEvent {
id: number;
name: string;
context: Object;
state: string;
changed: boolean;
newValue: string;
}
}
declare const Mobservable: Mobservable.Static;
export = Mobservable;
-56
View File
@@ -1,56 +0,0 @@
import mobservable = require('mobservable');
import {observable} from "mobservable";
var v = mobservable(3);
v.observe(() => {});
var a = mobservable([1, 2, 3]);
class Order {
@observable price: number = 3;
@observable amount: number = 2;
@observable orders: string[] = [];
@observable get total() {
return this.amount * this.price * (1 + this.orders.length);
}
}
export function testObservable() {
var a = mobservable(3);
var b = mobservable(() => a() * 2);
}
export function testAnnotations() {
var order1totals: number[] = [];
var order1 = new Order();
var order2 = new Order();
var disposer = mobservable.observe(() => {
order1totals.push(order1.total);
});
order2.price = 4;
order1.amount = 1;
order2.orders.push('bla');
order1.orders.splice(0, 0, 'boe', 'hoi');
disposer();
order1.orders.pop();
};
export function testTyping() {
var ar: mobservable.ObservableArray<number> = mobservable.makeReactive([1, 2]);
ar.observe((d: mobservable.ArrayChange<number> | mobservable.ArraySplice<number>) => {
console.log(d.type);
});
var ar2: mobservable.ObservableArray<number> = mobservable([1, 2]);
ar2.observe((d: mobservable.ArrayChange<number> | mobservable.ArraySplice<number>) => {
console.log(d.type);
});
var x: mobservable.ObservableValue<number> = mobservable(3);
}
-25
View File
@@ -1,25 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"experimentalDecorators": true,
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"mobservable-tests.ts"
]
}
-278
View File
@@ -1,278 +0,0 @@
// Type definitions for mssql 3.3
// Project: https://www.npmjs.com/package/mssql
// Definitions by: COLSA Corporation <http://www.colsa.com/>, Ben Farr <https://github.com/jaminfarr>, Vitor Buzinaro <https://github.com/buzinas>, Matt Richardson <https://github.com/mrrichar/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import events = require('events');
type sqlTypeWithNoParams = { type: sqlTypeFactoryWithNoParams }
type sqlTypeWithLength = { type: sqlTypeFactoryWithLength, length: number }
type sqlTypeWithScale = { type: sqlTypeFactoryWithScale, scale: number }
type sqlTypeWithPrecisionScale = { type: sqlTypeFactoryWithPrecisionScale, precision: number, scale: number }
type sqlTypeWithTvpType = { type: sqlTypeFactoryWithTvpType, tvpType: any }
type sqlTypeFactoryWithNoParams = () => sqlTypeWithNoParams;
type sqlTypeFactoryWithLength = (length?: number) => sqlTypeWithLength;
type sqlTypeFactoryWithScale = (scale?: number) => sqlTypeWithScale;
type sqlTypeFactoryWithPrecisionScale = (precision?: number, scale?: number) => sqlTypeWithPrecisionScale;
type sqlTypeFactoryWithTvpType = (tvpType: any) => sqlTypeWithTvpType;
export declare var VarChar: sqlTypeFactoryWithLength;
export declare var NVarChar: sqlTypeFactoryWithLength;
export declare var Text: sqlTypeFactoryWithNoParams;
export declare var Int: sqlTypeFactoryWithNoParams;
export declare var BigInt: sqlTypeFactoryWithNoParams;
export declare var TinyInt: sqlTypeFactoryWithNoParams;
export declare var SmallInt: sqlTypeFactoryWithNoParams;
export declare var Bit: sqlTypeFactoryWithNoParams;
export declare var Float: sqlTypeFactoryWithNoParams;
export declare var Numeric: sqlTypeFactoryWithPrecisionScale;
export declare var Decimal: sqlTypeFactoryWithPrecisionScale;
export declare var Real: sqlTypeFactoryWithNoParams;
export declare var Date: sqlTypeFactoryWithNoParams;
export declare var DateTime: sqlTypeFactoryWithNoParams;
export declare var DateTime2: sqlTypeFactoryWithScale;
export declare var DateTimeOffset: sqlTypeFactoryWithScale;
export declare var SmallDateTime: sqlTypeFactoryWithNoParams;
export declare var Time: sqlTypeFactoryWithScale;
export declare var UniqueIdentifier: sqlTypeFactoryWithNoParams;
export declare var SmallMoney: sqlTypeFactoryWithNoParams;
export declare var Money: sqlTypeFactoryWithNoParams;
export declare var Binary: sqlTypeFactoryWithNoParams;
export declare var VarBinary: sqlTypeFactoryWithLength;
export declare var Image: sqlTypeFactoryWithNoParams;
export declare var Xml: sqlTypeFactoryWithNoParams;
export declare var Char: sqlTypeFactoryWithLength;
export declare var NChar: sqlTypeFactoryWithLength;
export declare var NText: sqlTypeFactoryWithNoParams;
export declare var TVP: sqlTypeFactoryWithTvpType;
export declare var UDT: sqlTypeFactoryWithNoParams;
export declare var Geography: sqlTypeFactoryWithNoParams;
export declare var Geometry: sqlTypeFactoryWithNoParams;
export declare var TYPES: {
VarChar: sqlTypeFactoryWithLength;
NVarChar: sqlTypeFactoryWithLength;
Text: sqlTypeFactoryWithNoParams;
Int: sqlTypeFactoryWithNoParams;
BigInt: sqlTypeFactoryWithNoParams;
TinyInt: sqlTypeFactoryWithNoParams;
SmallInt: sqlTypeFactoryWithNoParams;
Bit: sqlTypeFactoryWithNoParams;
Float: sqlTypeFactoryWithNoParams;
Numeric: sqlTypeFactoryWithPrecisionScale;
Decimal: sqlTypeFactoryWithPrecisionScale;
Real: sqlTypeFactoryWithNoParams;
Date: sqlTypeFactoryWithNoParams;
DateTime: sqlTypeFactoryWithNoParams;
DateTime2: sqlTypeFactoryWithScale;
DateTimeOffset: sqlTypeFactoryWithScale;
SmallDateTime: sqlTypeFactoryWithNoParams;
Time: sqlTypeFactoryWithScale;
UniqueIdentifier: sqlTypeFactoryWithNoParams;
SmallMoney: sqlTypeFactoryWithNoParams;
Money: sqlTypeFactoryWithNoParams;
Binary: sqlTypeFactoryWithNoParams;
VarBinary: sqlTypeFactoryWithLength;
Image: sqlTypeFactoryWithNoParams;
Xml: sqlTypeFactoryWithNoParams;
Char: sqlTypeFactoryWithLength;
NChar: sqlTypeFactoryWithLength;
NText: sqlTypeFactoryWithNoParams;
TVP: sqlTypeFactoryWithTvpType;
UDT: sqlTypeFactoryWithNoParams;
Geography: sqlTypeFactoryWithNoParams;
Geometry: sqlTypeFactoryWithNoParams;
};
export declare var MAX: number;
export declare var fix: boolean;
export declare var Promise: any;
interface IMap extends Array<{ js: any, sql: any }> {
register(jstype: any, sql: any): void;
}
export declare var map: IMap;
export declare var DRIVERS: string[];
type recordSet = any;
type IIsolationLevel = number;
export declare var ISOLATION_LEVEL: {
READ_UNCOMMITTED: IIsolationLevel
READ_COMMITTED: IIsolationLevel
REPEATABLE_READ: IIsolationLevel
SERIALIZABLE: IIsolationLevel
SNAPSHOT: IIsolationLevel
}
export interface IOptions {
encrypt?: boolean;
instanceName?: string;
useUTC?: boolean;
tdsVersion?: string;
appName?: string;
abortTransactionOnError?: boolean;
trustedConnection?: boolean;
}
export interface IPool {
min: number;
max: number;
idleTimeoutMillis: number;
}
export declare var pool: IPool;
export interface config {
driver?: string;
user?: string;
password?: string;
server: string;
port?: number;
domain?: string;
database: string;
connectionTimeout?: number;
requestTimeout?: number;
stream?: boolean;
options?: IOptions;
pool?: IPool;
}
export declare class Connection extends events.EventEmitter {
public connected: boolean;
public connecting: boolean;
public driver: string;
public constructor(config: config, callback?: (err?: any) => void);
public connect(): Promise<Connection>;
public connect(callback: (err: any) => void): void;
public close(): Promise<void>;
public close(callback: (err: any) => void): void;
}
export declare class ConnectionError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
declare class columns {
public add(name: string, type: any, options: any): void;
}
declare class rows {
public add(...row: any[]): void;
}
export declare class Table {
public create: boolean;
public columns: columns;
public rows: rows;
public constructor(tableName: string);
}
interface IRequestParameters {
[name: string]: {
name: string;
type: any;
io: number;
value: any;
length: number;
scale: number;
precision: number;
tvpType: any;
}
}
export declare class Request extends events.EventEmitter {
public connection: Connection;
public transaction: Transaction;
public pstatement: PreparedStatement;
public parameters: IRequestParameters;
public verbose: boolean;
public multiple: boolean;
public canceled: boolean;
public stream: any;
public constructor(connection?: Connection);
public constructor(transaction: Transaction);
public constructor(preparedStatement: PreparedStatement);
public execute(procedure: string): Promise<recordSet>;
public execute<Entity>(procedure: string, callback: (err?: any, recordsets?: Entity[], returnValue?: any, rowsAffected?: number) => void): void;
public input(name: string, value: any): void;
public input(name: string, type: any, value: any): void;
public output(name: string, type: any, value?: any): void;
public pipe(stream: NodeJS.WritableStream): void;
public query(command: string): Promise<void>;
public query<Entity>(command: string): Promise<Entity[]>;
public query(command: string, callback: (err?: any, recordset?: any, rowsAffected?: number) => void): void;
public query<Entity>(command: string, callback: (err?: any, recordset?: Entity[]) => void): void;
public batch(batch: string): Promise<recordSet>;
public batch<Entity>(batch: string): Promise<Entity[]>;
public batch(batch: string, callback: (err?: any, recordset?: any) => void): void;
public batch<Entity>(batch: string, callback: (err?: any, recordset?: Entity[]) => void): void;
public bulk(table: Table): Promise<void>;
public bulk(table: Table, callback: (err: any, rowCount: any) => void): void;
public cancel(): void;
}
export declare class RequestError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
export declare class Transaction extends events.EventEmitter {
public connection: Connection;
public isolationLevel: IIsolationLevel;
public constructor(connection?: Connection);
public begin(isolationLevel?: IIsolationLevel): Promise<void>;
public begin(isolationLevel?: IIsolationLevel, callback?: (err?: any) => void): void;
public commit(): Promise<void>;
public commit(callback: (err?: any) => void): void;
public rollback(): Promise<void>;
public rollback(callback: (err?: any) => void): void;
}
export declare class TransactionError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
export declare class PreparedStatement extends events.EventEmitter {
public connection: Connection;
public transaction: Transaction;
public prepared: boolean;
public statement: string;
public parameters: IRequestParameters;
public multiple: boolean;
public stream: any;
public constructor(connection?: Connection);
public input(name: string, type: any): void;
public output(name: string, type: any): void;
public prepare(statement?: string): Promise<void>;
public prepare(statement?: string, callback?: (err?: any) => void): void;
public execute(values: Object): Promise<recordSet>;
public execute<Entity>(values: Object): Promise<Entity[]>;
public execute(values: Object, callback: (err: any, recordSet: recordSet, rowsAffected: number) => void): void;
public execute<Entity>(values: Object, callback: (err: any, recordSet: Entity[]) => void): void;
public unprepare(): Promise<void>;
public unprepare(callback: (err?: any) => void): void;
}
export declare class PreparedStatementError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
-603
View File
@@ -1,603 +0,0 @@
// Type definitions for Navigation 2.0.0
// Project: http://grahammendick.github.io/navigation/
// Definitions by: Graham Mendick <https://github.com/grahammendick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = Navigation;
declare namespace Navigation {
/**
* Defines a contract a class must implement in order to configure a State
*/
interface StateInfo {
/**
* Gets the unique key
*/
key: string;
/**
* Gets the default NavigationData for this State
*/
defaults?: any;
/**
* Gets the default NavigationData Types for this State
*/
defaultTypes?: any;
/**
* Gets the textual description of the state
*/
title?: string;
/**
* Gets the route Url patterns
*/
route?: string | string[];
/**
* Gets a value that indicates whether to maintain the crumb trail
*/
trackCrumbTrail?: boolean | string;
/**
* Gets a value that indicates whether NavigationData Types are
* preserved when navigating
*/
trackTypes?: boolean;
/**
* Gets the additional state attributes
*/
[extras: string]: any;
}
/**
* Represents a view and is the destination of a navigation
*/
class State implements StateInfo {
/**
* Gets the unique key
*/
key: string;
/**
* Gets the default NavigationData for this State
*/
defaults: any;
/**
* Gets the default NavigationData Types for this State
*/
defaultTypes: any;
/**
* Gets the formatted default NavigationData for this State
*/
formattedDefaults: any;
/**
* Gets the formatted default array NavigationData for this State
*/
formattedArrayDefaults: { [index: string]: string[]; };
/**
* Gets the textual description of the state
*/
title: string;
/**
* Gets the route Url patterns
*/
route: string | string[];
/**
* Gets a value that indicates whether to maintain the crumb trail
*/
trackCrumbTrail: boolean;
/**
* Gets the crumb trail key
*/
crumbTrailKey: string;
/**
* Gets a value that indicates whether NavigationData Types are
* preserved when navigating
*/
trackTypes: boolean;
/**
* Gets the additional state attributes
*/
[extras: string]: any;
/**
* Called on the old State before navigating to a different State
* @param state The new State
* @param data The new NavigationData
* @param url The new target location
* @param unload The function to call to continue to navigate
* @param history A value indicating whether browser history was used
*/
unloading: (state: State, data: any, url: string, unload: () => void, history?: boolean) => void;
/**
* Called on the old State after navigating to a different State
*/
dispose: () => void;
/**
* Called on the current State after navigating to it
* @param data The current NavigationData
* @param asyncData The data passed asynchronously while navigating
*/
navigated: (data: any, asyncData: any) => void;
/**
* Called on the new State before navigating to it
* @param data The new NavigationData
* @param url The new target location
* @param navigate The function to call to continue to navigate
* @param history A value indicating whether browser history was used
*/
navigating: (data: any, url: string, navigate: (asyncData?: any) => void, history: boolean) => void;
/**
* Encodes the Url value
* @param state The State navigated to
* @param key The key of the navigation data item
* @param val The Url value of the navigation data item
* @param queryString A value indicating the Url value's location
*/
urlEncode(state: State, key: string, val: string, queryString: boolean): string;
/**
* Decodes the Url value
* @param state The State navigated to
* @param key The key of the navigation data item
* @param val The Url value of the navigation data item
* @param queryString A value indicating the Url value's location
*/
urlDecode(state: State, key: string, val: string, queryString: boolean): string;
/**
* Validates the NavigationData before navigating to the new State
* @param data The new NavigationData
* @returns Validation success indicator
*/
validate(data: any): boolean;
/**
* Truncates the crumb trail whenever a repeated or initial State is
* encountered
* @param The State navigated to
* @param The Crumb collection representing the crumb trail
* @returns Truncated crumb trail
*/
truncateCrumbTrail(state: State, crumbs: Crumb[]): Crumb[];
}
/**
* Defines a contract a class must implement in order to manage the browser
* Url
*/
interface HistoryManager {
/**
* Gets or sets a value indicating whether to disable browser history
*/
disabled: boolean;
/**
* Registers browser history event listeners
* @param navigateHistory The history navigation event handler
*/
init(navigateHistory: () => void): void;
/**
* Adds browser history
* @param url The current url
* @param replace A value indicating whether to replace the current
* browser history entry
*/
addHistory(url: string, replace: boolean): void;
/**
* Gets the current location
*/
getCurrentUrl(): string;
/**
* Gets an Href from the url
*/
getHref(url: string): string;
/**
* Gets a Url from the anchor or location
*/
getUrl(hrefElement: HTMLAnchorElement | Location): string;
/**
* Removes browser history event listeners
*/
stop(): void;
}
/**
* Manages history using the browser Url's hash. If used in a browser
* without the hashchange event or outside of a browser environment, then
* history is disabled
*/
class HashHistoryManager implements HistoryManager {
/**
* Gets or sets a value indicating whether to disable browser history.
* Set to true if used in a browser without the hashchange event or
* outside of a browser environment
*/
disabled: boolean;
/**
* Initializes a new instance of the HashHistoryManager class
*/
constructor();
/**
* Initializes a new instance of the HashHistoryManager class
* @param replaceQueryIdentifier a value indicating whether to use '#'
* in place of '?'. Set to true for Internet explorer 6 and 7 support
*/
constructor(replaceQueryIdentifier: boolean);
/**
* Registers a listener for the hashchange event
* @param navigateHistory The history navigation event handler
*/
init(navigateHistory: any): void;
/**
* Sets the browser Url's hash to the url
* @param url The current url
* @param replace A value indicating whether to replace the current
* browser history entry
*/
addHistory(url: string, replace: boolean): void;
/**
* Gets the current location
*/
getCurrentUrl(): string;
/**
* Gets an Href from the url
*/
getHref(url: string): string;
/**
* Gets a Url from the anchor or location
*/
getUrl(hrefElement: HTMLAnchorElement | Location): string;
/**
* Removes a listener for the hashchange event
*/
stop(): void;
}
/**
* Manages history using the HTML5 history api. If used in a browser
* without the HTML5 history api or outside of a browser environment, then
* history is disabled
*/
class HTML5HistoryManager implements HistoryManager {
/**
* Gets or sets a value indicating whether to disable browser history.
* Set to true if used in a browser without the HTML5 history api or
* outside of a browser environment
*/
disabled: boolean;
/**
* Initializes a new instance of the HTML5HistoryManager class
*/
constructor();
/**
* Initializes a new instance of the HTML5HistoryManager class
* @param applicationPath The application path
*/
constructor(applicationPath: string);
/**
* Registers a listener for the popstate event
* @param navigateHistory The history navigation event handler
*/
init(navigateHistory: () => void): void;
/**
* Sets the browser Url to the url using pushState
* @param url The current url
* @param replace A value indicating whether to replace the current
* browser history entry
*/
addHistory(url: string, replace: boolean): void;
/**
* Gets the current location
*/
getCurrentUrl(): string;
/**
* Gets an Href from the url
*/
getHref(url: string): string;
/**
* Gets a Url from the anchor or location
*/
getUrl(hrefElement: HTMLAnchorElement | Location): string;
/**
* Removes a listener for the popstate event
*/
stop(): void;
}
/**
* Represents one piece of the crumb trail and holds the information need
* to return to and recreate the State as previously visited
*/
class Crumb {
/**
* Gets the Context Data held at the time of navigating away from this
* State
*/
data: any;
/**
* Gets the configuration information associated with this navigation
*/
state: State;
/**
* Gets a value indicating whether the Crumb is the last in the crumb
* trail
*/
last: boolean;
/**
* Gets the State Title
*/
title: string;
/**
* Gets the link navigation to return to the State and pass the
* associated Data
*/
url: string;
/**
* Gets the link navigation without crumb trail to return to the State
* and pass the associated Data
*/
crumblessUrl: string;
/**
* Initializes a new instance of the Crumb class
* @param data The Context Data held at the time of navigating away
* from this State
* @param state The configuration information associated with this
* navigation
* @param link The link navigation to return to the State and pass the
* associated Data
* @param crumblessLink The link navigation without crumb trail to
* return to the State and pass the associated Data
* @param last A value indicating whether the Crumb is the last in the
* crumb trail
*/
constructor(data: any, state: State, link: string, crumblessLink: string, last: boolean);
}
/**
* Provides properties for accessing context sensitive navigation
* information. Holds the current State and NavigationData
*/
class StateContext {
/**
* Gets the last State displayed before the current State
*/
oldState: State;
/**
* Gets the NavigationData for the last displayed State
*/
oldData: any;
/**
* Gets the State of the last Crumb in the crumb trail
*/
previousState: State;
/**
* Gets the NavigationData of the last Crumb in the crumb trail
*/
previousData: any;
/**
* Gets the current State
*/
state: State;
/**
* Gets the NavigationData for the current State
*/
data: any;
/**
* Gets the current Url
*/
url: string;
/**
* Gets or sets the current title
*/
title: string;
/**
* Gets a Crumb collection representing the crumb trail, ordered oldest
* Crumb first
*/
crumbs: Crumb[];
/**
* Gets the next crumb
*/
nextCrumb: Crumb;
/**
* Clears the Context Data
*/
clear(): void;
/**
* Combines the data with all the current NavigationData
* @param The data to add to the current NavigationData
* @returns The combined data
*/
includeCurrentData(data: any): any;
/**
* Combines the data with a subset of the current NavigationData
* @param The data to add to the current NavigationData
* @returns The combined data
*/
includeCurrentData(data: any, keys: string[]): any;
}
/**
* Manages all navigation. These can be forward, backward or refreshing the
* current State
*/
class StateNavigator {
/**
* Provides access to context sensitive navigation information
*/
stateContext: StateContext;
/**
* Gets the browser Url manager
*/
historyManager: HistoryManager;
/**
* Gets a list of States
*/
states: { [index: string]: State; };
/**
* Initializes a new instance of the StateNavigator class
*/
constructor();
/**
* Initializes a new instance of the StateNavigator class
* @param states A collection of States
*/
constructor(states: StateInfo[]);
/**
* Initializes a new instance of the StateNavigator class
* @param states A collection of States
* @param historyManager The manager of the browser Url
*/
constructor(states: StateInfo[], historyManager: HistoryManager);
/**
* Configures the StateNavigator
* @param stateInfos A collection of State Infos
*/
configure(stateInfos: StateInfo[]): void;
/**
* Configures the StateNavigator
* @param stateInfos A collection of State Infos
* @param historyManager The manager of the browser Url
*/
configure(stateInfos: StateInfo[], historyManager: HistoryManager): void;
/**
* Registers a navigate event listener
* @param handler The navigate event listener
*/
onNavigate(handler: (oldState: State, state: State, data: any, asyncData: any) => void): void;
/**
* Unregisters a navigate event listener
* @param handler The navigate event listener
*/
offNavigate(handler: (oldState: State, state: State, data: any, asyncData: any) => void): void;
/**
* Navigates to a State
* @param stateKey The key of a State
* @throws state does not match the key of a State or there is
* NavigationData that cannot be converted to a String
* @throws A mandatory route parameter has not been supplied a value
*/
navigate(stateKey: string): void;
/**
* Navigates to a State
* @param stateKey The key of a State
* @param navigationData The NavigationData to be passed to the next
* State and stored in the StateContext
* @throws state does not match the key of a State or there is
* NavigationData that cannot be converted to a String
* @throws A mandatory route parameter has not been supplied a value
*/
navigate(stateKey: string, navigationData: any): void;
/**
* Navigates to a State
* @param stateKey The key of a State
* @param navigationData The NavigationData to be passed to the next
* State and stored in the StateContext
* @param A value determining the effect on browser history
* @throws state does not match the key of a State or there is
* NavigationData that cannot be converted to a String
* @throws A mandatory route parameter has not been supplied a value
*/
navigate(stateKey: string, navigationData: any, historyAction: 'add' | 'replace' | 'none'): void;
/**
* Gets a Url to navigate to a State
* @param stateKey The key of a State
* @returns Url that will navigate to State specified in the action
* @throws state does not match the key of a State or there is
* NavigationData that cannot be converted to a String
*/
getNavigationLink(stateKey: string): string;
/**
* Gets a Url to navigate to a State
* @param stateKey The key of a State
* @param navigationData The NavigationData to be passed to the next
* State and stored in the StateContext
* @returns Url that will navigate to State specified in the action
* @throws state does not match the key of a State or there is
* NavigationData that cannot be converted to a String
*/
getNavigationLink(stateKey: string, navigationData: any): string;
/**
* Determines if the distance specified is within the bounds of the
* crumb trail represented by the Crumbs collection
*/
canNavigateBack(distance: number): boolean;
/**
* Navigates back along the crumb trail
* @param distance Starting at 1, the number of Crumb steps to go back
* @throws canNavigateBack returns false for this distance
* @throws A mandatory route parameter has not been supplied a value
*/
navigateBack(distance: number): void;
/**
* Navigates back along the crumb trail
* @param distance Starting at 1, the number of Crumb steps to go back
* @param A value determining the effect on browser history
* @throws canNavigateBack returns false for this distance
* @throws A mandatory route parameter has not been supplied a value
*/
navigateBack(distance: number, historyAction: 'add' | 'replace' | 'none'): void;
/**
* Gets a Url to navigate back along the crumb trail
* @param distance Starting at 1, the number of Crumb steps to go back
* @throws canNavigateBack returns false for this distance
*/
getNavigationBackLink(distance: number): string;
/**
* Navigates to the current State passing no NavigationData
* @throws A mandatory route parameter has not been supplied a value
*/
refresh(): void;
/**
* Navigates to the current State
* @param navigationData The NavigationData to be passed to the current
* State and stored in the StateContext
* @throws There is NavigationData that cannot be converted to a String
* @throws A mandatory route parameter has not been supplied a value
*/
refresh(navigationData: any): void;
/**
* Navigates to the current State
* @param navigationData The NavigationData to be passed to the current
* State and stored in the StateContext
* @param A value determining the effect on browser history
* @throws There is NavigationData that cannot be converted to a String
* @throws A mandatory route parameter has not been supplied a value
*/
refresh(navigationData: any, historyAction: 'add' | 'replace' | 'none'): void;
/**
* Gets a Url to navigate to the current State
*/
getRefreshLink(): string;
/**
* Gets a Url to navigate to the current State
* @param navigationData The NavigationData to be passed to the current
* State and stored in the StateContext
* @returns Url that will navigate to the current State
* @throws There is NavigationData that cannot be converted to a String
*/
getRefreshLink(navigationData: any): string;
/**
* Navigates to the url
* @param url The target location
*/
navigateLink(url: string): void;
/**
* Navigates to the url
* @param url The target location
* @param A value determining the effect on browser history
*/
navigateLink(url: string, historyAction: 'add' | 'replace' | 'none'): void;
/**
* Navigates to the url
* @param url The target location
* @param A value determining the effect on browser history
* @param history A value indicating whether browser history was used
*/
navigateLink(url: string, historyAction: 'add' | 'replace' | 'none', history: boolean): void;
/**
* Parses the url out into State and Navigation Data
* @param url The url to parse
*/
parseLink(url: string): { state: State; data: any; };
/**
* Navigates to the current location
*/
start(): void;
/**
* Navigates to the passed in url
* @param url The url to navigate to
*/
start(url: string): void;
}
}
-91
View File
@@ -1,91 +0,0 @@
import Navigation = require("navigation");
namespace NavigationTests {
// History Manager
class LogHistoryManager extends Navigation.HashHistoryManager {
addHistory(url: string) {
console.log('add history');
super.addHistory(url, false);
}
}
// Configuration
var config = [
{ key: 'people', route: ['people/{page}', 'people/{page}/sort/{sort}'], defaults: { page: 1 }, help: 'people.htm' },
{ key: 'person', route: 'person/{id}', trackTypes: false, defaultTypes: { id: 'number' }, trackCrumbTrail: true }
];
var stateNavigator = new Navigation.StateNavigator(config);
stateNavigator.configure(config, new LogHistoryManager());
// States
var states = stateNavigator.states;
var people = states['people'];
var person = states['person'];
var help = people['help'];
var pageDefault = people.defaults.page;
var idDefaultType = person.defaultTypes.id;
// State Controller
people.dispose = () => {};
people.navigating = (data, url, navigate) => {
navigate([]);
};
people.navigated = (data, asyncData) => {};
person.navigating = (data, url, navigate) => {
navigate();
};
person.navigated = (data) => {};
person.urlEncode = function urlEncode(state: Navigation.State, key: string, val: string, queryString: boolean): string {
return queryString ? val.replace(/\s/g, '+') : encodeURIComponent(val);
};
person.urlDecode = function urlDecode(state: Navigation.State, key: string, val: string, queryString: boolean): string {
return queryString ? val.replace(/\+/g, ' ') : decodeURIComponent(val);
};
person.validate = (data: any) => data.id > 0;
// Navigation Event
var navigationListener = (oldState: Navigation.State, state: Navigation.State, data: any, asyncData: any) => {
stateNavigator.offNavigate(navigationListener);
};
stateNavigator.onNavigate(navigationListener);
// Navigation
stateNavigator.navigate('people');
stateNavigator.navigate('people', null, 'add');
stateNavigator.refresh();
stateNavigator.refresh({ page: 3 });
stateNavigator.refresh({ page: 2 }, 'replace');
stateNavigator.navigate('person', { id: 10 });
var canGoBack: boolean = stateNavigator.canNavigateBack(1);
stateNavigator.navigateBack(1);
stateNavigator.stateContext.clear();
// Navigation Link
var link = stateNavigator.getNavigationLink('people');
link = stateNavigator.getRefreshLink();
link = stateNavigator.getRefreshLink({ page: 2 });
stateNavigator.navigateLink(link);
link = stateNavigator.getNavigationLink('person', { id: 10 });
stateNavigator.navigateLink(link, 'replace');
link = stateNavigator.getNavigationBackLink(1);
var crumb = stateNavigator.stateContext.crumbs[0];
link = crumb.url;
stateNavigator.navigateLink(link, 'none', true);
// State Context
var state: Navigation.State = stateNavigator.stateContext.state;
var url: string = stateNavigator.stateContext.url;
var title: string = stateNavigator.stateContext.title;
var page: number = stateNavigator.stateContext.data.page;
state = stateNavigator.stateContext.oldState;
page = stateNavigator.stateContext.oldData.page;
state = stateNavigator.stateContext.previousState;
page = stateNavigator.stateContext.previousData.page;
// Navigation Data
var data = stateNavigator.stateContext.includeCurrentData({ sort: 'name' }, ['page']);
stateNavigator.refresh(data);
var data = stateNavigator.stateContext.includeCurrentData({ pageSize: 10 });
stateNavigator.refresh(data);
}
-223
View File
@@ -1,223 +0,0 @@
// Type definitions for NeDB
// Project: https://github.com/louischatriot/nedb
// Definitions by: Stefan Steinhart <https://github.com/reppners>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = NeDBDataStore;
export as namespace Nedb;
declare namespace NeDBDataStore { }
declare class NeDBDataStore {
constructor();
constructor(path:string);
constructor(options:NeDB.DataStoreOptions);
persistence:NeDB.Persistence;
/**
* Load the database from the datafile, and trigger the execution of buffered commands if any
*/
loadDatabase(cb?:(err:Error)=>void):void;
/**
* Get an array of all the data in the database
*/
getAllData():Array<any>;
/**
* Reset all currently defined indexes
*/
resetIndexes(newData:any):void;
/**
* Ensure an index is kept for this field. Same parameters as lib/indexes
* For now this function is synchronous, we need to test how much time it takes
* We use an async API for consistency with the rest of the code
* @param {String} options.fieldName
* @param {Boolean} options.unique
* @param {Boolean} options.sparse
* @param {Function} cb Optional callback, signature: err
*/
ensureIndex(options:NeDB.EnsureIndexOptions, cb?:(err:Error)=>void):void;
/**
* Remove an index
* @param {String} fieldName
* @param {Function} cb Optional callback, signature: err
*/
removeIndex(fieldName:string, cb?:(err:Error)=>void):void;
/**
* Add one or several document(s) to all indexes
*/
addToIndexes<T>(doc:T):void;
addToIndexes<T>(doc:Array<T>):void;
/**
* Remove one or several document(s) from all indexes
*/
removeFromIndexes<T>(doc:T):void;
removeFromIndexes<T>(doc:Array<T>):void;
/**
* Update one or several documents in all indexes
* To update multiple documents, oldDoc must be an array of { oldDoc, newDoc } pairs
* If one update violates a constraint, all changes are rolled back
*/
updateIndexes<T>(oldDoc:T, newDoc:T):void;
updateIndexes<T>(updates:Array<{oldDoc:T; newDoc:T;}>):void;
/**
* Return the list of candidates for a given query
* Crude implementation for now, we return the candidates given by the first usable index if any
* We try the following query types, in this order: basic match, $in match, comparison match
* One way to make it better would be to enable the use of multiple indexes if the first usable index
* returns too much data. I may do it in the future.
*
* TODO: needs to be moved to the Cursor module
*/
getCandidates(query:any):void;
/**
* Insert a new document
* @param {Function} cb Optional callback, signature: err, insertedDoc
*/
insert<T>(newDoc:T, cb?:(err:Error, document:T)=>void):void;
/**
* Count all documents matching the query
* @param {any} query MongoDB-style query
*/
count(query:any, callback:(err:Error, n:number)=>void):void;
count(query:any):NeDB.CursorCount;
/**
* Find all documents matching the query
* If no callback is passed, we return the cursor so that user can limit, skip and finally exec
* @param {any} query MongoDB-style query
* @param {any} projection MongoDB-style projection
*/
find<T>(query:any, projection:T, callback:(err:Error, documents:Array<T>)=>void):void;
find<T>(query:any, projection:T):NeDB.Cursor<T>;
/**
* Find all documents matching the query
* If no callback is passed, we return the cursor so that user can limit, skip and finally exec
* * @param {any} query MongoDB-style query
*/
find<T>(query:any, callback:(err:Error, documents:Array<T>)=>void):void;
find<T>(query:any):NeDB.Cursor<T>;
/**
* Find one document matching the query
* @param {any} query MongoDB-style query
* @param {any} projection MongoDB-style projection
*/
findOne<T>(query:any, projection:T, callback:(err:Error, document:T)=>void):void;
/**
* Find one document matching the query
* @param {any} query MongoDB-style query
*/
findOne<T>(query:any, callback:(err:Error, document:T)=>void):void;
/**
* Update all docs matching query v1.7.4 and prior signature.
* For now, very naive implementation (recalculating the whole database)
* @param {any} query
* @param {any} updateQuery
* @param {Object} options Optional options
* options.multi If true, can update multiple documents (defaults to false)
* options.upsert If true, document is inserted if the query doesn't match anything
* @param {Function} cb Optional callback, signature: err,
* numReplaced,
* upsert (set to true if the update was in fact an upsert)
*
* @api private Use Datastore.update which has the same signature
*/
update(query:any, updateQuery:any, options?:NeDB.UpdateOptions, cb?:(err:Error, numberOfUpdated:number, upsert:boolean)=>void):void;
/**
* Update all docs matching query v1.8 signature.
* For now, very naive implementation (recalculating the whole database)
* @param {any} query
* @param {any} updateQuery
* @param {Object} options Optional options
* options.multi If true, can update multiple documents (defaults to false)
* options.upsert If true, document is inserted if the query doesn't match anything
* @param {Function} cb Optional callback, signature: err,
* numAffected,
* affectedDocuments (when returnUpdatedDocs is set to true), obj or array
* upsert (set to true if the update was in fact an upsert)
*
* @api private Use Datastore.update which has the same signature
*/
update<T>(query:any, updateQuery:any, options?:NeDB.UpdateOptions, cb?:(err:Error, numberOfUpdated:number, affectedDocuments:any, upsert:boolean)=>void):void;
/**
* Remove all docs matching the query
* For now very naive implementation (similar to update)
* @param {Object} query
* @param {Object} options Optional options
* options.multi If true, can update multiple documents (defaults to false)
* @param {Function} cb Optional callback, signature: err, numRemoved
*
* @api private Use Datastore.remove which has the same signature
*/
remove(query:any, options:NeDB.RemoveOptions, cb?:(err:Error, n:number)=>void):void;
remove(query:any, cb?:(err:Error, n:number)=>void):void;
}
declare namespace NeDB {
interface Cursor<T> {
sort(query:any):Cursor<T>;
skip(n:number):Cursor<T>;
limit(n:number):Cursor<T>;
projection(query:any):Cursor<T>;
exec(callback:(err:Error, documents:Array<T>)=>void):void;
}
interface CursorCount {
exec(callback:(err:Error, count:number)=>void):void;
}
interface DataStoreOptions {
filename?:string // Optional, datastore will be in-memory only if not provided
inMemoryOnly?:boolean // Optional, default to false
nodeWebkitAppName?:boolean // Optional, specify the name of your NW app if you want options.filename to be relative to the directory where
autoload?:boolean // Optional, defaults to false
onload?:(error:Error)=>any // Optional, if autoload is used this will be called after the load database with the error object as parameter. If you don't pass it the error will be thrown
afterSerialization?:(line:string)=>string; // (optional): hook you can use to transform data after it was serialized and before it is written to disk. Can be used for example to encrypt data before writing database to disk. This function takes a string as parameter (one line of an NeDB data file) and outputs the transformed string, which must absolutely not contain a \n character (or data will be lost)
beforeDeserialization?:(line:string)=>string; // (optional): reverse of afterSerialization. Make sure to include both and not just one or you risk data loss. For the same reason, make sure both functions are inverses of one another. Some failsafe mechanisms are in place to prevent data loss if you misuse the serialization hooks: NeDB checks that never one is declared without the other, and checks that they are reverse of one another by testing on random strings of various lengths. In addition, if too much data is detected as corrupt, NeDB will refuse to start as it could mean you're not using the deserialization hook corresponding to the serialization hook used before (see below)
corruptAlertThreshold?:number; // (optional): between 0 and 1, defaults to 10%. NeDB will refuse to start if more than this percentage of the datafile is corrupt. 0 means you don't tolerate any corruption, 1 means you don't care
}
/**
* multi (defaults to false) which allows the modification of several documents if set to true
* upsert (defaults to false) if you want to insert a new document corresponding to the update rules if your query doesn't match anything
*/
interface UpdateOptions {
multi?: boolean;
upsert?: boolean;
returnUpdatedDocs?: boolean
}
/**
* options only one option for now: multi which allows the removal of multiple documents if set to true. Default is false
*/
interface RemoveOptions {
multi?:boolean
}
interface EnsureIndexOptions {
fieldName:string;
unique?:boolean;
sparse?:boolean;
}
interface Persistence {
compactDatafile():void;
setAutocompactionInterval(interval:number):void;
stopAutocompaction():void;
}
}
-711
View File
@@ -1,711 +0,0 @@
// Type definitions for node-form v1.0.13
// Project: https://github.com/rsamec/form
// Definitions by: Roman Samec <https://github.com/rsamec>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
import * as Q from "q";
export as namespace Validation;
export = Validation;
declare namespace Validation {
/**
* Custom message functions.
*/
interface IErrorCustomMessage {
(config: any, args: any): string;
}
/**
* It represents a property validator for atomic object.
*/
interface IPropertyValidator {
isAcceptable(s: any): boolean;
customMessage?: IErrorCustomMessage;
tagName?: string;
}
/**
* It represents a property validator for simple string value.
*/
interface IStringValidator extends IPropertyValidator {
isAcceptable(s: string): boolean;
}
/**
* It represents an async property validator for atomic object.
*/
interface IAsyncPropertyValidator {
isAcceptable(s: any): Q.Promise<boolean>;
customMessage?: IErrorCustomMessage;
isAsync: boolean;
tagName?: string;
}
/**
* It represents an async property validator for simple string value.
*/
interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator {
isAcceptable(s: string): Q.Promise<boolean>;
}
/**
* It defines compare operators.
*/
enum CompareOperator {
LessThan = 0,
LessThanEqual = 1,
Equal = 2,
NotEqual = 3,
GreaterThanEqual = 4,
GreaterThan = 5,
}
class StringFce {
static format(s: string, args: any): string;
}
class NumberFce {
static GetNegDigits(value: string): number;
}
class LettersOnlyValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class ZipCodeValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class EmailValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class UrlValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class RequiredValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class DateValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class DateISOValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class NumberValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class DigitValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class SignedDigitValidator implements IStringValidator {
public isAcceptable(s: string): boolean;
public tagName: string;
}
class MinLengthValidator implements IStringValidator {
public MinLength: number;
constructor(MinLength?: number);
public isAcceptable(s: string): boolean;
public tagName: string;
}
class MaxLengthValidator implements IStringValidator {
public MaxLength: number;
constructor(MaxLength?: number);
public isAcceptable(s: string): boolean;
public tagName: string;
}
class RangeLengthValidator implements IStringValidator {
public RangeLength: number[];
constructor(RangeLength?: number[]);
public isAcceptable(s: string): boolean;
public MinLength : number;
public MaxLength : number;
public tagName: string;
}
class MinValidator implements IPropertyValidator {
public Min: number;
constructor(Min?: number);
public isAcceptable(s: any): boolean;
public tagName: string;
}
class MaxValidator implements IPropertyValidator {
public Max: number;
constructor(Max?: number);
public isAcceptable(s: any): boolean;
public tagName: string;
}
class RangeValidator implements IPropertyValidator {
public Range: number[];
constructor(Range?: number[]);
public isAcceptable(s: any): boolean;
public Min : number;
public Max : number;
public tagName: string;
}
class StepValidator implements IPropertyValidator {
public Step: string;
constructor(Step?: string);
public isAcceptable(s: any): boolean;
public tagName: string;
}
class PatternValidator implements IStringValidator {
public Pattern: string;
constructor(Pattern?: string);
public isAcceptable(s: string): boolean;
public tagName: string;
}
class ContainsValidator implements IAsyncPropertyValidator {
public Options: Q.Promise<any[]>;
constructor(Options: Q.Promise<any[]>);
public isAcceptable(s: string): Q.Promise<boolean>;
public isAsync: boolean;
public tagName: string;
}
}
declare namespace Validation {
/**
* basic error structure
*/
interface IError {
HasError: boolean;
ErrorMessage: string;
TranslateArgs?: IErrorTranslateArgs;
}
/**
* support for localization of error messages
*/
interface IErrorTranslateArgs {
TranslateId: string;
MessageArgs: any;
CustomMessage?: IErrorCustomMessage;
}
/**
* It defines conditional function.
*/
interface IOptional {
(): boolean;
}
/**
* It represents the validation result.
*/
interface IValidationFailure extends IError {
IsAsync: boolean;
Error: IError;
}
/**
* This class provides unit of information about error.
* Implements composite design pattern to enable nesting of error information.
*/
interface IValidationResult {
/**
* The name of error collection.
*/
Name: string;
/**
* Add error information to child collection of errors.
* @param validationResult - error information to be added.
*/
Add(validationResult: IValidationResult): void;
/**
* Remove error information from child collection of errors.
* @param index - index of error information to be removed.
*/
Remove(index: number): void;
/**
* Return collections of child errors information.
*/
Children: IValidationResult[];
/**
* Return true if there is any error.
*/
HasErrors: boolean;
/**
* Return true if there is any error and hasw dirty state.
*/
HasErrorsDirty: boolean;
/**
* Return error message, if there is no error, return empty string.
*/
ErrorMessage: string;
/**
* Return number of errors.
*/
ErrorCount: number;
/**
* It enables to have errors optional.
*/
Optional?: IOptional;
/**
* It enables support for localization of error messages.
*/
TranslateArgs?: IErrorTranslateArgs[];
}
/**
*
* @ngdoc object
* @name Error
* @module Validation
*
*
* @description
* It represents basic error structure.
*/
class Error implements IError {
public HasError: boolean;
public ErrorMessage: string;
constructor();
}
/**
*
* @ngdoc object
* @name ValidationFailure
* @module Validation
*
*
* @description
* It represents validation failure.
*/
class ValidationFailure implements IError {
public Error: IError;
public IsAsync: boolean;
constructor(Error: IError, IsAsync: boolean);
public HasError : boolean;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs;
}
/**
*
* @ngdoc object
* @name ValidationResult
* @module Validation
*
*
* @description
* It represents simple abstract error object.
*/
class ValidationResult implements IValidationResult {
public Name: string;
constructor(Name: string);
public IsDirty: boolean;
public Children : IValidationResult[];
public Add(error: IValidationResult): void;
public Remove(index: number): void;
public Optional: IOptional;
public TranslateArgs: IErrorTranslateArgs[];
public HasErrorsDirty : boolean;
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
}
/**
*
* @ngdoc object
* @name CompositeValidationResult
* @module Validation
*
*
* @description
* It represents composite error object.
*/
class CompositeValidationResult implements IValidationResult {
public Name: string;
public Children: IValidationResult[];
constructor(Name: string);
public Optional: IOptional;
public AddFirst(error: IValidationResult): void;
public Add(error: IValidationResult): void;
public Remove(index: number): void;
public HasErrorsDirty : boolean;
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs[];
public LogErrors(headerMessage?: string): void;
public Errors : {
[name: string]: IValidationResult;
};
private FlattenErros;
public SetDirty(): void;
public SetPristine(): void;
private SetDirtyEx(node, dirty);
private flattenErrors(node, errorCollection);
private traverse(node, indent);
}
}
declare namespace Validation {
/**
* @ngdoc module
* @name Validation
*
*
* @description
* # Validation (core module)
* The module itself contains the essential components for an validation engine to function. The table below
* lists a high level breakdown of each of the components (object, functions) available within this core module.
*
* <div doc-module-components="Validation"></div>
*/
/**
* It defines validation function.
*/
interface IValidate {
(args: IError): void;
}
/**
* It defines async validation function.
*/
interface IAsyncValidate {
(args: IError): Q.Promise<any>;
}
/**
* It represents named validation function.
*/
interface IValidatorFce {
Name: string;
ValidationFce?: IValidate;
AsyncValidationFce?: IAsyncValidate;
}
/**
* This class represents custom validator.
*/
interface IValidator {
Validate(context: any): IValidationFailure;
ValidateAsync(context: any): Q.Promise<IValidationFailure>;
Error: IError;
}
/**
* It represents abstract validator for type of <T>.
*/
interface IAbstractValidator<T> {
RuleFor(prop: string, validator: IPropertyValidator): any;
ValidationFor(prop: string, validator: IValidatorFce): any;
ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>): any;
/**
* It creates new concrete validation rule and assigned data context to this rule.
* @param name of the rule
* @constructor
*/
CreateRule(name: string): IAbstractValidationRule<any>;
CreateAbstractRule(name: string): IAbstractValidationRule<any>;
CreateAbstractListRule(name: string): IAbstractValidationRule<any>;
/**
* return true if this validation rule is intended for list of items, otherwise true
*/
ForList: boolean;
}
/**
* It represents concrete validation rule for type of <T>.
*/
interface IAbstractValidationRule<T> {
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
Validate(context: T): IValidationResult;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
ValidateAsync(context: T): Q.Promise<IValidationResult>;
/**
* Performs validation and async validation using a validation context.
*/
ValidateAll(context: T): void;
/**
* Performs validation and async validation using a validation context for a passed field.
*/
ValidateField(context: T, propName: string): void;
/**
* Return validation results.
*/
ValidationResult: IValidationResult;
Rules: {
[name: string]: IPropertyValidationRule<T>;
};
Validators: {
[name: string]: IValidator;
};
Children: {
[name: string]: AbstractValidationRule<any>;
};
}
/**
* It represents property validation rule for type of <T>.
*/
interface IPropertyValidationRule<T> {
/**
*The validators that are grouped under this rule.
*/
Validators: {
[name: string]: any;
};
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
Validate(context: IValidationContext<T>): IValidationFailure[];
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
}
/**
* It represents a data context for validation rule.
*/
interface IValidationContext<T> {
/**
* Return current value.
*/
Value: string;
/**
* Return property name for current data context.
*/
Key: string;
/**
* Data context for validation rule.
*/
Data: T;
}
/**
*
* @ngdoc object
* @name AbstractValidator
* @module Validation
*
*
* @description
* It enables to create custom validator for your own abstract object (class) and to assign validation rules to its properties.
* You can assigned these rules
*
* + property validation rules - use _RuleFor_ property
* + property async validation rules - use _RuleFor_ property
* + shared validation rules - use _ValidationFor_ property
* + custom object validator - use _ValidatorFor_ property - enables composition of child custom validators
*/
class AbstractValidator<T> implements IAbstractValidator<T> {
public Validators: {
[name: string]: IPropertyValidator[];
};
public AbstractValidators: {
[name: string]: IAbstractValidator<any>;
};
public ValidationFunctions: {
[name: string]: IValidatorFce[];
};
public RuleFor(prop: string, validator: IPropertyValidator): void;
public ValidationFor(prop: string, fce: IValidatorFce): void;
public ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>, forList?: boolean): void;
public CreateAbstractRule(name: string): AbstractValidationRule<T>;
public CreateAbstractListRule(name: string): AbstractListValidationRule<T>;
public CreateRule(name: string): AbstractValidationRule<T>;
/**
* Return true if this validation rule is intended for list of items, otherwise true.
*/
public ForList: boolean;
}
/**
*
* @ngdoc object
* @name AbstractValidationRule
* @module Validation
*
*
* @description
* It represents concreate validator for custom object. It enables to assign validation rules to custom object properties.
*/
class AbstractValidationRule<T> implements IAbstractValidationRule<T> {
public Name: string;
public validator: AbstractValidator<T>;
public ValidationResult: IValidationResult;
public Rules: {
[name: string]: IPropertyValidationRule<T>;
};
public Validators: {
[name: string]: IValidator;
};
public Children: {
[name: string]: AbstractValidationRule<any>;
};
/**
* Return true if this validation rule is intended for list of items, otherwise true.
*/
public ForList: boolean;
constructor(Name: string, validator: AbstractValidator<T>, forList?: boolean);
public addChildren(): void;
public SetOptional(fce: IOptional): void;
private createRuleFor(prop);
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
public Validate(context: T): IValidationResult;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsync(context: T): Q.Promise<IValidationResult>;
public ValidateAll(context: T): void;
public ValidateField(context: T, propName: string): void;
}
/**
*
* @ngdoc object
* @name AbstractListValidationRule
* @module Validation
*
*
* @description
* It represents an validator for custom object. It enables to assign rules to custom object properties.
*/
class AbstractListValidationRule<T> extends AbstractValidationRule<T> {
public Name: string;
public validator: AbstractValidator<T>;
constructor(Name: string, validator: AbstractValidator<T>);
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
public Validate(context: any): IValidationResult;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsync(context: any): Q.Promise<IValidationResult>;
private getValidationRule(i);
private getIndexedKey(i);
public NotifyListChanged(list: any[]): void;
}
/**
*
* @ngdoc object
* @name ValidationContext
* @module Validation
*
*
* @description
* It represents a data context for validation rule.
*/
class ValidationContext<T> implements IValidationContext<T> {
public Key: string;
public Data: T;
constructor(Key: string, Data: T);
public Value : any;
}
class MessageLocalization {
static customMsg: string;
static defaultMessages: {
"required": string;
"remote": string;
"email": string;
"url": string;
"date": string;
"dateISO": string;
"number": string;
"digits": string;
"signedDigits": string;
"creditcard": string;
"equalTo": string;
"maxlength": string;
"minlength": string;
"rangelength": string;
"range": string;
"max": string;
"min": string;
"step": string;
"contains": string;
"mask": string;
"custom": string;
};
static ValidationMessages: {
"required": string;
"remote": string;
"email": string;
"url": string;
"date": string;
"dateISO": string;
"number": string;
"digits": string;
"signedDigits": string;
"creditcard": string;
"equalTo": string;
"maxlength": string;
"minlength": string;
"rangelength": string;
"range": string;
"max": string;
"min": string;
"step": string;
"contains": string;
"mask": string;
"custom": string;
};
static GetValidationMessage(validator: any): string;
}
/**
*
* @ngdoc object
* @name PropertyValidationRule
* @module Validation
*
*
* @description
* It represents a property validation rule. The property has assigned collection of property validators.
*/
class PropertyValidationRule<T> extends ValidationResult implements IPropertyValidationRule<T> {
public Name: string;
public Validators: {
[name: string]: any;
};
public ValidationFailures: {
[name: string]: IValidationFailure;
};
constructor(Name: string, validatorsToAdd?: IPropertyValidator[]);
public AddValidator(validator: any): void;
public Errors : {
[name: string]: IValidationFailure;
};
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs[];
/**
* Performs validation using a validation context and returns a collection of Validation Failures.
*/
public Validate(context: IValidationContext<T>): IValidationFailure[];
public ValidateEx(value: any): IValidationFailure[];
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
/**
* Performs validation using a validation context and returns a collection of Validation Failures asynchronoulsy.
*/
public ValidateAsyncEx(value: string): Q.Promise<IValidationFailure[]>;
}
/**
*
* @ngdoc object
* @name Validator
* @module Validation
*
*
* @description
* It represents a custom validator. It enables to define your own shared validation rules
*/
class Validator extends ValidationResult implements IValidator {
public Name: string;
private ValidateFce;
private AsyncValidationFce;
public Error: IError;
public ValidationFailures: {
[name: string]: IValidationFailure;
};
constructor(Name: string, ValidateFce?: IValidate, AsyncValidationFce?: IAsyncValidate);
public Optional: IOptional;
public Validate(context: any): IValidationFailure;
public ValidateAsync(context: any): Q.Promise<IValidationFailure>;
public HasError : boolean;
public Errors : {
[name: string]: IValidationFailure;
};
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs[];
}
}
-25
View File
@@ -1,25 +0,0 @@
interface IPerson{
Checked:boolean;
FirstName:string;
LastName:string;
Email:string;
}
//create custom composite validator
var personValidator = new Validation.AbstractValidator<IPerson>();
//create field validators
var required = new Validation.RequiredValidator();
var email = new Validation.EmailValidator();
var maxLength = new Validation.MaxLengthValidator();
maxLength.MaxLength = 15;
personValidator.RuleFor("FirstName", required);
personValidator.RuleFor("FirstName", maxLength);
personValidator.RuleFor("LastName", required);
personValidator.RuleFor("LastName", maxLength);
personValidator.RuleFor("Email", required);
personValidator.RuleFor("Email", email);
-22
View File
@@ -1,22 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"node-form-tests.ts"
]
}
+257 -197
View File
@@ -1,94 +1,28 @@
{
"packages": [
{
"libraryName": "Moment",
"typingsPackageName": "moment",
"sourceRepoURL": "https://github.com/moment/moment",
"asOfVersion": "2.13.0"
},
{
"libraryName": "ng-table",
"typingsPackageName": "ng-table",
"sourceRepoURL": "https://github.com/esvit/ng-table",
"asOfVersion": "2.0.1"
},
{
"libraryName": "spotify-web-api-js",
"typingsPackageName": "spotify-web-api-js",
"sourceRepoURL": "https://github.com/JMPerez/spotify-web-api-js",
"asOfVersion": "0.21.0"
},
{
"libraryName": "Linq.JS",
"typingsPackageName": "linq",
"sourceRepoURL": "https://linqjs.codeplex.com/",
"asOfVersion": "2.2.33"
},
{
"libraryName": "Protractor",
"typingsPackageName": "protractor",
"sourceRepoURL": "https://github.com/angular/protractor",
"asOfVersion": "4.0.0"
},
{
"libraryName": "Dexie.js",
"typingsPackageName": "dexie",
"sourceRepoURL": "https://github.com/dfahlander/Dexie.js",
"asOfVersion": "1.3.1"
},
{
"libraryName": "LinqSharp",
"typingsPackageName": "linqsharp",
"sourceRepoURL": "https://github.com/brunolm/LinqSharp",
"libraryName": "ajv",
"typingsPackageName": "ajv",
"sourceRepoURL": "https://github.com/epoberezkin/ajv",
"asOfVersion": "1.0.0"
},
{
"libraryName": "TypeScript",
"typingsPackageName": "typescript",
"sourceRepoURL": "https://github.com/Microsoft/TypeScript",
"asOfVersion": "2.0.0"
},
{
"libraryName": "TypeScript",
"typingsPackageName": "typescript-services",
"sourceRepoURL": "https://github.com/Microsoft/TypeScript",
"asOfVersion": "2.0.0"
},
{
"libraryName": "Prando",
"typingsPackageName": "prando",
"sourceRepoURL": "https://github.com/zeh/prando",
"libraryName": "antd",
"typingsPackageName": "antd",
"sourceRepoURL": "https://github.com/ant-design/ant-design",
"asOfVersion": "1.0.0"
},
{
"libraryName": "Shopify Prime",
"typingsPackageName": "shopify-prime",
"sourceRepoURL": "https://github.com/nozzlegear/shopify-prime",
"asOfVersion": "2.0.0"
"libraryName": "Argon2",
"typingsPackageName": "argon2",
"sourceRepoURL": "https://github.com/ranisalt/node-argon2",
"asOfVersion": "0.15.0"
},
{
"libraryName": "SimpleSignal",
"typingsPackageName": "simplesignal",
"sourceRepoURL": "https://github.com/zeh/simplesignal",
"asOfVersion": "1.0.0"
},
{
"libraryName": "Redux",
"typingsPackageName": "redux",
"sourceRepoURL": "https://github.com/reactjs/redux",
"asOfVersion": "3.6.0"
},
{
"libraryName": "Redux Thunk",
"typingsPackageName": "redux-thunk",
"sourceRepoURL": "https://github.com/gaearon/redux-thunk",
"asOfVersion": "2.1.0"
},
{
"libraryName": "Normalizr",
"typingsPackageName": "normalizr",
"sourceRepoURL": "https://github.com/paularmstrong/normalizr",
"asOfVersion": "2.0.18"
"libraryName": "axios",
"typingsPackageName": "axios",
"sourceRepoURL": "https://github.com/mzabriskie/axios",
"asOfVersion": "0.14.0"
},
{
"libraryName": "camel-case",
@@ -108,12 +42,90 @@
"sourceRepoURL": "https://github.com/blakeembrey/constant-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "date-fns",
"typingsPackageName": "date-fns",
"sourceRepoURL": "https://github.com/date-fns/date-fns",
"asOfVersion": "2.6.0"
},
{
"libraryName": "Dexie.js",
"typingsPackageName": "dexie",
"sourceRepoURL": "https://github.com/dfahlander/Dexie.js",
"asOfVersion": "1.3.1"
},
{
"libraryName": "dot-case",
"typingsPackageName": "dot-case",
"sourceRepoURL": "https://github.com/blakeembrey/dot-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "dva",
"typingsPackageName": "dva",
"sourceRepoURL": "https://github.com/dvajs/dva",
"asOfVersion": "1.1.0"
},
{
"libraryName": "ecmarkup",
"typingsPackageName": "ecmarkup",
"sourceRepoURL": "https://github.com/bterlson/ecmarkup",
"asOfVersion": "3.4.0"
},
{
"libraryName": "FineUploader",
"typingsPackageName": "fine-uploader",
"sourceRepoURL": "http://fineuploader.com/",
"asOfVersion": "5.14.0"
},
{
"libraryName": "gaea-model",
"typingsPackageName": "gaea-model",
"sourceRepoURL": "https://github.com/ascoders/gaea-model",
"asOfVersion": "0.0.0"
},
{
"libraryName": "Facebook's Immutable",
"typingsPackageName": "immutable",
"sourceRepoURL": "https://github.com/facebook/immutable-js",
"asOfVersion": "3.8.7"
},
{
"libraryName": "inversify",
"typingsPackageName": "inversify",
"sourceRepoURL": "http://inversify.io",
"asOfVersion": "2.0.33"
},
{
"libraryName": "inversify-binding-decorators",
"typingsPackageName": "inversify-binding-decorators",
"sourceRepoURL": "https://github.com/inversify/inversify-binding-decorators",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-express-utils",
"typingsPackageName": "inversify-express-utils",
"sourceRepoURL": "https://github.com/inversify/inversify-express-utils",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-inject-decorators",
"typingsPackageName": "inversify-inject-decorators",
"sourceRepoURL": "https://github.com/inversify/inversify-inject-decorators",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-logger-middleware",
"typingsPackageName": "inversify-logger-middleware",
"sourceRepoURL": "https://github.com/inversify/inversify-logger-middleware",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-restify-utils",
"typingsPackageName": "inversify-restify-utils",
"sourceRepoURL": "https://github.com/inversify/inversify-restify-utils",
"asOfVersion": "2.0.0"
},
{
"libraryName": "is-lower-case",
"typingsPackageName": "is-lower-case",
@@ -126,6 +138,30 @@
"sourceRepoURL": "https://github.com/blakeembrey/is-upper-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "jsonschema",
"typingsPackageName": "jsonschema",
"sourceRepoURL": "https://github.com/tdegrunt/jsonschema",
"asOfVersion": "1.1.1"
},
{
"libraryName": "Linq.JS",
"typingsPackageName": "linq",
"sourceRepoURL": "https://linqjs.codeplex.com/",
"asOfVersion": "2.2.33"
},
{
"libraryName": "LinqSharp",
"typingsPackageName": "linqsharp",
"sourceRepoURL": "https://github.com/brunolm/LinqSharp",
"asOfVersion": "1.0.0"
},
{
"libraryName": "localforage",
"typingsPackageName": "localforage",
"sourceRepoURL": "https://github.com/localForage/localForage",
"asOfVersion": "0.0.34"
},
{
"libraryName": "lower-case",
"typingsPackageName": "lower-case",
@@ -138,6 +174,36 @@
"sourceRepoURL": "https://github.com/blakeembrey/lower-case-first",
"asOfVersion": "1.0.1"
},
{
"libraryName": "mobservable",
"typingsPackageName": "mobservable",
"sourceRepoURL": "github.com/mweststrate/mobservable",
"asOfVersion": "1.2.5"
},
{
"libraryName": "Moment",
"typingsPackageName": "moment",
"sourceRepoURL": "https://github.com/moment/moment",
"asOfVersion": "2.13.0"
},
{
"libraryName": "ng-table",
"typingsPackageName": "ng-table",
"sourceRepoURL": "https://github.com/esvit/ng-table",
"asOfVersion": "2.0.1"
},
{
"libraryName": "Normalizr",
"typingsPackageName": "normalizr",
"sourceRepoURL": "https://github.com/paularmstrong/normalizr",
"asOfVersion": "2.0.18"
},
{
"libraryName": "Numbro",
"typingsPackageName": "numbro",
"sourceRepoURL": "https://github.com/foretagsplatsen/numbro/",
"asOfVersion": "1.9.3"
},
{
"libraryName": "param-case",
"typingsPackageName": "param-case",
@@ -156,18 +222,108 @@
"sourceRepoURL": "https://github.com/blakeembrey/path-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "pixi-spine",
"typingsPackageName": "pixi-spine",
"sourceRepoURL": "https://github.com/pixijs/pixi-spine",
"asOfVersion": "1.4.2"
},
{
"libraryName": "poly2tri.js",
"typingsPackageName": "poly2tri",
"sourceRepoURL": "https://github.com/r3mi/poly2tri.js",
"asOfVersion": "1.4.0"
},
{
"libraryName": "Prando",
"typingsPackageName": "prando",
"sourceRepoURL": "https://github.com/zeh/prando",
"asOfVersion": "1.0.0"
},
{
"libraryName": "Protractor",
"typingsPackageName": "protractor",
"sourceRepoURL": "https://github.com/angular/protractor",
"asOfVersion": "4.0.0"
},
{
"libraryName": "Raven JS",
"typingsPackageName": "raven-js",
"sourceRepoURL": "https://github.com/getsentry/raven-js",
"asOfVersion": "3.10.0"
},
{
"libraryName": "Redux",
"typingsPackageName": "redux",
"sourceRepoURL": "https://github.com/reactjs/redux",
"asOfVersion": "3.6.0"
},
{
"libraryName": "redux-persist",
"typingsPackageName": "redux-persist",
"sourceRepoURL": "https://github.com/rt2zz/redux-persist",
"asOfVersion": "4.3.1"
},
{
"libraryName": "redux-persist-transform-compress",
"typingsPackageName": "redux-persist-transform-compress",
"sourceRepoURL": "https://github.com/rt2zz/redux-persist-transform-compress",
"asOfVersion": "4.2.0"
},
{
"libraryName": "redux-saga",
"typingsPackageName": "redux-saga",
"sourceRepoURL": "https://github.com/redux-saga/redux-saga",
"asOfVersion": "0.10.5"
},
{
"libraryName": "Redux Thunk",
"typingsPackageName": "redux-thunk",
"sourceRepoURL": "https://github.com/gaearon/redux-thunk",
"asOfVersion": "2.1.0"
},
{
"libraryName": "node-scanf",
"typingsPackageName": "scanf",
"sourceRepoURL": "https://github.com/Lellansin/node-scanf",
"asOfVersion": "0.7.3"
},
{
"libraryName": "sentence-case",
"typingsPackageName": "sentence-case",
"sourceRepoURL": "https://github.com/blakeembrey/sentence-case",
"asOfVersion": "1.1.3"
},
{
"libraryName": "Shopify Prime",
"typingsPackageName": "shopify-prime",
"sourceRepoURL": "https://github.com/nozzlegear/shopify-prime",
"asOfVersion": "2.0.0"
},
{
"libraryName": "SimpleSignal",
"typingsPackageName": "simplesignal",
"sourceRepoURL": "https://github.com/zeh/simplesignal",
"asOfVersion": "1.0.0"
},
{
"libraryName": "snake-case",
"typingsPackageName": "snake-case",
"sourceRepoURL": "https://github.com/blakeembrey/snake-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "spotify-web-api-js",
"typingsPackageName": "spotify-web-api-js",
"sourceRepoURL": "https://github.com/JMPerez/spotify-web-api-js",
"asOfVersion": "0.21.0"
},
{
"libraryName": "Sugar",
"typingsPackageName": "sugar",
"sourceRepoURL": "https://github.com/andrewplummer/Sugar",
"asOfVersion": "2.0.2"
},
{
"libraryName": "swap-case",
"typingsPackageName": "swap-case",
@@ -180,6 +336,18 @@
"sourceRepoURL": "https://github.com/blakeembrey/title-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "TypeScript",
"typingsPackageName": "typescript",
"sourceRepoURL": "https://github.com/Microsoft/TypeScript",
"asOfVersion": "2.0.0"
},
{
"libraryName": "TypeScript",
"typingsPackageName": "typescript-services",
"sourceRepoURL": "https://github.com/Microsoft/TypeScript",
"asOfVersion": "2.0.0"
},
{
"libraryName": "upper-case",
"typingsPackageName": "upper-case",
@@ -192,90 +360,12 @@
"sourceRepoURL": "https://github.com/blakeembrey/upper-case-first",
"asOfVersion": "1.1.2"
},
{
"libraryName": "Sugar",
"typingsPackageName": "sugar",
"sourceRepoURL": "https://github.com/andrewplummer/Sugar",
"asOfVersion": "2.0.2"
},
{
"libraryName": "ajv",
"typingsPackageName": "ajv",
"sourceRepoURL": "https://github.com/epoberezkin/ajv",
"asOfVersion": "1.0.0"
},
{
"libraryName": "date-fns",
"typingsPackageName": "date-fns",
"sourceRepoURL": "https://github.com/date-fns/date-fns",
"asOfVersion": "2.6.0"
},
{
"libraryName": "vuejs",
"typingsPackageName": "vue",
"sourceRepoURL": "https://github.com/vuejs/vue",
"asOfVersion": "2.0.0"
},
{
"libraryName": "Facebook's Immutable",
"typingsPackageName": "immutable",
"sourceRepoURL": "https://github.com/facebook/immutable-js",
"asOfVersion": "3.8.7"
},
{
"libraryName": "dva",
"typingsPackageName": "dva",
"sourceRepoURL": "https://github.com/dvajs/dva",
"asOfVersion": "1.1.0"
},
{
"libraryName": "inversify",
"typingsPackageName": "inversify",
"sourceRepoURL": "http://inversify.io",
"asOfVersion": "2.0.33"
},
{
"libraryName": "inversify-express-utils",
"typingsPackageName": "inversify-express-utils",
"sourceRepoURL": "https://github.com/inversify/inversify-express-utils",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-binding-decorators",
"typingsPackageName": "inversify-binding-decorators",
"sourceRepoURL": "https://github.com/inversify/inversify-binding-decorators",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-logger-middleware",
"typingsPackageName": "inversify-logger-middleware",
"sourceRepoURL": "https://github.com/inversify/inversify-logger-middleware",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-inject-decorators",
"typingsPackageName": "inversify-inject-decorators",
"sourceRepoURL": "https://github.com/inversify/inversify-inject-decorators",
"asOfVersion": "2.0.0"
},
{
"libraryName": "inversify-restify-utils",
"typingsPackageName": "inversify-restify-utils",
"sourceRepoURL": "https://github.com/inversify/inversify-restify-utils",
"asOfVersion": "2.0.0"
},
{
"libraryName": "Argon2",
"typingsPackageName": "argon2",
"sourceRepoURL": "https://github.com/ranisalt/node-argon2",
"asOfVersion": "0.15.0"
},
{
"libraryName": "node-scanf",
"typingsPackageName": "scanf",
"sourceRepoURL": "https://github.com/Lellansin/node-scanf",
"asOfVersion": "0.7.3"
},
{
"libraryName": "vue-router",
"typingsPackageName": "vue-router",
@@ -283,46 +373,16 @@
"asOfVersion": "2.0.0"
},
{
"libraryName": "ecmarkup",
"typingsPackageName": "ecmarkup",
"sourceRepoURL": "https://github.com/bterlson/ecmarkup",
"asOfVersion": "3.4.0"
"libraryName": "x2js",
"typingsPackageName": "x2js",
"sourceRepoURL": "https://code.google.com/p/x2js/",
"asOfVersion": "3.1.0"
},
{
"libraryName": "redux-saga",
"typingsPackageName": "redux-saga",
"sourceRepoURL": "https://github.com/redux-saga/redux-saga",
"asOfVersion": "0.10.5"
},
{
"libraryName": "axios",
"typingsPackageName": "axios",
"sourceRepoURL": "https://github.com/mzabriskie/axios",
"asOfVersion": "0.14.0"
},
{
"libraryName": "gaea-model",
"typingsPackageName": "gaea-model",
"sourceRepoURL": "https://github.com/ascoders/gaea-model",
"asOfVersion": "0.0.0"
},
{
"libraryName": "jsonschema",
"typingsPackageName": "jsonschema",
"sourceRepoURL": "https://github.com/tdegrunt/jsonschema",
"asOfVersion": "1.1.1"
},
{
"libraryName": "Raven JS",
"typingsPackageName": "raven-js",
"sourceRepoURL": "https://github.com/getsentry/raven-js",
"asOfVersion": "3.10.0"
},
{
"libraryName": "antd",
"typingsPackageName": "antd",
"sourceRepoURL": "https://github.com/ant-design/ant-design",
"asOfVersion": "1.0.0"
"libraryName": "@xmpp/jid",
"typingsPackageName": "xmpp-jid",
"sourceRepoURL": "github.com/node-xmpp/node-xmpp/",
"asOfVersion": "1.2.0"
}
]
}
}
-210
View File
@@ -1,210 +0,0 @@
{
"name": "definitely-typed",
"version": "0.0.1",
"dependencies": {
"assertion-error": {
"version": "1.0.1",
"from": "assertion-error@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz"
},
"balanced-match": {
"version": "0.3.0",
"from": "balanced-match@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz"
},
"bluebird": {
"version": "3.3.4",
"from": "bluebird@>=3.3.1 <4.0.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.3.4.tgz"
},
"brace-expansion": {
"version": "1.1.3",
"from": "brace-expansion@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.3.tgz"
},
"concat-map": {
"version": "0.0.1",
"from": "concat-map@0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
},
"core-util-is": {
"version": "1.0.2",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
},
"findup-sync": {
"version": "0.3.0",
"from": "findup-sync@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz",
"dependencies": {
"glob": {
"version": "5.0.15",
"from": "glob@>=5.0.0 <5.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz"
}
}
},
"git-wrapper": {
"version": "0.1.1",
"from": "git-wrapper@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz"
},
"glob": {
"version": "7.0.3",
"from": "glob@>=7.0.0 <8.0.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.3.tgz"
},
"hoek": {
"version": "3.0.4",
"from": "hoek@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-3.0.4.tgz"
},
"inflight": {
"version": "1.0.4",
"from": "inflight@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"isemail": {
"version": "2.1.0",
"from": "isemail@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/isemail/-/isemail-2.1.0.tgz"
},
"joi": {
"version": "8.0.4",
"from": "joi@>=8.0.4 <9.0.0",
"resolved": "https://registry.npmjs.org/joi/-/joi-8.0.4.tgz"
},
"joi-assert": {
"version": "0.0.3",
"from": "joi-assert@>=0.0.3 <0.0.4",
"resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz"
},
"jsonparse": {
"version": "0.0.5",
"from": "jsonparse@0.0.5",
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz"
},
"JSONStream": {
"version": "0.8.4",
"from": "JSONStream@>=0.8.4 <0.9.0",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz"
},
"lazy.js": {
"version": "0.4.2",
"from": "lazy.js@>=0.4.2 <0.5.0",
"resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz"
},
"manticore": {
"version": "0.2.4",
"from": "manticore@>=0.2.4 <0.3.0",
"resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz",
"dependencies": {
"bluebird": {
"version": "1.2.4",
"from": "bluebird@>=1.2.4 <2.0.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz"
}
}
},
"minimatch": {
"version": "3.0.0",
"from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz"
},
"minimist": {
"version": "0.0.10",
"from": "minimist@>=0.0.1 <0.1.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz"
},
"moment": {
"version": "2.12.0",
"from": "moment@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.12.0.tgz"
},
"once": {
"version": "1.3.3",
"from": "once@>=1.3.0 <2.0.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz"
},
"optimist": {
"version": "0.6.1",
"from": "optimist@>=0.6.1 <0.7.0",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz"
},
"parsimmon": {
"version": "0.7.0",
"from": "parsimmon@>=0.7.0 <0.8.0",
"resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.7.0.tgz"
},
"path-is-absolute": {
"version": "1.0.0",
"from": "path-is-absolute@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz"
},
"pjs": {
"version": "5.1.1",
"from": "pjs@>=5.0.0 <6.0.0",
"resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz"
},
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@>=1.0.17 <1.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"through": {
"version": "2.3.8",
"from": "through@>=2.2.7 <3.0.0",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
},
"through2": {
"version": "0.5.1",
"from": "through2@>=0.5.1 <0.6.0",
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz"
},
"topo": {
"version": "2.0.0",
"from": "topo@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.0.tgz"
},
"type-detect": {
"version": "0.1.2",
"from": "type-detect@>=0.1.2 <0.2.0",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz"
},
"wordwrap": {
"version": "0.0.3",
"from": "wordwrap@>=0.0.2 <0.1.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"
},
"wrappy": {
"version": "1.0.1",
"from": "wrappy@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
},
"xregexp": {
"version": "3.1.0",
"from": "xregexp@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-3.1.0.tgz"
},
"xtend": {
"version": "3.0.0",
"from": "xtend@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
}
}
}
-49
View File
@@ -1,49 +0,0 @@
// Type definitions for Numbro.js
// Project: https://github.com/foretagsplatsen/numbro
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface NumbroLanguage {
delimiters: {
thousands: string;
decimal: string;
};
abbreviations: {
thousand: string;
million: string;
billion: string;
trillion: string;
};
ordinal(num: number): string;
currency: {
symbol: string;
};
}
interface Numbro {
(value?: any): Numbro;
version: string;
isNumbro: boolean;
language(key: string, values?: NumbroLanguage): Numbro;
zeroFormat(format: string): string;
clone(): Numbro;
format(inputString?: string): string;
formatCurrency(inputString?: string): string;
unformat(inputString: string): number;
value(): number;
valueOf(): number;
set (value: any): Numbro;
add(value: any): Numbro;
subtract(value: any): Numbro;
multiply(value: any): Numbro;
divide(value: any): Numbro;
difference(value: any): number;
}
declare var numbro: Numbro;
declare module "numbro" {
export = numbro;
}
-43
View File
@@ -1,43 +0,0 @@
var valueFormat: string = numbro(1000).format('0,0');
// '1,000'
var valueUnformat: number = numbro().unformat('($10,000.00)');
// '-10000'
var value3: Numbro = numbro(1000);
var added: Numbro = value3.add(10);
// 1010
var value4: Numbro = numbro(1000);
var formatValue4a: string = value4.format('0,0');
// '1,000'
var formatValue4b: number = value4.value();
// 1000
var value5: Numbro = numbro();
value5.set(1000);
var value5Num: number = value5.value();
// 1000
var value6: Numbro = numbro(1000);
var value: number = 100;
var difference = value6.difference(value);
// 900
var value7: Numbro = numbro(0);
numbro.zeroFormat('N/A');
var zeroString: string = value7.format('0.0');
// 'N/A'
var a: Numbro = numbro(1000);
var b: Numbro = numbro(a);
var c: Numbro = a.clone();
var aVal: number = a.set(2000).value();
// 2000
var bVal: number = b.value();
// 1000
var cVal: number = c.add(10).value();
// 1010
-22
View File
@@ -1,22 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"numbro-tests.ts"
]
}
-108
View File
@@ -1,108 +0,0 @@
// Type definitions for PaymentRequest
// Project: https://www.w3.org/TR/payment-request/
// Definitions by: Adam Cmiel <https://github.com/adamcmiel>, Eiji Kitamura <https://github.com/agektmr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface PaymentRequest extends EventTarget {
new (methodData: PaymentMethodData[], details: PaymentDetails, options?: PaymentOptions): PaymentRequest;
show(): PromiseLike<PaymentResponse>;
abort(): PromiseLike<void>;
canMakePayment(): Promise<boolean>;
readonly paymentRequestID: string;
readonly shippingAddress?: PaymentAddress;
readonly shippingOption?: string;
readonly shippingType?: string;
onshippingaddresschange: PaymentUpdateEventListener;
onshippingoptionchange: PaymentUpdateEventListener;
}
interface PaymentMethodData {
supportedMethods: string[];
data?: {
supportedNetworks: string[];
supportedTypes: string[];
};
}
interface PaymentCurrencyAmount {
currency: string;
value: string;
currencySystem?:string;
}
interface PaymentDetails {
total: PaymentItem;
displayItems?: PaymentItem[];
shippingOptions?: PaymentShippingOption[];
modifiers?: PaymentDetailsModifier[];
error?: string;
}
interface PaymentDetailsModifier {
supportedMethods: string[];
total?: PaymentItem;
additionalDisplayItems?: PaymentItem[];
data?: Object;
}
interface PaymentOptions {
requestShipping?: boolean;
requestPayerEmail?: boolean;
requestPayerPhone?: boolean;
requestPayerName?: boolean;
shippingType?: 'shipping' | 'delivery' | 'pickup';
}
interface PaymentItem {
label: string;
amount: PaymentCurrencyAmount;
pending?: boolean;
}
interface PaymentAddress {
readonly country: string;
readonly addressLine: string[];
readonly region: string;
readonly city: string;
readonly dependentLocality: string;
readonly postalCode: string;
readonly sortingCode: string;
readonly languageCode: string;
readonly organization: string;
readonly recipient: string;
readonly phone: string;
}
interface PaymentShippingOption {
id: string;
label: string;
amount: PaymentCurrencyAmount;
selected?: boolean;
}
interface PaymentResponse {
readonly paymentRequestID: string;
readonly methodName: string;
readonly details: Object;
readonly shippingAddress?: PaymentAddress;
readonly shippingOption?: string;
readonly payerEmail?: string;
readonly payerPhone?: string;
readonly payerName?: string;
complete(result?: '' | 'success' | 'fail'): PromiseLike<void>;
toJSON(): Object;
}
interface PaymentUpdateEventListener extends EventListener {
(evt: PaymentRequestUpdateEvent): void;
}
interface PaymentRequestUpdateEvent extends Event {
updateWith(d: PromiseLike<PaymentDetails>): void;
}
interface Window {
PaymentRequest?: PaymentRequest;
}
-118
View File
@@ -1,118 +0,0 @@
/// <reference path="index.d.ts" />
/// Code examples derived from
/// https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/
async function makeRequest() {
if (!window.PaymentRequest) {
return Promise.reject(new Error("PaymentRequest not available"))
}
const methodData = [
{
supportedMethods: ["visa", "mastercard"]
}
]
const details: PaymentDetails = {
displayItems: [
{
label: "Original donation amount",
amount: { currency: "USD", value : "65.00" }, // US$65.00
},
{
label: "Friends and family discount",
amount: { currency: "USD", value : "-10.00" }, // -US$10.00
}
],
total: {
label: "Total",
amount: { currency: "USD", value : "55.00" }, // US$55.00
}
}
const options: PaymentOptions = {
requestShipping: true,
requestPayerEmail: true,
requestPayerPhone: true,
requestPayerName: true,
shippingType: 'delivery'
}
const request = new window.PaymentRequest(methodData, details, options)
request.addEventListener("shippingaddresschange", (e: any) => {
e.updateWith(((details, addr) => {
if (addr.country === 'US') {
var shippingOption = {
id: '',
label: '',
amount: {currency: 'USD', value: '0.00'},
selected: true
};
if (addr.region === 'US') {
shippingOption.id = 'us';
shippingOption.label = 'Standard shipping in US';
shippingOption.amount.value = '0.00';
details.total.amount.value = '55.00';
} else {
shippingOption.id = 'others';
shippingOption.label = 'International shipping';
shippingOption.amount.value = '10.00';
details.total.amount.value = '65.00';
}
if (details.displayItems.length === 2) {
details.displayItems.splice(1, 0, shippingOption);
} else {
details.displayItems.splice(1, 1, shippingOption);
}
details.shippingOptions = [shippingOption];
} else {
details.shippingOptions = [];
}
return Promise.resolve(details);
})(details, request.shippingAddress));
})
let canMakePayment = await request.canMakePayment()
if (canMakePayment) {
return request.show()
} else {
throw 'can not make payment on this environment.'
}
}
async function processPayment(): Promise<PaymentResponse> {
let paymentResponse: PaymentResponse;
try {
paymentResponse = await makeRequest()
} catch (error) {
location.href = '/checkout';
return;
}
var paymentData = {
// payment method string
method: paymentResponse.methodName,
// payment details as you requested
details: paymentResponse.details,
// shipping address information
address: paymentResponse.shippingAddress,
// shipping option
shippingOption: paymentResponse.shippingOption
}
// make call to backend to process payment data
const ok = await Promise.resolve(true)
if (ok) {
paymentResponse.complete("success")
} else {
paymentResponse.complete("fail")
}
}
function onShippingAddressChange(e: any) {
}
document.querySelector("#pay").addEventListener("click", processPayment)
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"paymentrequest-tests.ts"
]
}
-1042
View File
File diff suppressed because it is too large Load Diff
-311
View File
@@ -1,311 +0,0 @@
import * as PIXI from "pixi.js";
namespace Spine {
export class Dragon {
private renderer: PIXI.CanvasRenderer | PIXI.WebGLRenderer;
private stage: PIXI.Container;
private dragon: PIXI.spine.Spine;
constructor() {
this.renderer = PIXI.autoDetectRenderer(800, 600, { backgroundColor: 0x1099bb });
document.body.appendChild(this.renderer.view);
// create the root of the scene graph
this.stage = new PIXI.Container();
PIXI.loader.add('dragon', '../../_assets/spine/dragon.json').load(this.onAssetsLoaded);
}
private onAssetsLoaded = (loader: PIXI.loaders.Loader, res: any): void => {
// initiate the spine animation
this.dragon = new PIXI.spine.Spine(res.dragon.spineData);
this.dragon.skeleton.setToSetupPose();
this.dragon.update(0);
this.dragon.autoUpdate = false;
// create a container for the spin animation and add the animation to it
var dragonCage: PIXI.Container = new PIXI.Container();
dragonCage.addChild(this.dragon);
// measure the spine animation and position it inside its container to align it to the origin
var localRect: PIXI.Rectangle = this.dragon.getLocalBounds();
this.dragon.position.set(-localRect.x, -localRect.y);
// now we can scale, position and rotate the container as any other display object
var scale = Math.min((this.renderer.width * 0.7) / dragonCage.width, (this.renderer.height * 0.7) / dragonCage.height);
dragonCage.scale.set(scale, scale);
dragonCage.position.set((this.renderer.width - dragonCage.width) * 0.5, (this.renderer.height - dragonCage.height) * 0.5);
// add the container to the stage
this.stage.addChild(dragonCage);
// once position and scaled, set the animation to play
this.dragon.state.setAnimation(0, 'flying', true);
this.animate();
}
private animate = (): void => {
requestAnimationFrame(this.animate);
// update the spine animation, only needed if dragon.autoupdate is set to false
this.dragon.update(0.01666666666667); // HARDCODED FRAMERATE!
this.renderer.render(this.stage);
}
}
}
namespace Spine {
export class Goblin {
private renderer: PIXI.CanvasRenderer | PIXI.WebGLRenderer;
private stage: PIXI.Container;
private goblin: PIXI.spine.Spine;
constructor() {
this.renderer = PIXI.autoDetectRenderer(800, 600, { backgroundColor: 0x1099bb });
document.body.appendChild(this.renderer.view);
// create the root of the scene graph
this.stage = new PIXI.Container();
this.stage.interactive = true;
PIXI.loader.add('goblins', '../../_assets/spine/goblins.json').load(this.onAssetsLoaded);
}
private onAssetsLoaded = (loader: PIXI.loaders.Loader, res: any): void => {
// initiate the spine animation
this.goblin = new PIXI.spine.Spine(res.goblins.spineData);
this.goblin.skeleton.setSkinByName('goblin');
this.goblin.skeleton.setSlotsToSetupPose();
this.goblin.position.x = 400;
this.goblin.position.y = 600;
this.goblin.scale.set(1.5);
this.goblin.state.setAnimationByName(0, 'walk', true);
this.stage.addChild(this.goblin);
this.stage.on('click', () => {
// change current skin
var currentSkinName = this.goblin.skeleton.skin.name;
var newSkinName = (currentSkinName === 'goblin' ? 'goblingirl' : 'goblin');
this.goblin.skeleton.setSkinByName(newSkinName);
this.goblin.skeleton.setSlotsToSetupPose();
});
this.animate();
}
private animate = (): void => {
requestAnimationFrame(this.animate);
this.renderer.render(this.stage);
}
}
}
namespace Spine {
export class Pixie {
private renderer: PIXI.CanvasRenderer | PIXI.WebGLRenderer;
private stage: PIXI.Container;
private pixie: PIXI.spine.Spine;
private position: number;
private background: PIXI.Sprite;
private background2: PIXI.Sprite;
private foreground: PIXI.Sprite;
private foreground2: PIXI.Sprite;
constructor() {
this.renderer = PIXI.autoDetectRenderer(800, 600, { backgroundColor: 0x1099bb });
document.body.appendChild(this.renderer.view);
// create the root of the scene graph
this.stage = new PIXI.Container();
this.stage.interactive = true;
PIXI.loader.add('pixie', '../../_assets/spine/pixie.json').load(this.onAssetsLoaded);
}
private onAssetsLoaded = (loader: PIXI.loaders.Loader, res: any): void => {
this.background = PIXI.Sprite.fromImage('../../_assets/spine/iP4_BGtile.jpg');
this.background2 = PIXI.Sprite.fromImage('../../_assets/spine/iP4_BGtile.jpg');
this.stage.addChild(this.background);
this.stage.addChild(this.background2);
this.foreground = PIXI.Sprite.fromImage('../../_assets/spine/iP4_ground.png');
this.foreground2 = PIXI.Sprite.fromImage('../../_assets/spine/iP4_ground.png');
this.stage.addChild(this.foreground);
this.stage.addChild(this.foreground2);
this.foreground.position.y = this.foreground2.position.y = 640 - this.foreground2.height;
this.pixie = new PIXI.spine.Spine(res.pixie.spineData);
var scale = 0.3;
this.pixie.position.x = 1024 / 3;
this.pixie.position.y = 500;
this.pixie.scale.x = this.pixie.scale.y = scale;
this.stage.addChild(this.pixie);
this.pixie.stateData.setMix('running', 'jump', 0.2);
this.pixie.stateData.setMix('jump', 'running', 0.4);
this.pixie.state.setAnimation(0, 'running', true);
this.stage.on('mousedown', this.onTouchStart);
this.stage.on('touchstart', this.onTouchStart);
this.animate();
}
private onTouchStart = (): void => {
this.pixie.state.setAnimation(0, 'jump', false);
this.pixie.state.addAnimation(0, 'running', true, 0);
}
private animate = (): void => {
this.position += 10;
this.background.position.x = -(this.position * 0.6);
this.background.position.x %= 1286 * 2;
if (this.background.position.x < 0) {
this.background.position.x += 1286 * 2;
}
this.background.position.x -= 1286;
this.background2.position.x = -(this.position * 0.6) + 1286;
this.background2.position.x %= 1286 * 2;
if (this.background2.position.x < 0) {
this.background2.position.x += 1286 * 2;
}
this.background2.position.x -= 1286;
this.foreground.position.x = -this.position;
this.foreground.position.x %= 1286 * 2;
if (this.foreground.position.x < 0) {
this.foreground.position.x += 1286 * 2;
}
this.foreground.position.x -= 1286;
this.foreground2.position.x = -this.position + 1286;
this.foreground2.position.x %= 1286 * 2;
if (this.foreground2.position.x < 0) {
this.foreground2.position.x += 1286 * 2;
}
this.foreground2.position.x -= 1286;
requestAnimationFrame(this.animate);
this.renderer.render(this.stage);
}
}
namespace Spine {
export class SpineBoy {
private renderer: PIXI.CanvasRenderer | PIXI.WebGLRenderer;
private stage: PIXI.Container;
private spineboy: PIXI.spine.Spine;
constructor() {
this.renderer = PIXI.autoDetectRenderer(800, 600, { backgroundColor: 0x1099bb });
document.body.appendChild(this.renderer.view);
// create the root of the scene graph
this.stage = new PIXI.Container();
this.stage.interactive = true;
PIXI.loader.add('spineboy', '../../_assets/spine/spineboy.json').load(this.onAssetsLoaded);
}
private onAssetsLoaded = (loader: PIXI.loaders.Loader, res: any): void => {
// initiate the spine animation
this.spineboy = new PIXI.spine.Spine(res.spineboy.spineData);
this.spineboy.position.x = this.renderer.width / 2;
this.spineboy.position.y = this.renderer.height;
this.spineboy.scale.set(1.5);
// set up the mixes!
this.spineboy.stateData.setMix('walk', 'jump', 0.2);
this.spineboy.stateData.setMix('jump', 'walk', 0.4);
// play animation
this.spineboy.state.setAnimation(0, 'walk', true);
this.stage.addChild(this.spineboy);
this.stage.on('click', () => {
this.spineboy.state.setAnimation(0, 'jump', false);
this.spineboy.state.addAnimation(0, 'walk', true, 0);
});
this.animate();
}
private animate = (): void => {
requestAnimationFrame(this.animate);
this.renderer.render(this.stage);
}
}
}
}
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"pixi-spine-tests.ts"
]
}
-4
View File
@@ -1,4 +0,0 @@
{
"extends": "../tslint.json",
"rules": {}
}
-2891
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-9
View File
@@ -1,9 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"forbidden-types": false,
"interface-name": false,
"no-empty-interface": false,
"unified-signatures": false
}
}
-1747
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-8
View File
@@ -1,8 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"forbidden-types": false,
"no-empty-interface": false,
"unified-signatures": false
}
}
-113
View File
@@ -1,113 +0,0 @@
// Type definitions for poly2tri v0.9.10
// Project: http://github.com/r3mi/poly2tri.js/
// Definitions by: Elemar Junior <https://github.com/elemarjr/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace poly2tri {
interface IPointLike {
x: number;
y: number;
}
class Point implements IPointLike {
x: number;
y: number;
constructor(x: number, y: number);
toString(): string;
toJSON(): JSON;
clone(): Point;
set_zero(): Point;
set(x: number, y: number): Point;
negate(): Point;
add(n: IPointLike): Point;
sub(n: IPointLike): Point;
mul(s: number): Point;
length(): number;
normalize(): number;
equals(p: IPointLike): boolean;
static negate(p: IPointLike): Point;
static add(a: IPointLike, b: IPointLike): Point;
static sub(a: IPointLike, b: IPointLike): Point;
static mul(s: number, p: IPointLike): Point;
static cross(a: number, b: number): number;
static cross(a: IPointLike, b: number): number;
static cross(a: IPointLike, b: IPointLike): number;
static cross(a: number, b: IPointLike): number;
static toStringBase(p: IPointLike): string;
static toString(p: IPointLike): string;
static compare(a: IPointLike, b: IPointLike): number;
static equals(a: IPointLike, b: IPointLike): boolean;
static dot(a: IPointLike, b: IPointLike): number;
}
class SweepContext {
constructor(contour: Array<IPointLike>);
constructor(contour: Array<IPointLike>, options: JSON);
addHole(polyline: Array<IPointLike>): SweepContext;
addHoles(holes: Array<Array<IPointLike>>): SweepContext;
addPoint(point: IPointLike): SweepContext;
addPoints(point: Array<IPointLike>): SweepContext;
triangulate(): SweepContext;
getBoundingBox(): { min: IPointLike; max: IPointLike; };
getTriangles(): Array<Triangle>;
}
class Triangle {
constructor(a: IPointLike, b: IPointLike, c: IPointLike);
toString(): string;
getPoint(index: number): IPointLike;
getPoints(): Array<IPointLike>;
containsPoint(point: IPointLike): boolean;
containsPoints(p1: IPointLike, p2: IPointLike): boolean;
isInterior(): boolean;
}
}

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