mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
Vendored
+1
-1
@@ -127,6 +127,6 @@ interface Auth0DelegationToken {
|
||||
|
||||
declare var Auth0: Auth0Static;
|
||||
|
||||
declare module "auth0" {
|
||||
declare module "auth0-js" {
|
||||
export = Auth0
|
||||
}
|
||||
|
||||
@@ -0,0 +1,773 @@
|
||||
///<reference path="blessed.d.ts" />
|
||||
|
||||
import * as blessed from 'blessed';
|
||||
|
||||
let screen: blessed.Widgets.Screen = null;
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-autopad.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/autopad.log',
|
||||
smartCSR: true,
|
||||
autoPadding: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var box1 = blessed.box({
|
||||
parent: screen,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line'
|
||||
});
|
||||
|
||||
var box2 = blessed.box({
|
||||
parent: box1,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line'
|
||||
});
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-bigtext.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/bigtext.log',
|
||||
smartCSR: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var box = blessed.bigtext({
|
||||
parent: screen,
|
||||
content: 'Hello',
|
||||
shrink: true,
|
||||
width: '80%',
|
||||
// height: '80%',
|
||||
height: 'shrink',
|
||||
// width: 'shrink',
|
||||
border: 'line',
|
||||
fch: ' ',
|
||||
ch: '\u2592',
|
||||
style: {
|
||||
fg: 'red',
|
||||
bg: 'blue',
|
||||
bold: false
|
||||
}
|
||||
});
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-csr.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/csr.log',
|
||||
smartCSR: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var lorem = require('fs').readFileSync(__dirname + '/git.diff', 'utf8');
|
||||
|
||||
var cleanSides = screen.cleanSides;
|
||||
function expectClean(value: any) {
|
||||
screen.cleanSides = function(el: blessed.widget.Element) {
|
||||
var ret = cleanSides.apply(this, arguments);
|
||||
if (ret !== value) {
|
||||
throw new Error('Failed. Expected '
|
||||
+ value + ' from cleanSides. Got '
|
||||
+ ret + '.');
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
var btext = blessed.box({
|
||||
parent: screen,
|
||||
left: 'center',
|
||||
top: 'center',
|
||||
width: '80%',
|
||||
height: '80%',
|
||||
style: {
|
||||
bg: 'green'
|
||||
},
|
||||
border: 'line',
|
||||
content: 'CSR should still work.'
|
||||
});
|
||||
let _oscroll = btext.scroll;
|
||||
btext.scroll = function(offset, always) {
|
||||
expectClean(true);
|
||||
return _oscroll(offset, always);
|
||||
};
|
||||
|
||||
var text = blessed.scrollabletext({
|
||||
parent: screen,
|
||||
content: lorem,
|
||||
border: 'line',
|
||||
left: 'center',
|
||||
top: 'center',
|
||||
draggable: true,
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
mouse: true,
|
||||
keys: true,
|
||||
vi: true
|
||||
});
|
||||
|
||||
_oscroll = text.scroll;
|
||||
text.scroll = function(offset, always) {
|
||||
var el = this;
|
||||
var value = true;
|
||||
if (el.left < 0) value = true;
|
||||
if (el.top < 0) value = false;
|
||||
if (el.left + el.width > screen.width) value = true;
|
||||
if (el.top + el.height > screen.height) value = false;
|
||||
expectClean(value);
|
||||
return _oscroll(offset, always);
|
||||
};
|
||||
|
||||
text.focus();
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-dock-noborder.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/dock.log',
|
||||
smartCSR: true,
|
||||
dockBorders: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
blessed.box({
|
||||
parent: screen,
|
||||
left: -1,
|
||||
top: -1,
|
||||
width: '50%+1',
|
||||
height: '50%+1',
|
||||
border: 'line',
|
||||
content: 'Foo'
|
||||
});
|
||||
|
||||
blessed.box({
|
||||
parent: screen,
|
||||
left: '50%-1',
|
||||
top: -1,
|
||||
width: '50%+3',
|
||||
height: '50%+1',
|
||||
content: 'Bar',
|
||||
border: 'line'
|
||||
});
|
||||
|
||||
blessed.box({
|
||||
parent: screen,
|
||||
left: -1,
|
||||
top: '50%-1',
|
||||
width: '50%+1',
|
||||
height: '50%+3',
|
||||
border: 'line',
|
||||
content: 'Foo'
|
||||
});
|
||||
|
||||
blessed.listtable({
|
||||
parent: screen,
|
||||
left: '50%-1',
|
||||
top: '50%-1',
|
||||
width: '50%+3',
|
||||
height: '50%+3',
|
||||
border: 'line',
|
||||
align: 'center',
|
||||
tags: true,
|
||||
keys: true,
|
||||
vi: true,
|
||||
mouse: true,
|
||||
style: {
|
||||
header: {
|
||||
fg: 'blue',
|
||||
bold: true
|
||||
},
|
||||
cell: {
|
||||
fg: 'magenta',
|
||||
selected: {
|
||||
bg: 'blue'
|
||||
}
|
||||
}
|
||||
},
|
||||
data: [
|
||||
[ 'Animals', 'Foods', 'Times', 'Numbers' ],
|
||||
[ 'Elephant', 'Apple', '1:00am', 'One' ],
|
||||
[ 'Bird', 'Orange', '2:15pm', 'Two' ],
|
||||
[ 'T-Rex', 'Taco', '8:45am', 'Three' ],
|
||||
[ 'Mouse', 'Cheese', '9:05am', 'Four' ]
|
||||
]
|
||||
}).focus();
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://raw.githubusercontent.com/chjj/blessed/master/example/simple-form.js
|
||||
|
||||
var form = blessed.form({
|
||||
parent: screen,
|
||||
keys: true,
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 30,
|
||||
height: 4,
|
||||
bg: 'green',
|
||||
content: 'Submit or cancel?'
|
||||
});
|
||||
|
||||
var submit = blessed.button({
|
||||
parent: form,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
padding: {
|
||||
left: 1,
|
||||
right: 1
|
||||
},
|
||||
left: 10,
|
||||
top: 2,
|
||||
shrink: true,
|
||||
name: 'submit',
|
||||
content: 'submit',
|
||||
style: {
|
||||
bg: 'blue',
|
||||
focus: {
|
||||
bg: 'red'
|
||||
},
|
||||
hover: {
|
||||
bg: 'red'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var cancel = blessed.button({
|
||||
parent: form,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
padding: {
|
||||
left: 1,
|
||||
right: 1
|
||||
},
|
||||
left: 20,
|
||||
top: 2,
|
||||
shrink: true,
|
||||
name: 'cancel',
|
||||
content: 'cancel',
|
||||
style: {
|
||||
bg: 'blue',
|
||||
focus: {
|
||||
bg: 'red'
|
||||
},
|
||||
hover: {
|
||||
bg: 'red'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-layout.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/layout.log',
|
||||
smartCSR: true,
|
||||
autoPadding: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var layout = blessed.layout({
|
||||
parent: screen,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
border: 'line',
|
||||
layout: process.argv[2] === 'grid' ? 'grid' : 'inline',
|
||||
style: {
|
||||
bg: 'red',
|
||||
border: {
|
||||
fg: 'blue'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var box1 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '1'
|
||||
});
|
||||
|
||||
var box2 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '2'
|
||||
});
|
||||
|
||||
var box3 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '3'
|
||||
});
|
||||
|
||||
var box4 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '4'
|
||||
});
|
||||
|
||||
var box5 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '5'
|
||||
});
|
||||
|
||||
var box6 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '6'
|
||||
});
|
||||
|
||||
var box7 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '7'
|
||||
});
|
||||
|
||||
var box8 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '8'
|
||||
});
|
||||
|
||||
var box9 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '9'
|
||||
});
|
||||
|
||||
var box10 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '10'
|
||||
});
|
||||
|
||||
var box11 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '11'
|
||||
});
|
||||
|
||||
var box12 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '12'
|
||||
});
|
||||
|
||||
if (process.argv[2] !== 'grid') {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
blessed.box({
|
||||
parent: layout,
|
||||
// width: i % 2 === 0 ? 10 : 20,
|
||||
// height: i % 2 === 0 ? 5 : 10,
|
||||
width: Math.random() > 0.5 ? 10 : 20,
|
||||
height: Math.random() > 0.5 ? 5 : 10,
|
||||
border: 'line',
|
||||
content: (i + 1 + 12) + ''
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-form.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/form.log',
|
||||
warnings: true
|
||||
});
|
||||
|
||||
type FormData = {
|
||||
radio1: boolean;
|
||||
radio2: boolean;
|
||||
text: string;
|
||||
check: boolean;
|
||||
};
|
||||
|
||||
var form2 = blessed.form<FormData>({
|
||||
parent: screen,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
vi: true,
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: '100%',
|
||||
//height: 12,
|
||||
style: {
|
||||
bg: 'green',
|
||||
border: {
|
||||
inverse: true
|
||||
},
|
||||
scrollbar: {
|
||||
inverse: true
|
||||
}
|
||||
},
|
||||
content: 'foobar',
|
||||
scrollable: true,
|
||||
scrollbar: {
|
||||
ch: ' '
|
||||
}
|
||||
//alwaysScroll: true
|
||||
});
|
||||
|
||||
form2.on('submit', (data) => {
|
||||
output.setContent(JSON.stringify(data, null, 2));
|
||||
screen.render();
|
||||
});
|
||||
|
||||
form2.key('d', function() {
|
||||
form2.scroll(1, true);
|
||||
screen.render();
|
||||
});
|
||||
|
||||
form2.key('u', function() {
|
||||
form2.scroll(-1, true);
|
||||
screen.render();
|
||||
});
|
||||
|
||||
var set = blessed.radioset({
|
||||
parent: form2,
|
||||
left: 1,
|
||||
top: 1,
|
||||
shrink: true,
|
||||
//padding: 1,
|
||||
//content: 'f',
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
}
|
||||
});
|
||||
|
||||
var radio1 = blessed.radiobutton({
|
||||
parent: set,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 0,
|
||||
top: 0,
|
||||
name: 'radio1',
|
||||
content: 'radio1'
|
||||
});
|
||||
|
||||
var radio2 = blessed.radiobutton({
|
||||
parent: set,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 15,
|
||||
top: 0,
|
||||
name: 'radio2',
|
||||
content: 'radio2'
|
||||
});
|
||||
|
||||
var text2 = blessed.textbox({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
style: {
|
||||
bg: 'blue'
|
||||
},
|
||||
height: 1,
|
||||
width: 20,
|
||||
left: 1,
|
||||
top: 3,
|
||||
name: 'text'
|
||||
});
|
||||
|
||||
text2.on('focus', function() {
|
||||
text2.readInput();
|
||||
});
|
||||
|
||||
var check = blessed.checkbox({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 28,
|
||||
top: 1,
|
||||
name: 'check',
|
||||
content: 'check'
|
||||
});
|
||||
|
||||
var check2 = blessed.checkbox({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 28,
|
||||
top: 14,
|
||||
name: 'foooooooo2',
|
||||
content: 'foooooooo2'
|
||||
});
|
||||
|
||||
var submit = blessed.button({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
padding: {
|
||||
left: 1,
|
||||
right: 1
|
||||
},
|
||||
left: 29,
|
||||
top: 3,
|
||||
name: 'submit',
|
||||
content: 'submit',
|
||||
style: {
|
||||
bg: 'blue',
|
||||
focus: {
|
||||
bg: 'red'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
submit.on('press', function() {
|
||||
form2.submit();
|
||||
});
|
||||
|
||||
var box1 = blessed.box({
|
||||
parent: form2,
|
||||
left: 1,
|
||||
top: 10,
|
||||
height: 10,
|
||||
width: 10,
|
||||
content: 'one',
|
||||
style: {
|
||||
bg: 'cyan'
|
||||
}
|
||||
});
|
||||
|
||||
var box2 = blessed.box({
|
||||
parent: box1,
|
||||
left: 1,
|
||||
top: 2,
|
||||
height: 8,
|
||||
width: 9,
|
||||
content: 'two',
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
}
|
||||
});
|
||||
|
||||
var box3 = blessed.box({
|
||||
parent: box2,
|
||||
left: 1,
|
||||
top: 2,
|
||||
height: 6,
|
||||
width: 8,
|
||||
content: 'three',
|
||||
style: {
|
||||
bg: 'yellow'
|
||||
}
|
||||
});
|
||||
|
||||
var box4 = blessed.box({
|
||||
parent: box3,
|
||||
left: 1,
|
||||
top: 2,
|
||||
height: 4,
|
||||
width: 7,
|
||||
content: 'four',
|
||||
style: {
|
||||
bg: 'blue'
|
||||
}
|
||||
});
|
||||
|
||||
var output = blessed.scrollabletext({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
left: 0,
|
||||
top: 20,
|
||||
height: 5,
|
||||
right: 0,
|
||||
style: {
|
||||
bg: 'red'
|
||||
},
|
||||
content: 'foobar'
|
||||
});
|
||||
|
||||
var bottom = blessed.line({
|
||||
parent: form2,
|
||||
type: 'line',
|
||||
orientation: 'horizontal',
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 50,
|
||||
style: {
|
||||
fg: 'blue'
|
||||
}
|
||||
});
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
form2.focus();
|
||||
|
||||
form2.submit();
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-table.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/table.log',
|
||||
autoPadding: false,
|
||||
fullUnicode: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var DU = '杜';
|
||||
var JUAN = '鹃';
|
||||
|
||||
var table = blessed.table({
|
||||
//parent: screen,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
data: null,
|
||||
border: 'line',
|
||||
align: 'center',
|
||||
tags: true,
|
||||
//width: '80%',
|
||||
width: 'shrink',
|
||||
style: {
|
||||
border: {
|
||||
fg: 'red'
|
||||
},
|
||||
header: {
|
||||
fg: 'blue',
|
||||
bold: true
|
||||
},
|
||||
cell: {
|
||||
fg: 'magenta'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var data1 = [
|
||||
[ 'Animals', 'Foods', 'Times' ],
|
||||
[ 'Elephant', 'Apple', '1:00am' ],
|
||||
[ 'Bird', 'Orange', '2:15pm' ],
|
||||
[ 'T-Rex', 'Taco', '8:45am' ],
|
||||
[ 'Mouse', 'Cheese', '9:05am' ]
|
||||
];
|
||||
|
||||
data1[1][0] = '{red-fg}' + data1[1][0] + '{/red-fg}';
|
||||
data1[2][0] += ' (' + DU + JUAN + ')';
|
||||
|
||||
var data2 = [
|
||||
[ 'Animals', 'Foods', 'Times', 'Numbers' ],
|
||||
[ 'Elephant', 'Apple', '1:00am', 'One' ],
|
||||
[ 'Bird', 'Orange', '2:15pm', 'Two' ],
|
||||
[ 'T-Rex', 'Taco', '8:45am', 'Three' ],
|
||||
[ 'Mouse', 'Cheese', '9:05am', 'Four' ]
|
||||
];
|
||||
|
||||
data2[1][0] = '{red-fg}' + data2[1][0] + '{/red-fg}';
|
||||
data2[2][0] += ' (' + DU + JUAN + ')';
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
table.setData(data2);
|
||||
screen.append(table);
|
||||
screen.render();
|
||||
|
||||
setTimeout(function() {
|
||||
table.setData(data1);
|
||||
screen.render();
|
||||
}, 3000);
|
||||
Vendored
+2812
-1247
File diff suppressed because it is too large
Load Diff
Vendored
+5
-1
@@ -11,7 +11,7 @@ interface JQuery {
|
||||
daterangepicker(settings?: daterangepicker.Settings, callback?: (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any): JQuery;
|
||||
}
|
||||
|
||||
declare module daterangepicker {
|
||||
declare namespace daterangepicker {
|
||||
|
||||
interface DatepickerEventObject extends JQueryEventObject {
|
||||
date: Date;
|
||||
@@ -164,3 +164,7 @@ declare module daterangepicker {
|
||||
monthNames?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
declare module "daterangepicker" {
|
||||
export = daterangepicker;
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -4766,6 +4766,10 @@ declare namespace Electron {
|
||||
* @returns Whether the web page is destroyed.
|
||||
*/
|
||||
isDestroyed(): boolean;
|
||||
/**
|
||||
* @returns Whether the web page is focused.
|
||||
*/
|
||||
isFocused(): boolean;
|
||||
/**
|
||||
* @returns Whether guest page is still loading resources.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="./halfred.d.ts" />
|
||||
|
||||
// run test with: $ tsc --noImplicitAny --target es6 --module commonjs halfred-tests.ts
|
||||
import { parse } from 'halfred'; // require('halfred');
|
||||
let resource = parse({foo: "bar", "_links": { "self": { href: "fooo" }}});
|
||||
console.log(resource);
|
||||
|
||||
let allLinks = resource.allLinks();
|
||||
for (let key in allLinks) {
|
||||
let link = allLinks[key];
|
||||
|
||||
console.log(link[0].href);
|
||||
}
|
||||
Vendored
+247
@@ -0,0 +1,247 @@
|
||||
// Type definitions for Halfred v1.0.0
|
||||
// Project: https://github.com/basti1302/halfred
|
||||
// Definitions by: David Herges <https://github.com/dherges>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "halfred" {
|
||||
|
||||
/**
|
||||
* halfred.parse(object) returns a Resource object.
|
||||
*
|
||||
* @see https://github.com/basti1302/halfred#usage
|
||||
*/
|
||||
export function parse(object: any): Resource;
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#enabledisable-validation */
|
||||
export function enableValidation(flag: boolean): void;
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#enabledisable-validation */
|
||||
export function disableValidation(): void;
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#resource-api */
|
||||
export interface Resource {
|
||||
|
||||
/**
|
||||
* Returns an object which has an array for each link that was present in the source object.
|
||||
* See below why each link is represented as an array.
|
||||
*/
|
||||
allLinkArrays(): LinkCollection;
|
||||
|
||||
/** Alias for allLinkArrays() */
|
||||
allLinks(): LinkCollection;
|
||||
|
||||
/**
|
||||
* Returns the array of links for the given key, or null if there are no links for this key.
|
||||
*/
|
||||
linkArray(key: string): Link[];
|
||||
|
||||
/**
|
||||
* Returns the first element of the array of links for the given key or null if there are no
|
||||
* links for this key.
|
||||
*/
|
||||
link(key: string): Link;
|
||||
|
||||
/**
|
||||
* Returns an object which has an array for each embedded resource that was present in the
|
||||
* source object.
|
||||
* See below why each embedded resource is represented as an array. Each element of any of
|
||||
* this arrays is in turn a Resource object.
|
||||
*/
|
||||
allEmbeddedResourceArrays(): ResourceCollection;
|
||||
|
||||
/** Alias for allEmbeddedResourceArrays() */
|
||||
allEmbeddedArrays(): ResourceCollection;
|
||||
|
||||
/** Alias for allEmbeddedResourceArrays() */
|
||||
allEmbeddedResources(): ResourceCollection;
|
||||
|
||||
/**
|
||||
* Returns the array of embedded resources for the given key, or null if there are no embedded
|
||||
* resources for this key. Each element of this arrays is in turn a Resource object.
|
||||
*/
|
||||
embeddedResourceArray(key: string): Resource[];
|
||||
|
||||
/** Alias for embeddedResourceArray() */
|
||||
embeddedArray(key: string): Resource[];
|
||||
|
||||
/**
|
||||
* Returns the first element of the array of embedded resources for the given key or null if
|
||||
* there are no embedded resources for this key. The returend object is a Resource object.
|
||||
*/
|
||||
embeddedResource(key: string): Resource;
|
||||
|
||||
/** Alias for embeddedResource(key) */
|
||||
embedded(key: string): Resource;
|
||||
|
||||
/**
|
||||
* Returns the unmodified, original object that was parsed to this resource. This is rather
|
||||
* uninteresting for the source object you give to the parse method (because you probably
|
||||
* still have a reference to the source object) but it is a convenient way to get the part of
|
||||
* the source object that corresponds to an embedded resource.
|
||||
*/
|
||||
original(): any;
|
||||
|
||||
/**
|
||||
* Returns true if the resource has any CURIEs (Compact URIs).
|
||||
*
|
||||
* @see http://www.w3.org/TR/2010/NOTE-curie-20101216/
|
||||
*/
|
||||
hasCuries(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the array of CURIEs. Each object in the array is a link object, which means it
|
||||
* can be templated etc. See below for the link object API.
|
||||
*/
|
||||
curieArray(): Link[];
|
||||
|
||||
/**
|
||||
* Returns the curie with the given name, if any. The returned object is a link object, which
|
||||
* means it can be templated etc. See below for link object API.
|
||||
*/
|
||||
curie(name: string): Link;
|
||||
|
||||
/**
|
||||
* Returns the compact URI for the given full URL, if any
|
||||
*/
|
||||
reverseResolveCurie(fullUrl: string): string;
|
||||
|
||||
/**
|
||||
* Returns all validation issues. Validation issues are only gathered if validation has been
|
||||
* turned on by calling ``halfred.enableValidation()`` before calling ``halfred.parse``.
|
||||
*/
|
||||
validationIssues(): any;
|
||||
|
||||
/**
|
||||
* Alias for validationIssues()
|
||||
*/
|
||||
validation(): any;
|
||||
|
||||
/*
|
||||
XX ... think we should NOT try to represent these things in TypeScript.
|
||||
|
||||
In addition to the methods mentioned here, resource has all properties of the source object.
|
||||
This is also true for embedded Resource objects. The non-HAL properties (that is, any
|
||||
property except _links and _embedded) are copied over to the Resource object. This is always
|
||||
a shallow copy, so modifying the a non-HAL property in the Resource object might also alter
|
||||
the source object and vice versa.
|
||||
|
||||
The Resource object also has the properties _links and _embedded but they might differ from
|
||||
the _links/_embedded properties in the source object (Halfred applies some normalization to
|
||||
them). These are not intended to be accessed by clients directly, instead, use the provided
|
||||
methods to work with links and embedded resources.
|
||||
*/
|
||||
}
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#links-and-embedded-resources */
|
||||
interface ResourceCollection {
|
||||
[key: string]: Resource[];
|
||||
}
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#links-and-embedded-resources */
|
||||
interface LinkCollection {
|
||||
[rel: string]: Link[]
|
||||
}
|
||||
|
||||
/**
|
||||
* A Link Object represents a hyperlink from the containing resource to a URI.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5
|
||||
*/
|
||||
interface Link {
|
||||
|
||||
/**
|
||||
* The "href" property is REQUIRED.
|
||||
*
|
||||
* Its value is either a URI [RFC3986] or a URI Template [RFC6570].
|
||||
*
|
||||
* If the value is a URI Template then the Link Object SHOULD have a
|
||||
* "templated" attribute whose value is true.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.1
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The "templated" property is OPTIONAL.
|
||||
*
|
||||
* Its value is boolean and SHOULD be true when the Link Object's "href"
|
||||
* property is a URI Template.
|
||||
*
|
||||
* Its value SHOULD be considered false if it is undefined or any other
|
||||
* value than true.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.2
|
||||
*/
|
||||
templated?: boolean;
|
||||
|
||||
/**
|
||||
* The "type" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string used as a hint to indicate the media type
|
||||
* expected when dereferencing the target resource.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.3
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* The "deprecation" property is OPTIONAL.
|
||||
*
|
||||
* Its presence indicates that the link is to be deprecated (i.e.
|
||||
* removed) at a future date. Its value is a URL that SHOULD provide
|
||||
* further information about the deprecation.
|
||||
*
|
||||
* A client SHOULD provide some notification (for example, by logging a
|
||||
* warning message) whenever it traverses over a link that has this
|
||||
* property. The notification SHOULD include the deprecation property's
|
||||
* value so that a client manitainer can easily find information about
|
||||
* the deprecation.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.4
|
||||
*/
|
||||
deprecation?: string;
|
||||
|
||||
/**
|
||||
* The "name" property is OPTIONAL.
|
||||
*
|
||||
* Its value MAY be used as a secondary key for selecting Link Objects
|
||||
* which share the same relation type.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.5
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The "profile" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string which is a URI that hints about the profile (as
|
||||
* defined by [I-D.wilde-profile-link]) of the target resource.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.6
|
||||
*/
|
||||
profile?: string;
|
||||
|
||||
/**
|
||||
* The "title" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string and is intended for labelling the link with a
|
||||
* human-readable identifier (as defined by [RFC5988]).
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.7
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* The "hreflang" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string and is intended for indicating the language of
|
||||
* the target resource (as defined by [RFC5988]).
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.8
|
||||
*/
|
||||
hreflang?: string;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+38
-38
@@ -240,7 +240,7 @@ interface HighchartsPlotBands {
|
||||
* Border color for the plot band. Also requires borderWidth to be set.
|
||||
* @default null
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* Border width for the plot band. Also requires borderColor to be set.
|
||||
* @default 0
|
||||
@@ -471,7 +471,7 @@ interface HighchartsAxisOptions {
|
||||
/**
|
||||
* Configure a crosshair that follows either the mouse pointer or the hovered point.
|
||||
*/
|
||||
crosshair?: HighchartsCrosshairObject;
|
||||
crosshair?: HighchartsCrosshairObject | boolean;
|
||||
/**
|
||||
* For a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default
|
||||
* string representations used for each unit. For an overview of the replacement codes, see dateFormat.
|
||||
@@ -556,7 +556,7 @@ interface HighchartsAxisOptions {
|
||||
* The color of the line marking the axis itself.
|
||||
* @default '#C0D0E0'.
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the line marking the axis itself.
|
||||
* @default 1
|
||||
@@ -820,7 +820,7 @@ interface HighchartsAxisOptions {
|
||||
interface HighchartsColorAxisDataClass {
|
||||
from?: number;
|
||||
to?: number;
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
@@ -906,7 +906,7 @@ interface HighchartsColorAxisOptions {
|
||||
* The color of the line marking the axis itself.
|
||||
* @default '#C0D0E0'
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the line marking the axis itself.
|
||||
* @default 0
|
||||
@@ -926,7 +926,7 @@ interface HighchartsColorAxisOptions {
|
||||
* The color of the marker.
|
||||
* @default 'gray'
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
};
|
||||
/**
|
||||
* The maximum value of the axis in terms of map point values. If null, the max value is automatically calculated.
|
||||
@@ -1382,7 +1382,7 @@ interface HighchartsShadow {
|
||||
/**
|
||||
* @default 'black'
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* @default 1
|
||||
*/
|
||||
@@ -1491,7 +1491,7 @@ interface HighchartsChartOptions {
|
||||
* The color of the outer chart border.
|
||||
* @default '#4572A7'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The corner radius of the outer chart border.
|
||||
* @default 0
|
||||
@@ -1721,7 +1721,7 @@ interface HighchartsChartOptions {
|
||||
interface HighchartsCSSObject {
|
||||
background?: string;
|
||||
border?: string;
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
cursor?: string;
|
||||
font?: string;
|
||||
fontFamily?: string;
|
||||
@@ -2429,7 +2429,7 @@ interface HighchartsLegendOptions {
|
||||
* The color of the drawn border around the legend.
|
||||
* @default '#909090'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border corner radius of the legend.
|
||||
* @default 0
|
||||
@@ -2724,7 +2724,7 @@ interface HighchartsPaneBackground {
|
||||
/**
|
||||
* @default 'silver'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* @default 1
|
||||
*/
|
||||
@@ -2803,7 +2803,7 @@ interface HighchartsDataLabels {
|
||||
* The border color for the data label.
|
||||
* @since 2.2.1
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border radius in pixels for the data label.
|
||||
* @default 0
|
||||
@@ -2820,7 +2820,7 @@ interface HighchartsDataLabels {
|
||||
* The text color for the data labels.
|
||||
* @default null
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Whether to hide data labels that are outside the plot area. By default, the data label is moved inside the plot
|
||||
* area according to the overflow option.
|
||||
@@ -3066,7 +3066,7 @@ interface HighchartsMarkerState {
|
||||
* The color of the point marker's outline. When null, the series' or point's color is used.
|
||||
* @default '#FFFFFF', '#000000' for select state
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the point marker's outline.
|
||||
* @default 0
|
||||
@@ -3276,7 +3276,7 @@ interface HighchartsAreaZone {
|
||||
* Defines the color of the series.
|
||||
* @since 4.1.0
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* A name for the dash style to use for the graph.
|
||||
* @since 4.1.0
|
||||
@@ -3321,7 +3321,7 @@ interface HighchartsRangeDataLabels {
|
||||
* @default undefined
|
||||
* @since 2.2.1
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border radius in pixels for the data label.
|
||||
* @default 0
|
||||
@@ -3338,7 +3338,7 @@ interface HighchartsRangeDataLabels {
|
||||
* The text color for the data labels.
|
||||
* @default null
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Whether to hide data labels that are outside the plot area. By default, the data label is moved inside the plot
|
||||
* area according to the overflow option.
|
||||
@@ -3471,7 +3471,7 @@ interface HighchartsDial {
|
||||
* @default 'black'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
backgroundColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The length of the dial's base part, relative to the total radius or length of the dial.
|
||||
* @default '70%'.
|
||||
@@ -3490,7 +3490,7 @@ interface HighchartsDial {
|
||||
* @default 'silver'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the gauge dial border in pixels.
|
||||
* @default 0
|
||||
@@ -3524,14 +3524,14 @@ interface HighchartsPivot {
|
||||
* @default 'black'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
backgroundColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border or stroke color of the pivot. In able to change this, the borderWidth must also be set to something
|
||||
* other than the default 0.
|
||||
* @default 'silver'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border or stroke width of the pivot.
|
||||
* @default 0
|
||||
@@ -3554,7 +3554,7 @@ interface HighchartsTreeMapLevel {
|
||||
* Can set borderColor on all points which lies on the same level.
|
||||
* @since 4.1.0
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* et the dash style of the border of all the point which lies on the level.
|
||||
* @since 4.1.0
|
||||
@@ -3569,7 +3569,7 @@ interface HighchartsTreeMapLevel {
|
||||
* Can set a color on all points which lies on the same level.
|
||||
* @since 4.1.0
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Can set the options of dataLabels on each point which lies on the level.
|
||||
* @default undefined
|
||||
@@ -3594,7 +3594,7 @@ interface HighchartsTreeMapLevel {
|
||||
}
|
||||
|
||||
/**
|
||||
* General options for all series types
|
||||
* General options for all series types.
|
||||
*/
|
||||
interface HighchartsSeriesChart {
|
||||
/**
|
||||
@@ -3615,7 +3615,7 @@ interface HighchartsSeriesChart {
|
||||
* specified. In bar type series it applies to the bars unless a color is specified per point. The default value is
|
||||
* pulled from the options.colors array.
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Polar charts only. Whether to connect the ends of a line series plot across the extremes.
|
||||
* @default true
|
||||
@@ -3860,7 +3860,7 @@ interface HighchartsAreaChart extends HighchartsSeriesChart {
|
||||
* A separate color for the graph line. By default the line takes the color of the series, but the lineColor setting
|
||||
* allows setting a separate color for the line without altering the fillColor.
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* A separate color for the negative part of the area.
|
||||
* @since 3.0
|
||||
@@ -3902,7 +3902,7 @@ interface HighchartsBarChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each column or bar.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The corner radius of the border surrounding each column or bar.
|
||||
* @default 0
|
||||
@@ -4263,7 +4263,7 @@ interface HighchartsFunnelChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each column or bar.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each column or bar.
|
||||
* @default 1
|
||||
@@ -4385,7 +4385,7 @@ interface HighchartsHeatMapChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each column or bar.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The corner radius of the border surrounding each column or bar.
|
||||
* @default 0
|
||||
@@ -4468,7 +4468,7 @@ interface HighchartsPieChart extends HighchartsSeriesChart {
|
||||
* borderless pies.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each column or bar.
|
||||
* @default 1
|
||||
@@ -4573,7 +4573,7 @@ interface HighchartsPyramidChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each slice
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each slice
|
||||
* @default 1
|
||||
@@ -4688,7 +4688,7 @@ interface HighchartsTreeMapChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each tree map item.
|
||||
* @default '#E0E0E0'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each column or bar.
|
||||
* @default 1
|
||||
@@ -4783,7 +4783,7 @@ interface HighchartsWaterFallChart extends HighchartsBarChart {
|
||||
* @default '#333333'
|
||||
* @since 3.0
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The color used specifically for positive point columns. When not specified, the general series color is used.
|
||||
*/
|
||||
@@ -4834,7 +4834,7 @@ interface HighchartsIndividualSeriesOptions {
|
||||
* specified. In bar type series it applies to the bars unless a color is specified per point. The default
|
||||
* value is pulled from the options.colors array.
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user
|
||||
* that the points and lines can be clicked.
|
||||
@@ -4949,7 +4949,7 @@ interface HighchartsDataPoint {
|
||||
* Individual color for the point. By default the color is pulled from the global colors array.
|
||||
* @default undefined
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Serves a purpose only if a colorAxis object is defined in the chart options. This value will decide which color
|
||||
* the point gets from the scale of the colorAxis.
|
||||
@@ -5173,7 +5173,7 @@ interface HighchartsTitleOptions {
|
||||
}
|
||||
|
||||
interface HighchartsCrosshairObject {
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
width?: number;
|
||||
dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot
|
||||
zIndex?: number;
|
||||
@@ -5200,7 +5200,7 @@ interface HighchartsTooltipOptions extends HighchartsSeriesTooltipOptions {
|
||||
* The color of the tooltip border. When null, the border takes the color of the corresponding series or point.
|
||||
* @default null
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The radius of the rounded border corners.
|
||||
* @default 3
|
||||
@@ -5602,7 +5602,7 @@ interface HighchartsAxisObject {
|
||||
* @param {boolean | HighchartsAnimation} animation When true, the resize will be animated with default animation options. The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
setExtremes(min?: number, max?: number, redraw?: boolean, animation?: boolean | HighchartsAnimation): void;
|
||||
setExtremes(min?: number, max?: number, redraw?: boolean, animation?: boolean | HighchartsAnimation, eventArguments?: any): void;
|
||||
/**
|
||||
* Update the title of the axis after render time.
|
||||
* @param {HighchartsAxisTitle} title The new title options on the same format as given in xAxis.title.
|
||||
|
||||
Vendored
+2
-2
@@ -39,7 +39,7 @@ type JSONEditorOptions<TValue> = {
|
||||
/**
|
||||
* The icon library to use for the editor.
|
||||
*/
|
||||
iconlib?: boolean;
|
||||
iconlib?: "bootstrap2" | "bootstrap3" | "foundation2" | "foundation3" | "jqueryui" | "fontawesome3" | "fontawesome4";
|
||||
/**
|
||||
* If true, objects can only contain properties defined with the properties keyword.
|
||||
*/
|
||||
@@ -75,7 +75,7 @@ type JSONEditorOptions<TValue> = {
|
||||
/**
|
||||
* The CSS theme to use.
|
||||
*/
|
||||
theme?: string;
|
||||
theme?: "barebones" | "html" | "bootstrap2" | "bootstrap3" | "foundation3" | "foundation4" | "foundation5" | "foundation6" | "jqueryui";
|
||||
/**
|
||||
* If true, only required properties will be included by default.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="karma-fixture.d.ts" />
|
||||
|
||||
fixture.setBase('fixtures/base/path');
|
||||
fixture.load('test1.html', 'test1.json', false);
|
||||
fixture.load('test1.html', 'test2.html', 'test1.json');
|
||||
fixture.set('<em></em>', true);
|
||||
fixture.set('<em></em>', '<strong><strong/>');
|
||||
fixture.cleanup();
|
||||
fixture.el.firstChild;
|
||||
JSON.stringify(fixture.json[0]);
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for karma-fixture 0.2.6
|
||||
// Project: https://github.com/billtrik/karma-fixture
|
||||
// Definitions by: Ezekiel Victor <https://github.com/evictor/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module fixture {
|
||||
var el: HTMLElement;
|
||||
var json: any[];
|
||||
|
||||
function load(...files: string[]): any;
|
||||
function load(file1: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, file3: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, file3: string, file4: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, file3: string, file4: string, file5: string, append?: boolean): any;
|
||||
|
||||
function set(...htmlStrs: string[]): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, htmlStr5: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
|
||||
function cleanup(): void;
|
||||
|
||||
function setBase(fixtureBasePath: string): void;
|
||||
}
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@ declare module "knex" {
|
||||
|
||||
type Callback = Function;
|
||||
type Client = Function;
|
||||
type Value = string|number|boolean|Date|Array<string>|Array<number>|Array<Date>|Array<boolean>;
|
||||
type Value = string|number|boolean|Date|Array<string>|Array<number>|Array<Date>|Array<boolean>|Buffer;
|
||||
type ColumnName = string|Knex.Raw|Knex.QueryBuilder;
|
||||
type TableName = string|Knex.Raw|Knex.QueryBuilder;
|
||||
|
||||
|
||||
@@ -826,3 +826,17 @@ namespace vm_tests {
|
||||
Debug.scripts().forEach(function(script: any) { console.log(script.name); });
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/dist/latest-v4.x/docs/api/errors.html ///
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace errors_tests {
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -13,6 +13,10 @@ interface Error {
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
interface ErrorConstructor {
|
||||
captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
|
||||
stackTraceLimit: number;
|
||||
}
|
||||
|
||||
// compat for TypeScript 1.8
|
||||
// if you use with --target es3 or --target es5 and use below definitions,
|
||||
@@ -2398,3 +2402,7 @@ declare module "constants" {
|
||||
export var X_OK: number;
|
||||
export var UV_UDP_REUSEADDR: number;
|
||||
}
|
||||
|
||||
declare module "process" {
|
||||
export = process;
|
||||
}
|
||||
|
||||
@@ -244,10 +244,21 @@ function bufferTests() {
|
||||
let index: number;
|
||||
index = buffer.indexOf("23");
|
||||
index = buffer.indexOf("23", 1);
|
||||
index = buffer.indexOf("23", 1, "utf8");
|
||||
index = buffer.indexOf(23);
|
||||
index = buffer.indexOf(buffer);
|
||||
}
|
||||
|
||||
{
|
||||
let buffer = new Buffer('123');
|
||||
let index: number;
|
||||
index = buffer.lastIndexOf("23");
|
||||
index = buffer.lastIndexOf("23", 1);
|
||||
index = buffer.lastIndexOf("23", 1, "utf8");
|
||||
index = buffer.lastIndexOf(23);
|
||||
index = buffer.lastIndexOf(buffer);
|
||||
}
|
||||
|
||||
// Imported Buffer from buffer module works properly
|
||||
{
|
||||
let b = new ImportedBuffer('123');
|
||||
|
||||
Vendored
+6
-2
@@ -503,8 +503,8 @@ interface NodeBuffer extends Uint8Array {
|
||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
fill(value: any, offset?: number, end?: number): this;
|
||||
// TODO: encoding param
|
||||
indexOf(value: string | number | Buffer, byteOffset?: number): number;
|
||||
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
// TODO: entries
|
||||
// TODO: includes
|
||||
// TODO: keys
|
||||
@@ -2625,3 +2625,7 @@ declare module "constants" {
|
||||
export var X_OK: number;
|
||||
export var UV_UDP_REUSEADDR: number;
|
||||
}
|
||||
|
||||
declare module "process" {
|
||||
export = process;
|
||||
}
|
||||
@@ -1,17 +1,79 @@
|
||||
/// <reference path="object-assign.d.ts" />
|
||||
import objectAssign = require("object-assign");
|
||||
|
||||
function assign1() {
|
||||
var result = objectAssign({hello: "world"});
|
||||
return result;
|
||||
interface Target {
|
||||
hellow: string;
|
||||
}
|
||||
|
||||
function assign2() {
|
||||
var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"});
|
||||
return result;
|
||||
interface Source1 {
|
||||
source1: string;
|
||||
}
|
||||
|
||||
function assign3() {
|
||||
var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"}, {hello: "stop", the: "spinning"});
|
||||
return result;
|
||||
interface Result extends Target, Source1 {
|
||||
|
||||
}
|
||||
|
||||
interface Source2 {
|
||||
source2: string;
|
||||
}
|
||||
|
||||
interface Result2 extends Result, Source2 {
|
||||
|
||||
}
|
||||
|
||||
interface Source3 {
|
||||
source3: string;
|
||||
}
|
||||
|
||||
interface Result3 extends Result2, Source3 {
|
||||
|
||||
}
|
||||
|
||||
interface Source4 {
|
||||
source4: string;
|
||||
}
|
||||
|
||||
interface Result4 extends Result3, Source4 {
|
||||
|
||||
}
|
||||
|
||||
interface Source5 {
|
||||
source5: string;
|
||||
}
|
||||
|
||||
interface Result5 extends Result4, Source5 {
|
||||
|
||||
}
|
||||
|
||||
function assign1(): Result {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"});
|
||||
}
|
||||
|
||||
function assign2(): Result2 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"});
|
||||
}
|
||||
|
||||
function assign3(): Result3 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"});
|
||||
}
|
||||
|
||||
function assign4(): Result4 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"});
|
||||
}
|
||||
|
||||
function assign5(): Result5 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"});
|
||||
}
|
||||
|
||||
function assign() {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"}, {
|
||||
hellow: "hellow",
|
||||
source1: "source1",
|
||||
source2: "source2",
|
||||
source3: "source3",
|
||||
source4: "source4",
|
||||
source5: "source5",
|
||||
generic: "any"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
@@ -4,6 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "object-assign" {
|
||||
function objectAssign<T, U>(target: T, source: U): T & U;
|
||||
function objectAssign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
function objectAssign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
function objectAssign<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q;
|
||||
function objectAssign<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R;
|
||||
function objectAssign(target: any, ...sources: any[]): any;
|
||||
export = objectAssign;
|
||||
}
|
||||
|
||||
Vendored
+3114
-519
File diff suppressed because it is too large
Load Diff
Vendored
+1
@@ -1456,6 +1456,7 @@ declare namespace PIXI {
|
||||
global: Point;
|
||||
target: DisplayObject;
|
||||
originalEvent: Event;
|
||||
identifier: number;
|
||||
|
||||
getLocalPosition(displayObject: DisplayObject, point?: Point, globalPos?: Point): Point;
|
||||
|
||||
|
||||
@@ -38,6 +38,16 @@ namespace PouchDBCoreTests {
|
||||
});
|
||||
}
|
||||
|
||||
function testCompact() {
|
||||
const db = new PouchDB<{}>();
|
||||
// Promise version
|
||||
db.compact().then( (res: PouchDB.Core.Response) => {});
|
||||
// Promise version with optional options
|
||||
db.compact({interval: 300}).then( (res: PouchDB.Core.Response) => {});
|
||||
// Options with a callback
|
||||
db.compact({interval: 300}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testDestroy() {
|
||||
const db = new PouchDB<{}>();
|
||||
|
||||
@@ -75,4 +85,31 @@ namespace PouchDBCoreTests {
|
||||
db.info({ ajax: { cache: true }}, (error, result) => {
|
||||
});
|
||||
}
|
||||
|
||||
function testRemove() {
|
||||
type MyModel = { rev: 'rev', property: 'someProperty '};
|
||||
let model: PouchDB.Core.Document<MyModel>;
|
||||
const id = 'model';
|
||||
const rev = 'rev';
|
||||
|
||||
const db = new PouchDB<MyModel>();
|
||||
|
||||
// Promise version with doc
|
||||
db.remove(model).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with doc and options
|
||||
db.remove(model, {}).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with docId and rev
|
||||
db.remove(id, rev).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with docId and rev and options
|
||||
db.remove(id, rev, {}).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Callback version with doc
|
||||
db.remove(model, {}, (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Callback version with docId and rev
|
||||
db.remove(id, rev, {}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+23
@@ -164,6 +164,10 @@ declare namespace PouchDB {
|
||||
interface PostOptions extends PutOptions {
|
||||
}
|
||||
|
||||
interface CompactOptions extends Core.Options {
|
||||
interval?: number;
|
||||
}
|
||||
|
||||
interface InfoOptions extends Options {
|
||||
}
|
||||
}
|
||||
@@ -264,6 +268,11 @@ declare namespace PouchDB {
|
||||
allDocs(options?: Core.AllDocsOptions):
|
||||
Promise<Core.AllDocsResponse<Content>>;
|
||||
|
||||
/** Compact the database */
|
||||
compact(options?: Core.CompactOptions): Promise<Core.Response>;
|
||||
compact(options: Core.CompactOptions,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
|
||||
/** Destroy the database */
|
||||
destroy(options: Core.DestroyOptions | void,
|
||||
callback: Core.AnyCallback): void;
|
||||
@@ -319,6 +328,20 @@ declare namespace PouchDB {
|
||||
revision?: Core.RevisionId,
|
||||
options?: Core.PutOptions): Promise<Core.Response>;
|
||||
|
||||
/** Remove a doc from the database */
|
||||
remove(doc: Core.Document<Content>,
|
||||
options: Core.Options,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
remove(docId: Core.DocumentId,
|
||||
revision: Core.RevisionId,
|
||||
options: Core.Options,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
remove(doc: Core.Document<Content>,
|
||||
options?: Core.Options): Promise<Core.Response>;
|
||||
remove(docId: Core.DocumentId,
|
||||
revision: Core.RevisionId,
|
||||
options?: Core.Options): Promise<Core.Response>;
|
||||
|
||||
/** Get database information */
|
||||
info(options: Core.InfoOptions | void,
|
||||
callback: Core.Callback<any, Core.DatabaseInfo>): void;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/// <reference path="./pouchdb-upsert.d.ts" />
|
||||
|
||||
import * as pouchdbUpsert from 'pouchdb-upsert';
|
||||
PouchDB.plugin(pouchdbUpsert);
|
||||
|
||||
namespace PouchDBUpsertTests {
|
||||
type UpsertDocModel = { _id: 'test-doc1', name: 'test' };
|
||||
let docToUpsert: PouchDB.Core.Document<UpsertDocModel>;
|
||||
const db = new PouchDB<UpsertDocModel>();
|
||||
|
||||
function testUpsert_WithPromise_AndReturnDoc() {
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return doc;
|
||||
}).then((res: PouchDB.Core.Response) => {
|
||||
});
|
||||
}
|
||||
|
||||
function testUpsert_WithPromise_AndReturnBoolean() {
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return false;
|
||||
}).then((res: PouchDB.Core.Response) => {
|
||||
});
|
||||
}
|
||||
|
||||
function testUpsert_WithCallback_AndReturnDoc() {
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return doc;
|
||||
}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testUpsert_WithCallback_AndReturnBoolean() {
|
||||
// callback return boolean
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return false;
|
||||
}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testPutIfNotExists_WithPromise() {
|
||||
db.putIfNotExists(docToUpsert).then( (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testPutIfNotExists_WithCallback() {
|
||||
db.putIfNotExists(docToUpsert, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
}
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// Type definitions for pouchdb-upsert v2.0.1
|
||||
// Project: https://github.com/pouchdb/upsert
|
||||
// Definitions by: Keith D. Moore <https://github.com/keithdmoore>, Andrew Mitchell <https://github.com/hotforfeature>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../pouchdb-core/pouchdb-core.d.ts" />
|
||||
|
||||
declare namespace PouchDB {
|
||||
|
||||
interface Database<Content extends Core.Encodable> {
|
||||
/**
|
||||
* Perform an upsert (update or insert) operation. Returns a Promise.
|
||||
*
|
||||
* @param docId - the _id of the document.
|
||||
* @param diffFun - function that takes the existing doc as input and returns an updated doc.
|
||||
* If this diffFunc returns falsey, then the update won't be performed (as an optimization).
|
||||
* If the document does not already exist, then {} will be the input to diffFunc.
|
||||
*
|
||||
*/
|
||||
upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback<Content>): Promise<Core.Response>;
|
||||
|
||||
/**
|
||||
* Perform an upsert (update or insert) operation. If a callback is not provided, the Promise based version
|
||||
* of this function will be called.
|
||||
*
|
||||
* @param docId - the _id of the document.
|
||||
* @param diffFun - function that takes the existing doc as input and returns an updated doc.
|
||||
* If this diffFunc returns falsey, then the update won't be performed (as an optimization).
|
||||
* If the document does not already exist, then {} will be the input to diffFunc.
|
||||
* @param callback - called with the results after operation is completed.
|
||||
*/
|
||||
upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback<Content>,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
|
||||
/**
|
||||
* Put a new document with the given docId, if it doesn't already exist. Returns a Promise.
|
||||
*
|
||||
* @param doc - the document to insert. Should contain an _id if docId is not specified
|
||||
* If the document already exists, then the Promise will just resolve immediately.
|
||||
*/
|
||||
putIfNotExists(doc: Core.Document<Content>): Promise<Core.Response>;
|
||||
|
||||
//
|
||||
/**
|
||||
* Put a new document with the given docId, if it doesn't already exist. If a callback is not provided,
|
||||
* the Promise based version of this function will be called.
|
||||
*
|
||||
* @param doc - the document to insert. Should contain an _id if docId is not specified
|
||||
* If the document already exists, then the Promise will just resolve immediately.
|
||||
* @param callback - called with the results after operation is completed.
|
||||
* If you don't specify a callback, then the Promise version of this function will be invoked and it
|
||||
* will return a Promise.
|
||||
*/
|
||||
putIfNotExists(doc: Core.Document<Content>,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
}
|
||||
|
||||
interface UpsertDiffCallback<Content extends Core.Encodable> {
|
||||
(doc: Core.Document<Content>): Core.Document<Content>|boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'pouchdb-upsert' {
|
||||
const plugin: PouchDB.Plugin;
|
||||
export = plugin;
|
||||
}
|
||||
Vendored
+1
-1
@@ -23,7 +23,7 @@ declare module "pusher-js" {
|
||||
config: Config; //TODO: add GlobalConfig typings
|
||||
channels: any; //TODO: Type this
|
||||
global_emitter: EventsDispatcher;
|
||||
sessionId: number;
|
||||
sessionID: number;
|
||||
timeline: any; //TODO: Type this
|
||||
connection: ConnectionManager;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+1807
File diff suppressed because it is too large
Load Diff
Vendored
+13
-9
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Raven.js
|
||||
// Project: https://github.com/getsentry/raven-js
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, Benjamin Pannell <http://github.com/spartan563>
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, Benjamin Pannell <http://github.com/spartan563>, Gary Blackwood <http://github.com/Garee>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var Raven: RavenStatic;
|
||||
@@ -10,15 +10,15 @@ declare module 'raven-js' {
|
||||
}
|
||||
|
||||
interface RavenOptions {
|
||||
/** The log level associated with this event. Default: error */
|
||||
level?: string;
|
||||
|
||||
/** The name of the logger used by Sentry. Default: javascript */
|
||||
logger?: string;
|
||||
|
||||
/** The release version of the application you are monitoring with Sentry */
|
||||
release?: string;
|
||||
|
||||
/** The environment in which the application is running. */
|
||||
environment?: string;
|
||||
|
||||
/** The name of the server or device that the client is running on */
|
||||
serverName?: string;
|
||||
|
||||
@@ -39,11 +39,6 @@ interface RavenOptions {
|
||||
[id: string]: string;
|
||||
};
|
||||
|
||||
extra?: any;
|
||||
|
||||
/** In some cases you may see issues where Sentry groups multiple events together when they should be separate entities. In other cases, Sentry simply doesn’t group events together because they’re so sporadic that they never look the same. */
|
||||
fingerprint?: string[];
|
||||
|
||||
/** A function which allows mutation of the data payload right before being sent to Sentry */
|
||||
dataCallback?: (data: any) => any;
|
||||
|
||||
@@ -53,8 +48,17 @@ interface RavenOptions {
|
||||
/** By default, Raven does not truncate messages. If you need to truncate characters for whatever reason, you may set this to limit the length. */
|
||||
maxMessageLength?: number;
|
||||
|
||||
/** Enables/disables automatic collection of breadcrumbs. Default: true. */
|
||||
autoBreadcrumbs?: any;
|
||||
|
||||
/** The max number of breadcrumb captures. Default: 100. */
|
||||
maxBreadcrumbs?: number;
|
||||
|
||||
/** Override the default HTTP data transport handler. */
|
||||
transport?: (options: RavenTransportOptions) => void;
|
||||
|
||||
/** Allow the use of a Sentry DSN with a private key. Default: false. */
|
||||
allowSecretKey?: boolean;
|
||||
}
|
||||
|
||||
interface RavenStatic {
|
||||
|
||||
@@ -19,6 +19,8 @@ class Test extends React.Component<any, any> {
|
||||
style={{ borderStyle: "dashed" }}
|
||||
activeStyle={{ borderStyle: "dotted" }}
|
||||
className="regular"
|
||||
minSize={2000}
|
||||
maxSize={Infinity}
|
||||
activeClassName="active"
|
||||
rejectClassName="reject"
|
||||
disableClick={true}
|
||||
|
||||
Vendored
+8
@@ -22,6 +22,14 @@ declare namespace ReactDropzone {
|
||||
* Clicking the <Dropzone> brings up the browser file picker. To disable, set to true.
|
||||
*/
|
||||
disableClick?: boolean;
|
||||
/**
|
||||
* Min file size accepted
|
||||
*/
|
||||
minSize?: number;
|
||||
/**
|
||||
* Max file size accepted
|
||||
*/
|
||||
maxSize?: number;
|
||||
/**
|
||||
* To accept only a single file, set this to false.
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,7 @@ declare namespace NotificationSystem {
|
||||
noAnimation?: boolean;
|
||||
ref?: string;
|
||||
style?: Style | boolean;
|
||||
allowHTML?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -233,8 +233,8 @@ connect(mapStateToProps3)(TodoApp);
|
||||
// return { todos: state.todos };
|
||||
//}
|
||||
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState {
|
||||
return objectAssign({}, ownProps, {
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps {
|
||||
return objectAssign({}, ownProps, dispatchProps, {
|
||||
todos: stateProps.todos[ownProps.userId],
|
||||
addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text)
|
||||
});
|
||||
|
||||
@@ -268,8 +268,8 @@ connect(mapStateToProps3)(TodoApp);
|
||||
// return { todos: state.todos };
|
||||
//}
|
||||
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState {
|
||||
return objectAssign({}, ownProps, {
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps {
|
||||
return objectAssign({}, ownProps, dispatchProps, {
|
||||
todos: stateProps.todos[ownProps.userId],
|
||||
addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text)
|
||||
});
|
||||
|
||||
@@ -33,14 +33,28 @@ rest.post("http://user:pass@service.com/action", {
|
||||
}
|
||||
});
|
||||
|
||||
// post JSON
|
||||
// post JSON with no options
|
||||
var jsonData = { id: 334 };
|
||||
rest.postJson("http://example.com/action", jsonData).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
// put JSON
|
||||
// put JSON with no options
|
||||
var jsonData = { id: 334 };
|
||||
rest.putJson("http://example.com/action", jsonData).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
// post JSON with options
|
||||
var jsonData = { id: 334 };
|
||||
var options = { query: {"api-version": "1.0"}};
|
||||
rest.postJson("http://example.com/action", jsonData, options).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
// put JSON with options
|
||||
var jsonData = { id: 334 };
|
||||
var options = { query: {"api-version": "1.0"}};
|
||||
rest.putJson("http://example.com/action", jsonData, options).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
Vendored
+8
-4
@@ -40,10 +40,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via GET method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
json(url: string, options?: RestlerOptions): RestlerResult;
|
||||
json(url: string, data?: any, options?: RestlerOptions, method?: string): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a PATCH request.
|
||||
@@ -56,10 +57,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via PATCH method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
patchJson(url: string, options?: RestlerOptions): RestlerResult;
|
||||
patchJson(url: string, data?: any, options?: RestlerOptions): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a POST request.
|
||||
@@ -72,10 +74,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via POST method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
postJson(url: string, options?: RestlerOptions): RestlerResult;
|
||||
postJson(url: string, data?: any, options?: RestlerOptions): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a PUT request.
|
||||
@@ -88,10 +91,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via PUT method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
putJson(url: string, options?: RestlerOptions): RestlerResult;
|
||||
putJson(url: string, data?: any, options?: RestlerOptions): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a PUT request.
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/// <reference path="./set-cookie-parser.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import * as assert from "assert";
|
||||
import * as http from "http";
|
||||
import * as setCookie from "set-cookie-parser";
|
||||
|
||||
// Call parse function on imported object
|
||||
var input = "foo=bar;";
|
||||
var cookies = setCookie.parse(input);
|
||||
assert.equal(cookies.length, 1);
|
||||
assert.equal(cookies[0].name, "foo");
|
||||
assert.equal(cookies[0].value, "bar");
|
||||
|
||||
// Required properties only test
|
||||
var requiredOnly = "foo=bar;";
|
||||
cookies = setCookie(requiredOnly);
|
||||
assert.equal(cookies.length, 1);
|
||||
assert.equal(cookies[0].name, "foo");
|
||||
assert.equal(cookies[0].value, "bar");
|
||||
|
||||
// Optional properties included test
|
||||
var optionalIncluded = "foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure";
|
||||
cookies = setCookie(optionalIncluded);
|
||||
assert.equal(cookies.length, 1);
|
||||
assert.equal(cookies[0].name, "foo");
|
||||
assert.equal(cookies[0].value, "bar");
|
||||
assert.equal(cookies[0].domain, ".example.com");
|
||||
assert.equal(cookies[0].path, "/");
|
||||
assert.deepEqual(cookies[0].expires, new Date('Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)'));
|
||||
assert.equal(cookies[0].maxAge, 1000);
|
||||
assert.equal(cookies[0].httpOnly, true);
|
||||
assert.equal(cookies[0].secure, true);
|
||||
|
||||
// Array of strings test
|
||||
var arrayOfCookies = ["bam=baz", "foo=bar"];
|
||||
cookies = setCookie(arrayOfCookies);
|
||||
assert.equal(cookies.length, 2);
|
||||
assert.equal(cookies[0].name, "bam");
|
||||
assert.equal(cookies[0].value, "baz");
|
||||
assert.equal(cookies[1].name, "foo");
|
||||
assert.equal(cookies[1].value, "bar");
|
||||
|
||||
// HTTP response message test
|
||||
var message = <http.IncomingMessage>{};
|
||||
message.headers = { "set-cookie": ["bam=baz", "foo=bar"] };
|
||||
cookies = setCookie(message);
|
||||
assert.equal(cookies.length, 2);
|
||||
assert.equal(cookies[0].name, "bam");
|
||||
assert.equal(cookies[0].value, "baz");
|
||||
assert.equal(cookies[1].name, "foo");
|
||||
assert.equal(cookies[1].value, "bar");
|
||||
|
||||
// Create new cookie with only required properties
|
||||
var requiredOnlyCookie: setCookie.Cookie = {
|
||||
name: "Foo",
|
||||
value: "Bar"
|
||||
}
|
||||
|
||||
// Create new cookie with all properties included optional ones
|
||||
var optionalIncludedCookie: setCookie.Cookie = {
|
||||
name: "Bam",
|
||||
value: "Baz",
|
||||
domain: ".example.com",
|
||||
path: "/",
|
||||
expires: new Date("Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)"),
|
||||
maxAge: 1000,
|
||||
httpOnly: true,
|
||||
secure: true
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for set-cookie-parser
|
||||
// Project: https://github.com/nfriedly/set-cookie-parser
|
||||
// Definitions by: Nick Paddock <https://github.com/nickp10>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "set-cookie-parser" {
|
||||
import http = require("http");
|
||||
|
||||
function SetCookieParser(input: string | string[] | http.IncomingMessage): SetCookieParser.Cookie[];
|
||||
|
||||
namespace SetCookieParser {
|
||||
function parse(input: string | string[] | http.IncomingMessage): Cookie[];
|
||||
|
||||
interface Cookie {
|
||||
name: string;
|
||||
value: string;
|
||||
path?: string;
|
||||
expires?: Date;
|
||||
maxAge?: number;
|
||||
domain?: string;
|
||||
secure?: boolean;
|
||||
httpOnly?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = SetCookieParser;
|
||||
}
|
||||
@@ -1,15 +1,78 @@
|
||||
|
||||
/// <reference path="simple-assign.d.ts" />
|
||||
import assign = require("simple-assign");
|
||||
import simpleAssign = require("simple-assign");
|
||||
|
||||
function assign1() {
|
||||
return assign({hello: "world"});
|
||||
interface Target {
|
||||
hellow: string;
|
||||
}
|
||||
|
||||
function assign2() {
|
||||
return assign({hello: "world"}, {hello: "worlds", second: "extra"});
|
||||
interface Source1 {
|
||||
source1: string;
|
||||
}
|
||||
|
||||
function assign3() {
|
||||
return assign({hello: "world"}, {hello: "worlds", second: "extra"}, {hello: "stop", the: "spinning"});
|
||||
interface Result extends Target, Source1 {
|
||||
|
||||
}
|
||||
|
||||
interface Source2 {
|
||||
source2: string;
|
||||
}
|
||||
|
||||
interface Result2 extends Result, Source2 {
|
||||
|
||||
}
|
||||
|
||||
interface Source3 {
|
||||
source3: string;
|
||||
}
|
||||
|
||||
interface Result3 extends Result2, Source3 {
|
||||
|
||||
}
|
||||
|
||||
interface Source4 {
|
||||
source4: string;
|
||||
}
|
||||
|
||||
interface Result4 extends Result3, Source4 {
|
||||
|
||||
}
|
||||
|
||||
interface Source5 {
|
||||
source5: string;
|
||||
}
|
||||
|
||||
interface Result5 extends Result4, Source5 {
|
||||
|
||||
}
|
||||
|
||||
function assign1(): Result {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"});
|
||||
}
|
||||
|
||||
function assign2(): Result2 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"});
|
||||
}
|
||||
|
||||
function assign3(): Result3 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"});
|
||||
}
|
||||
|
||||
function assign4(): Result4 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"});
|
||||
}
|
||||
|
||||
function assign5(): Result5 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"});
|
||||
}
|
||||
|
||||
function assign() {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"}, {
|
||||
hellow: "hellow",
|
||||
source1: "source1",
|
||||
source2: "source2",
|
||||
source3: "source3",
|
||||
source4: "source4",
|
||||
source5: "source5",
|
||||
generic: "any"
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ declare module "simple-assign" {
|
||||
function simpleAssign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
function simpleAssign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
function simpleAssign<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q;
|
||||
function simpleAssign<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: T): T & U & V & W & Q & R;
|
||||
function simpleAssign<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R;
|
||||
function simpleAssign(target: any, ...sources: any[]): any;
|
||||
export = simpleAssign;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="socket.io-parser.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import * as parser from 'socket.io-parser';
|
||||
var encoder = new parser.Encoder();
|
||||
var packet = {
|
||||
type: parser.EVENT,
|
||||
data: 'test-packet',
|
||||
id: 13
|
||||
};
|
||||
encoder.encode(packet, function (encodedPackets) {
|
||||
var decoder = new parser.Decoder();
|
||||
decoder.on('decoded', function (decodedPacket) {
|
||||
decodedPacket.type == parser.EVENT
|
||||
decodedPacket.data == 'test-packet'
|
||||
decodedPacket.id == 13
|
||||
});
|
||||
|
||||
for (var i = 0; i < encodedPackets.length; i++) {
|
||||
decoder.add(encodedPackets[i]);
|
||||
}
|
||||
});
|
||||
|
||||
var packet2 = {
|
||||
type: parser.BINARY_EVENT,
|
||||
data: { i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)]) },
|
||||
id: 15
|
||||
};
|
||||
encoder.encode(packet2, function (encodedPackets) {
|
||||
var decoder = new parser.Decoder();
|
||||
decoder.on('decoded', function (decodedPacket) {
|
||||
decodedPacket.type == parser.BINARY_EVENT
|
||||
Buffer.isBuffer(decodedPacket.data.i) == true
|
||||
Buffer.isBuffer(decodedPacket.data.j) == true
|
||||
decodedPacket.id == 15
|
||||
});
|
||||
|
||||
for (var i = 0; i < encodedPackets.length; i++) {
|
||||
decoder.add(encodedPackets[i]);
|
||||
}
|
||||
});
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for json-editor
|
||||
// Project: https://github.com/socketio/socket.io-parser
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path='../node/node.d.ts' />
|
||||
|
||||
declare module "socket.io-parser" {
|
||||
namespace Parser {
|
||||
type Packet = {
|
||||
type: number,
|
||||
data: any,
|
||||
id: number
|
||||
}
|
||||
type EncodedPacket = string | Buffer | ArrayBuffer | Blob;
|
||||
|
||||
var types: string[];
|
||||
|
||||
var CONNECT: number;
|
||||
var DISCONNECT: number;
|
||||
var EVENT: number;
|
||||
var ACK: number;
|
||||
var ERROR: number;
|
||||
var BINARY_EVENT: number;
|
||||
var BINARY_ACK: number;
|
||||
|
||||
class Encoder {
|
||||
encode(packet: Packet, callback: (encodedPackets: EncodedPacket[]) => void): void;
|
||||
}
|
||||
|
||||
class Decoder {
|
||||
on(event: string, callback: (decodedPacket: Packet) => void): void;
|
||||
add(encodedPacket: EncodedPacket): void;
|
||||
destroy(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = Parser;
|
||||
}
|
||||
Vendored
+10
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for TypeScript-STL v1.0.0
|
||||
// Type definitions for TypeScript-STL v1.0.1
|
||||
// Project: https://github.com/samchon/typescript-stl
|
||||
// Definitions by: Jeongho Nam <http://samchon.org>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -7097,6 +7097,14 @@ declare namespace std {
|
||||
* shall be a function pointer or a function object.
|
||||
*/
|
||||
sort(compare: (left: T, right: T) => boolean): void;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
private qsort(first, last, compare);
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
private partition(first, last, compare);
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -9217,7 +9225,7 @@ declare namespace std {
|
||||
*/
|
||||
erase(first: VectorReverseIterator<T>, last: VectorReverseIterator<T>): VectorReverseIterator<T>;
|
||||
/**
|
||||
* @hiddde
|
||||
* @hidden
|
||||
*/
|
||||
protected erase_by_range(first: VectorIterator<T>, last: VectorIterator<T>): VectorIterator<T>;
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ function test_HeadersCopiedFromHeaders() {
|
||||
}
|
||||
|
||||
function test_HeadersCopiedFromHash() {
|
||||
var source:HeadersMap = {
|
||||
var source: DOMStringMap = {
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
return new Headers(source);
|
||||
|
||||
Vendored
+96
-85
@@ -1,98 +1,109 @@
|
||||
// Type definitions for fetch API
|
||||
// Type definitions for Fetch API
|
||||
// Project: https://github.com/github/fetch
|
||||
// Definitions by: Ryan Graham <https://github.com/ryan-codingintrigue>
|
||||
// Definitions by: Ryan Graham <https://github.com/ryan-codingintrigue>, Kagami Sascha Rosylight <https://github.com/saschanaz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Request extends Body {
|
||||
constructor(input: string|Request, init?:RequestInit);
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Headers;
|
||||
context: RequestContext;
|
||||
referrer: string;
|
||||
mode: RequestMode;
|
||||
redirect: RequestRedirect;
|
||||
credentials: RequestCredentials;
|
||||
cache: RequestCache;
|
||||
}
|
||||
|
||||
interface RequestInit {
|
||||
method?: string;
|
||||
headers?: HeaderInit|{ [index: string]: string };
|
||||
body?: BodyInit;
|
||||
mode?: RequestMode;
|
||||
redirect?: RequestRedirect;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
}
|
||||
|
||||
type RequestContext =
|
||||
"audio" | "beacon" | "cspreport" | "download" | "embed" |
|
||||
"eventsource" | "favicon" | "fetch" | "font" | "form" | "frame" |
|
||||
"hyperlink" | "iframe" | "image" | "imageset" | "import" |
|
||||
"internal" | "location" | "manifest" | "object" | "ping" | "plugin" |
|
||||
"prefetch" | "script" | "serviceworker" | "sharedworker" |
|
||||
"subresource" | "style" | "track" | "video" | "worker" |
|
||||
"xmlhttprequest" | "xslt";
|
||||
type RequestMode = "same-origin" | "no-cors" | "cors";
|
||||
type RequestRedirect = "follow" | "error" | "manual";
|
||||
type RequestCredentials = "omit" | "same-origin" | "include";
|
||||
type RequestCache =
|
||||
"default" | "no-store" | "reload" | "no-cache" |
|
||||
"force-cache" | "only-if-cached";
|
||||
|
||||
declare interface HeadersMap {
|
||||
[index: string]: string;
|
||||
interface Window {
|
||||
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
||||
}
|
||||
declare var fetch: typeof window.fetch;
|
||||
|
||||
declare type HeadersInit = Headers | string[][] | { [key: string]: string };
|
||||
declare class Headers {
|
||||
constructor(headers?:Headers|HeadersMap)
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string):void;
|
||||
get(name: string): string;
|
||||
getAll(name: string): Array<string>;
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string): void;
|
||||
forEach(callback: (value: string, name: string) => void): void;
|
||||
constructor(init?: HeadersInit);
|
||||
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
get(name: string): string; // | null; (TS 2.0 strict null check)
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string): void;
|
||||
|
||||
// WebIDL pair iterator: iterable<ByteString, ByteString>
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
forEach(callback: (value: string, index: number, headers: Headers) => void, thisArg?: any): void;
|
||||
keys(): IterableIterator<string>;
|
||||
values(): IterableIterator<string>;
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
}
|
||||
|
||||
declare class Body {
|
||||
bodyUsed: boolean;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
blob(): Promise<Blob>;
|
||||
formData(): Promise<FormData>;
|
||||
json(): Promise<any>;
|
||||
json<T>(): Promise<T>;
|
||||
text(): Promise<string>;
|
||||
declare type BodyInit = Blob | ArrayBufferView | ArrayBuffer | FormData /* | URLSearchParams */ | string;
|
||||
interface Body {
|
||||
bodyUsed: boolean;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
blob(): Promise<Blob>;
|
||||
formData(): Promise<FormData>;
|
||||
json(): Promise<any>;
|
||||
text(): Promise<string>;
|
||||
}
|
||||
|
||||
declare class Response extends Body {
|
||||
constructor(body?: BodyInit, init?: ResponseInit);
|
||||
static error(): Response;
|
||||
static redirect(url: string, status: number): Response;
|
||||
type: ResponseType;
|
||||
url: string;
|
||||
status: number;
|
||||
ok: boolean;
|
||||
statusText: string;
|
||||
headers: Headers;
|
||||
clone(): Response;
|
||||
declare type RequestInfo = Request | string;
|
||||
interface Request extends Body {
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Headers;
|
||||
|
||||
type: RequestType
|
||||
destination: RequestDestination;
|
||||
referrer: string;
|
||||
referrerPolicy: ReferrerPolicy;
|
||||
mode: RequestMode;
|
||||
credentials: RequestCredentials;
|
||||
cache: RequestCache;
|
||||
redirect: RequestRedirect;
|
||||
integrity: string;
|
||||
|
||||
clone(): Request;
|
||||
}
|
||||
interface RequestInit {
|
||||
method?: string;
|
||||
headers?: HeadersInit;
|
||||
body?: BodyInit;
|
||||
referrer?: string;
|
||||
referrerPolicy?: ReferrerPolicy;
|
||||
mode?: RequestMode;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
redirect?: RequestRedirect;
|
||||
integrity?: string;
|
||||
window?: any;
|
||||
}
|
||||
interface RequestConstructor {
|
||||
new (input: RequestInfo, init?: RequestInit): Request;
|
||||
}
|
||||
declare var Request: RequestConstructor;
|
||||
|
||||
type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video";
|
||||
type RequestDestination = "" | "document" | "embed" | "font" | "image" | "manifest" | "media" | "object" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "worker" | "xslt";
|
||||
type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";
|
||||
type RequestCredentials = "omit" | "same-origin" | "include";
|
||||
type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached";
|
||||
type RequestRedirect = "follow" | "error" | "manual";
|
||||
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
||||
|
||||
interface Response extends Body {
|
||||
type: ResponseType;
|
||||
url: string;
|
||||
redirected: boolean;
|
||||
status: number;
|
||||
ok: boolean;
|
||||
statusText: string;
|
||||
headers: Headers;
|
||||
body: any /*ReadableStream | null*/;
|
||||
trailer: Promise<Headers>;
|
||||
|
||||
clone(): Response;
|
||||
}
|
||||
interface ResponseInit {
|
||||
status?: number;
|
||||
statusText?: string;
|
||||
headers?: HeadersInit;
|
||||
}
|
||||
interface ResponseConstructor {
|
||||
new (body?: BodyInit, init?: ResponseInit): Response;
|
||||
|
||||
error(): Response;
|
||||
redirect(url: string, status?: number): Response;
|
||||
}
|
||||
declare var Response: ResponseConstructor;
|
||||
|
||||
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";
|
||||
|
||||
interface ResponseInit {
|
||||
status: number;
|
||||
statusText?: string;
|
||||
headers?: HeaderInit;
|
||||
}
|
||||
|
||||
declare type HeaderInit = Headers|Array<string>;
|
||||
declare type BodyInit = ArrayBuffer|ArrayBufferView|Blob|FormData|string;
|
||||
declare type RequestInfo = Request|string;
|
||||
|
||||
interface Window {
|
||||
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
|
||||
}
|
||||
|
||||
declare var fetch: typeof window.fetch;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/// <reference path="xmlpoke.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
// tsc xmlpoke-tests.ts && node xmlpoke-tests.js
|
||||
|
||||
import * as xmlpoke from 'xmlpoke';
|
||||
import * as assert from 'assert';
|
||||
|
||||
let result: string;
|
||||
|
||||
// add with xpath, value
|
||||
result = xmlpoke('<a/>', xml => xml.add('/a/b', 'c'));
|
||||
assert.equal(result, '<a><b>c</b></a>');
|
||||
|
||||
// add with xpath, Transform
|
||||
const addfn: XmlPoke.Transform = (node, value) => 'c';
|
||||
result = xmlpoke('<a/>', xml => xml.add('/a/b', addfn));
|
||||
assert.equal(result, '<a><b>c</b></a>');
|
||||
|
||||
// add with xpath, CDataValue
|
||||
const cdataval: XmlPoke.CDataValue = new xmlpoke.CDataValue('c');
|
||||
result = xmlpoke('<a/>', xml => xml.add('/a/b', cdataval));
|
||||
assert.equal(result, '<a><b><![CDATA[c]]></b></a>');
|
||||
|
||||
// add with xpath, XMLVal
|
||||
const xmlval = new xmlpoke.XmlString('<c/>');
|
||||
result = xmlpoke('<a/>', xml => xml.add('/a/b', xmlval));
|
||||
assert.equal(result, '<a><b><c/></b></a>');
|
||||
|
||||
// add with map
|
||||
result = xmlpoke('<a/>', xml => xml.add({
|
||||
'/a/b': 'c'
|
||||
}));
|
||||
assert.equal(result, '<a><b>c</b></a>');
|
||||
|
||||
// set with xpath, value
|
||||
result = xmlpoke('<a>b</a>', xml => xml.set('/a', 'c'));
|
||||
assert.equal(result, '<a>c</a>');
|
||||
|
||||
// set with map
|
||||
result = xmlpoke('<a>b</a>', xml => xml.set({
|
||||
'/a': 'c'
|
||||
}));
|
||||
assert.equal(result, '<a>c</a>');
|
||||
|
||||
// set with xpath that doesn't exist (no-op)
|
||||
result = xmlpoke('<a><b>bval</b></a>', xml => xml.set('/a/c', 'cval'));
|
||||
assert.equal(result, '<a><b>bval</b></a>');
|
||||
|
||||
// setOrAdd with xpath, value
|
||||
result = xmlpoke('<a/>', xml => xml.setOrAdd('/a/b', 'c'));
|
||||
assert.equal(result, '<a><b>c</b></a>');
|
||||
|
||||
// setOrAdd with map
|
||||
result = xmlpoke('<a/>', xml => xml.setOrAdd({
|
||||
'/a/b': 'c'
|
||||
}));
|
||||
assert.equal(result, '<a><b>c</b></a>');
|
||||
|
||||
// setOrAdd with xpath that doesn't exist: add
|
||||
result = xmlpoke('<a><b>bval</b></a>', xml => xml.setOrAdd('/a/c', 'cval'));
|
||||
assert.equal(result, '<a><b>bval</b><c>cval</c></a>');
|
||||
|
||||
// remove
|
||||
result = xmlpoke('<a><b/></a>', xml => xml.remove('//b'));
|
||||
assert.equal(result, '<a/>');
|
||||
|
||||
// clear
|
||||
result = xmlpoke('<a><b/></a>', xml => xml.clear('/a'));
|
||||
assert.equal(result, '<a/>');
|
||||
|
||||
// withBasePath, addNamespace, errorOnNoMatches
|
||||
result = xmlpoke('<test><x><![CDATA[hello]]></x></test>', xml =>
|
||||
xml.withBasePath('/test')
|
||||
.addNamespace('x', 'http://example.com/x')
|
||||
.errorOnNoMatches()
|
||||
.set('/x', (node, value) => {
|
||||
assert.equal(typeof node, 'object');
|
||||
assert.equal((node.constructor as any).name, 'Element');
|
||||
assert.equal(value, 'hello');
|
||||
return 'y';
|
||||
}));
|
||||
assert.equal(result, '<test><x>y</x></test>');
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for xmlpoke 0.1.12
|
||||
// Project: https://github.com/mikeobrien/node-xmlpoke
|
||||
// Definitions by: Garth Kidd <https://github.com/garthk/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../xpath/xpath.d.ts" />
|
||||
|
||||
declare module XmlPoke { // ghost module
|
||||
interface Transform {
|
||||
(node: Node, value: string): Value;
|
||||
}
|
||||
type Value = string | boolean | number | XmlValue | CDataValue | PathToValueMap | Transform;
|
||||
type PathToValueMap = {
|
||||
[xpath: string]: Value;
|
||||
}
|
||||
interface API {
|
||||
add(xpath: string, value: Value): API;
|
||||
add(map: PathToValueMap): API;
|
||||
set(xpath: string, value: Value): API;
|
||||
set(map: PathToValueMap): API;
|
||||
setOrAdd(xpath: string, value: Value): API;
|
||||
setOrAdd(map: PathToValueMap): API;
|
||||
remove(xpath: string): API;
|
||||
clear(xpath: string): API;
|
||||
withBasePath(xpath: string): API;
|
||||
addNamespace(prefix: string, uri: string): API;
|
||||
errorOnNoMatches(): API;
|
||||
}
|
||||
interface CDataValue {
|
||||
value: string;
|
||||
}
|
||||
interface XmlValue {
|
||||
value: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'xmlpoke' {
|
||||
const xmlpoke: {
|
||||
(xml: string, modify: (api: XmlPoke.API) => void): string;
|
||||
CDataValue: new (value: string) => XmlPoke.CDataValue;
|
||||
XmlString: new (value: string) => XmlPoke.XmlValue;
|
||||
};
|
||||
namespace xmlpoke {}
|
||||
export = xmlpoke;
|
||||
}
|
||||
Reference in New Issue
Block a user