Merge branch 'master' into UpdateReactToIncludeChildren

This commit is contained in:
Kanchalai Tanglertsampan
2017-05-04 16:02:48 -07:00
32 changed files with 1278 additions and 1252 deletions
+21 -21
View File
@@ -337,16 +337,16 @@ export interface DatetimepickerOptions {
/** Shows the week of the year to the left of first day of the week.
* @default: false
*/
calendarWeeks?: boolean;
calendarWeeks?: boolean;
/** Using a Bootstraps collapse to switch between date/time pickers.
* @default: true
*/
collapse?: boolean;
collapse?: boolean;
/** Disables the section of days of the week, e.g. weekends.
* Accepts: array of numbers from 0-6
* @default: false
*/
daysOfWeekDisabled?: number[] | boolean;
daysOfWeekDisabled?: number[] | boolean;
/** Changes the heading of the datepicker when in "days" view.
* @default: "MMMM YYYY"
*/
@@ -358,14 +358,14 @@ export interface DatetimepickerOptions {
/** Sets the picker default date/time. Overrides useCurrent
* @default: false
*/
defaultDate?: boolean | moment.Moment | Date | string;
defaultDate?: boolean | moment.Moment | Date | string;
/** Disables selection of dates in the array, e.g. holidays
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
* eg disabledDates = ["2010-10-10"]; -> disabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
disabledDates?: boolean | Array<moment.Moment | Date | string> | any;
disabledDates?: boolean | Array<moment.Moment | Date | string> | any;
/** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
@@ -384,7 +384,7 @@ export interface DatetimepickerOptions {
* eg enabledDates = ["2010-10-10"]; -> enabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
enabledDates?: boolean | Array<moment.Moment | Date | string> | any;
enabledDates?: boolean | Array<moment.Moment | Date | string> | any;
/** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
@@ -403,17 +403,17 @@ export interface DatetimepickerOptions {
/** See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
* @default: false
*/
format?: boolean | string | moment.MomentBuiltinFormat;
format?: boolean | string | moment.MomentBuiltinFormat;
/** Change the default icons for the pickers functions. */
icons?: Icons;
icons?: Icons;
/** Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
* @default: false
*/
ignoreReadonly?: boolean;
ignoreReadonly?: boolean;
/** Will display the picker inline without the need of a input field. This will also hide borders and shadows.
* @default: false
*/
inline?: boolean;
inline?: boolean;
/** Allows for custom events to fire on keyboard press.
* eg: keybinds: {
* up: (widget) => console.log(widget),
@@ -433,17 +433,17 @@ export interface DatetimepickerOptions {
/** See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
* @default: moment.locale()
*/
locale?: string;
locale?: string;
/** Prevents date/time selections after this date.
* maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
maxDate?: boolean | moment.Moment | Date | string;
maxDate?: boolean | moment.Moment | Date | string;
/** Prevents date/time selections before this date.
* minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
minDate?: boolean | moment.Moment | Date | string;
minDate?: boolean | moment.Moment | Date | string;
/** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
*/
@@ -452,7 +452,7 @@ export interface DatetimepickerOptions {
* Clicking the "Clear" button will set the calendar to null.
* @default: false
*/
showClear?: boolean;
showClear?: boolean;
/** Show the "Close" button in the icon toolbar.
* Clicking the "Close" button will call hide()
* @default: false
@@ -462,11 +462,11 @@ export interface DatetimepickerOptions {
* Clicking the "Today" button will set the calendar view and set the date to now.
* @default: false
*/
showTodayButton?: boolean;
showTodayButton?: boolean;
/** Shows the picker side by side when using the time and date together.
* @default: false
*/
sideBySide?: boolean;
sideBySide?: boolean;
/** Number of minutes the up/down arrow's will move the minutes value in the time picker
* @default: 1
*/
@@ -479,17 +479,17 @@ export interface DatetimepickerOptions {
/** Changes the placement of the icon toolbar.
* @default: "default"
*/
toolbarPlacement?: "default" | "top" | "bottom";
toolbarPlacement?: "default" | "top" | "bottom";
/** This will change the tooltips over each icon to a custom string */
tooltips?: Tooltips;
/** On show, will set the picker to the current date/time
* @default: true
*/
useCurrent?: boolean;
useCurrent?: boolean;
/** Defines if moment should use strict date parsing when considering a date to be valid
* @default: false
*/
useStrict?: boolean;
useStrict?: boolean;
/** This will change the viewDate without changing or setting the selected date.
* @default: false
*/
@@ -498,7 +498,7 @@ export interface DatetimepickerOptions {
* Note: To limit the picker to selecting, for instance the year and month, use format: MM/YYYY
* @default: "days"
*/
viewMode?: "decades" | "years" | "months" | "days";
viewMode?: "decades" | "years" | "months" | "days";
/** On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
* @default: null
*/
@@ -520,7 +520,7 @@ export interface Icons {
/** default: "glyphicon glyphicon-screenshot" */
previous?: string;
/** default: "glyphicon glyphicon-chevron-right" */
time?: string;
time?: string;
/** default: "glyphicon glyphicon-chevron-down" */
today?: string;
/** default: "glyphicon glyphicon-chevron-up" */
+2 -2
View File
@@ -438,7 +438,7 @@ interface ChocolateChipStatic {
/**
* Serialize
*/
serialize(form: HTMLFormElement | ChocolateChipElementArray): string;
serialize(form: HTMLFormElement | ChocolateChipElementArray): string;
/**
* Grabs values from a form and converts them into a JSON object.
@@ -862,7 +862,7 @@ interface ChocolateChipElementArray extends Array<HTMLElement> {
* @param property The property to remove.
* @return HTMLElement[]
*/
removeProp(property: string): ChocolateChipElementArray;
removeProp(property: string): ChocolateChipElementArray;
/**
* Adds the specified class(es) to each of the set of matched elements.
+10 -10
View File
@@ -87,7 +87,7 @@ export interface PolynomialEasingFactory {
*
* @param e Exponent for polynomial easing.
*/
exponent(e: number): PolynomialEasingFactory;
exponent(e: number): PolynomialEasingFactory;
}
/**
@@ -240,7 +240,7 @@ export interface BackEasingFactory {
*
* @param s Overshoot parameter
*/
overshoot(s: number): BackEasingFactory;
overshoot(s: number): BackEasingFactory;
}
/**
@@ -282,14 +282,14 @@ export interface ElasticEasingFactory {
*
* @param a Amplitude for elastic easing.
*/
amplitude(a: number): ElasticEasingFactory;
/**
* Returns a new elastic easing with the specified amplitude a.
* Defaults to 0.3,if not specified.
*
* @param p Period for elastic easing.
*/
period(p: number): ElasticEasingFactory;
amplitude(a: number): ElasticEasingFactory;
/**
* Returns a new elastic easing with the specified amplitude a.
* Defaults to 0.3,if not specified.
*
* @param p Period for elastic easing.
*/
period(p: number): ElasticEasingFactory;
}
/**
+13 -7
View File
@@ -1,13 +1,19 @@
import * as deepmerge from "deepmerge";
const x = { foo: { bar: 3 },
array: [ { does: 'work', too: [ 1, 2, 3 ] } ] };
const y = { foo: { baz: 4 },
const x = {
foo: { bar: 3 },
array: [{ does: 'work', too: [1, 2, 3] }]
};
const y = {
foo: { baz: 4 },
quux: 5,
array: [ { does: 'work', too: [ 4, 5, 6 ] }, { really: 'yes' } ] };
array: [{ does: 'work', too: [4, 5, 6] }, { really: 'yes' }]
};
const expected = { foo: { bar: 3, baz: 4 },
array: [ { does: 'work', too: [ 1, 2, 3, 4, 5, 6 ] }, { really: 'yes' } ],
quux: 5 };
const expected = {
foo: { bar: 3, baz: 4 },
array: [{ does: 'work', too: [1, 2, 3, 4, 5, 6] }, { really: 'yes' }],
quux: 5
};
const result = deepmerge<any>(x, y);
+434 -434
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -548,9 +548,9 @@ declare namespace Ember {
toArray(): any[];
uniq(): Enumerable;
without(value: any): Enumerable;
'@each': EachProxy;
'@each': EachProxy;
Boolean: boolean;
'[]': any[];
'[]': any[];
firstObject: any;
hasEnumerableObservers: boolean;
lastObject: any;
@@ -630,8 +630,8 @@ declare namespace Ember {
unshiftObject(object: any): any;
unshiftObjects(objects: any[]): any[];
without(value: any): Enumerable;
'[]': any[];
'@each': EachProxy;
'[]': any[];
'@each': EachProxy;
Boolean: boolean;
firstObject: any;
hasEnumerableObservers: boolean;
@@ -1030,7 +1030,7 @@ declare namespace Ember {
toArray(): any[];
uniq(): Enumerable;
without(value: any): Enumerable;
'[]': any[];
'[]': any[];
firstObject: any;
hasEnumerableObservers: boolean;
lastObject: any;
@@ -1291,7 +1291,7 @@ declare namespace Ember {
toArray(): any[];
uniq(): Enumerable;
without(value: any): Enumerable;
'[]': any[];
'[]': any[];
firstObject: any;
hasEnumerableObservers: boolean;
lastObject: any;
+3 -2
View File
@@ -29,13 +29,14 @@ function validate(decoded: User, request: Hapi.Request, callback: hapiAuthJwt2.V
}
server.register(hapiAuthJwt2, err => {
server.auth.strategy('jwt', 'jwt', <hapiAuthJwt2.Options> {
const options: hapiAuthJwt2.Options = {
key: 'NeverShareYourSecret',
validateFunc: validate,
verifyOptions: {
algorithms: ['HS256']
}
});
};
server.auth.strategy('jwt', 'jwt', options);
});
server.start();
+42 -26
View File
@@ -120,8 +120,8 @@ export interface IServerConnectionOptions extends IConnectionConfigurationServer
export interface IConnectionConfigurationServerDefaults {
/** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */
app?: any;
/** if false, response content encoding is disabled. Defaults to true */
compression?: boolean;
/** if false, response content encoding is disabled. Defaults to true */
compression?: boolean;
/** connection load limits configuration where: */
load?: {
/** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */
@@ -408,7 +408,7 @@ export interface IProxyHandlerConfig {
maxSockets?: boolean | number;
}
/** TODO: fill in joi definition */
export interface IJoi {}
export interface IJoi { }
/** a validation function using the signature function(value, options, next) */
export interface IValidationFunction {
@@ -514,7 +514,7 @@ export interface IRouteAdditionalConfigurationOptions {
};
/** an alternative location for the route handler option. */
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** an optional unique identifier used to look up the route using server.lookup(). */
id?: number;
/** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */
@@ -764,14 +764,21 @@ export interface IServerRealm {
/** server.state(name, [options]) http://hapijs.com/api#serverstatename-options
HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions where:*/
export interface IServerState {
/** - the cookie name string. */name: string;
/** - the cookie name string. */
name: string;
/** - are the optional cookie settings: */options: {
/** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ttl: number;
/** - sets the 'Secure' flag.Defaults to false.*/isSecure: boolean;
/** - sets the 'HttpOnly' flag.Defaults to false.*/isHttpOnly: boolean
/** - the path scope.Defaults to null (no path).*/path: any;
/** - the domain scope.Defaults to null (no domain). */domain: any;
/** - are the optional cookie settings: */
options: {
/** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/
ttl: number;
/** - sets the 'Secure' flag.Defaults to false.*/
isSecure: boolean;
/** - sets the 'HttpOnly' flag.Defaults to false.*/
isHttpOnly: boolean
/** - the path scope.Defaults to null (no path).*/
path: any;
/** - the domain scope.Defaults to null (no domain). */
domain: any;
/** if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where:
request - the request object.
next - the continuation function using the function(err, value) signature.*/
@@ -783,16 +790,25 @@ export interface IServerState {
'form' - object value is encoded using the x-www-form-urlencoded method.
'iron' - Encrypts and sign the value using iron.*/
encoding: string;
/** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/sign: {
/** - algorithm options.Defaults to require('iron').defaults.integrity.*/integrity: any;
/** - password used for HMAC key generation.*/password: string;
/** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/
sign: {
/** - algorithm options.Defaults to require('iron').defaults.integrity.*/
integrity: any;
/** - password used for HMAC key generation.*/
password: string;
};
/** - password used for 'iron' encoding.*/password: string;
/** - options for 'iron' encoding.Defaults to require('iron').defaults.*/iron: any;
/** - if false, errors are ignored and treated as missing cookies.*/ignoreErrors: boolean;
/** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/clearInvalid: boolean;
/** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/strictHeader: boolean;
/** - overrides the default proxy localStatePassThrough setting.*/passThrough: any;
/** - password used for 'iron' encoding.*/
password: string;
/** - options for 'iron' encoding.Defaults to require('iron').defaults.*/
iron: any;
/** - if false, errors are ignored and treated as missing cookies.*/
ignoreErrors: boolean;
/** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/
clearInvalid: boolean;
/** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/
strictHeader: boolean;
/** - overrides the default proxy localStatePassThrough setting.*/
passThrough: any;
};
}
@@ -915,7 +931,7 @@ export interface IRouteConfiguration {
/** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/
vhost?: string;
/** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** - additional route options.*/
config?: IRouteAdditionalConfigurationOptions;
}
@@ -1122,7 +1138,7 @@ export interface IServerMethod {
generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/
export interface IServerMethodOptions {
bind?: any;
cache?: ICatBoxCachePolicyOptions;
cache?: ICatBoxCachePolicyOptions;
callback?: boolean;
generateKey?(args: any[]): string;
}
@@ -1891,9 +1907,9 @@ export class Server extends Events.EventEmitter {
* }
* });
*/
strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string): void;
strategy(name: string, scheme: string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string): void;
strategy(name: string, scheme: string, options?: any): void;
/** server.auth.test(strategy, request, next)
Tests a request against an authentication strategy where:
@@ -1959,7 +1975,7 @@ export class Server extends Events.EventEmitter {
// value === { capital: 'oslo' };
});
});*/
cache(options: ICatBoxCachePolicyOptions): void;
cache(options: ICatBoxCachePolicyOptions): void;
/** server.connection([options])
Adds an incoming server connection
+12 -12
View File
@@ -27,13 +27,13 @@ interface JasmineAjaxRequest extends XMLHttpRequest {
}
interface JasmineAjaxRequestTracker {
track(request: JasmineAjaxRequest): void;
first(): JasmineAjaxRequest;
count(): number;
reset(): void;
mostRecent(): JasmineAjaxRequest;
at(index: number): JasmineAjaxRequest;
filter(urlToMatch: RegExp): JasmineAjaxRequest[];
track(request: JasmineAjaxRequest): void;
first(): JasmineAjaxRequest;
count(): number;
reset(): void;
mostRecent(): JasmineAjaxRequest;
at(index: number): JasmineAjaxRequest;
filter(urlToMatch: RegExp): JasmineAjaxRequest[];
filter(urlToMatch: Function): JasmineAjaxRequest[];
filter(urlToMatch: string): JasmineAjaxRequest[];
}
@@ -48,14 +48,14 @@ interface JasmineAjaxRequestStubReturnOptions {
interface JasmineAjaxRequestStub {
data?: string;
method?: string;
andReturn(options: JasmineAjaxRequestStubReturnOptions): void;
matches(fullUrl: string, data: string, method: string): boolean;
method?: string;
andReturn(options: JasmineAjaxRequestStubReturnOptions): void;
matches(fullUrl: string, data: string, method: string): boolean;
}
interface JasmineAjaxStubTracker {
addStub(stub: JasmineAjaxRequestStub): void;
reset(): void;
addStub(stub: JasmineAjaxRequestStub): void;
reset(): void;
findStub(url: string, data?: string, method?: string): JasmineAjaxRequestStub;
}
+1 -1
View File
@@ -1779,7 +1779,7 @@ describe("mockAjax", () => {
mockAjax.install();
mockAjax.requests.track(<any> { url: '/testurl' });
// mockAjax.requests.track(<any> { url: '/testurl' });
mockAjax.stubRequest('/bobcat');
expect(mockAjax.requests.count()).toEqual(1);
+3 -3
View File
@@ -10,7 +10,7 @@ declare namespace JQueryValidation {
type ValidatePredicate = ((element: HTMLElement, event: JQueryEventObject) => void);
type ShouldValidatePredicate = boolean|ValidatePredicate;
type ShouldValidatePredicate = boolean | ValidatePredicate;
interface ValidationOptions {
/**
@@ -218,7 +218,7 @@ declare namespace JQueryValidation {
*
* @param template The string to format.
*/
format(template: string): ( (...args: any[]) => string);
format(template: string): ((...args: any[]) => string);
format(template: string, ...args: any[]): string;
/**
* Modify default settings for validation.
@@ -232,7 +232,7 @@ declare namespace JQueryValidation {
}
interface Validator {
element(element: string|JQuery): boolean;
element(element: string | JQuery): boolean;
checkForm(): boolean;
/**
* Validates the form, returns true if it is valid, false otherwise.
@@ -15,8 +15,8 @@ function test_validate() {
const errors = validator.numberOfInvalids();
if (errors) {
const message = errors === 1
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
$("div.error span").html(message);
$("div.error").show();
} else {
@@ -56,7 +56,7 @@ function test_validate() {
},
errorPlacement: (error, element) => {
if (element.attr("name") === "fname"
|| element.attr("name") === "lname")
|| element.attr("name") === "lname")
error.insertAfter("#lastname");
else
error.insertAfter(element);
@@ -84,7 +84,7 @@ function test_validate() {
onclick: (elt) => { }
});
$(".selector").validate({
onfocusout: (elt, event) => { },
onfocusout: (elt, event) => { },
onkeyup: (elt, event) => { },
onclick: (elt, event) => { }
});
@@ -155,12 +155,12 @@ function test_validate() {
highlight: (element: HTMLInputElement, errorClass, validClass) => {
$(element).addClass(errorClass).removeClass(validClass);
$((<HTMLInputElement> element).form).find("label[for=" + element.id + "]")
.addClass(errorClass);
.addClass(errorClass);
},
unhighlight: (element: HTMLInputElement, errorClass, validClass) => {
$(element).removeClass(errorClass).addClass(validClass);
$((<HTMLInputElement> element).form).find("label[for=" + element.id + "]")
.removeClass(errorClass);
.removeClass(errorClass);
}
});
$(".selector").validate({
@@ -174,8 +174,8 @@ function test_validate() {
onclick: false,
});
$('.selector').validate({
onfocusout: () => {},
onkeyup: () => {},
onfocusout: () => { },
onkeyup: () => { },
onclick: elt => 2,
});
}
+21 -21
View File
@@ -34,7 +34,7 @@ export interface UtilBase {
* @param {Function} ctor base Class
* @param {Function} superCtor super Class
*/
inherit( ctor: ((...args: any[]) => any), superCtor: ((...args: any[]) => any) ): void;
inherit(ctor: ((...args: any[]) => any), superCtor: ((...args: any[]) => any)): void;
/**
* @method extend
@@ -53,7 +53,7 @@ export interface UtilBase {
* @param {String or Number} px
* @return {Number}
*/
pxToInt(px: string| number): number;
pxToInt(px: string | number): number;
/**
* @method clone
@@ -145,7 +145,7 @@ export interface UtilBase {
* @param {Number} dataSize
* @return {String} 변환된 csv 문자열
*/
dataToCsv(keys: string[] , dataList: any[], dataSize: number): string;
dataToCsv(keys: string[], dataList: any[], dataSize: number): string;
/**
* @method dataToCsv2
@@ -268,7 +268,7 @@ export interface UtilBase {
* @param {Object} [context=null]
* @return {Function} 최적화된 루프 콜백 (index, groupIndex 2가지 파라미터를 받는다.)
*/
loop(total: number, context?: any): ((index: number, groupIndex: number) => void );
loop(total: number, context?: any): ((index: number, groupIndex: number) => void);
/**
* @method loopArray
@@ -280,7 +280,7 @@ export interface UtilBase {
* @param {Object} [context=null]
* @return {Function} 최적화된 루프 콜백 (data, index, groupIndex 3가지 파라미터를 받는다.)
*/
loopArray(data: any[], context?: any): ((data: any, index: number, groupIndex: number) => void );
loopArray(data: any[], context?: any): ((data: any, index: number, groupIndex: number) => void);
/**
* @method makeIndex
@@ -405,7 +405,7 @@ export interface JuiStatic {
* @param {String} type Event type
* @param {Array} args Event arguments
*/
emit(key: string, type: string, args: any[]): void;
emit(key: string, type: string, args: any[]): void;
/**
* @method get
@@ -414,7 +414,7 @@ export interface JuiStatic {
* @param {Integer/String} key
* @returns {Object/Array} UI instance
*/
get(key: number|string): any;
get(key: number | string): any;
/**
* @method getAll
@@ -422,7 +422,7 @@ export interface JuiStatic {
*
* @return {Array} UI instances
*/
getAll(): any[];
getAll(): any[];
/**
* @method create
@@ -433,7 +433,7 @@ export interface JuiStatic {
* @param {Object} options
* @return {Object}
*/
create(type: string, selector: any, options?: {}): any;
create(type: string, selector: any, options?: {}): any;
}
export interface UICollection {
@@ -455,7 +455,7 @@ export interface UICore {
* @param {Function} args Event Arguments
* @return {Mixed}
*/
emit(type: string, args: () => void): any;
emit(type: string, args: () => void): any;
/**
* @method on
@@ -464,7 +464,7 @@ export interface UICore {
* @param {String} type Event type
* @param {Function} callback
*/
on(type: string, callback: () => void): void;
on(type: string, callback: () => void): void;
/**
* @method off
@@ -472,7 +472,7 @@ export interface UICore {
*
* @param {String} type Event type
*/
off(type: string): void;
off(type: string): void;
/**
* @method addValid
@@ -481,7 +481,7 @@ export interface UICore {
* @param {String} name Method name
* @param {Array} params Parameters
*/
addValid(name: string, params: any[]): void;
addValid(name: string, params: any[]): void;
/**
* @method callBefore
@@ -491,7 +491,7 @@ export interface UICore {
* @param {Function} callback
* @return {Mixed}
*/
callBefore(name: string, callback: () => void): void;
callBefore(name: string, callback: () => void): void;
/**
* @method callAfter
@@ -501,7 +501,7 @@ export interface UICore {
* @param {Function} callback
* @return {Mixed}
*/
callAfter(name: string, callback: () => void): void;
callAfter(name: string, callback: () => void): void;
/**
* @method callDelay
@@ -510,7 +510,7 @@ export interface UICore {
* @param {String} name Method name
* @param {Function} callback
*/
callDelay(name: string, callObj: () => void): void;
callDelay(name: string, callObj: () => void): void;
/**
* @method setTpl
@@ -519,7 +519,7 @@ export interface UICore {
* @param {String} name Template name
* @param {String} html Template markup
*/
setTpl(name: string, html: string): void;
setTpl(name: string, html: string): void;
/**
* @method setOption
@@ -528,14 +528,14 @@ export interface UICore {
* @param {String} key
* @param {Mixed} value
*/
setOption(key: string, value: any): void;
setOption(key: string, value: any): void;
/**
* @method destroy
* Removes all events set in a UI obejct and the DOM element
*
*/
destroy(): void;
destroy(): void;
}
//noinspection TypeScriptUnresolvedVariable
@@ -549,7 +549,7 @@ export interface UIEvent extends UICore {
* @param {String/HTMLElement} Selector
* @returns {*|jQuery}
*/
find(selector: any): JQuery;
find(selector: any): JQuery;
}
export class ColorScale {
@@ -807,7 +807,7 @@ export interface UtilMath {
inverseMatrix3d(a: any[]): any[];
}
export interface UtilScaleOrdinal extends Function {
export interface UtilScaleOrdinal extends Function {
(x: number): number;
domain(values: any[]): UtilScaleOrdinal;
range(values: any[]): UtilScaleOrdinal;
+46 -46
View File
@@ -3,16 +3,16 @@
// Definitions by: Jin-Ho Park <https://github.com/easylogic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import {UIEvent} from 'jui-core';
import { UIEvent } from 'jui-core';
export interface GridColumn {
(index: number|string): this;
(index: number | string): this;
/** @property {HTMLElement} [element=null] TH element of a specified column */
element: any;
/** @property {String} [order="asc"] Column sort state */
order: "asc"|"desc";
order: "asc" | "desc";
/** @property {String} [name=null] Column name */
name?: string;
@@ -27,7 +27,7 @@ export interface GridColumn {
index: number;
/** @property {"show"/"hide"/"resize"} [type="show"] The current column state */
type: "show"|"hide"|"resize";
type: "show" | "hide" | "resize";
/** @property {Integer} [width=null] Column width */
width?: number;
@@ -47,7 +47,7 @@ export interface GridRow {
rownum?: number;
/** @property {String/Integer} [index=null] Index of a specified row. In the case of a tree structure, a depth is given. */
index: number|string;
index: number | string;
/** @property {HTMLElement} [element=null] TR element of a specified row. */
element: any;
@@ -68,12 +68,12 @@ export interface GridRow {
depth: number;
/** @property {"open"/"fold"} [type="fold"] State value that indicates whether a child row is shown or hidden. */
type: "open"|"fold";
type: "open" | "fold";
/** @property {Function} [type="null"] State value that indicates whether a child row is shown or hidden. */
tpl?(): void;
setIndex(rownum: number|string): void;
setIndex(rownum: number | string): void;
reload(columns: GridColumn[], seq: any, xssFilter: any): void;
destroy(): void;
isLeaf(): boolean;
@@ -81,37 +81,37 @@ export interface GridRow {
open(): void;
appendChild(row: GridRow): void;
insertChild(rownum: number, row: GridRow, isReload?: any): void;
removeChild(index: number|string): void;
removeChild(index: number | string): void;
lastChild(): GridRow;
lastChildLeaf(lastRow: GridRow): GridRow|any;
lastChildLeaf(lastRow: GridRow): GridRow | any;
showCell(index: number): void;
hideCell(index: number): void;
}
export interface GridBase {
appendRow(index: number|string, data?: {}): GridRow;
insertRow(index: number|string, data: {}): GridRow;
updateRow(index: number|string, data: {}): GridRow;
moveRow(index: number|string, targetIndex: number|string): void;
removeRow(index: number|string): void;
openRow(index: number|string): void;
appendRow(index: number | string, data?: {}): GridRow;
insertRow(index: number | string, data: {}): GridRow;
updateRow(index: number | string, data: {}): GridRow;
moveRow(index: number | string, targetIndex: number | string): void;
removeRow(index: number | string): void;
openRow(index: number | string): void;
openRowAll(): void;
foldRow(index: number|string): void;
foldRow(index: number | string): void;
foldRowAll(): void;
removeRows(): void;
sortRows(name: string, isDesc: boolean): void;
appendColumn(tplType: string, dataList: any[]): void;
removeColumn(index: number|string): void;
hideColumn(index: number|string): void;
showColumn(index: number|string): void;
removeColumn(index: number | string): void;
hideColumn(index: number | string): void;
showColumn(index: number | string): void;
getColumnCount(): number;
getRowCount(): number;
getColumn(index?: number|string): GridColumn|GridColumn[];
getRow(index?: number|string): GridRow|GridRow[];
getRowAll(index: number|string): GridRow[];
getRowParent(index: number|string): GridRow;
setColumn(index: number|string, column: GridColumn): void;
setRow(index: number|string, row: GridRow): void;
getColumn(index?: number | string): GridColumn | GridColumn[];
getRow(index?: number | string): GridRow | GridRow[];
getRowAll(index: number | string): GridRow[];
getRowParent(index: number | string): GridRow;
setColumn(index: number | string, column: GridColumn): void;
setRow(index: number | string, row: GridRow): void;
}
export interface GridTable extends UIEvent {
@@ -153,7 +153,7 @@ export interface GridTable extends UIEvent {
* @cfg {Boolean/Array} [colshow=false]
* Sets a column index shown when the Show/Hide Column menu is enabled.
*/
colshow?: boolean|any[],
colshow?: boolean | any[],
/**
* @cfg {Boolean} [scroll=false]
@@ -189,7 +189,7 @@ export interface GridTable extends UIEvent {
* @cfg {Boolean|Array} [editRow=false]
* Determines whether to use a modified row area.
*/
editRow?: boolean|any[],
editRow?: boolean | any[],
/**
* @cfg {Boolean} [editEvent=true]
@@ -207,7 +207,7 @@ export interface GridTable extends UIEvent {
* @cfg {Boolean/Array} [sort=false]
* Determines whether to use the table sort function.
*/
sort?: boolean|any[],
sort?: boolean | any[],
/**
* @cfg {Integer} [sortIndex=null]
@@ -219,7 +219,7 @@ export interface GridTable extends UIEvent {
* @cfg {String} [sortOrder="asc"]
* Determines whether to use the table sort function.
*/
sortOrder?: "asc"|"desc",
sortOrder?: "asc" | "desc",
/**
* @cfg {Boolean} [sortEvent=true]
@@ -242,7 +242,7 @@ export interface GridTable extends UIEvent {
*
* @param {Array} rows
*/
update(indexOrRows?: any, rows?: any): void;
update(indexOrRows?: any, rows?: any): void;
/**
* @method updateTree
* It is possible to configure a tree table using an object array with the index and data properties.
@@ -257,7 +257,7 @@ export interface GridTable extends UIEvent {
*
* @param {RowObject} row
*/
append(rowOrIndex?: number|any, row?: any): void;
append(rowOrIndex?: number | any, row?: any): void;
/**
* @method insert
@@ -468,7 +468,7 @@ export interface GridTable extends UIEvent {
* @param {"Integer"/"String"} key index or column key
* @return {ColumnObject} column
*/
getColumn(index: number|string): GridColumn;
getColumn(index: number | string): GridColumn;
/**
* @method showColumn
@@ -476,7 +476,7 @@ export interface GridTable extends UIEvent {
*
* @param {"Integer"/"String"} key index or column name
*/
showColumn(index: number|string, e?: any): void;
showColumn(index: number | string, e?: any): void;
/**
* @method hideColumn
@@ -484,7 +484,7 @@ export interface GridTable extends UIEvent {
*
* @param {"Integer"/"String"} key index or column name
*/
hideColumn(index: number|string, e?: any): void;
hideColumn(index: number | string, e?: any): void;
/**
* @method initColumns
@@ -662,7 +662,7 @@ export interface GridXTable extends UIEvent {
*
* @param {Integer} index
*/
open(index: number|string): void;
open(index: number | string): void;
/**
* @method fold
@@ -670,19 +670,19 @@ export interface GridXTable extends UIEvent {
*
* @param {Integer} index
*/
fold(index: number|string): void;
fold(index: number | string): void;
/**
* @method openAll
* Shows all child rows of a specified index.
*/
openAll(index: number|string): void;
openAll(index: number | string): void;
/**
* @method foldAll
* Hides all child rows of a specified index.
*/
foldAll(index: number|string): void;
foldAll(index: number | string): void;
/**
* @method next
@@ -705,7 +705,7 @@ export interface GridXTable extends UIEvent {
* @param {Integer} index
* @param {String} order "asc" or "desc"
*/
sort(index: number, order: "asc"|"desc", e?: any, isNotLoading?: any): void;
sort(index: number, order: "asc" | "desc", e?: any, isNotLoading?: any): void;
/**
* @method filter
@@ -762,7 +762,7 @@ export interface GridXTable extends UIEvent {
* @param {Integer|String} index
* @param {Integer} dist
*/
scrollTop(index: number|string, dist: number): void;
scrollTop(index: number | string, dist: number): void;
/**
* @deprecated
@@ -831,7 +831,7 @@ export interface GridXTable extends UIEvent {
* @param {"Integer"/"String"} key index or column key
* @return {ColumnObject} column
*/
getColumn(index: number|string): GridColumn;
getColumn(index: number | string): GridColumn;
/**
* @method getData
@@ -840,7 +840,7 @@ export interface GridXTable extends UIEvent {
* @param {"Integer"/"String"} key index
* @return {ColumnObject} data
*/
getData(index: number|string): any;
getData(index: number | string): any;
/**
* @method showColumn
@@ -848,7 +848,7 @@ export interface GridXTable extends UIEvent {
*
* @param {"Integer"/"String"} key index or column name
*/
showColumn(index: number|string): void;
showColumn(index: number | string): void;
/**
* @method hideColumn
@@ -856,7 +856,7 @@ export interface GridXTable extends UIEvent {
*
* @param {"Integer"/"String"} key index or column name
*/
hideColumn(index: number|string): void;
hideColumn(index: number | string): void;
/**
* @method initColumns
@@ -864,7 +864,7 @@ export interface GridXTable extends UIEvent {
*
* @param {"Integer"/"String"} key index or column name
*/
initColumns(keys: number|string): void;
initColumns(keys: number | string): void;
/**
* @method showColumnMenu
@@ -973,7 +973,7 @@ export interface GridXTable extends UIEvent {
* @param {Integer} columnIndex
* @param {Function} callback
*/
rowFunc(type: "sum"|"avg", index: number, callback: (data: any) => void): any;
rowFunc(type: "sum" | "avg", index: number, callback: (data: any) => void): any;
/**
* @method getPage
+60 -60
View File
@@ -3,7 +3,7 @@
// Definitions by: Jin-Ho Park <https://github.com/easylogic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import {UIEvent} from 'jui-core';
import { UIEvent } from 'jui-core';
export interface UIAccordion extends UIEvent {
(selector: any, options?: {
@@ -26,7 +26,7 @@ export interface UIAccordion extends UIEvent {
*
*/
multipanel?: boolean
}) : this;
}): this;
/**
* @method activeIndex
@@ -52,7 +52,7 @@ export interface UIAutoComplete {
* Designates words subject to autofill
*/
words?: string[]
}) : this;
}): this;
/**
* @method update
@@ -61,14 +61,14 @@ export interface UIAutoComplete {
* @param {Array} words
*
*/
update(newWords: string[]): void;
update(newWords: string[]): void;
/**
* @method close
* Close the active drop-down
*
*/
close(): void;
close(): void;
/**
* @method list
@@ -76,7 +76,7 @@ export interface UIAutoComplete {
*
* @return {Array} words
*/
list(): string[];
list(): string[];
}
export interface UIColorPicker {
@@ -85,11 +85,11 @@ export interface UIColorPicker {
event?: any,
type?: string,
color?: string
}) : this;
}): this;
getColor(type: string): string|{};
getColor(type: string): string | {};
setColor(value: string|{}): void;
setColor(value: string | {}): void;
}
export interface UICombo {
@@ -130,14 +130,14 @@ export interface UICombo {
* @cfg {"top"/"bottom"} [position="bottom"]
* It is possible to determine an initial selection button with a specified value
*/
position?: "top"|"bottom",
position?: "top" | "bottom",
/**
* @cfg {Boolean} [flex=true]
* Drop-down menu is varied by changing the width function
*/
flex?: boolean
}) : this;
}): this;
/**
* @method setIndex
@@ -145,7 +145,7 @@ export interface UICombo {
*
* @param {Number} index
*/
setIndex(index: number): void;
setIndex(index: number): void;
/**
* @method setValue
@@ -153,7 +153,7 @@ export interface UICombo {
*
* @param {Mixed} value
*/
setValue(value: any): void;
setValue(value: any): void;
/**
* @method getData
@@ -161,7 +161,7 @@ export interface UICombo {
*
* @return {Object}
*/
getData(): {};
getData(): {};
/**
* @method getValue
@@ -169,7 +169,7 @@ export interface UICombo {
*
* @return {Mixed}
*/
getValue(): any;
getValue(): any;
/**
* @method getText
@@ -177,25 +177,25 @@ export interface UICombo {
*
* @return {String}
*/
getText(): string;
getText(): string;
/**
* @method open
* Shows the element list of a combo box
*/
open(e: any): void;
open(e: any): void;
/**
* @method fold
* Hides the element list of a combo box
*/
fold(): void;
fold(): void;
/**
* @method reload
* Re-defines a combo box
*/
reload(): void;
reload(): void;
}
export interface UIDatePicker {
@@ -206,7 +206,7 @@ export interface UIDatePicker {
* @cfg {"daily"/"monthly"/"yearly"} [type="daily"]
* Determines the type of a calendar
*/
type?: "daily"|"monthly"|"yearly",
type?: "daily" | "monthly" | "yearly",
/**
* @cfg {String} [titleFormat="yyyy.MM"]
@@ -224,7 +224,7 @@ export interface UIDatePicker {
* @cfg {Date} [date="now"]
* Selects a specific date as a basic
*/
date?: "now"|Date,
date?: "now" | Date,
/**
* @cfg {Date} [minDate="null"]
@@ -237,7 +237,7 @@ export interface UIDatePicker {
* Selects a specific maximum date
*/
maxDate?: Date
}) : this;
}): this;
/**
* @method page
@@ -246,7 +246,7 @@ export interface UIDatePicker {
* @param {Integer} year
* @param {Integer} month
*/
page(y: number, m: number): void;
page(y: number, m: number): void;
/**
* @method prev
@@ -260,7 +260,7 @@ export interface UIDatePicker {
* Outputs a calendar that fits the next year/month
*
*/
next(e: any, moveYear?: boolean): void;
next(e: any, moveYear?: boolean): void;
/**
* @method select
@@ -268,7 +268,7 @@ export interface UIDatePicker {
*
* @param {"year"/"month"/"date"/"timestamp"/"Date"}
*/
select( ...args: any[]): void;
select(...args: any[]): void;
/**
* @method addTime
@@ -276,7 +276,7 @@ export interface UIDatePicker {
*
* @param {"Integer"/"Date"} time Timestamp or Date
*/
addTime(time: number|Date): void;
addTime(time: number | Date): void;
/**
* @method getDate
@@ -284,7 +284,7 @@ export interface UIDatePicker {
*
* @return {Date} Date object
*/
getDate(): Date;
getDate(): Date;
/**
* @method getTime
@@ -292,7 +292,7 @@ export interface UIDatePicker {
*
* @return {Integer} Timestamp
*/
getTime(): number;
getTime(): number;
/**
* @method getFormat
@@ -300,13 +300,13 @@ export interface UIDatePicker {
*
* @return {String} format Formatted date string
*/
getFormat(format: string): string;
getFormat(format: string): string;
/**
* @method reload
* Reloads the datepicker
*/
reload(): void;
reload(): void;
}
export interface UIDropdown {
@@ -377,7 +377,7 @@ export interface UIDropdown {
* @param {Integer} x
* @param {Integer} y
*/
show(x: number, y: number): void;
show(x: number, y: number): void;
/**
* @method move
@@ -386,13 +386,13 @@ export interface UIDropdown {
* @param {Integer} x
* @param {Integer} y
*/
move(x: number, y: number): void;
move(x: number, y: number): void;
/**
* @method reload
* Reloads the dropdown list
*/
reload(): void;
reload(): void;
}
export interface UIModal {
@@ -403,7 +403,7 @@ export interface UIModal {
* @cfg {"black"/"gray"} [color="black"]
* Determines the color of a modal
*/
color?: "black"|"gray",
color?: "black" | "gray",
/**
* @cfg {Float} [opacity=0.4]
@@ -415,7 +415,7 @@ export interface UIModal {
* @cfg {String/DOMElement} [target="body"]
* Sets a selector on which a modal is shown
*/
target?: string|any,
target?: string | any,
/**
* @cfg {Integer} [index=0]
@@ -434,19 +434,19 @@ export interface UIModal {
* Automatically hides a modal when clicking on it
*/
autoHide?: boolean
}): this;
}): this;
/**
* @method hide
* Hides a modal
*/
hide(): void;
hide(): void;
/**
* @method show
* Shows a modal
*/
show(): void;
show(): void;
/**
* @method resize
@@ -463,7 +463,7 @@ export interface UINotify {
* @cfg {"top"/"top-lefet"/"top-right"/"bottom"/"bottom-left"/"bottom-right"} [position="top-right"]
* Designates the location where a notice message is added
*/
position?: "top"|"top-lefet"|"top-right"|"bottom"|"bottom-left"|"bottom-right",
position?: "top" | "top-lefet" | "top-right" | "bottom" | "bottom-left" | "bottom-right",
/**
* @cfg {Integer} [padding=12]
@@ -524,7 +524,7 @@ export interface UINotify {
reset(): void;
}
export interface UIPaging {
export interface UIPaging {
(selector: any, options?: {
tpl?: any,
event?: any,
@@ -593,7 +593,7 @@ export interface UIProgress {
tpl?: any,
event?: any,
type?: "simple" | "flat", // simple or flat
orient?: "horizontal"|"vertical", // or vertical,
orient?: "horizontal" | "vertical", // or vertical,
min?: number,
max?: number,
value?: number,
@@ -618,7 +618,7 @@ export interface UIProperty {
loadItems(newItems: any[]): void;
addItem(item: {}|any[]): void;
addItem(item: {} | any[]): void;
// remove item by key or title
removeItem(item: {}): void;
@@ -628,7 +628,7 @@ export interface UIProperty {
*
* get a list of group's title.
*/
getGroupList(): any[];
getGroupList(): any[];
/**
* @method collapsed
@@ -637,7 +637,7 @@ export interface UIProperty {
*
* @param {String} id
*/
collapsed(id: string): void;
collapsed(id: string): void;
/**
* @method expanded
@@ -683,13 +683,13 @@ export interface UISelect {
event?: any,
items?: any[],
placeholder?: string,
align?: 'left'|'right',
valign?: 'top'|'bottom',
align?: 'left' | 'right',
valign?: 'top' | 'bottom',
multi?: boolean
}): this;
setValue(value: any|any[]): void;
getValue(): any| any[];
setValue(value: any | any[]): void;
getValue(): any | any[];
setSelectedIndex(index: number): void;
getSelectedIndex(): number;
update(data: any[]): void;
@@ -699,8 +699,8 @@ export interface UISlider {
(selector: any, options?: {
tpl?: any,
event?: any,
type?: "single"|"double", // or double
orient?: "horizontal"|"vertical", // or vertical,
type?: "single" | "double", // or double
orient?: "horizontal" | "vertical", // or vertical,
min?: number,
max?: number,
step?: number,
@@ -776,13 +776,13 @@ export interface UISplitter {
* @cfg {"vertical"/"horizontal"} [direction='vertical']
* set bar's direction
*/
direction?: 'vertical'|'horizontal',
direction?: 'vertical' | 'horizontal',
/**
* @cfg {String/Number} [initSize='50%']
* set first panel's default width or height
*/
initSize?: string|number,
initSize?: string | number,
/**
* @cfg {Number/Array} [minSize=30]
@@ -794,7 +794,7 @@ export interface UISplitter {
* minSize[1] is second panel's minimum size
*
*/
minSize?: number|number[],
minSize?: number | number[],
/**
* @cfg {String} [items=[]]
@@ -846,7 +846,7 @@ export interface UITab {
* @cfg {String/DOMElement} [target=""]
* Determines a selector in the area to become the content of a tab
*/
target?: string|any,
target?: string | any,
/**
* @cfg {Integer} [index=0]
@@ -963,7 +963,7 @@ export interface UITooltip {
* @cfg {"top"/"bottom"/"left"/"right"} [position="top"]
* Determines the location where a tooltip is shown
*/
position?: "top"|"bottom"|"left"|"right",
position?: "top" | "bottom" | "left" | "right",
/**
* @cfg {Integer} [width=150]
@@ -975,7 +975,7 @@ export interface UITooltip {
* @cfg {"left"/"right"/"center"} [align="left"]
* Determines the alignment state inside a tooltip
*/
align?: "left"|"right"|"center",
align?: "left" | "right" | "center",
/**
* @cfg {Integer} [delay=0]
@@ -1260,25 +1260,25 @@ export interface UIWindow {
* @cfg {String/Integer} [left="auto"]
* Determines the X coordinate of a window
*/
left?: string|number,
left?: string | number,
/**
* @cfg {String/Integer} [top="auto"]
* Determines the Y coordinate of a window
*/
top?: string|number,
top?: string | number,
/**
* @cfg {String/Integer} [right="auto"]
* Determines the X coordinate based on the right side of a window
*/
right?: string|number,
right?: string | number,
/**
* @cfg {String/Integer} [bottom="auto"]
* Determines the Y coordinate based on the bottom side of a window
*/
bottom?: string|number,
bottom?: string | number,
/**
* @cfg {Boolean} [modal=false]
+9 -9
View File
@@ -3,18 +3,18 @@ import * as boot from 'loopback-boot';
import * as cookieParser from 'cookie-parser';
class Server {
app: loopback.LoopBackApplication;
app: loopback.LoopBackApplication;
static boostrap(): Server {
return new Server();
}
constructor() {
this.app = loopback();
static boostrap(): Server {
return new Server();
}
constructor() {
this.app = loopback();
this.app.use(cookieParser());
this.app.use(cookieParser());
this.config();
}
this.config();
}
private config(): void {
boot(this.app, __dirname, (err: Error) => {
+1 -1
View File
@@ -60,7 +60,7 @@ declare class Nedb {
* If one update violates a constraint, all changes are rolled back
*/
updateIndexes<T>(oldDoc: T, newDoc: T): void;
updateIndexes<T>(updates: Array<{oldDoc: T; newDoc: T}>): void;
updateIndexes<T>(updates: Array<{ oldDoc: T; newDoc: T }>): void;
/**
* Return the list of candidates for a given query
+68 -68
View File
@@ -54,7 +54,7 @@ class BaseCollection<T> {
findByID(id: string): Promise<T> {
return new Promise((resolve, reject) => {
this.dataStore.findOne<T>({_id: id}, (err: Error, doc: T) => {
this.dataStore.findOne<T>({ _id: id }, (err: Error, doc: T) => {
if (err) {
reject(err);
} else {
@@ -102,7 +102,7 @@ class BaseCollection<T> {
upsert(query: any, updateQuery: any): Promise<T[]> {
const a: Promise<T[]> = new Promise((resolve, reject) => {
this.dataStore.update(query, updateQuery, {upsert: true}, (err: Error, numberOfUpdated: number, upsert: boolean) => {
this.dataStore.update(query, updateQuery, { upsert: true }, (err: Error, numberOfUpdated: number, upsert: boolean) => {
if (err) {
reject(err);
} else {
@@ -112,7 +112,7 @@ class BaseCollection<T> {
});
const b: Promise<T[]> = new Promise((resolve, reject) => {
this.dataStore.update(query, updateQuery, {upsert: true}, (err: Error, numberOfUpdated: number, affectedDocs: any, upsert: boolean) => {
this.dataStore.update(query, updateQuery, { upsert: true }, (err: Error, numberOfUpdated: number, affectedDocs: any, upsert: boolean) => {
if (err) {
reject(err);
} else {
@@ -154,19 +154,19 @@ import Datastore = require('nedb');
let db = new Datastore();
// Type 2: Persistent datastore with manual loading
db = new Datastore({filename: 'path/to/datafile'});
db = new Datastore({ filename: 'path/to/datafile' });
db.loadDatabase((err) => { // Callback is optional
// Now commands will be executed
});
// Type 3: Persistent datastore with automatic loading
db = new Datastore({filename: 'path/to/datafile', autoload: true});
db = new Datastore({ filename: 'path/to/datafile', autoload: true });
// You can issue commands right away
// Type 4: Persistent datastore for a Node Webkit app called 'nwtest'
// For example on Linux, the datafile will be ~/.config/nwtest/nedb-data/something.db
import path = require('path');
db = new Datastore({filename: path.join(require('nw.gui').App.dataPath, 'something.db')});
db = new Datastore({ filename: path.join(require('nw.gui').App.dataPath, 'something.db') });
// Of course you can create multiple datastores if you need several
// collections. In this case it's usually a good idea to use autoload for all collections.
@@ -179,14 +179,14 @@ dbContainer.users.loadDatabase();
dbContainer.robots.loadDatabase();
const doc: any = {
hello: 'world'
, n: 5
, today: new Date()
, nedbIsAwesome: true
, notthere: null
, notToBeSaved: undefined // Will not be saved
, fruits: ['apple', 'orange', 'pear']
, infos: {name: 'nedb'}
hello: 'world',
n: 5,
today: new Date(),
nedbIsAwesome: true,
notthere: null,
notToBeSaved: undefined, // Will not be saved
fruits: ['apple', 'orange', 'pear'],
infos: { name: 'nedb' }
};
db.insert(doc, (err: Error, newDoc: any) => { // Callback is optional
@@ -194,54 +194,54 @@ db.insert(doc, (err: Error, newDoc: any) => { // Callback is optional
// newDoc has no key called notToBeSaved since its value was undefined
});
db.insert([{a: 5}, {a: 42}], (err: Error, newdocs: any[]) => {
db.insert([{ a: 5 }, { a: 42 }], (err: Error, newdocs: any[]) => {
// Two documents were inserted in the database
// newDocs is an array with these documents, augmented with their _id
});
// If there is a unique constraint on field 'a', this will fail
db.insert([{a: 5}, {a: 42}, {a: 5}], (err: Error) => {
db.insert([{ a: 5 }, { a: 42 }, { a: 5 }], (err: Error) => {
// err is a 'uniqueViolated' error
// The database was not modified
});
// Finding all planets in the solar system
db.find({system: 'solar'}, (err: Error, docs: any[]) => {
db.find({ system: 'solar' }, (err: Error, docs: any[]) => {
// docs is an array containing documents Mars, Earth, Jupiter
// If no document is found, docs is equal to []
});
// Finding all planets whose name contain the substring 'ar' using a regular expression
db.find({planet: /ar/}, (err: Error, docs: any[]) => {
db.find({ planet: /ar/ }, (err: Error, docs: any[]) => {
// docs contains Mars and Earth
});
// Finding all inhabited planets in the solar system
db.find({system: 'solar', inhabited: true}, (err: Error, docs: any[]) => {
db.find({ system: 'solar', inhabited: true }, (err: Error, docs: any[]) => {
// docs is an array containing document Earth only
});
// Use the dot-notation to match fields in subdocuments
db.find({"humans.genders": 2}, (err: Error, docs: any[]) => {
db.find({ "humans.genders": 2 }, (err: Error, docs: any[]) => {
// docs contains Earth
});
// Use the dot-notation to navigate arrays of subdocuments
db.find({"completeData.planets.name": "Mars"}, (err: Error, docs: any[]) => {
db.find({ "completeData.planets.name": "Mars" }, (err: Error, docs: any[]) => {
// docs contains document 5
});
db.find({"completeData.planets.name": "Jupiter"}, (err: Error, docs: any[]) => {
db.find({ "completeData.planets.name": "Jupiter" }, (err: Error, docs: any[]) => {
// docs is empty
});
db.find({"completeData.planets.0.name": "Earth"}, (err: Error, docs: any[]) => {
db.find({ "completeData.planets.0.name": "Earth" }, (err: Error, docs: any[]) => {
// docs contains document 5
// If we had tested against "Mars" docs would be empty because we are matching against a specific array element
});
// You can also deep-compare objects. Don't confuse this with dot-notation!
db.find({humans: {genders: 2}}, (err: Error, docs: any[]) => {
db.find({ humans: { genders: 2 } }, (err: Error, docs: any[]) => {
// docs is empty, because { genders: 2 } is not equal to { genders: 2, eyes: true }
});
@@ -250,66 +250,66 @@ db.find({}, (err: Error, docs: any[]) => {
});
// The same rules apply when you want to only find one document
db.findOne({_id: 'id1'}, (err: Error, doc: any) => {
db.findOne({ _id: 'id1' }, (err: Error, doc: any) => {
// doc is the document Mars
// If no document is found, doc is null
});
// $lt, $lte, $gt and $gte work on numbers and strings
db.find({"humans.genders": {$gt: 5}}, (err: Error, docs: any[]) => {
db.find({ "humans.genders": { $gt: 5 } }, (err: Error, docs: any[]) => {
// docs contains Omicron Persei 8, whose humans have more than 5 genders (7).
});
// When used with strings, lexicographical order is used
db.find({planet: {$gt: 'Mercury'}}, (err: Error, docs: any[]) => {
db.find({ planet: { $gt: 'Mercury' } }, (err: Error, docs: any[]) => {
// docs contains Omicron Persei 8
});
// Using $in. $nin is used in the same way
db.find({planet: {$in: ['Earth', 'Jupiter']}}, (err: Error, docs: any[]) => {
db.find({ planet: { $in: ['Earth', 'Jupiter'] } }, (err: Error, docs: any[]) => {
// docs contains Earth and Jupiter
});
// Using $exists
db.find({satellites: {$exists: true}}, (err: Error, docs: any[]) => {
db.find({ satellites: { $exists: true } }, (err: Error, docs: any[]) => {
// docs contains only Mars
});
// Using $regex with another operator
db.find({planet: {$regex: /ar/, $nin: ['Jupiter', 'Earth']}}, (err: Error, docs: any[]) => {
db.find({ planet: { $regex: /ar/, $nin: ['Jupiter', 'Earth'] } }, (err: Error, docs: any[]) => {
// docs only contains Mars because Earth was excluded from the match by $nin
});
// Using an array-specific comparison function
// Note: you can't use nested comparison functions, e.g. { $size: { $lt: 5 } } will throw an error
db.find({satellites: {$size: 2}}, (err: Error, docs: any[]) => {
db.find({ satellites: { $size: 2 } }, (err: Error, docs: any[]) => {
// docs contains Mars
});
db.find({satellites: {$size: 1}}, (err: Error, docs: any[]) => {
db.find({ satellites: { $size: 1 } }, (err: Error, docs: any[]) => {
// docs is empty
});
// If a document's field is an array, matching it means matching any element of the array
db.find({satellites: 'Phobos'}, (err: Error, docs: any[]) => {
db.find({ satellites: 'Phobos' }, (err: Error, docs: any[]) => {
// docs contains Mars. Result would have been the same if query had been { satellites: 'Deimos' }
});
// This also works for queries that use comparison operators
db.find({satellites: {$lt: 'Amos'}}, (err: Error, docs: any[]) => {
db.find({ satellites: { $lt: 'Amos' } }, (err: Error, docs: any[]) => {
// docs is empty since Phobos and Deimos are after Amos in lexicographical order
});
// This also works with the $in and $nin operator
db.find({satellites: {$in: ['Moon', 'Deimos']}}, (err: Error, docs: any[]) => {
db.find({ satellites: { $in: ['Moon', 'Deimos'] } }, (err: Error, docs: any[]) => {
// docs contains Mars (the Earth document is not complete!)
});
db.find({$or: [{planet: 'Earth'}, {planet: 'Mars'}]}, (err: Error, docs: any[]) => {
db.find({ $or: [{ planet: 'Earth' }, { planet: 'Mars' }] }, (err: Error, docs: any[]) => {
// docs contains Earth and Mars
});
db.find({$not: {planet: 'Earth'}}, (err: Error, docs: any[]) => {
db.find({ $not: { planet: 'Earth' } }, (err: Error, docs: any[]) => {
// docs contains Mars, Jupiter, Omicron Persei 8
});
@@ -322,53 +322,53 @@ db.find({
});
// You can mix normal queries, comparison queries and logical operators
db.find({$or: [{planet: 'Earth'}, {planet: 'Mars'}], inhabited: true}, (err: Error, docs: any[]) => {
db.find({ $or: [{ planet: 'Earth' }, { planet: 'Mars' }], inhabited: true }, (err: Error, docs: any[]) => {
// docs contains Earth
});
// No query used means all results are returned (before the Cursor modifiers)
db.find({}).sort({planet: 1}).skip(1).limit(2).exec((err: Error, docs: any[]) => {
db.find({}).sort({ planet: 1 }).skip(1).limit(2).exec((err: Error, docs: any[]) => {
// docs is [doc3, doc1]
});
// You can sort in reverse order like this
db.find({system: 'solar'}).sort({planet: -1}).exec((err: Error, docs: any[]) => {
db.find({ system: 'solar' }).sort({ planet: -1 }).exec((err: Error, docs: any[]) => {
// docs is [doc1, doc3, doc2]
});
// You can sort on one field, then another, and so on like this:
db.find({}).sort({firstField: 1, secondField: -1});
db.find({}).sort({ firstField: 1, secondField: -1 });
// Same database as above
// Keeping only the given fields
db.find({planet: 'Mars'}, {planet: 1, system: 1}, (err: Error, docs: any[]) => {
db.find({ planet: 'Mars' }, { planet: 1, system: 1 }, (err: Error, docs: any[]) => {
// docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }]
});
// Keeping only the given fields but removing _id
db.find({planet: 'Mars'}, {planet: 1, system: 1, _id: 0}, (err: Error, docs: any[]) => {
db.find({ planet: 'Mars' }, { planet: 1, system: 1, _id: 0 }, (err: Error, docs: any[]) => {
// docs is [{ planet: 'Mars', system: 'solar' }]
});
// Omitting only the given fields and removing _id
db.find({planet: 'Mars'}, {planet: 0, system: 0, _id: 0}, (err: Error, docs: any[]) => {
db.find({ planet: 'Mars' }, { planet: 0, system: 0, _id: 0 }, (err: Error, docs: any[]) => {
// docs is [{ inhabited: false, satellites: ['Phobos', 'Deimos'] }]
});
// Failure: using both modes at the same time
db.find({planet: 'Mars'}, {planet: 0, system: 1}, (err: Error, docs: any[]) => {
db.find({ planet: 'Mars' }, { planet: 0, system: 1 }, (err: Error, docs: any[]) => {
// err is the error message, docs is undefined
});
// You can also use it in a Cursor way but this syntax is not compatible with MongoDB
// If upstream compatibility is important don't use this method
db.find({planet: 'Mars'}).projection({planet: 1, system: 1}).exec((err: Error, docs: any[]) => {
db.find({ planet: 'Mars' }).projection({ planet: 1, system: 1 }).exec((err: Error, docs: any[]) => {
// docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }]
});
// Count all planets in the solar system
db.count({system: 'solar'}, (err: Error, count: number) => {
db.count({ system: 'solar' }, (err: Error, count: number) => {
// count equals to 3
});
@@ -384,7 +384,7 @@ db.count({}, (err: Error, count: number) => {
// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true }
// Replace a document by another
db.update({planet: 'Jupiter'}, {planet: 'Pluton'}, {}, (err: Error, numReplaced: number) => {
db.update({ planet: 'Jupiter' }, { planet: 'Pluton' }, {}, (err: Error, numReplaced: number) => {
// numReplaced = 1
// The doc #3 has been replaced by { _id: 'id3', planet: 'Pluton' }
// Note that the _id is kept unchanged, and the document has been replaced
@@ -392,19 +392,19 @@ db.update({planet: 'Jupiter'}, {planet: 'Pluton'}, {}, (err: Error, numReplaced:
});
// Set an existing field's value
db.update({system: 'solar'}, {$set: {system: 'solar system'}}, {multi: true}, (err: Error, numReplaced: number) => {
db.update({ system: 'solar' }, { $set: { system: 'solar system' } }, { multi: true }, (err: Error, numReplaced: number) => {
// numReplaced = 3
// Field 'system' on Mars, Earth, Jupiter now has value 'solar system'
});
// Setting the value of a non-existing field in a subdocument by using the dot-notation
db.update({planet: 'Mars'}, {$set: {"data.satellites": 2, "data.red": true}}, {}, () => {
db.update({ planet: 'Mars' }, { $set: { "data.satellites": 2, "data.red": true } }, {}, () => {
// Mars document now is { _id: 'id1', system: 'solar', inhabited: false
// , data: { satellites: 2, red: true }
// }
// Not that to set fields in subdocuments, you HAVE to use dot-notation
// Using object-notation will just replace the top-level field
db.update({planet: 'Mars'}, {$set: {data: {satellites: 3}}}, {}, () => {
db.update({ planet: 'Mars' }, { $set: { data: { satellites: 3 } } }, {}, () => {
// Mars document now is { _id: 'id1', system: 'solar', inhabited: false
// , data: { satellites: 3 }
// }
@@ -413,23 +413,23 @@ db.update({planet: 'Mars'}, {$set: {"data.satellites": 2, "data.red": true}}, {}
});
// Deleting a field
db.update({planet: 'Mars'}, {$unset: {planet: true}}, {}, () => {
db.update({ planet: 'Mars' }, { $unset: { planet: true } }, {}, () => {
// Now the document for Mars doesn't contain the planet field
// You can unset nested fields with the dot notation of course
});
// Upserting a document
db.update({planet: 'Pluton'}, {
db.update({ planet: 'Pluton' }, {
planet: 'Pluton',
inhabited: false
}, {upsert: true}, (err: Error, numReplaced: number, upsert: boolean) => {
}, { upsert: true }, (err: Error, numReplaced: number, upsert: boolean) => {
// numReplaced = 1, upsert = { _id: 'id5', planet: 'Pluton', inhabited: false }
// A new document { _id: 'id5', planet: 'Pluton', inhabited: false } has been added to the collection
});
// If you upsert with a modifier, the upserted doc is the query modified by the modifier
// This is simpler than it sounds :)
db.update({planet: 'Pluton'}, {$inc: {distance: 38}}, {upsert: true}, () => {
db.update({ planet: 'Pluton' }, { $inc: { distance: 38 } }, { upsert: true }, () => {
// A new document { _id: 'id5', planet: 'Pluton', distance: 38 } has been added to the collection
});
@@ -437,12 +437,12 @@ db.update({planet: 'Pluton'}, {$inc: {distance: 38}}, {upsert: true}, () => {
// let's see how we can modify the array field atomically
// $push inserts new elements at the end of the array
db.update({_id: 'id6'}, {$push: {fruits: 'banana'}}, {}, () => {
db.update({ _id: 'id6' }, { $push: { fruits: 'banana' } }, {}, () => {
// Now the fruits array is ['apple', 'orange', 'pear', 'banana']
});
// $pop removes an element from the end (if used with 1) or the front (if used with -1) of the array
db.update({_id: 'id6'}, {$pop: {fruits: 1}}, {}, () => {
db.update({ _id: 'id6' }, { $pop: { fruits: 1 } }, {}, () => {
// Now the fruits array is ['apple', 'orange']
// With { $pop: { fruits: -1 } }, it would have been ['orange', 'pear']
});
@@ -450,22 +450,22 @@ db.update({_id: 'id6'}, {$pop: {fruits: 1}}, {}, () => {
// $addToSet adds an element to an array only if it isn't already in it
// Equality is deep-checked (i.e. $addToSet will not insert an object in an array already containing the same object)
// Note that it doesn't check whether the array contained duplicates before or not
db.update({_id: 'id6'}, {$addToSet: {fruits: 'apple'}}, {}, () => {
db.update({ _id: 'id6' }, { $addToSet: { fruits: 'apple' } }, {}, () => {
// The fruits array didn't change
// If we had used a fruit not in the array, e.g. 'banana', it would have been added to the array
});
// $pull removes all values matching a value or even any NeDB query from the array
db.update({_id: 'id6'}, {$pull: {fruits: 'apple'}}, {}, () => {
db.update({ _id: 'id6' }, { $pull: { fruits: 'apple' } }, {}, () => {
// Now the fruits array is ['orange', 'pear']
});
db.update({_id: 'id6'}, {$pull: {fruits: {$in: ['apple', 'pear']}}}, {}, () => {
db.update({ _id: 'id6' }, { $pull: { fruits: { $in: ['apple', 'pear'] } } }, {}, () => {
// Now the fruits array is ['orange']
});
// $each can be used to $push or $addToSet multiple values at once
// This example works the same way with $addToSet
db.update({_id: 'id6'}, {$push: {fruits: {$each: ['banana', 'orange']}}}, {}, () => {
db.update({ _id: 'id6' }, { $push: { fruits: { $each: ['banana', 'orange'] } } }, {}, () => {
// Now the fruits array is ['apple', 'orange', 'pear', 'banana', 'orange']
});
@@ -477,32 +477,32 @@ db.update({_id: 'id6'}, {$push: {fruits: {$each: ['banana', 'orange']}}}, {}, ()
// Remove one document from the collection
// options set to {} since the default for multi is false
db.remove({_id: 'id2'}, {}, (err: Error, numRemoved: number) => {
db.remove({ _id: 'id2' }, {}, (err: Error, numRemoved: number) => {
// numRemoved = 1
});
// Remove multiple documents
db.remove({system: 'solar'}, {multi: true}, (err: Error, numRemoved: number) => {
db.remove({ system: 'solar' }, { multi: true }, (err: Error, numRemoved: number) => {
// numRemoved = 3
// All planets from the solar system were removed
});
db.ensureIndex({fieldName: 'somefield'}, (err: Error) => {
db.ensureIndex({ fieldName: 'somefield' }, (err: Error) => {
// If there was an error, err is not null
});
// Using a unique constraint with the index
db.ensureIndex({fieldName: 'somefield', unique: true}, (err: Error) => {
db.ensureIndex({ fieldName: 'somefield', unique: true }, (err: Error) => {
});
// Using a sparse unique index
db.ensureIndex({fieldName: 'somefield', unique: true, sparse: true}, (err: Error) => {
db.ensureIndex({ fieldName: 'somefield', unique: true, sparse: true }, (err: Error) => {
});
// Format of the error message when the unique constraint is not met
db.insert({somefield: 'nedb'}, (err: Error) => {
db.insert({ somefield: 'nedb' }, (err: Error) => {
// err is null
db.insert({somefield: 'nedb'}, (err: Error) => {
db.insert({ somefield: 'nedb' }, (err: Error) => {
// err is { errorType: 'uniqueViolated'
// , key: 'name'
// , message: 'Unique constraint violated for key name' }
+2 -2
View File
@@ -33,10 +33,10 @@ OpticsAgent.instrumentHapiServer(hapiServer);
const koaServer = new KoaServer();
koaServer.use(OpticsAgent.koaMiddleware());
const req = {} as express.Request;
declare const req: express.Request;
OpticsAgent.context(req);
const agent = new OpticsAgent.Agent({ apiKey: '1234' });
const schema = {} as GraphQLSchema;
declare const schema: GraphQLSchema;
agent.instrumentSchema(schema);
@@ -42,8 +42,8 @@ class SnapCarouselTest extends React.Component<{}, {}> {
const styles = StyleSheet.create({
container: {
flex: 1
} as ViewStyle,
},
item: {
width: 75
} as ViewStyle
}
});
@@ -35,28 +35,28 @@ class SwiperTest extends React.Component<{}, {}> {
const styles = StyleSheet.create({
wrapper: {
} as ViewStyle,
},
slide1: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#9DD6EB'
} as ViewStyle,
},
slide2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#97CAE5'
} as ViewStyle,
},
slide3: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#92BBD9'
} as ViewStyle,
},
text: {
color: '#fff',
fontSize: 30,
fontWeight: 'bold'
} as ViewStyle
}
});
+12
View File
@@ -7471,6 +7471,18 @@ export interface UIManagerStatic {
onFail: () => void, /* currently unused */
onSuccess: MeasureLayoutOnSuccessCallback
): void;
/**
* Automatically animates views to their new positions when the
* next layout happens.
*
* A common way to use this API is to call it before calling `setState`.
*
* Note that in order to get this to work on **Android** you need to set the following flags via `UIManager`:
*
* UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
*/
setLayoutAnimationEnabledExperimental(value: boolean): void;
}
export interface SwitchPropertiesIOS extends ViewProperties {
+13 -13
View File
@@ -78,24 +78,24 @@ const styles = StyleSheet.create<LocalStyles>(
//alternative declaration of styles (inline typings)
const stylesAlt = StyleSheet.create(
{
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
} as ViewStyle,
welcome: {
fontSize: 20,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
} as TextStyle,
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
textAlign: 'center',
color: '#333333',
marginBottom: 5,
} as TextStyle
}
}
)
);
class CustomView extends React.Component<{}, {}> {
+9 -9
View File
@@ -52,9 +52,9 @@ class ModalSwitch extends React.Component<RouteComponentProps<void>, void> {
return (
<div>
<Switch location={isModal ? this.previousLocation : location}>
<Route exact path='/' component={Home}/>
<Route path='/gallery' component={Gallery}/>
<Route path='/img/:id' component={ImageView}/>
<Route exact path='/' component={Home} />
<Route path='/gallery' component={Gallery} />
<Route path='/img/:id' component={ImageView} />
</Switch>
{isModal ? <Route path='/img/:id' component={Modal} /> : null}
</div>
@@ -70,14 +70,14 @@ const IMAGES = [
{ id: 4, title: 'Crimson', color: 'Crimson' }
];
const Thumbnail: React.SFC<{color: string}> = ({ color }) =>
const Thumbnail: React.SFC<{ color: string }> = ({ color }) =>
<div style={{
width: 50,
height: 50,
background: color
}}/>;
}} />;
const Image: React.SFC<{color: string}> = ({ color }) =>
const Image: React.SFC<{ color: string }> = ({ color }) =>
<div style={{
width: '100%',
height: 400,
@@ -113,7 +113,7 @@ const Gallery = () => (
</div>
);
const ImageView: React.SFC<RouteComponentProps<{id: string}>> = ({ match }) => {
const ImageView: React.SFC<RouteComponentProps<{ id: string }>> = ({ match }) => {
const image = IMAGES[parseInt(match.params.id, 10)];
if (!image) {
return <div>Image not found</div>;
@@ -127,7 +127,7 @@ const ImageView: React.SFC<RouteComponentProps<{id: string}>> = ({ match }) => {
);
};
const Modal: React.SFC<RouteComponentProps<{id: string}>> = ({ match, history }) => {
const Modal: React.SFC<RouteComponentProps<{ id: string }>> = ({ match, history }) => {
const image = IMAGES[parseInt(match.params.id, 10)];
if (!image) {
return null!;
@@ -149,7 +149,7 @@ const Modal: React.SFC<RouteComponentProps<{id: string}>> = ({ match, history })
}}
>
<div className='modal' style={{
position: 'absolute',
position: 'absolute',
background: '#fff',
top: 25,
left: '10%',
+7 -10
View File
@@ -33,10 +33,7 @@ interface CustomHistory {
type CombinedHistory = History & CustomHistory;
function createCustomHistory(history: History): CombinedHistory {
return {
...history,
test() {}
} as CombinedHistory;
return Object.assign(history, { test() { } });
}
const customHistory = createCustomHistory(browserHistory);
@@ -79,7 +76,7 @@ interface DashboardProps {
}
class Dashboard extends React.Component<DashboardProps, {}> {
static staticMethodToBeHoisted(): void {}
static staticMethodToBeHoisted(): void { }
navigate() {
const router = this.props.router;
@@ -125,20 +122,20 @@ ReactDOM.render((
<Router history={hashHistory}>
<Route path="/" component={Master}>
<IndexRoute component={DashboardWithRouter} />
<Route path="users" component={Users}/>
<Route path="*" component={NotFound}/>
<Route path="users" component={Users} />
<Route path="*" component={NotFound} />
</Route>
</Router>
), document.body);
ReactDOM.render((
<Router history={ routerHistory }>
<Router history={routerHistory}>
<Route path="/" component={Master} />
</Router>
), document.body);
ReactDOM.render((
<Router history={ customHistory }>
<Router history={customHistory}>
<Route path="/" component={Master} />
</Router>
), document.body);
@@ -147,7 +144,7 @@ const history = createMemoryHistory("baseurl");
const routes = (
<Route path="/" component={Master}>
<IndexRoute component={DashboardWithRouter} />
<Route path="users" component={Users}/>
<Route path="users" component={Users} />
</Route>
);
+2 -8
View File
@@ -63,17 +63,11 @@ export type OverscanIndices = {
export type CellSizeAndPositionManager = {
areOffsetsAdjusted(): boolean;
configure({
cellCount,
estimatedCellSize
}: ConfigureParams): void;
configure({ cellCount, estimatedCellSize }: ConfigureParams): void;
getCellCount(): number;
getEstimatedCellSize(): number;
getLastMeasuredIndex(): number;
getOffsetAdjustment({
containerSize,
offset // safe
}: ContainerSizeAndOffset): number;
getOffsetAdjustment({ containerSize, offset/*safe*/ }: ContainerSizeAndOffset): number;
/**
* This method returns the size and position for the cell at the specified index.
* It just-in-time calculates (or used cached values) for cells leading up to the index.
+3 -3
View File
@@ -42,7 +42,7 @@ declare module 'request-promise-native/errors' {
response: http.IncomingMessage;
}
interface RequestErrorConstructor {
new (cause: any, options: rp.Options, response: http.IncomingMessage): RequestError;
new(cause: any, options: rp.Options, response: http.IncomingMessage): RequestError;
(cause: any, options: rp.Options, response: http.IncomingMessage): RequestError;
prototype: RequestError;
}
@@ -55,7 +55,7 @@ declare module 'request-promise-native/errors' {
response: http.IncomingMessage;
}
interface StatusCodeErrorConstructor extends Error {
new (statusCode: number, body: any, options: rp.Options, response: http.IncomingMessage): StatusCodeError;
new(statusCode: number, body: any, options: rp.Options, response: http.IncomingMessage): StatusCodeError;
(statusCode: number, body: any, options: rp.Options, response: http.IncomingMessage): StatusCodeError;
prototype: StatusCodeError;
}
@@ -68,7 +68,7 @@ declare module 'request-promise-native/errors' {
response: http.IncomingMessage;
}
interface TransformErrorConstructor extends Error {
new (cause: any, options: rp.Options, response: http.IncomingMessage): TransformError;
new(cause: any, options: rp.Options, response: http.IncomingMessage): TransformError;
(cause: any, options: rp.Options, response: http.IncomingMessage): TransformError;
prototype: TransformError;
}
@@ -249,9 +249,9 @@ import * as qs from 'querystring';
const CONSUMER_KEY = 'key';
const CONSUMER_SECRET = 'secret';
let oauth = {
callback: 'http://mysite.com/callback/'
, consumer_key: CONSUMER_KEY
, consumer_secret: CONSUMER_SECRET
callback: 'http://mysite.com/callback/',
consumer_key: CONSUMER_KEY,
consumer_secret: CONSUMER_SECRET,
};
url = 'https://api.twitter.com/oauth/request_token';
@@ -272,11 +272,11 @@ rpn.post({ url, oauth }, (e, r, body) => {
// after the user is redirected back to your server
let auth_data: any = qs.parse(body);
let oauth = {
consumer_key: CONSUMER_KEY
, consumer_secret: CONSUMER_SECRET
, token: auth_data.oauth_token
, token_secret: req_data.oauth_token_secret
, verifier: auth_data.oauth_verifier
consumer_key: CONSUMER_KEY,
consumer_secret: CONSUMER_SECRET,
token: auth_data.oauth_token,
token_secret: req_data.oauth_token_secret,
verifier: auth_data.oauth_verifier,
};
url = 'https://api.twitter.com/oauth/access_token';
@@ -284,10 +284,10 @@ rpn.post({ url, oauth }, (e, r, body) => {
// ready to make signed requests on behalf of the user
let perm_data: any = qs.parse(body);
let oauth = {
consumer_key: CONSUMER_KEY
, consumer_secret: CONSUMER_SECRET
, token: perm_data.oauth_token
, token_secret: perm_data.oauth_token_secret
consumer_key: CONSUMER_KEY,
consumer_secret: CONSUMER_SECRET,
token: perm_data.oauth_token,
token_secret: perm_data.oauth_token_secret,
};
url = 'https://api.twitter.com/1.1/users/show.json';
@@ -406,17 +406,17 @@ rpn.get('http://10.255.255.1', { timeout: 1500 }, (err) => {
let rand = Math.floor(Math.random() * 100000000).toString();
rpn(
{
method: 'PUT'
, uri: 'http://mikeal.iriscouch.com/testjs/' + rand
, multipart:
method: 'PUT',
uri: 'http://mikeal.iriscouch.com/testjs/' + rand,
multipart:
[{
'content-type': 'application/json'
, body: JSON.stringify({ foo: 'bar', _attachments: { 'message.txt': { follows: true, length: 18, content_type: 'text/plain' } } })
}
, { body: 'I am an attachment' }
'content-type': 'application/json',
body: JSON.stringify({ foo: 'bar', _attachments: { 'message.txt': { follows: true, length: 18, content_type: 'text/plain' } } })
},
{ body: 'I am an attachment' }
]
}
, (error, response, body) => {
},
(error, response, body) => {
if (response.statusCode === 201) {
console.log('document saved as: http://mikeal.iriscouch.com/testjs/' + rand);
} else {
@@ -428,11 +428,11 @@ rpn(
rpn(
{
method: 'GET'
, uri: 'http://www.google.com'
, gzip: true
}
, (error, response, body) => {
method: 'GET',
uri: 'http://www.google.com',
gzip: true
},
(error, response, body) => {
// body is the decompressed response body
console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity'));
console.log('the decoded data is: ' + body);
+1 -1
View File
@@ -454,7 +454,7 @@ export interface ServerOptions {
handleUpgrades?: boolean;
router?: Router;
httpsServerOptions?: any;
socketio?: boolean;
socketio?: boolean;
}
export interface ClientOptions {
File diff suppressed because it is too large Load Diff
+16 -16
View File
@@ -5,9 +5,9 @@ const app = new Hapi.Server();
module.exports = app; // for testing
const config = {
const config: SwaggerHapi.Config = {
appRoot: __dirname // required config
} as SwaggerHapi.Config;
};
SwaggerHapi.create(config, (err, swaggerHapi) => {
if (err) { throw err; }
@@ -29,21 +29,21 @@ SwaggerHapi.create(config, (err, swaggerHapi) => {
});
const swaggerSecurityHandlerCb = (err: Error) => {
// do nothing
// do nothing
};
const configComplex: SwaggerHapi.Config = {
appRoot: __dirname,
configDir: "some/directory",
controllersDirs: ["some/directory"],
fittingsDirs: ["some/directory"],
mockMode: true,
swaggerControllerPipe: 'swagger_controllers',
swaggerSecurityHandlers: {
// did not manage to research the typings of first 3 arguments
someHandlerName: ({}, {}, {}, swaggerSecurityHandlerCb) => {
// do nothing
}
},
validateResponse: true
appRoot: __dirname,
configDir: "some/directory",
controllersDirs: ["some/directory"],
fittingsDirs: ["some/directory"],
mockMode: true,
swaggerControllerPipe: 'swagger_controllers',
swaggerSecurityHandlers: {
// did not manage to research the typings of first 3 arguments
someHandlerName: ({ }, { }, { }, swaggerSecurityHandlerCb) => {
// do nothing
}
},
validateResponse: true
};
@@ -3,9 +3,9 @@ import * as restify from "restify";
const app = restify.createServer();
const config = {
appRoot: __dirname // required config
} as SwaggerRestify.Config;
const config: SwaggerRestify.Config = {
appRoot: __dirname // required config
};
SwaggerRestify.create(config, (err, swaggerRestify) => {
if (err) { throw err; }