This commit is contained in:
Craig Kovatch
2018-01-10 11:01:32 -08:00
29 changed files with 741 additions and 471 deletions
+2
View File
@@ -169,6 +169,8 @@ export const allLimit: typeof everyLimit;
export function concat<T, R, E>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function concat<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function concatLimit<T, R, E>(arr: T[] | IterableIterator<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function concatLimit<T, R, E>(arr: Dictionary<T>, limit: number,iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export const concatSeries: typeof concat;
// Control Flow
+7 -7
View File
@@ -120,7 +120,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
dynamodb: {
Keys: {
Id: {
N: 101
N: '101'
}
},
NewImage: {
@@ -128,7 +128,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
S: 'New item!'
},
Id: {
N: 101
N: '101'
}
},
StreamViewType: 'NEW_AND_OLD_IMAGES',
@@ -150,13 +150,13 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
S: 'New item!'
},
Id: {
N: 101
N: '101'
}
},
SequenceNumber: '222',
Keys: {
Id: {
N: 101
N: '101'
}
},
SizeBytes: 59,
@@ -165,7 +165,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
S: 'This item has changed'
},
Id: {
N: 101
N: '101'
}
},
StreamViewType: 'NEW_AND_OLD_IMAGES'
@@ -182,7 +182,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
dynamodb: {
Keys: {
Id: {
N: 101
N: '101'
}
},
SizeBytes: 38,
@@ -192,7 +192,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
S: 'This item has changed'
},
Id: {
N: 101
N: '101'
}
},
StreamViewType: 'NEW_AND_OLD_IMAGES'
+1 -1
View File
@@ -74,7 +74,7 @@ interface AttributeValue {
BOOL?: boolean;
L?: Array<AttributeValue>;
M?: { [id: string]: AttributeValue };
N?: number;
N?: string;
NS?: Array<string>;
NULL?: boolean;
S?: string;
+7 -6
View File
@@ -4,6 +4,7 @@
// Cameron Crothers <https://github.com/JProgrammer>
// Marshall Cottrell <https://github.com/marshall007>
// Weeco <https://github.com/weeco>
// Gabriel Terwesten <https://github.com/blaugold>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -456,18 +457,18 @@ declare namespace Bull {
nextRepeatableJob(name: string, data: any, opts: JobOptions): Promise<Job>;
/**
* Removes a given repeatable job. The RepeatOpts needs to be the same as the ones used for
* the job when it was added.
* Removes a given repeatable job. The RepeatOptions and JobId needs to be the same as the ones
* used for the job when it was added.
*/
removeRepeatable(repeat: RepeatOptions): Promise<void>;
removeRepeatable(repeat: RepeatOptions & { jobId?: JobId }): Promise<void>;
/**
* Removes a given repeatable job. The RepeatOpts needs to be the same as the ones used for
* the job when it was added.
* Removes a given repeatable job. The RepeatOptions and JobId needs to be the same as the ones
* used for the job when it was added.
*
* name: The name of the to be removed job
*/
removeRepeatable(name: string, repeat: RepeatOptions): Promise<void>;
removeRepeatable(name: string, repeat: RepeatOptions & { jobId?: JobId }): Promise<void>;
/**
* Returns a promise that resolves with the job counts for the given queue.
+14 -209
View File
@@ -1,3 +1,10 @@
interface Window {
kanbanData: any;
themeVarient: string;
themeStyle: string;
themeColor: string;
}
module AccordionComponent {
$(function () {
var sample = new ej.Accordion($("#basicAccordion"), {
@@ -18,8 +25,6 @@ module AccordionComponent {
});
}
module AutocompleteComponent{
var carList = [
"Audi S6", "Austin-Healey", "Alfa Romeo", "Aston Martin",
@@ -54,10 +59,6 @@ module AutocompleteComponent{
});
}
module Barcodecomponent {
$(function () {
var barcodesample = new ej.datavisualization.Barcode($("#Barcode"), {
@@ -66,16 +67,13 @@ module Barcodecomponent {
});
}
module Bulletgraphcomponent {
$(function () {
var bulletsample = new ej.datavisualization.BulletGraph($("#BulletGraph"), {
isResponsive: true,
load: function () {
var sender = $("#BulletGraph").data("ejBulletGraph");
var theme: string;
var bulletTheme = window.themeStyle + window.themeColor + window.themeVarient;
if (bulletTheme) {
switch (bulletTheme) {
@@ -129,10 +127,6 @@ module Bulletgraphcomponent {
});
}
module ButtonComponent {
$(function () {
var basicButton = new ej.Button($("#buttonnormal"), {
@@ -178,10 +172,8 @@ module ButtonComponent {
});
}
module ChartComponent {
var theme = "???";
$(function () {
var chartsample = new ej.datavisualization.Chart($("#Chart"), {
primaryXAxis: {
@@ -259,7 +251,6 @@ module ChartComponent {
model.primaryYAxis.labelIntersectAction = "rotate45";
model.primaryYAxis.edgeLabelPlacement = "hide";
}
var theme = window.themeStyle + window.themeColor + window.themeVarient;
if (theme) {
switch (theme) {
case "flatdark":
@@ -301,16 +292,11 @@ module ChartComponent {
},
title: { text: 'Efficiency of oil-fired power production' },
size: { height: "600" },
legend: { visible: true},
load:"loadTheme"
legend: { visible: true}
});
});
}
module circulargaugecomponent {
$(function () {
var circularsample = new ej.datavisualization.CircularGauge($("#CircularGauge"), {
@@ -362,9 +348,6 @@ module circulargaugecomponent {
});
}
module ColorPickerComponent {
$(function () {
var colorSample = new ej.ColorPicker($("#colorpick"), {
@@ -373,31 +356,6 @@ module ColorPickerComponent {
});
}
module ComboBoxComponent{
var BikeList = [
{ empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" },
{ empid: "bk4", text: "Discover" }, { empid: "bk5", text: "Dazzler" }, { empid: "bk6", text: "Flame" },
{ empid: "bk7", text: "Fazzer" }, { empid: "bk8", text: "FZ-S" }, { empid: "bk9", text: "Pulsar" },
{ empid: "bk10", text: "Shine" }, { empid: "bk11", text: "R15" }, { empid: "bk12", text: "Unicorn" }
];
$(function () {
var comboboxInstance =new ej.ComboBox($("#selectCar"), {
width: "100%",
placeholder: "Select a Bike",
fields: { text: "text", value: "empid" },
dataSource: BikeList,
autofill: true
});
});
}
module DatePickerComponent {
$(function () {
var dateSample = new ej.DatePicker($("#datepick"), {
@@ -406,9 +364,6 @@ module DatePickerComponent {
});
}
module DateTimePickerComponent {
$(function () {
var datetimeSample = new ej.DateRangePicker($("#daterangepick"), {
@@ -417,8 +372,6 @@ module DateTimePickerComponent {
});
}
module DateTimePickerComponent {
$(function () {
var datetimeSample = new ej.DateTimePicker($("#datetimepick"), {
@@ -427,8 +380,6 @@ module DateTimePickerComponent {
});
}
$(function () {
var diagram = new ej.datavisualization.Diagram($("#diagram"), {
width: "1000px",
@@ -501,8 +452,6 @@ function createLabel(options : any) {
return options;
}
module DialogComponent {
$(function () {
var dialogInstance = new ej.Dialog($("#basicDialog"), {
@@ -525,9 +474,6 @@ module DialogComponent {
});
}
module digitalgaugecomponent {
$(function () {
var digitalgaugesample = new ej.datavisualization.DigitalGauge($("#DigitalGauge"), {
@@ -551,10 +497,6 @@ module digitalgaugecomponent {
}
module DropDownListComponent {
var BikeList = [
{ empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" },
@@ -586,10 +528,6 @@ module DropDownListComponent {
}
module ExplorerComponent {
$(function () {
var file = new ej.FileExplorer($("#fileExplorer"), {
@@ -603,9 +541,6 @@ module ExplorerComponent {
});
}
module GanttComponent {
$(function () {
var ganttInstance = new ej.Gantt($("#GanttContainer"), {
@@ -656,8 +591,6 @@ module GanttComponent {
});
}
module GridComponent {
$(function () {
var gridInstance = new ej.Grid($("#Grid"), {
@@ -693,8 +626,6 @@ module GridComponent {
});
}
var columns = ["Vegie-spread", "Tofuaa", "Alice Mutton", "Konbu", "Fl�temysost"]
var itemSource: any[] = [];
for (var i = 0; i < columns.length; i++) {
@@ -740,13 +671,6 @@ $(function () {
});
});
declare var window:myWindow;
export interface myWindow extends Window{
kanbanData:any;
}
module KanbanComponent {
$(function () {
var sample = new ej.Kanban($("#Kanban"), {
@@ -769,9 +693,6 @@ module KanbanComponent {
});
}
module lineargaugecomponent {
$(function () {
var linearsample = new ej.datavisualization.LinearGauge($("#LinearGauge"), {
@@ -800,10 +721,6 @@ module lineargaugecomponent {
});
}
module ListBoxComponent {
$(function () {
var listboxInstance = new ej.ListBox($("#selectcar"), {
@@ -812,8 +729,6 @@ module ListBoxComponent {
});
}
module ListviewComponent {
$(function () {
var listviewInstance = new ej.ListView($("#defaultlistview"), {
@@ -823,7 +738,6 @@ module ListviewComponent {
});
}
var world_map=
{
"type": "FeatureCollection",
@@ -1050,11 +964,6 @@ module mapcomponenet {
}
module MenuComponent {
$(function () {
var sample = new ej.Menu($("#syncfusionProducts"),{
@@ -1078,12 +987,6 @@ module MenuComponent {
}
module NavigationDrawerComponent {
$(function () {
var navigationdrawerInstance = new ej.NavigationDrawer($("#navpane"), {
@@ -1105,8 +1008,6 @@ module NavigationDrawerComponent {
});
}
module PDFViewerComponent {
$(function () {
var pdfviewerControl = new ej.PdfViewer($("#pdfviewer"), {
@@ -1116,8 +1017,6 @@ module PDFViewerComponent {
});
}
module PivotChartOlap {
$(function () {
var sample = new ej.PivotChart($("#PivotChart"),{
@@ -1154,14 +1053,11 @@ module PivotChartOlap {
size: { height: "460px", width: "100%" },
primaryXAxis: { title: { text: "Date - Fiscal" }, labelRotation: 0 },
primaryYAxis: { title: { text: "Internet Sales Amount" } },
legend: { visible: true, rowCount: 2 },
load:"loadTheme"
legend: { visible: true, rowCount: 2 }
});
});
}
var pivot_dataset = [
{ Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" },
{ Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" },
@@ -1229,14 +1125,11 @@ module PivotChartRelational {
},
size: { height: "460px", width: "100%" },
primaryYAxis: { title: { text: "Amount" } },
legend: { visible: true },
load:"loadTheme"
legend: { visible: true }
});
});
}
module PivotGaugeOlap {
$(function () {
@@ -1342,8 +1235,6 @@ module PivotGaugeOlap {
});
}
var pivot_dataset = [
{ Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" },
{ Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" },
@@ -1463,8 +1354,6 @@ module PivotGaugeRelational {
});
}
module PivotGridOlap {
$(function () {
@@ -1502,8 +1391,6 @@ module PivotGridOlap {
});
}
var pivot_dataset = [
{ Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" },
{ Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" },
@@ -1572,8 +1459,6 @@ module PivotGridRelational {
});
}
module PivotTreeMap {
$(function () {
var sample = new ej.PivotTreeMap($("#PivotTreeMap"),{
@@ -1607,8 +1492,6 @@ module PivotTreeMap {
});
}
module ProgressBarComponent {
$(function () {
var sample = new ej.ProgressBar($("#progressBar"),{
@@ -1625,9 +1508,6 @@ module ProgressBarComponent {
}
declare var rteObj: any;
declare var data: any;
var radialEle = $('#defaultradialmenu'), action = 0, forRedo = 0;
@@ -1671,7 +1551,6 @@ module RadialMenuComponent {
});
}
function bold(e: any) {
rteObj = rteEle.data("ejRTE");
@@ -1707,9 +1586,6 @@ function redo(e: any) {
radialEle.focus();
}
module RadialSliderComponent {
$(function () {
var radialsliderInstance = new ej.RadialSlider($("#radialSlider"), {
@@ -1718,7 +1594,6 @@ module RadialSliderComponent {
});
}
module rangecomponent {
$(function () {
var linearsample = new ej.datavisualization.RangeNavigator($("#RangeNavigator"), {
@@ -1833,8 +1708,6 @@ function GetData() {
return data;
};
module RatingComponent {
$(function () {
@@ -1889,8 +1762,6 @@ module RatingComponent {
}
module ReportViewerComponent {
$(function () {
var report = new ej.ReportViewer($("#territoryReportViewer"), {
@@ -1903,8 +1774,6 @@ module ReportViewerComponent {
});
}
var fontfamily = ["Segoe UI", "Arial", "Times New Roman", "Tahoma", "Helvetica"], fontsize = ["1pt", "2pt", "3pt", "4pt", "5pt"], action1 = ["New", "Clear"], action2 = ["Bold", "Italic", "Underline", "strikethrough", "superscript", "subscript", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyFull", "Undo", "Redo"];
module RibbonComponent {
$(function () {
@@ -2579,7 +2448,7 @@ module RibbonComponent {
function colorHandler(args:any) {
(this._id.indexOf("fillcolor") != -1) ? $("#contenteditor").css('background-color', args.value) : document.execCommand('forecolor', false, args.value);
}
function onClick(args) {
function onClick(args: any) {
var val, prop = args.text;
val = (ej.isNullOrUndefined(args.model.text)) ? args.model.activeText : args.model.text;
if (action1.indexOf(val) != -1)
@@ -2595,10 +2464,6 @@ function onClick(args) {
}
module RotatorComponent {
$(function () {
var rotatorInstance = new ej.Rotator($("#sliderContent"), {
@@ -2620,8 +2485,6 @@ module RotatorComponent {
});
}
module RTEComponent {
$(function () {
var sample = new ej.RTE($("#rteSample"),{
@@ -2692,8 +2555,6 @@ module RTEComponent {
}
module ScheduleComponent {
$(function () {
var sample = new ej.Schedule($("#Schedule1"), {
@@ -2762,8 +2623,6 @@ module ScheduleComponent {
});
}
module ScrollerComponent {
$(function () {
var scrollerSample = new ej.Scroller($("#scrollcontent"), {
@@ -2777,8 +2636,6 @@ module ScrollerComponent {
});
}
module SignatureComponent {
$(function () {
var basicSignature = new ej.Signature($("#signature"), {
@@ -2789,9 +2646,6 @@ module SignatureComponent {
});
}
module SliderComponent {
$(function () {
var slider = new ej.Slider($("#minSlider"), {
@@ -2810,10 +2664,6 @@ module SliderComponent {
}
module linesparkline {
$(function () {
@@ -2942,10 +2792,6 @@ module piesparkline4 {
}
module SplitterComponent {
$(function () {
var splitterInstance = new ej.Splitter($("#outterSpliter"), {
@@ -2961,8 +2807,6 @@ module SplitterComponent {
});
}
module SpreadsheetComponent {
$(function () {
var sample = new ej.Spreadsheet($("#basicSpreadsheet"), {
@@ -2990,9 +2834,6 @@ $(function () {
});
}
var default_data: Array<Object> = [
{ Category : "Employees", Country : "USA", JobDescription : "Sales", JobGroup:"Executive", EmployeesCount : 50 },
{ Category : "Employees", Country : "USA", JobDescription : "Sales", JobGroup : "Analyst", EmployeesCount : 40 },
@@ -3058,15 +2899,11 @@ module sunburstcomponent {
},
title:{text:"Employees Count"},
zoomSettings:{enable:false},
legend:{visible:true,position:'top'},
load:"loadTheme"
legend:{visible:true,position:'top'}
});
});
}
module TabComponent {
$(function () {
var sample = new ej.Tab($("#defaultTab"),{
@@ -3080,11 +2917,8 @@ module TabComponent {
});
}
module TagCloudComponent {
var websiteCollection = [
{ text: "Google", url: "http://www.google.com", frequency: 12 },
{ text: "All Things Digital", url: "http://allthingsd.com/", frequency: 3 },
@@ -3119,8 +2953,6 @@ module TagCloudComponent {
});
}
module EditorComponent {
$(function () {
var num = new ej.NumericTextbox($("#numeric"), {
@@ -3153,10 +2985,6 @@ module EditorComponent {
});
}
module TileViewComponent {
$(function () {
var tile1 = new ej.Tile($("#tile1"), {
@@ -3235,8 +3063,6 @@ module TileViewComponent {
});
}
module TimePickerComponent {
$(function () {
var timeSample = new ej.TimePicker($("#timepick"), {
@@ -3245,9 +3071,6 @@ module TimePickerComponent {
});
}
module ToolbarComponent {
$(function () {
@@ -3264,9 +3087,6 @@ module ToolbarComponent {
}
module TooltipComponent {
$(function () {
@@ -3322,8 +3142,6 @@ module TooltipComponent {
});
}
module TreeGridComponent {
$(function () {
var treegridInstance = new ej.TreeGrid($("#TreeGridContainer"), {
@@ -3365,9 +3183,6 @@ module TreeGridComponent {
});
}
var population_data: Array<Object> = [
{ Continent: "Asia", Country: "Indonesia", Growth: 3, Population: 237641326 },
{ Continent: "Asia", Country: "Russia", Growth: 2, Population: 152518015 },
@@ -3406,10 +3221,6 @@ module treemapcomponent {
});
}
module TreeViewComponent {
$(function () {
var tree = new ej.TreeView($("#treeView"), {
@@ -3421,9 +3232,6 @@ module TreeViewComponent {
});
}
module UploadboxComponent {
$(function () {
@@ -3445,9 +3253,6 @@ module UploadboxComponent {
}
module WaitingPopupComponent {
$(function () {
var sample = new ej.WaitingPopup($("#target"),{
+7 -1
View File
@@ -1,8 +1,14 @@
// Type definitions for lime-js 0.0.3
// Type definitions for lime-js 0.0.4
// Project: https://github.com/takenet/lime-js
// Definitions by: Arthur Xavier <https://github.com/arthur-xavier>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Support for painless dependency injection
export as namespace Lime;
// Support AMD require
export = Lime;
declare namespace Lime {
interface Envelope {
+1 -1
View File
@@ -1,4 +1,4 @@
import * as Lime from 'lime-js';
var transport = new Lime.WebSocketTransport(true);
var clientChannel = new Lime.ClientChannel(transport, true, true);
+4 -3
View File
@@ -2,9 +2,10 @@
// Project: https://github.com/krasimir/navigo
// Definitions by: Adrian Ehrsam <https://github.com/aersamkull>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
type Keys = string
type State = {[k in Keys]: any}
type Keys = string;
type State = {[k in Keys]: any};
type Params = State;
interface NavigoHooks {
@@ -46,7 +47,7 @@ declare class Navigo {
resolve(currentURL?: string): boolean;
link(path: string): string;
lastRouteResolved(): {url: string, query: string};
disableIfAPINotAvailable(): void;
+11 -3
View File
@@ -1,14 +1,22 @@
import Navigo = require("navigo");
type Keys = string;
type State = {[k in Keys]: any};
type Params = State;
const root = null;
const useHash = false;
let router = new Navigo(root, useHash);
const before = (done: (suppress?: boolean) => void, params: Params) => done();
const after = (params: Params) => params;
router.hooks({
before: function(done, params) { //do something },
after: function(params) { //do something }
});
before,
after
});
router
.on('/products/list', () => {
+29
View File
@@ -0,0 +1,29 @@
// Type definitions for react-flags-select 1.1
// Project: https://github.com/ekwonye-richard/react-flags-select#readme
// Definitions by: Artur Sianiuk <https://github.com/senukartur>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Component } from 'react';
interface Props {
countries?: string[];
blackList?: boolean;
customLabels?: {[propName: string]: string};
selectedSize?: number;
optionsSize?: number;
defaultCountry?: string;
placeholder?: string;
className?: string;
showSelectedLabel?: boolean;
showOptionLabel?: boolean;
alignOptions?: string;
onSelect?: (countryCode: string) => void;
disabled?: boolean;
searchable?: boolean;
}
declare class ReactFlagsSelect extends Component<Props> {
updateSelected(countryCode: string): void;
}
export default ReactFlagsSelect;
@@ -0,0 +1,73 @@
import * as React from 'react';
import ReactFlagsSelect from 'react-flags-select';
export class ReactFlagsSelectTest extends React.Component {
countries = ['US', 'GB', 'FR', 'DE', 'IT'];
customLabels = {US: 'EN-US', GB: 'EN-GB', FR: 'FR', DE: 'DE', IT: 'IT'};
onSelectFlag(countryCode: string) { }
render() {
return (
<div>
<ReactFlagsSelect />
<ReactFlagsSelect defaultCountry='US' />
<ReactFlagsSelect searchable={true} />
<ReactFlagsSelect countries={this.countries} />
<ReactFlagsSelect countries={this.countries} blackList={true} />
<ReactFlagsSelect className='menu-flags' />
<ReactFlagsSelect alignOptions='left' />
<ReactFlagsSelect
countries={this.countries}
customLabels={this.customLabels}
/>
<ReactFlagsSelect
countries={this.countries}
customLabels={this.customLabels}
placeholder='Select Language'
/>
<ReactFlagsSelect
countries={this.countries}
customLabels={this.customLabels}
placeholder='Select Language'
showSelectedLabel={false}
/>
<ReactFlagsSelect
countries={this.countries}
customLabels={this.customLabels}
placeholder='Select Language'
showSelectedLabel={false}
showOptionLabel={false}
/>
<ReactFlagsSelect
countries={this.countries}
customLabels={this.customLabels}
placeholder='Select Language'
showSelectedLabel={false}
showOptionLabel={false}
selectedSize={14}
/>
<ReactFlagsSelect
countries={this.countries}
customLabels={this.customLabels}
placeholder='Select Language'
showSelectedLabel={false}
showOptionLabel={false}
selectedSize={18}
optionsSize={14}
/>
<ReactFlagsSelect
defaultCountry='US'
showSelectedLabel={false}
disabled={true}
/>
<ReactFlagsSelect
defaultCountry='GB'
onSelect={this.onSelectFlag}
/>
<ReactFlagsSelect
ref='userFlag'
defaultCountry='FR'
/>
</div>
);
}
}
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-flags-select-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+180 -174
View File
@@ -1,184 +1,190 @@
// Type definitions for react-loadable 5.3
// Project: https://github.com/thejameskyle/react-loadable#readme
// Definitions by: Diogo Franco <https://github.com/Kovensky>, Oden S. <https://github.com/odensc>
// Definitions by: Diogo Franco <https://github.com/Kovensky>, Oden S. <https://github.com/odensc>, Ian Ker-Seymer <https://github.com/ianks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import * as React from 'react';
/// <reference types="react" />
export interface LoadingComponentProps {
isLoading: boolean;
pastDelay: boolean;
timedOut: boolean;
error: any;
declare namespace Loadable {
interface LoadingComponentProps {
isLoading: boolean;
pastDelay: boolean;
timedOut: boolean;
error: any;
}
type Options<Props, Exports extends object> = OptionsWithoutRender<Props> | OptionsWithRender<Props, Exports>;
interface CommonOptions {
/**
* React component displayed after delay until loader() succeeds. Also responsible for displaying errors.
*
* If you don't want to render anything you can pass a function that returns null
* (this is considered a valid React component).
*/
// NOTE: () => null is only needed until React.SFC supports components returning null
loading: React.ComponentType<LoadingComponentProps> | (() => null);
/**
* Defaults to 200, in milliseconds.
*
* Only show the loading component if the loader() has taken this long to succeed or error.
*/
delay?: number | false | null;
/**
* Disabled by default.
*
* After the specified time in milliseconds passes, the component's `timedOut` prop will be set to true.
*/
timeout?: number | false | null;
/**
* Optional array of module paths that `Loadable.Capture`'s `report` function will be applied on during
* server-side rendering. This helps the server know which modules were imported/used during SSR.
* ```ts
* Loadable({
* loader: () => import('./my-component'),
* modules: ['./my-component'],
* });
* ```
*/
modules?: string[];
/**
* An optional function which returns an array of Webpack module ids which you can get
* with require.resolveWeak. This is used by the client (inside `Loadable.preloadReady`) to
* guarantee each webpack module is preloaded before the first client render.
* ```ts
* Loadable({
* loader: () => import('./Foo'),
* webpack: () => [require.resolveWeak('./Foo')],
* });
* ```
*/
webpack?: () => number[];
}
interface OptionsWithoutRender<Props> extends CommonOptions {
/**
* Function returning a promise which returns a React component displayed on success.
*
* Resulting React component receives all the props passed to the generated component.
*/
loader(): Promise<React.ComponentType<Props> | { default: React.ComponentType<Props> }>;
}
interface OptionsWithRender<Props, Exports extends object> extends CommonOptions {
/**
* Function returning a promise which returns an object to be passed to `render` on success.
*/
loader(): Promise<Exports>;
/**
* If you want to customize what gets rendered from your loader you can also pass `render`.
*
* Note: If you want to load multiple resources at once, you can also use `Loadable.Map`.
*
* ```ts
* Loadable({
* // ...
* render(loaded, props) {
* const Component = loaded.default;
* return <Component {...props} />
* }
* });
* ```
*/
render(loaded: Exports, props: Props): React.ReactNode;
// NOTE: render is not optional if the loader return type is not compatible with the type
// expected in `OptionsWithoutRender`. If you do not want to provide a render function, ensure that your
// function is returning a promise for a React.ComponentType or is the result of import()ing a module
// that has a component as its `default` export.
}
interface OptionsWithMap<Props, Exports extends { [key: string]: any }> extends CommonOptions {
/**
* An object containing functions which return promises, which resolve to an object to be passed to `render` on success.
*/
loader: {
[P in keyof Exports]: () => Promise<Exports[P]>
};
/**
* If you want to customize what gets rendered from your loader you can also pass `render`.
*
* Note: If you want to load multiple resources at once, you can also use `Loadable.Map`.
*
* ```ts
* Loadable({
* // ...
* render(loaded, props) {
* const Component = loaded.default;
* return <Component {...props} />
* }
* });
* ```
*/
render(loaded: Exports, props: Props): React.ReactNode;
}
interface LoadableComponent {
/**
* The generated component has a static method preload() for calling the loader function ahead of time.
* This is useful for scenarios where you think the user might do something next and want to load the
* next component eagerly.
*
* Note: preload() intentionally does not return a promise. You should not be depending on the timing of
* preload(). It's meant as a performance optimization, not for creating UI logic.
*/
preload(): void;
}
interface LoadableCaptureProps {
/**
* Function called for every moduleName that is rendered via React Loadable.
*/
report: (moduleName: string) => void;
}
interface Loadable {
<Props, Exports extends object>(options: Options<Props, Exports>): React.ComponentType<Props> & LoadableComponent;
Map<Props, Exports extends { [key: string]: any }>(options: OptionsWithMap<Props, Exports>): React.ComponentType<Props> & LoadableComponent;
/**
* This will call all of the LoadableComponent.preload methods recursively until they are all
* resolved. Allowing you to preload all of your dynamic modules in environments like the server.
* ```ts
* Loadable.preloadAll().then(() => {
* app.listen(3000, () => {
* console.log('Running on http://localhost:3000/');
* });
* });
* ```
*/
preloadAll(): Promise<void>;
/**
* Check for modules that are already loaded in the browser and call the matching
* `LoadableComponent.preload` methods.
* ```ts
* window.main = () => {
* Loadable.preloadReady().then(() => {
* ReactDOM.hydrate(
* <App/>,
* document.getElementById('app'),
* );
* });
* };
* ```
*/
preloadReady(): Promise<void>;
Capture: React.ComponentType<LoadableCaptureProps>;
}
}
export type Options<Props, Exports extends object> = OptionsWithoutRender<Props> | OptionsWithRender<Props, Exports>;
declare const LoadableExport: Loadable.Loadable;
export interface CommonOptions {
/**
* React component displayed after delay until loader() succeeds. Also responsible for displaying errors.
*
* If you don't want to render anything you can pass a function that returns null
* (this is considered a valid React component).
*/
// NOTE: () => null is only needed until React.SFC supports components returning null
loading: React.ComponentType<LoadingComponentProps> | (() => null);
/**
* Defaults to 200, in milliseconds.
*
* Only show the loading component if the loader() has taken this long to succeed or error.
*/
delay?: number | false | null;
/**
* Disabled by default.
*
* After the specified time in milliseconds passes, the component's `timedOut` prop will be set to true.
*/
timeout?: number | false | null;
/**
* Optional array of module paths that `Loadable.Capture`'s `report` function will be applied on during
* server-side rendering. This helps the server know which modules were imported/used during SSR.
* ```ts
* Loadable({
* loader: () => import('./my-component'),
* modules: ['./my-component'],
* });
* ```
*/
modules?: string[];
/**
* An optional function which returns an array of Webpack module ids which you can get
* with require.resolveWeak. This is used by the client (inside `Loadable.preloadReady`) to
* guarantee each webpack module is preloaded before the first client render.
* ```ts
* Loadable({
* loader: () => import('./Foo'),
* webpack: () => [require.resolveWeak('./Foo')],
* });
* ```
*/
webpack?: () => number[];
/* tslint:disable-next-line */
declare module "react-loadable" {
export = LoadableExport;
}
export interface OptionsWithoutRender<Props> extends CommonOptions {
/**
* Function returning a promise which returns a React component displayed on success.
*
* Resulting React component receives all the props passed to the generated component.
*/
loader(): Promise<React.ComponentType<Props> | { default: React.ComponentType<Props> }>;
}
export interface OptionsWithRender<Props, Exports extends object> extends CommonOptions {
/**
* Function returning a promise which returns an object to be passed to `render` on success.
*/
loader(): Promise<Exports>;
/**
* If you want to customize what gets rendered from your loader you can also pass `render`.
*
* Note: If you want to load multiple resources at once, you can also use `Loadable.Map`.
*
* ```ts
* Loadable({
* // ...
* render(loaded, props) {
* const Component = loaded.default;
* return <Component {...props} />
* }
* });
* ```
*/
render(loaded: Exports, props: Props): React.ReactNode;
// NOTE: render is not optional if the loader return type is not compatible with the type
// expected in `OptionsWithoutRender`. If you do not want to provide a render function, ensure that your
// function is returning a promise for a React.ComponentType or is the result of import()ing a module
// that has a component as its `default` export.
}
export interface OptionsWithMap<Props, Exports extends { [key: string]: any }> extends CommonOptions {
/**
* An object containing functions which return promises, which resolve to an object to be passed to `render` on success.
*/
loader: {
[P in keyof Exports]: () => Promise<Exports[P]>
};
/**
* If you want to customize what gets rendered from your loader you can also pass `render`.
*
* Note: If you want to load multiple resources at once, you can also use `Loadable.Map`.
*
* ```ts
* Loadable({
* // ...
* render(loaded, props) {
* const Component = loaded.default;
* return <Component {...props} />
* }
* });
* ```
*/
render(loaded: Exports, props: Props): React.ReactNode;
}
export interface LoadableComponent {
/**
* The generated component has a static method preload() for calling the loader function ahead of time.
* This is useful for scenarios where you think the user might do something next and want to load the
* next component eagerly.
*
* Note: preload() intentionally does not return a promise. You should not be depending on the timing of
* preload(). It's meant as a performance optimization, not for creating UI logic.
*/
preload(): void;
}
export interface LoadableCaptureProps {
/**
* Function called for every moduleName that is rendered via React Loadable.
*/
report: (moduleName: string) => void;
}
export interface Loadable {
<Props, Exports extends object>(options: Options<Props, Exports>): React.ComponentType<Props> & LoadableComponent;
Map<Props, Exports extends { [key: string]: any }>(options: OptionsWithMap<Props, Exports>): React.ComponentType<Props> & LoadableComponent;
/**
* This will call all of the LoadableComponent.preload methods recursively until they are all
* resolved. Allowing you to preload all of your dynamic modules in environments like the server.
* ```ts
* Loadable.preloadAll().then(() => {
* app.listen(3000, () => {
* console.log('Running on http://localhost:3000/');
* });
* });
* ```
*/
preloadAll(): Promise<void>;
/**
* Check for modules that are already loaded in the browser and call the matching
* `LoadableComponent.preload` methods.
* ```ts
* window.main = () => {
* Loadable.preloadReady().then(() => {
* ReactDOM.hydrate(
* <App/>,
* document.getElementById('app'),
* );
* });
* };
* ```
*/
preloadReady(): Promise<void>;
Capture: React.ComponentType<LoadableCaptureProps>;
}
declare const LoadableExport: Loadable;
export default LoadableExport;
+2 -2
View File
@@ -1,7 +1,7 @@
import * as React from 'react';
import Loadable, { LoadingComponentProps } from 'react-loadable';
import Loadable = require('react-loadable');
class LoadingComponent extends React.Component<LoadingComponentProps> {
class LoadingComponent extends React.Component<Loadable.LoadingComponentProps> {
render() {
return (
<div>
+29 -7
View File
@@ -1,6 +1,6 @@
// Type definitions for React OnSenui (react-onsenui) 2.7
// Type definitions for React Onsen UI (react-onsenui) 2.8
// Project: https://onsen.io/v2/docs/guide/react/
// Definitions by: Ozytis <https://ozytis.fr>
// Definitions by: Ozytis <https://ozytis.fr>, Salim <https://github.com/salim7>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -23,6 +23,10 @@ export interface AnimationOptions {
timing?: string;
}
export interface PullHookChangeEvent {
state: "initial" | "preaction" | "action";
}
/*** splitter ***/
export class SplitterSide extends Component<{
side?: "left" | "right",
@@ -33,13 +37,14 @@ export class SplitterSide extends Component<{
onPreClose?(e?: Event): void,
onModeChange?(e?: Event): void,
onClose?(e?: Event): void,
isSwipeable?: boolean,
swipeable?: boolean,
swipeTargetWidth?: number,
width?: number,
animation?: "overlay" | "default"
animationOptions?: AnimationOptions,
openThreshold?: number,
mode?: "collapse" | "split"
mode?: "collapse" | "split",
className?: string
}, any> { }
export class SplitterContent extends Component { }
@@ -89,11 +94,15 @@ export class Page extends Component<{
/*** Grid ***/
export class Col extends Component<{
verticalAlign?: "top" | "bottom" | "center",
width?: string
width?: string,
className?: string,
style?: React.CSSProperties,
}, any> {}
export class Row extends Component<{
verticalAlign?: "top" | "bottom" | "center",
className?: string,
style?: React.CSSProperties,
}, any> {}
/*** Navigation ***/
@@ -234,7 +243,7 @@ export class ProgressCircular extends Component<{
modifier?: string,
value?: number,
secondaryValue?: boolean,
intermediate?: boolean,
indeterminate?: boolean,
}, any> {}
export class Ripple extends Component<{
@@ -358,4 +367,17 @@ export class ListItem extends Component<{
onClick?: React.MouseEventHandler<any>,
}, any> {}
export class Card extends Component { }
export class Card extends Component<{
modifier?: string,
}, any> {}
/** Pull-to-refresh hook. */
export class PullHook extends Component<{
onChange?(e: PullHookChangeEvent): void,
onLoad?(done: () => void): void,
onPull?(): void,
disabled?: boolean,
height?: number,
thresholdHeight?: number,
fixedContent?: boolean,
}, any> {}
+3 -2
View File
@@ -28,14 +28,15 @@ export class App extends React.Component<AppProps, AppState> {
return (
<Splitter>
<SplitterSide
className='left'
side='left'
collapse={true}
isOpen={this.state.isOpen}
onClose={() => this.hide()}
isSwipeable={true}>
swipeable>
<Page>
Menu content
</Page>
</Page>
</SplitterSide>
<SplitterContent>
<Page>
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for redux-socket.io 1.4
// Project: https://github.com/itaylor/redux-socket.io#readme
// Definitions by: Igor Voropaev <https://github.com/snakeego>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="socket.io-client" />
import { Middleware, Action, Dispatch } from 'redux';
export interface MiddlewareOptions {
eventName?: string;
execute?: <S>(action: Action, emitBound: SocketIOClient.Socket, next: Dispatch<S>, dispatch: Dispatch<S>) => any;
}
export default function createSocketIoMiddleware(
socket: SocketIOClient.Socket,
criteria: (string | ReadonlyArray<string> | ((type: string, action: Action) => boolean)),
options?: MiddlewareOptions
): Middleware;
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"redux": "^3.6.0"
}
}
@@ -0,0 +1,10 @@
import * as ioclient from 'socket.io-client';
import createSocketIoMiddleware from 'redux-socket.io';
import { Action } from 'redux';
const socketio = ioclient("test");
const SocketIOMiddleware1 = createSocketIoMiddleware(socketio, "test");
const SocketIOMiddleware2 = createSocketIoMiddleware(socketio, ["test1", "test2"]);
const SocketIOMiddleware3 = createSocketIoMiddleware(socketio, (type: string, action: Action) => (type === 'test'));
const SocketIOMiddleware4 = createSocketIoMiddleware(socketio, "", { eventName: "test" });
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"redux-socket.io-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+24 -24
View File
@@ -141,7 +141,7 @@ declare namespace sequelize {
*/
(
values?: TAttributes,
options?: BelongsToCreateAssociationMixinOptions | CreateOptions<TAttributes> | BelongsToSetAssociationMixinOptions
options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions
): Promise<void>;
}
@@ -255,7 +255,7 @@ declare namespace sequelize {
*/
(
values?: TAttributes,
options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions<TAttributes>
options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions
): Promise<void>;
}
@@ -496,7 +496,7 @@ declare namespace sequelize {
*/
(
values?: TAttributes,
options?: HasManyCreateAssociationMixinOptions | CreateOptions<TAttributes>
options?: HasManyCreateAssociationMixinOptions | CreateOptions
): Promise<TInstance>;
}
@@ -959,7 +959,7 @@ declare namespace sequelize {
*/
(
values?: TAttributes,
options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions<TAttributes> | { through: TJoinTableAttributes }
options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions | { through: TJoinTableAttributes }
): Promise<TInstance>;
}
@@ -1332,8 +1332,8 @@ declare namespace sequelize {
*/
keyType?: DataTypeAbstract;
/**
* A string to represent the name of the field to use as the key for an 1 to many association in the source table.
*
* A string to represent the name of the field to use as the key for an 1 to many association in the source table.
*
* @see http://docs.sequelizejs.com/class/lib/model.js~Model.html#static-method-hasMany
* @see https://github.com/sequelize/sequelize/blob/b4fd46426db9cdbb97074bea121203d565e4195d/lib/associations/has-many.js#L81
*/
@@ -3187,7 +3187,7 @@ declare namespace sequelize {
/**
* Complex include options
*/
interface IncludeOptions<TAttributes = any> {
interface IncludeOptions {
/**
* The model you want to eagerly load
@@ -3214,7 +3214,7 @@ declare namespace sequelize {
/**
* A list of attributes to select from the child model
*/
attributes?: FindOptionsAttributesArray<TAttributes> | { include?: FindOptionsAttributesArray<TAttributes>, exclude?: keyof TAttributes };
attributes?: FindOptionsAttributesArray | { include?: FindOptionsAttributesArray, exclude?: Array<string> };
/**
* If true, converts to an inner join, which means that the parent model will only be loaded if it has any
@@ -3230,7 +3230,7 @@ declare namespace sequelize {
/**
* Load further nested related models
*/
include?: Array<Model<any, any> | IncludeOptions<TAttributes>>;
include?: Array<Model<any, any> | IncludeOptions>;
/**
* If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will
@@ -3244,14 +3244,14 @@ declare namespace sequelize {
/**
* Shortcut for types used in FindOptions.attributes
*/
type FindOptionsAttributesArray<TAttributes> = Array<keyof TAttributes | literal | [keyof TAttributes, string] | fn | [fn, string] | cast | [cast, string] | [literal, string]>;
type FindOptionsAttributesArray = Array<string | literal | [string, string] | fn | [fn, string] | cast | [cast, string] | [literal, string]>;
/**
* Options that are passed to any model creating a SELECT query
*
* A hash of options to describe the scope of the search
*/
interface FindOptions<T = any> extends LoggingOptions, SearchPathOptions {
interface FindOptions<T> extends LoggingOptions, SearchPathOptions {
/**
* A hash of attributes to describe your search. See above for examples.
@@ -3264,7 +3264,7 @@ declare namespace sequelize {
* `Sequelize.literal`, `Sequelize.fn` and so on), and the second is the name you want the attribute to
* have in the returned instance
*/
attributes?: FindOptionsAttributesArray<T> | { include?: FindOptionsAttributesArray<T>, exclude?: Array<keyof T> };
attributes?: FindOptionsAttributesArray | { include?: FindOptionsAttributesArray, exclude?: Array<string> };
/**
* If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will
@@ -3278,7 +3278,7 @@ declare namespace sequelize {
* If your association are set up with an `as` (eg. `X.hasMany(Y, { as: 'Z }`, you need to specify Z in
* the as attribute when eager loading Y).
*/
include?: Array<Model<any, any> | IncludeOptions<T>>;
include?: Array<Model<any, any> | IncludeOptions>;
/**
* Specifies an ordering. If a string is provided, it will be escaped. Using an array, you can provide
@@ -3319,7 +3319,7 @@ declare namespace sequelize {
* Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs.
* https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group
*/
group?: keyof T | keyof T[] | Object;
group?: string | string[] | Object;
/**
@@ -3338,12 +3338,12 @@ declare namespace sequelize {
rejectOnEmpty?: boolean;
}
type AnyFindOptions = FindOptions;
type AnyFindOptions = FindOptions<any>;
/**
* Options for Model.count method
*/
interface CountOptions<T = any> extends LoggingOptions, SearchPathOptions {
interface CountOptions extends LoggingOptions, SearchPathOptions {
/**
* A hash of search attributes.
@@ -3353,7 +3353,7 @@ declare namespace sequelize {
/**
* Include options. See `find` for details
*/
include?: Array<Model<any, any> | IncludeOptions<T>>;
include?: Array<Model<any, any> | IncludeOptions>;
/**
* Apply COUNT(DISTINCT(col))
@@ -3376,7 +3376,7 @@ declare namespace sequelize {
/**
* Options for Model.build method
*/
interface BuildOptions<T = any> extends ReturningOptions {
interface BuildOptions extends ReturningOptions {
/**
* If set to true, values will ignore field and virtual setters.
@@ -3393,13 +3393,13 @@ declare namespace sequelize {
*
* TODO: See set
*/
include?: Array<Model<any, any> | IncludeOptions<T>>;
include?: Array<Model<any, any> | IncludeOptions>;
}
/**
* Options for Model.create method
*/
interface CreateOptions<T = any> extends BuildOptions<T>, InstanceSaveOptions {
interface CreateOptions extends BuildOptions, InstanceSaveOptions {
/**
* On Duplicate
@@ -3867,7 +3867,7 @@ declare namespace sequelize {
*
* If you provide an `include` option, the number of matching associations will be counted instead.
*/
count(options?: CountOptions<TAttributes>): Promise<number>;
count(options?: CountOptions): Promise<number>;
/**
* Find all the rows matching your query, within a specified offset / limit, and get the total number of
@@ -3925,17 +3925,17 @@ declare namespace sequelize {
/**
* Builds a new model instance. Values is an object of key value pairs, must be defined but can be empty.
*/
build(record?: TAttributes, options?: BuildOptions<TAttributes>): TInstance;
build(record?: TAttributes, options?: BuildOptions): TInstance;
/**
* Undocumented bulkBuild
*/
bulkBuild(records: TAttributes[], options?: BuildOptions<TAttributes>): TInstance[];
bulkBuild(records: TAttributes[], options?: BuildOptions): TInstance[];
/**
* Builds a new model instance and calls save on it.
*/
create(values?: TAttributes, options?: CreateOptions<TAttributes>): Promise<TInstance>;
create(values?: TAttributes, options?: CreateOptions): Promise<TInstance>;
/**
* Find a row that matches the query, or build (but don't save) the row if none is found.
+51 -26
View File
@@ -1,8 +1,13 @@
// Type definitions for speakeasy v2.0.0
// Project: https://github.com/markbao/speakeasy
// Definitions by: Lucas Woo <https://github.com/legendecas>, Alexander Batukhtin <https://github.com/mrOlorin>
// Project: https://github.com/speakeasyjs/speakeasy
// Definitions by: Lucas Woo <https://github.com/legendecas>, Alexander Batukhtin <https://github.com/mrOlorin>, Aayush Kapoor <https://github.com/xeoneux>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface SharedOptions {
encoding?: string;
algorithm?: string;
}
interface Key {
ascii: string;
base32: string;
@@ -14,11 +19,9 @@ interface Key {
otpauth_url?: string;
}
interface DigestOptions {
interface DigestOptions extends SharedOptions {
secret: string;
counter: string;
encoding?: string;
algorithm?: string;
key?: string;
}
@@ -39,56 +42,78 @@ interface GenerateSecretOptions {
symbols?: boolean;
}
interface TotpOptions {
interface TotpOptions extends SharedOptions {
key?: string;
step?: number;
time?: number;
initial_time?: number;
length?: number;
encoding?: string;
counter?: number;
epoch?: number;
secret?: string;
digits?: number;
digest?: () => string;
algorithm?: string;
}
interface HotpOptions {
interface TotpVerifyOptions extends SharedOptions {
secret: string;
token: string;
time?: number;
step?: number;
epoch?: number;
counter?: number;
digits?: number;
window?: number;
}
interface HotpOptions extends SharedOptions {
key: string;
counter: number;
length?: number;
encoding?: string;
digits?: number;
digest?: () => string;
}
interface OtpauthURLOptions {
interface HotpVerifyOptions extends SharedOptions {
secret: string;
token: string;
counter: number;
digits?: number;
window?: number;
}
interface OtpauthURLOptions extends SharedOptions {
secret: string;
label: string;
issuer?: any;
type?: string;
counter?: number;
algorithm?: string;
digits?: number;
period?: number;
encoding?: string;
}
export declare function digest(options: DigestOptions): string;
interface Hotp {
(options: HotpOptions): string;
verifyDelta: (options: HotpVerifyOptions) => boolean;
verify: (options: HotpVerifyOptions) => boolean;
}
export declare function generate_key(options: GenerateOptions): Key;
interface Totp {
(options: TotpOptions): string;
verifyDelta: (options: TotpVerifyOptions) => boolean;
verify: (options: TotpVerifyOptions) => boolean;
}
export declare function generateSecret(options: GenerateSecretOptions): Key;
export declare function generateSecretASCII(length?: number, symbols?: boolean): string;
export declare function otpauthURL(options: OtpauthURLOptions): string;
export declare function hotp(options: HotpOptions): string;
export declare function counter(options: HotpOptions): string;
export declare function totp(options: TotpOptions): string;
export declare const hotp: Hotp;
export declare const totp: Totp;
export declare function time(options: TotpOptions): string;
export declare function counter(options: HotpOptions): string;
export declare function digest(options: DigestOptions): string;
export declare function generate_key(options: GenerateOptions): Key;
export declare function generateSecret(options?: GenerateSecretOptions): Key;
export declare function generateSecretASCII(
length?: number,
symbols?: boolean
): string;
export declare function otpauthURL(options: OtpauthURLOptions): string;
+9 -1
View File
@@ -37,4 +37,12 @@ speakeasy.generateSecretASCII(5, true);
speakeasy.otpauthURL({
secret: 'otpauthURLSecret',
label: 'otpauthURLLength'
});
});
speakeasy.totp.verify({secret: "secret", token: "123456"})
speakeasy.totp.verifyDelta({secret: "secret", token: "123456"})
speakeasy.hotp.verify({secret: "secret", token: "123456", counter: 123})
speakeasy.hotp.verifyDelta({secret: "secret", token: "123456", counter: 123})
+6 -1
View File
@@ -5694,6 +5694,12 @@ declare module _ {
**/
values(): _Chain<T>;
/**
* Wrapped type `object`.
* @see _.mapObject
**/
mapObject(fn: _.ListIterator<T, any>): _Chain<T>;
/**
* Wrapped type `object`.
* @see _.pairs
@@ -6096,6 +6102,5 @@ declare module _ {
}
interface _ChainOfArrays<T> extends _Chain<T[]> {
flatten(shallow?: boolean): _Chain<T>;
mapObject(fn: _.ListIterator<T, any>): _ChainOfArrays<T>;
}
}
+117 -1
View File
@@ -122,7 +122,7 @@ interface CredentialData {
id: string;
}
type Credential = PasswordCredential|FederatedCredential;
type Credential = PasswordCredential|FederatedCredential|PublicKeyCredential;
/**
* A generic and extensible Credential interface from which all credentials
@@ -309,6 +309,11 @@ interface CredentialRequestOptions {
* request.
*/
mediation?: CredentialMediationRequirement;
/**
* This property specifies options for requesting a public-key signature.
*/
publicKey?: PublicKeyCredentialRequestOptions;
}
/**
@@ -333,6 +338,10 @@ interface CredentialCreationOptions {
* @see {@link https://www.w3.org/TR/2017/WD-credential-management-1-20170804/#dom-credentialcreationoptions-federated}
*/
federated?: FederatedCredentialInit;
/**
* @see {@link https://w3c.github.io/webauthn/#dictionary-makecredentialoptions}
*/
publicKey?: MakePublicKeyCredentialOptions;
}
/**
@@ -351,3 +360,110 @@ interface FederatedCredentialRequestOptions {
*/
protocols?: string[];
}
// Type definitions for webauthn
// Spec: https://w3c.github.io/webauthn/
/**
* @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptions}
*/
interface PublicKeyCredentialRequestOptions {
challenge: BufferSource;
timeout: number;
rpId: string;
allowCredentials: PublicKeyCredentialDescriptor[];
userVerification?: 'required' | 'preferred' | 'discouraged';
extensions?: any;
}
/**
* @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialrpentity}
*/
interface PublicKeyCredentialRpEntity {
id: string;
name: string;
}
/**
* @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentity}
*/
interface PublicKeyCredentialUserEntity {
id: BufferSource;
name: string;
displayName: string;
}
/**
* @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialparameters}
*/
interface PublicKeyCredentialParameters {
type: 'public-key';
alg: number;
}
/**
* @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptor}
*/
interface PublicKeyCredentialDescriptor {
type: 'public-key';
id: BufferSource;
transports?: Array<string>;
}
/**
* @see {@link https://w3c.github.io/webauthn/#dictdef-authenticatorselectioncriteria}
*/
interface AuthenticatorSelectionCriteria {
authenticatorAttachment?: string;
requireResidentKey?: boolean;
requireUserVerification?: string;
}
/**
* @see {@link https://w3c.github.io/webauthn/#dictdef-makepublickeycredentialoptions}
*/
interface MakePublicKeyCredentialOptions {
rp: PublicKeyCredentialRpEntity;
user: PublicKeyCredentialUserEntity;
challenge: BufferSource;
pubKeyCredParams: Array<PublicKeyCredentialParameters>;
timeout?: number;
excludeCredentials?: Array<PublicKeyCredentialDescriptor>;
authenticatorSelection?: AuthenticatorSelectionCriteria;
attestation?: 'none' | 'indirect' | 'direct';
extensions?: any;
}
/**
* @see {@link https://w3c.github.io/webauthn/#authenticatorresponse}
*/
interface AuthenticatorResponse {
readonly clientDataJSON: ArrayBuffer;
}
/**
* @see {@link https://w3c.github.io/webauthn/#authenticatorattestationresponse}
*/
interface AuthenticatorAttestationResponse extends AuthenticatorResponse {
readonly attestationObject: ArrayBuffer;
}
/**
* @see {@link https://w3c.github.io/webauthn/#iface-authenticatorassertionresponse}
*/
interface AuthenticatorAssertionResponse extends AuthenticatorResponse {
readonly authenticatorData: ArrayBuffer;
readonly signature: ArrayBuffer;
readonly userHandle: ArrayBuffer;
}
/**
* @see {@link https://w3c.github.io/webauthn/#publickeycredential}
*/
interface PublicKeyCredential extends CredentialData {
readonly type: 'public-key';
readonly rawId: ArrayBuffer;
readonly response: AuthenticatorAttestationResponse|AuthenticatorAssertionResponse;
}
@@ -138,9 +138,10 @@ function federatedSignIn() {
break;
}
} else {
const pwCred = credential as PasswordCredential;
fetch(
'https://example.com/loginEndpoint',
{credentials: credential, method: 'POST'});
{credentials: pwCred, method: 'POST'});
}
});
}
@@ -270,3 +271,71 @@ function createFederatedCredential() {
// Credential created!
});
}
function webauthnRegister() {
if (!navigator.credentials) {
return;
}
const challenge = new Uint8Array(32);
window.crypto.getRandomValues(challenge);
const credPromise = navigator.credentials.create({
publicKey: {
rp: {
id: document.domain,
name: document.domain,
},
user: {
id: (new Uint8Array(1)).buffer,
name: 'test user',
displayName: 'test user',
},
challenge,
pubKeyCredParams: [
{type: 'public-key', alg: -7},
],
timeout: 5000,
authenticatorSelection: {},
}
});
credPromise.then((cred) => {
const pubKeyCred = cred as PublicKeyCredential;
console.log(pubKeyCred);
}, (e) => {
console.log(e.message);
});
}
function webauthnAuthenticate() {
if (!navigator.credentials) {
return;
}
const credentialID = new Uint8Array(64);
const challenge = new Uint8Array(32);
window.crypto.getRandomValues(challenge);
const authPromise = navigator.credentials.get({publicKey: {
challenge,
timeout: 5000,
rpId: document.domain,
allowCredentials: [{
type: "public-key",
id: credentialID,
}],
}});
authPromise.then((cred) => {
if (cred === null) {
return;
}
const pubKeyCred = cred as PublicKeyCredential;
const response = <AuthenticatorAssertionResponse> pubKeyCred.response;
const authData = new Uint8Array(response.authenticatorData);
}, (e) => {
console.log(e.message);
});
}
+7 -1
View File
@@ -1,6 +1,8 @@
// Type definitions for xmldoc 1.1
// Project: https://www.npmjs.com/package/xmldoc
// Definitions by: Xavier Stouder <https://github.com/Xstoudi>, Andrew Sheehan <https://github.com/ajsheehan>
// Definitions by: Xavier Stouder <https://github.com/Xstoudi>
// Andrew Sheehan <https://github.com/ajsheehan>
// Jordi Bunster <https://github.com/notlaforge>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped): // TypeScript Version: 2.1
export class XmlDocument extends XmlElement {
@@ -18,6 +20,10 @@ export class XmlElement {
children: XmlElement[];
firstChild: XmlElement;
lastChild: XmlElement;
line: number;
column: number;
position: number;
startTagPosition: number;
eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void;
childNamed(name: string): XmlElement;