mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,8 +94,6 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function bind() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -104,14 +102,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -120,14 +110,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', false);
|
||||
|
||||
@@ -139,12 +121,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,27 +140,15 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function off() {
|
||||
function defaultContext_defaultData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
function defaultData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
function defaultContext_customData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
function customContext_defaultData(this: I1, event: JQueryEventObject) { }
|
||||
|
||||
function customContext_customData(this: I1, event: JQueryEventObject) { }
|
||||
|
||||
interface I1 { kind: 'I1'; }
|
||||
function customData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_defaultData);
|
||||
$('table').off('myEvent', 'td', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_customData);
|
||||
$('table').off('myEvent', 'td', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', false);
|
||||
@@ -193,16 +157,10 @@ function JQuery() {
|
||||
$('table').off('myEvent', 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_defaultData);
|
||||
$('table').off('myEvent', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_customData);
|
||||
$('table').off('myEvent', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', false);
|
||||
@@ -213,19 +171,15 @@ function JQuery() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
defaultData,
|
||||
customData
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
defaultData,
|
||||
customData
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -236,8 +190,6 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function on() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -246,14 +198,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -262,14 +206,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -278,14 +214,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', false);
|
||||
|
||||
@@ -297,14 +225,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -313,14 +233,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', false);
|
||||
|
||||
@@ -332,12 +244,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
@@ -349,12 +255,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
@@ -366,12 +266,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
@@ -383,12 +277,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
@@ -400,19 +288,11 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function one() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -421,14 +301,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -437,14 +309,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -453,14 +317,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', false);
|
||||
|
||||
@@ -472,14 +328,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -488,14 +336,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', false);
|
||||
|
||||
@@ -507,12 +347,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
@@ -524,12 +358,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
@@ -541,12 +369,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
@@ -558,12 +380,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
@@ -575,12 +391,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -92,7 +92,7 @@ declare namespace Backbone {
|
||||
}
|
||||
|
||||
interface EventsHash {
|
||||
[selector: string]: string | {(eventObject: JQueryEventObject): void};
|
||||
[selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void};
|
||||
}
|
||||
|
||||
export const Events: Events;
|
||||
|
||||
@@ -42,7 +42,7 @@ $(() => {
|
||||
|
||||
$('#ex7').slider();
|
||||
|
||||
$('#ex7-enabled').click(function(this: HTMLInputElement) {
|
||||
$<HTMLInputElement>('#ex7-enabled').click(function() {
|
||||
if (this.checked) {
|
||||
// With JQuery
|
||||
$('#ex7').slider('enable');
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+7
-2
@@ -322,7 +322,7 @@ export interface TooltipOption {
|
||||
// Events
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
export interface CarouselEventHandler<TElement> extends JQuery.Event<TElement, undefined> {
|
||||
export interface CarouselEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined> {
|
||||
/**
|
||||
* The direction in which the carousel is sliding.
|
||||
*/
|
||||
@@ -339,6 +339,10 @@ export interface CarouselEventHandler<TElement> extends JQuery.Event<TElement, u
|
||||
to: number;
|
||||
}
|
||||
|
||||
export interface TapEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined> {
|
||||
relatedTarget: HTMLElement;
|
||||
}
|
||||
|
||||
export type AlertEvent = "close.bs.alert" | "closed.bs.alert";
|
||||
export type CarouselEvent = "slide.bs.carousel" | "slid.bs.carousel";
|
||||
export type CollapseEvent = "show.bs.collapse" | "shown.bs.collapse" | "hide.bs.collapse" | "hidden.bs.collapse";
|
||||
@@ -383,9 +387,10 @@ declare global {
|
||||
tooltip(options?: TooltipOption): this;
|
||||
|
||||
on(events: CarouselEvent, handler: JQuery.EventHandlerBase<TElement, CarouselEventHandler<TElement>>): this;
|
||||
on(events: TapEvent, handler: JQuery.EventHandlerBase<TElement, TapEventHandler<TElement>>): this;
|
||||
on(events:
|
||||
AlertEvent | CollapseEvent | DropdownEvent | ModalEvent |
|
||||
PopoverEvent | ScrollspyEvent | TapEvent | TooltipEvent,
|
||||
PopoverEvent | ScrollspyEvent | TooltipEvent,
|
||||
handler: JQuery.EventHandler<TElement>): this;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -426,8 +426,9 @@ declare class cropperjs {
|
||||
/**
|
||||
* Replace the image's src and rebuild the cropper.
|
||||
* @param url A new image url
|
||||
* @param hasSameSize If the new image has the same size with the old one, then it will not rebuilt the cropper and only update the urls of all related images. (Default: false)
|
||||
*/
|
||||
replace(url: string): void;
|
||||
replace(url: string, hasSameSize?: boolean): void;
|
||||
|
||||
/**
|
||||
* Enable (unfreeze) the cropper.
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+47
-7
@@ -23,12 +23,7 @@ export namespace v2 {
|
||||
searchAgents(
|
||||
request: SearchAgentRequest,
|
||||
options?: gax.CallOptions,
|
||||
cb?: (
|
||||
err: Error,
|
||||
agents: Agent[],
|
||||
arg3: any,
|
||||
response: any
|
||||
) => void
|
||||
cb?: (err: Error, agents: Agent[], arg3: any, response: any) => void
|
||||
): Promise<Agent[]>;
|
||||
searchAgentsStream(
|
||||
request: SearchAgentRequest,
|
||||
@@ -213,7 +208,28 @@ export namespace v2 {
|
||||
getProjectId(): Promise<string>;
|
||||
getProjectId(callback?: (error: Error, id: string) => string): void;
|
||||
|
||||
// TODO: add Session Entity Types service methods
|
||||
// TODO: add streaming calls
|
||||
|
||||
listSessionEntityTypes(
|
||||
request: ListSessionEntityTypesRequest,
|
||||
options?: gax.CallOptions
|
||||
): Promise<[SessionEntityType[]]>;
|
||||
getSessionEntityType(
|
||||
request: GetSessionEntityTypeRequest,
|
||||
options?: gax.CallOptions
|
||||
): Promise<[SessionEntityType]>;
|
||||
createSessionEntityType(
|
||||
request: CreateSessionEntityTypeRequest,
|
||||
options?: gax.CallOptions
|
||||
): Promise<[SessionEntityType]>;
|
||||
updateSessionEntityType(
|
||||
request: UpdateSessionEntityTypeRequest,
|
||||
options?: gax.CallOptions
|
||||
): Promise<[SessionEntityType]>;
|
||||
deleteSessionEntityType(
|
||||
request: DeleteSessionEntityTypeRequest,
|
||||
options?: gax.CallOptions
|
||||
): Promise<void>;
|
||||
}
|
||||
|
||||
class SessionsClient {
|
||||
@@ -504,6 +520,30 @@ export interface DeleteEntityTypeRequest {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ListSessionEntityTypesRequest {
|
||||
parent: string;
|
||||
pageSize?: number;
|
||||
}
|
||||
|
||||
export interface GetSessionEntityTypeRequest {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CreateSessionEntityTypeRequest {
|
||||
parent: string;
|
||||
sessionEntityType: SessionEntityType;
|
||||
}
|
||||
|
||||
export interface UpdateSessionEntityTypeRequest {
|
||||
sessionEntityType: SessionEntityType;
|
||||
/** @link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto */
|
||||
updateMask: any;
|
||||
}
|
||||
|
||||
export interface DeleteSessionEntityTypeRequest {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ListIntentsRequest {
|
||||
parent: string;
|
||||
languageCode?: string;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
"radix": false,
|
||||
"prefer-for-of": false,
|
||||
"one-line": false,
|
||||
"no-unnecessary-type-assertion": false
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { ExpiryManager } from "expirymanager";
|
||||
|
||||
const expiryManager = new ExpiryManager();
|
||||
|
||||
const keys = ['1', '2'];
|
||||
|
||||
expiryManager.expire(keys, 1);
|
||||
|
||||
expiryManager.unexpire(keys);
|
||||
|
||||
const expiry: number = expiryManager.getExpiry(keys[0]);
|
||||
|
||||
let expiredKeys = expiryManager.getExpiredKeys();
|
||||
expiredKeys = expiryManager.getExpiredKeys(expiryManager.now());
|
||||
|
||||
expiredKeys = expiryManager.extractExpiredKeys();
|
||||
expiredKeys = expiryManager.extractExpiredKeys(expiryManager.now());
|
||||
|
||||
expiryManager.clear();
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for expirymanager 0.9
|
||||
// Project: https://github.com/SocketCluster/expirymanager
|
||||
// Definitions by: Daniel Rose <https://github.com/DanielRose>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type Key = any;
|
||||
export type Keys = Key[];
|
||||
|
||||
export class ExpiryManager {
|
||||
constructor();
|
||||
|
||||
now(): number;
|
||||
|
||||
expire(keys: Keys, seconds: number): void;
|
||||
unexpire(keys: Keys): void;
|
||||
|
||||
getExpiry(key: Key): number;
|
||||
|
||||
getKeysByExpiry(expiry: number): Keys;
|
||||
|
||||
getExpiredKeys(time?: number): Keys;
|
||||
extractExpiredKeys(time?: number): Keys;
|
||||
|
||||
clear(): void;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"expirymanager-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -9,7 +9,7 @@ interface Services {
|
||||
users: User;
|
||||
}
|
||||
|
||||
const app = feathers() as Application<Services>;
|
||||
const app = feathers<Services>();
|
||||
|
||||
app.service('users').get(0).then(u => {
|
||||
const user: User = u;
|
||||
|
||||
+2
-1
@@ -12,7 +12,8 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import * as self from '@feathersjs/feathers';
|
||||
|
||||
declare const feathers: (() => Application<object>) & typeof self;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
declare const feathers: (<T = any>() => Application<T>) & typeof self;
|
||||
export default feathers;
|
||||
|
||||
export const version: string;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { FlexiMap } from "fleximap";
|
||||
|
||||
let flexiMap = new FlexiMap();
|
||||
flexiMap = new FlexiMap({ arr: [] });
|
||||
flexiMap = new FlexiMap([{ arr: [] }, { obj: {} }]);
|
||||
|
||||
flexiMap.set('keyA', {arr: [], obj: {}});
|
||||
let result = flexiMap.get(['keyA', 'arr']);
|
||||
|
||||
flexiMap.add(['keyB1', 'keyB2', 'keyB3'], 123);
|
||||
result = flexiMap.get(['keyB1', 'keyB2']);
|
||||
|
||||
const arr = [];
|
||||
arr[5] = 'Hello world';
|
||||
|
||||
flexiMap.set(['keyC1', 'keyC2'], arr);
|
||||
result = flexiMap.get(['keyC1', 'keyC2']);
|
||||
|
||||
flexiMap.set(['itemsA', 0], 'hello');
|
||||
flexiMap.set(['itemsA', 2], 'world');
|
||||
flexiMap.remove(['itemsA', 0]);
|
||||
|
||||
flexiMap.set(['itemsB', 0], 'a');
|
||||
flexiMap.set(['itemsB', 1], 'b');
|
||||
flexiMap.set(['itemsB', 2], 'c');
|
||||
let splicedItems = flexiMap.splice(['itemsB'], 1, 1);
|
||||
splicedItems = flexiMap.splice(['itemsB'], 1, 0, 'b2');
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for fleximap 0.9
|
||||
// Project: https://github.com/SocketCluster/fleximap
|
||||
// Definitions by: Daniel Rose <https://github.com/DanielRose>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export type KeyChain = any;
|
||||
|
||||
export class FlexiMap {
|
||||
constructor(object?: any[] | object);
|
||||
|
||||
get(keyChain: KeyChain): any;
|
||||
getRange(keyChain: KeyChain, fromIndex: number, toIndex: number): any;
|
||||
getRaw(keyChain: KeyChain): any;
|
||||
getAll(): any[] | object;
|
||||
|
||||
count(keyChain: KeyChain): number;
|
||||
|
||||
hasImmediateKey(key: string): boolean;
|
||||
hasKey(keyChain: KeyChain): boolean;
|
||||
hasType(keyChain: KeyChain, type: any): boolean;
|
||||
hasValue(keyChain: KeyChain, value: any): boolean;
|
||||
hasObject(keyChain: KeyChain, object: object): boolean;
|
||||
|
||||
set(keyChain: KeyChain, value: any): any;
|
||||
|
||||
add(keyChain: KeyChain, value: any): number;
|
||||
|
||||
concat(keyChain: KeyChain, value: any): any;
|
||||
|
||||
remove(keyChain: KeyChain): any;
|
||||
removeRange(keyChain: KeyChain, fromIndex: number, toIndex: number): any[];
|
||||
removeAll(): void;
|
||||
|
||||
splice(keyChain: KeyChain, index: number, count: number, ...items: any[]): any[];
|
||||
|
||||
pop(keyChain: KeyChain): any[];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"fleximap-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"no-declare-current-package": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-self-import": false,
|
||||
"no-unnecessary-generics": false
|
||||
"no-unnecessary-generics": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { IFrameComponent, IFrameOptions, iframeResizer } from "iframe-resizer";
|
||||
import iframeResizer = require("iframe-resizer");
|
||||
|
||||
function testOne(): void {
|
||||
const iframe: HTMLIFrameElement = document.createElement('iframe');
|
||||
const options: IFrameOptions = {log: true};
|
||||
const components: IFrameComponent[] = iframeResizer(options, iframe);
|
||||
const options: iframeResizer.IFrameOptions = {log: true};
|
||||
const components: iframeResizer.IFrameComponent[] = iframeResizer(options, iframe);
|
||||
if (components) {
|
||||
components.forEach(component => console.log(component.iFrameResizer));
|
||||
} else {
|
||||
@@ -13,7 +13,7 @@ function testOne(): void {
|
||||
|
||||
function testTwo(): void {
|
||||
const iframe: HTMLIFrameElement = document.createElement('iframe');
|
||||
const components: IFrameComponent[] = iframeResizer({
|
||||
const components: iframeResizer.IFrameComponent[] = iframeResizer({
|
||||
initCallback: () => {
|
||||
console.log('Init');
|
||||
},
|
||||
|
||||
Vendored
+310
-270
@@ -3,275 +3,315 @@
|
||||
// Definitions by: Armin Baljic <https://github.com/arminbaljic>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFrameObject {
|
||||
close(): void;
|
||||
moveToAnchor(anchor: string): void;
|
||||
resize(): void;
|
||||
sendMessage(message: any, targetOrigin?: string): void;
|
||||
declare namespace iframeResizer {
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFrameObject {
|
||||
close(): void;
|
||||
|
||||
moveToAnchor(anchor: string): void;
|
||||
|
||||
resize(): void;
|
||||
|
||||
sendMessage(
|
||||
message: any,
|
||||
targetOrigin?: string
|
||||
): void;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFrameComponent extends HTMLIFrameElement {
|
||||
iFrameResizer: IFrameObject;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFrameOptions {
|
||||
/**
|
||||
* When enabled changes to the Window size or the DOM will cause the iFrame to resize to the new content size.
|
||||
* Disable if using size method with custom dimensions.
|
||||
*/
|
||||
autoResize?: boolean;
|
||||
/**
|
||||
* Override the body background style in the iFrame.
|
||||
*/
|
||||
bodyBackground?: string;
|
||||
/**
|
||||
* Override the default body margin style in the iFrame. A string can be any valid value for the
|
||||
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
|
||||
*/
|
||||
bodyMargin?: number | string;
|
||||
/**
|
||||
* Override the default body padding style in the iFrame. A string can be any valid value for the
|
||||
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
|
||||
*/
|
||||
bodyPadding?: number | string;
|
||||
/**
|
||||
* When set to true, only allow incoming messages from the domain listed in the src property of the iFrame tag.
|
||||
* If your iFrame navigates between different domains, ports or protocols; then you will need to
|
||||
* provide an array of URLs or disable this option.
|
||||
*/
|
||||
checkOrigin?: boolean | string[];
|
||||
/**
|
||||
* When enabled in page linking inside the iFrame and from the iFrame to the parent page will be enabled.
|
||||
*/
|
||||
inPageLinks?: boolean;
|
||||
/**
|
||||
* Height calculation method.
|
||||
*/
|
||||
heightCalculationMethod?: HeightCalculationMethod;
|
||||
/**
|
||||
* Set iFrame Id
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* In browsers that don't support mutationObserver, such as IE10, the library falls back to using
|
||||
* setInterval, to check for changes to the page size.
|
||||
*/
|
||||
interval?: number;
|
||||
/**
|
||||
* Setting the log option to true will make the scripts in both the host page and the iFrame output
|
||||
* everything they do to the JavaScript console so you can see the communication between the two scripts.
|
||||
*/
|
||||
log?: boolean;
|
||||
/**
|
||||
* Set maximum height of iFrame.
|
||||
*/
|
||||
maxHeight?: number;
|
||||
/**
|
||||
* Set maximum width of iFrame.
|
||||
*/
|
||||
maxWidth?: number;
|
||||
/**
|
||||
* Set minimum height of iFrame.
|
||||
*/
|
||||
minHeight?: number;
|
||||
/**
|
||||
* Set minimum width of iFrame.
|
||||
*/
|
||||
minWidth?: number;
|
||||
/**
|
||||
* Listen for resize events from the parent page, or the iFrame. Select the 'child' value if the iFrame
|
||||
* can be resized independently of the browser window. Selecting this value can cause issues with some
|
||||
* height calculation methods on mobile devices.
|
||||
*/
|
||||
resizeFrom?: 'parent' | 'child';
|
||||
/**
|
||||
* Enable scroll bars in iFrame.
|
||||
*/
|
||||
scrolling?: boolean | 'auto';
|
||||
/**
|
||||
* Resize iFrame to content height.
|
||||
*/
|
||||
sizeHeight?: boolean;
|
||||
/**
|
||||
* Resize iFrame to content width.
|
||||
*/
|
||||
sizeWidth?: boolean;
|
||||
/**
|
||||
* Set the number of pixels the iFrame content size has to change by, before triggering a resize of the iFrame.
|
||||
*/
|
||||
tolerance?: number;
|
||||
/**
|
||||
* Width calculation method.
|
||||
*/
|
||||
widthCalculationMethod?: WidthCalculationMethod;
|
||||
|
||||
/**
|
||||
* Called when iFrame is closed via parentIFrame.close() or iframe.iframeResizer.close() methods.
|
||||
*/
|
||||
closedCallback?(iframeId: string): void;
|
||||
|
||||
/**
|
||||
* Initial setup callback function.
|
||||
*/
|
||||
initCallback?(iframe: IFrameComponent): void;
|
||||
|
||||
/**
|
||||
* Receive message posted from iFrame with the parentIFrame.sendMessage() method.
|
||||
*/
|
||||
messageCallback?(data: IFrameMessageData): void;
|
||||
|
||||
/**
|
||||
* Function called after iFrame resized. Passes in messageData object containing the iFrame, height, width
|
||||
* and the type of event that triggered the iFrame to resize.
|
||||
*/
|
||||
resizedCallback?(data: IFrameResizedData): void;
|
||||
|
||||
/**
|
||||
* Called before the page is repositioned after a request from the iFrame, due to either an in page link,
|
||||
* or a direct request from either parentIFrame.scrollTo() or parentIFrame.scrollToOffset().
|
||||
* If this callback function returns false, it will stop the library from repositioning the page, so that
|
||||
* you can implement your own animated page scrolling instead.
|
||||
*/
|
||||
scrollCallback?(data: IFrameScrollData): boolean;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFramePageOptions {
|
||||
/**
|
||||
* This option allows you to restrict the domain of the parent page,
|
||||
* to prevent other sites mimicking your parent page.
|
||||
*/
|
||||
targetOrigin?: string;
|
||||
|
||||
/**
|
||||
* Receive message posted from the parent page with the iframe.iFrameResizer.sendMessage() method.
|
||||
*/
|
||||
messageCallback?(message: any): void;
|
||||
|
||||
/**
|
||||
* This function is called once iFrame-Resizer has been initialized after receiving a call from the parent page.
|
||||
*/
|
||||
readyCallback?(): void;
|
||||
|
||||
/**
|
||||
* These option can be used to override the option set in the parent page
|
||||
*/
|
||||
heightCalculationMethod?: HeightCalculationMethod | (() => number);
|
||||
/**
|
||||
* These option can be used to override the option set in the parent page
|
||||
*/
|
||||
widthCalculationMethod?: WidthCalculationMethod | (() => number);
|
||||
}
|
||||
|
||||
type HeightCalculationMethod = 'bodyOffset' | 'bodyScroll' | 'documentElementOffset' | 'documentElementScroll' |
|
||||
'max' | 'min' | 'grow' | 'lowestElement' | 'taggedElement';
|
||||
|
||||
type WidthCalculationMethod = 'bodyOffset' | 'bodyScroll' | 'documentElementOffset' | 'documentElementScroll' |
|
||||
'max' | 'min' | 'scroll' | 'rightMostElement' | 'taggedElement';
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFramePage {
|
||||
/**
|
||||
* Turn autoResizing of the iFrame on and off. Returns bool of current state.
|
||||
*/
|
||||
autoResize(resize?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Remove the iFrame from the parent page.
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
* Returns the ID of the iFrame that the page is contained in.
|
||||
*/
|
||||
getId(): string;
|
||||
|
||||
/**
|
||||
* Ask the containing page for its positioning coordinates.
|
||||
*
|
||||
* Your callback function will be recalled when the parent page is scrolled or resized.
|
||||
*
|
||||
* Pass false to disable the callback.
|
||||
*/
|
||||
getPageInfo(callback: ((data: PageInfo) => void) | false): void;
|
||||
|
||||
/**
|
||||
* Scroll the parent page to the coordinates x and y
|
||||
*/
|
||||
scrollTo(
|
||||
x: number,
|
||||
y: number
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Scroll the parent page to the coordinates x and y relative to the position of the iFrame.
|
||||
*/
|
||||
scrollToOffset(
|
||||
x: number,
|
||||
y: number
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Send data to the containing page, message can be any data type that can be serialized into JSON. The `targetOrigin`
|
||||
* option is used to restrict where the message is sent to; to stop an attacker mimicking your parent page.
|
||||
* See the MDN documentation on postMessage for more details.
|
||||
*/
|
||||
sendMessage(
|
||||
message: any,
|
||||
targetOrigin?: string
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Change the method use to workout the height of the iFrame.
|
||||
*/
|
||||
setHeightCalculationMethod(method: HeightCalculationMethod): void;
|
||||
|
||||
/**
|
||||
* Change the method use to workout the width of the iFrame.
|
||||
*/
|
||||
setWidthCalculationMethod(method: WidthCalculationMethod): void;
|
||||
|
||||
/**
|
||||
* Set default target origin.
|
||||
*/
|
||||
setTargetOrigin(targetOrigin: string): void;
|
||||
|
||||
/**
|
||||
* Manually force iFrame to resize. To use passed arguments you need first to disable the `autoResize` option to
|
||||
* prevent auto resizing and enable the `sizeWidth` option if you wish to set the width.
|
||||
*/
|
||||
size(
|
||||
customHeight?: string,
|
||||
customWidth?: string
|
||||
): void;
|
||||
}
|
||||
|
||||
interface PageInfo {
|
||||
/**
|
||||
* The height of the iframe in pixels
|
||||
*/
|
||||
iframeHeight: number;
|
||||
/**
|
||||
* The width of the iframe in pixels
|
||||
*/
|
||||
iframeWidth: number;
|
||||
/**
|
||||
* The height of the viewport in pixels
|
||||
*/
|
||||
clientHeight: number;
|
||||
/**
|
||||
* The width of the viewport in pixels
|
||||
*/
|
||||
clientWidth: number;
|
||||
/**
|
||||
* The number of pixels between the left edge of the containing page and the left edge of the iframe
|
||||
*/
|
||||
offsetLeft: number;
|
||||
/**
|
||||
* The number of pixels between the top edge of the containing page and the top edge of the iframe
|
||||
*/
|
||||
offsetTop: number;
|
||||
/**
|
||||
* The number of pixels between the left edge of the iframe and the left edge of the iframe viewport
|
||||
*/
|
||||
scrollLeft: number;
|
||||
/**
|
||||
* The number of pixels between the top edge of the iframe and the top edge of the iframe viewport
|
||||
*/
|
||||
scrollTop: number;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFrameResizedData {
|
||||
iframe: IFrameComponent;
|
||||
height: number;
|
||||
width: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFrameMessageData {
|
||||
iframe: IFrameComponent;
|
||||
message: any;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IFrameScrollData {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFrameComponent extends HTMLIFrameElement {
|
||||
iFrameResizer: IFrameObject;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFrameOptions {
|
||||
/**
|
||||
* When enabled changes to the Window size or the DOM will cause the iFrame to resize to the new content size.
|
||||
* Disable if using size method with custom dimensions.
|
||||
*/
|
||||
autoResize?: boolean;
|
||||
/**
|
||||
* Override the body background style in the iFrame.
|
||||
*/
|
||||
bodyBackground?: string;
|
||||
/**
|
||||
* Override the default body margin style in the iFrame. A string can be any valid value for the
|
||||
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
|
||||
*/
|
||||
bodyMargin?: number | string;
|
||||
/**
|
||||
* Override the default body padding style in the iFrame. A string can be any valid value for the
|
||||
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
|
||||
*/
|
||||
bodyPadding?: number | string;
|
||||
/**
|
||||
* When set to true, only allow incoming messages from the domain listed in the src property of the iFrame tag.
|
||||
* If your iFrame navigates between different domains, ports or protocols; then you will need to
|
||||
* provide an array of URLs or disable this option.
|
||||
*/
|
||||
checkOrigin?: boolean | string[];
|
||||
/**
|
||||
* When enabled in page linking inside the iFrame and from the iFrame to the parent page will be enabled.
|
||||
*/
|
||||
inPageLinks?: boolean;
|
||||
/**
|
||||
* Height calculation method.
|
||||
*/
|
||||
heightCalculationMethod?: HeightCalculationMethod;
|
||||
/**
|
||||
* Set iFrame Id
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* In browsers that don't support mutationObserver, such as IE10, the library falls back to using
|
||||
* setInterval, to check for changes to the page size.
|
||||
*/
|
||||
interval?: number;
|
||||
/**
|
||||
* Setting the log option to true will make the scripts in both the host page and the iFrame output
|
||||
* everything they do to the JavaScript console so you can see the communication between the two scripts.
|
||||
*/
|
||||
log?: boolean;
|
||||
/**
|
||||
* Set maximum height of iFrame.
|
||||
*/
|
||||
maxHeight?: number;
|
||||
/**
|
||||
* Set maximum width of iFrame.
|
||||
*/
|
||||
maxWidth?: number;
|
||||
/**
|
||||
* Set minimum height of iFrame.
|
||||
*/
|
||||
minHeight?: number;
|
||||
/**
|
||||
* Set minimum width of iFrame.
|
||||
*/
|
||||
minWidth?: number;
|
||||
/**
|
||||
* Listen for resize events from the parent page, or the iFrame. Select the 'child' value if the iFrame
|
||||
* can be resized independently of the browser window. Selecting this value can cause issues with some
|
||||
* height calculation methods on mobile devices.
|
||||
*/
|
||||
resizeFrom?: 'parent' | 'child';
|
||||
/**
|
||||
* Enable scroll bars in iFrame.
|
||||
*/
|
||||
scrolling?: boolean | 'auto';
|
||||
/**
|
||||
* Resize iFrame to content height.
|
||||
*/
|
||||
sizeHeight?: boolean;
|
||||
/**
|
||||
* Resize iFrame to content width.
|
||||
*/
|
||||
sizeWidth?: boolean;
|
||||
/**
|
||||
* Set the number of pixels the iFrame content size has to change by, before triggering a resize of the iFrame.
|
||||
*/
|
||||
tolerance?: number;
|
||||
/**
|
||||
* Width calculation method.
|
||||
*/
|
||||
widthCalculationMethod?: WidthCalculationMethod;
|
||||
/**
|
||||
* Called when iFrame is closed via parentIFrame.close() or iframe.iframeResizer.close() methods.
|
||||
*/
|
||||
closedCallback?(iframeId: string): void;
|
||||
/**
|
||||
* Initial setup callback function.
|
||||
*/
|
||||
initCallback?(iframe: IFrameComponent): void;
|
||||
/**
|
||||
* Receive message posted from iFrame with the parentIFrame.sendMessage() method.
|
||||
*/
|
||||
messageCallback?(data: IFrameMessageData): void;
|
||||
/**
|
||||
* Function called after iFrame resized. Passes in messageData object containing the iFrame, height, width
|
||||
* and the type of event that triggered the iFrame to resize.
|
||||
*/
|
||||
resizedCallback?(data: IFrameResizedData): void;
|
||||
/**
|
||||
* Called before the page is repositioned after a request from the iFrame, due to either an in page link,
|
||||
* or a direct request from either parentIFrame.scrollTo() or parentIFrame.scrollToOffset().
|
||||
* If this callback function returns false, it will stop the library from repositioning the page, so that
|
||||
* you can implement your own animated page scrolling instead.
|
||||
*/
|
||||
scrollCallback?(data: IFrameScrollData): boolean;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFramePageOptions {
|
||||
/**
|
||||
* This option allows you to restrict the domain of the parent page,
|
||||
* to prevent other sites mimicking your parent page.
|
||||
*/
|
||||
targetOrigin?: string;
|
||||
/**
|
||||
* Receive message posted from the parent page with the iframe.iFrameResizer.sendMessage() method.
|
||||
*/
|
||||
messageCallback?(message: any): void;
|
||||
/**
|
||||
* This function is called once iFrame-Resizer has been initialized after receiving a call from the parent page.
|
||||
*/
|
||||
readyCallback?(): void;
|
||||
/**
|
||||
* These option can be used to override the option set in the parent page
|
||||
*/
|
||||
heightCalculationMethod?: HeightCalculationMethod | (() => number);
|
||||
/**
|
||||
* These option can be used to override the option set in the parent page
|
||||
*/
|
||||
widthCalculationMethod?: WidthCalculationMethod | (() => number);
|
||||
}
|
||||
|
||||
export type HeightCalculationMethod = 'bodyOffset' | 'bodyScroll' | 'documentElementOffset' | 'documentElementScroll' |
|
||||
'max' | 'min' | 'grow' | 'lowestElement' | 'taggedElement';
|
||||
|
||||
export type WidthCalculationMethod = 'bodyOffset' | 'bodyScroll' | 'documentElementOffset' | 'documentElementScroll' |
|
||||
'max' | 'min' | 'scroll' | 'rightMostElement' | 'taggedElement';
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFramePage {
|
||||
/**
|
||||
* Turn autoResizing of the iFrame on and off. Returns bool of current state.
|
||||
*/
|
||||
autoResize(resize?: boolean): boolean;
|
||||
/**
|
||||
* Remove the iFrame from the parent page.
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Returns the ID of the iFrame that the page is contained in.
|
||||
*/
|
||||
getId(): string;
|
||||
/**
|
||||
* Ask the containing page for its positioning coordinates.
|
||||
*
|
||||
* Your callback function will be recalled when the parent page is scrolled or resized.
|
||||
*
|
||||
* Pass false to disable the callback.
|
||||
*/
|
||||
getPageInfo(callback: ((data: PageInfo) => void) | false): void;
|
||||
/**
|
||||
* Scroll the parent page to the coordinates x and y
|
||||
*/
|
||||
scrollTo(x: number, y: number): void;
|
||||
/**
|
||||
* Scroll the parent page to the coordinates x and y relative to the position of the iFrame.
|
||||
*/
|
||||
scrollToOffset(x: number, y: number): void;
|
||||
/**
|
||||
* Send data to the containing page, message can be any data type that can be serialized into JSON. The `targetOrigin`
|
||||
* option is used to restrict where the message is sent to; to stop an attacker mimicking your parent page.
|
||||
* See the MDN documentation on postMessage for more details.
|
||||
*/
|
||||
sendMessage(message: any, targetOrigin?: string): void;
|
||||
/**
|
||||
* Change the method use to workout the height of the iFrame.
|
||||
*/
|
||||
setHeightCalculationMethod(method: HeightCalculationMethod): void;
|
||||
/**
|
||||
* Change the method use to workout the width of the iFrame.
|
||||
*/
|
||||
setWidthCalculationMethod(method: WidthCalculationMethod): void;
|
||||
/**
|
||||
* Set default target origin.
|
||||
*/
|
||||
setTargetOrigin(targetOrigin: string): void;
|
||||
/**
|
||||
* Manually force iFrame to resize. To use passed arguments you need first to disable the `autoResize` option to
|
||||
* prevent auto resizing and enable the `sizeWidth` option if you wish to set the width.
|
||||
*/
|
||||
size(customHeight?: string, customWidth?: string): void;
|
||||
}
|
||||
|
||||
export interface PageInfo {
|
||||
/**
|
||||
* The height of the iframe in pixels
|
||||
*/
|
||||
iframeHeight: number;
|
||||
/**
|
||||
* The width of the iframe in pixels
|
||||
*/
|
||||
iframeWidth: number;
|
||||
/**
|
||||
* The height of the viewport in pixels
|
||||
*/
|
||||
clientHeight: number;
|
||||
/**
|
||||
* The width of the viewport in pixels
|
||||
*/
|
||||
clientWidth: number;
|
||||
/**
|
||||
* The number of pixels between the left edge of the containing page and the left edge of the iframe
|
||||
*/
|
||||
offsetLeft: number;
|
||||
/**
|
||||
* The number of pixels between the top edge of the containing page and the top edge of the iframe
|
||||
*/
|
||||
offsetTop: number;
|
||||
/**
|
||||
* The number of pixels between the left edge of the iframe and the left edge of the iframe viewport
|
||||
*/
|
||||
scrollLeft: number;
|
||||
/**
|
||||
* The number of pixels between the top edge of the iframe and the top edge of the iframe viewport
|
||||
*/
|
||||
scrollTop: number;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFrameResizedData {
|
||||
iframe: IFrameComponent;
|
||||
height: number;
|
||||
width: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFrameMessageData {
|
||||
iframe: IFrameComponent;
|
||||
message: any;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
export interface IFrameScrollData {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export function iframeResizer(options: IFrameOptions, target: string | HTMLElement): IFrameComponent[];
|
||||
declare function iframeResizer(options: iframeResizer.IFrameOptions, target: string | HTMLElement): iframeResizer.IFrameComponent[];
|
||||
export = iframeResizer;
|
||||
export as namespace iframeResizer;
|
||||
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
import { Company } from "./Company";
|
||||
import { Avatar, LocationData, Segment, SocialProfile, Tag } from './User';
|
||||
|
||||
export type LeadIdentifier = { "id": string } | { "user_id": string };
|
||||
|
||||
export interface Lead {
|
||||
"type": "contact",
|
||||
readonly "id": string,
|
||||
"user_id": string | null,
|
||||
"email": string | null,
|
||||
"phone": string | null,
|
||||
"name": string | null,
|
||||
readonly "updated_at": number,
|
||||
"last_seen_ip": string | null,
|
||||
"unsubscribed_from_emails": boolean,
|
||||
"last_request_at": number | null,
|
||||
readonly "created_at": number,
|
||||
"user_agent_data": string | null,
|
||||
"custom_attributes": {
|
||||
[key: string]: any
|
||||
},
|
||||
"avatar": Avatar,
|
||||
"location_data": LocationData | {},
|
||||
"social_profiles": {
|
||||
"type": "social_profile.list",
|
||||
"social_profiles": SocialProfile[]
|
||||
},
|
||||
"companies": {
|
||||
"type": "company.list",
|
||||
"companies": Company[]
|
||||
},
|
||||
"segments": {
|
||||
"type": "segment.list",
|
||||
"segments": Segment[]
|
||||
|
||||
},
|
||||
"tags": {
|
||||
"type": "tag.list",
|
||||
"tags": Tag[]
|
||||
},
|
||||
"referrer": string | null,
|
||||
}
|
||||
|
||||
export interface List {
|
||||
"type": "user.list",
|
||||
"total_count": number,
|
||||
"contacts": Lead[],
|
||||
"pages": { "next"?: string, "page": number, "per_page": number, "total_pages": number }
|
||||
}
|
||||
Vendored
+36
-4
@@ -6,6 +6,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { List as UserList, User, UserIdentifier } from './User';
|
||||
import { List as LeadList, Lead, LeadIdentifier } from './Lead';
|
||||
import { CompanyIdentifier, List as CompanyList, Company } from './Company';
|
||||
import { TagIdentifier, List as TagList, Tag, TagOper } from './Tag';
|
||||
import { List as EventList, Event, ListParam as EventListParam } from './Event';
|
||||
@@ -33,6 +34,8 @@ export class Client {
|
||||
companies: Companies;
|
||||
tags: Tags;
|
||||
events: Events;
|
||||
contacts: Leads;
|
||||
leads: Leads;
|
||||
}
|
||||
|
||||
export class ApiResponse<T> extends IncomingMessage {
|
||||
@@ -51,17 +54,46 @@ export class Users {
|
||||
find(identifier: UserIdentifier): Promise<ApiResponse<User>>;
|
||||
find(identifier: UserIdentifier, cb: callback<ApiResponse<User>>): void;
|
||||
|
||||
list(): Promise<ApiResponse<User>>;
|
||||
list(cb: callback<ApiResponse<User>>): void;
|
||||
list(): Promise<ApiResponse<UserList>>;
|
||||
list(cb: callback<ApiResponse<UserList>>): void;
|
||||
|
||||
listBy(params: {tag_id?: string, segment_id?: string}): Promise<ApiResponse<UserList>>;
|
||||
listBy(params: {tag_id?: string, segment_id?: string}, cb: callback<ApiResponse<UserList>>): void;
|
||||
|
||||
scroll: Scroll<User>;
|
||||
|
||||
archive(): Promise<User>;
|
||||
archive(identifier: UserIdentifier): Promise<ApiResponse<User>>;
|
||||
archive(identifier: UserIdentifier, cb: callback<ApiResponse<User>>): void;
|
||||
|
||||
requestPermanentDeletion(id: string): Promise<{ id: number }>;
|
||||
requestPermanentDeletion(id: string, cb: callback<{ id: number }>): void;
|
||||
|
||||
requestPermanentDeletionByParams(identifier: UserIdentifier): Promise<{ id: number }>;
|
||||
requestPermanentDeletionByParams(identifier: UserIdentifier, cb: callback<{ id: number }>): void;
|
||||
}
|
||||
|
||||
export class Leads {
|
||||
create(lead: Partial<Lead>): Promise<ApiResponse<Lead>>;
|
||||
create(lead: Partial<Lead>, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
update(lead: UserIdentifier & Partial<Lead>): Promise<ApiResponse<Lead>>;
|
||||
update(lead: UserIdentifier & Partial<Lead>, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
list(): Promise<ApiResponse<LeadList>>;
|
||||
list(cb: callback<ApiResponse<LeadList>>): void;
|
||||
|
||||
listBy(params: { email?: string, tag_id?: string, segment_id?: string }): Promise<ApiResponse<LeadList>>;
|
||||
listBy(params: { email?: string, tag_id?: string, segment_id?: string }, cb: callback<ApiResponse<LeadList>>): void;
|
||||
|
||||
find(identifier: LeadIdentifier): Promise<ApiResponse<Lead>>
|
||||
find(identifier: LeadIdentifier, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
delete(id: string): Promise<ApiResponse<Lead>>;
|
||||
delete(id: string, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
convert(params: { contact: LeadIdentifier, user: UserIdentifier }): Promise<ApiResponse<Lead>>;
|
||||
convert(params: { contact: LeadIdentifier, user: UserIdentifier }, cb: callback<ApiResponse<Lead>>): void;
|
||||
|
||||
requestPermanentDeletion(): Promise<{id: number}>;
|
||||
}
|
||||
|
||||
export class Companies {
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
@@ -8,6 +8,11 @@
|
||||
|
||||
export interface PartialMockInstance<T> {
|
||||
mockReturnValue: jest.MockInstance<T>['mockReturnValue'];
|
||||
mockReturnValueOnce: jest.MockInstance<T>['mockReturnValueOnce'];
|
||||
mockResolvedValue: jest.MockInstance<T>['mockResolvedValue'];
|
||||
mockResolvedValueOnce: jest.MockInstance<T>['mockResolvedValueOnce'];
|
||||
mockRejectedValue: jest.MockInstance<T>['mockRejectedValue'];
|
||||
mockRejectedValueOnce: jest.MockInstance<T>['mockRejectedValueOnce'];
|
||||
}
|
||||
|
||||
export interface When {
|
||||
|
||||
Vendored
+2
-2
@@ -14,7 +14,7 @@ export interface FocusElements {
|
||||
declare global {
|
||||
interface JQuery {
|
||||
focusExit(options?: { debug: boolean }): JQuery;
|
||||
on(event: 'focusExit', handler: ((event: JQuery.Event<HTMLElement>, data: FocusElements) => void)): JQuery;
|
||||
one(event: 'focusin', handler: ((event: JQuery.Event<HTMLElement>) => void)): JQuery;
|
||||
on(event: 'focusExit', handler: ((event: JQuery.TriggeredEvent<HTMLElement>, data: FocusElements) => void)): JQuery;
|
||||
one(event: 'focusin', handler: ((event: JQuery.TriggeredEvent<HTMLElement>) => void)): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -18,6 +18,6 @@ export type FocusElements = Partial<{
|
||||
declare global {
|
||||
interface JQuery {
|
||||
mouseExit(options?: Options): JQuery;
|
||||
on(event: 'mouseExit', handler: ((event: JQuery.Event<HTMLElement>, data: FocusElements) => void)): JQuery;
|
||||
on(event: 'mouseExit', handler: ((event: JQuery.TriggeredEvent<HTMLElement>, data: FocusElements) => void)): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+319
-155
File diff suppressed because it is too large
Load Diff
+410
-829
File diff suppressed because it is too large
Load Diff
Vendored
+1886
-337
File diff suppressed because it is too large
Load Diff
@@ -384,7 +384,7 @@ function examples() {
|
||||
}
|
||||
|
||||
function bind_2() {
|
||||
function handler(event: JQuery.Event<HTMLElement, any>) {
|
||||
function handler(event: JQuery.TriggeredEvent<HTMLElement>) {
|
||||
alert(event.data.foo);
|
||||
}
|
||||
|
||||
@@ -830,7 +830,7 @@ function examples() {
|
||||
var len = kids.addClass('hilite').length;
|
||||
|
||||
$('#results span:first').text(len);
|
||||
$('#results span:last').text(event.target.tagName);
|
||||
$('#results span:last').text((event.target as Element).tagName);
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
@@ -1578,7 +1578,7 @@ function examples() {
|
||||
|
||||
function event_related_target_0() {
|
||||
$('a').mouseout(function(event) {
|
||||
alert((<HTMLElement> event.relatedTarget).nodeName); // "DIV"
|
||||
alert((event.relatedTarget as HTMLElement).nodeName); // "DIV"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1614,12 +1614,12 @@ function examples() {
|
||||
|
||||
function event_target_0() {
|
||||
$('body').click(function(event) {
|
||||
$('#log').html('clicked: ' + event.target.nodeName);
|
||||
$('#log').html('clicked: ' + (event.target as Node).nodeName);
|
||||
});
|
||||
}
|
||||
|
||||
function event_target_1() {
|
||||
function handler(event: JQuery.Event) {
|
||||
function handler(event: JQuery.TriggeredEvent) {
|
||||
var target = $(event.target);
|
||||
if (target.is('li')) {
|
||||
target.children().toggle();
|
||||
@@ -3018,10 +3018,10 @@ function examples() {
|
||||
function jQuery_proxy_0() {
|
||||
var me = {
|
||||
type: 'zombie',
|
||||
test: function(event: JQuery.Event) {
|
||||
test: function(event: JQuery.TriggeredEvent) {
|
||||
// Without proxy, `this` would refer to the event target
|
||||
// use event.target to reference that element.
|
||||
var element = event.target;
|
||||
var element = event.target as Element;
|
||||
$(element).css('background-color', 'red');
|
||||
|
||||
// With proxy, `this` refers to the me object encapsulating
|
||||
@@ -3033,7 +3033,7 @@ function examples() {
|
||||
|
||||
var you = {
|
||||
type: 'person',
|
||||
test: function(event: JQuery.Event) {
|
||||
test: function(event: JQuery.TriggeredEvent) {
|
||||
$('#log').append(this.type + ' ');
|
||||
},
|
||||
};
|
||||
@@ -3075,7 +3075,7 @@ function examples() {
|
||||
type: 'dog',
|
||||
|
||||
// Note that event comes *after* one and two
|
||||
test: function(one: typeof you, two: typeof they, event: JQuery.Event<HTMLElement>) {
|
||||
test: function(one: typeof you, two: typeof they, event: JQuery.TriggeredEvent<HTMLElement>) {
|
||||
$('#log')
|
||||
|
||||
// `one` maps to `you`, the 1st additional
|
||||
@@ -3796,7 +3796,7 @@ function examples() {
|
||||
}
|
||||
|
||||
function on_1() {
|
||||
function myHandler(event: JQuery.Event<HTMLElement, { foo: string; }>) {
|
||||
function myHandler(event: JQuery.TriggeredEvent<HTMLElement, { foo: string; }>) {
|
||||
alert(event.data.foo);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,24 +21,6 @@ jQuery("a").greenify(); // Makes all the links green.
|
||||
|
||||
// Events
|
||||
|
||||
function fixHooks() {
|
||||
function setHook() {
|
||||
jQuery.event.fixHooks.drop = {
|
||||
props: ["dataTransfer"]
|
||||
};
|
||||
}
|
||||
|
||||
function conflictResolution() {
|
||||
if (jQuery.event.fixHooks.drop) {
|
||||
throw new Error("Someone else took the jQuery.event.fixHooks.drop hook!");
|
||||
}
|
||||
|
||||
jQuery.event.fixHooks.drop = {
|
||||
props: ["dataTransfer"]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function special() {
|
||||
function defineSpecialEvent() {
|
||||
jQuery.event.special.pushy = {
|
||||
@@ -53,7 +35,7 @@ function special() {
|
||||
bindType: "click",
|
||||
handle(event) {
|
||||
const handleObj = event.handleObj;
|
||||
const targetData = jQuery.data(event.target);
|
||||
const targetData = jQuery.data(event.target as Element);
|
||||
let ret = null;
|
||||
|
||||
// If a multiple of the click count, run the handler
|
||||
|
||||
@@ -538,7 +538,7 @@ function longdesc() {
|
||||
$('#foo').slideUp(300).delay(800).fadeIn(400);
|
||||
}
|
||||
|
||||
function delegate_0(elements: HTMLElement[], selector: string, events: any, data: any, handler: JQuery.EventHandler<HTMLElement>) {
|
||||
function delegate_0(elements: HTMLElement[], selector: string, events: string, data: any, handler: JQuery.TypeEventHandler<HTMLElement, any, any, any, string>) {
|
||||
// jQuery 1.4.3+
|
||||
$(elements).delegate(selector, events, data, handler);
|
||||
// jQuery 1.7+
|
||||
@@ -886,7 +886,7 @@ function longdesc() {
|
||||
var currentRequests: JQuery.PlainObject = {};
|
||||
|
||||
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
|
||||
if ((<any> options).abortOnRetry) {
|
||||
if ((options as any).abortOnRetry) {
|
||||
if (currentRequests[options.url!]) {
|
||||
currentRequests[options.url!].abort();
|
||||
}
|
||||
@@ -1297,7 +1297,7 @@ function longdesc() {
|
||||
return $.css(elem, borderRadius!);
|
||||
},
|
||||
set: function(elem, value) {
|
||||
(<any> elem.style)[borderRadius!] = value;
|
||||
(elem.style as any)[borderRadius!] = value;
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -2016,7 +2016,7 @@ function longdesc() {
|
||||
}
|
||||
|
||||
function on_3() {
|
||||
function greet(event: JQuery.Event<HTMLElement, { name: string; }>) {
|
||||
function greet(event: JQuery.TriggeredEvent<HTMLElement, { name: string; }>) {
|
||||
alert('Hello ' + event.data.name);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
@@ -41,6 +41,8 @@ export class Request<T> implements Promise<T> {
|
||||
then<TResult1, TResult2>(onfulfilled?: ((value: T) => (PromiseLike<TResult1> | TResult1)) | null | undefined,
|
||||
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | null | undefined): Promise<TResult1 | TResult2>;
|
||||
|
||||
finally(onfinally?: () => void): Promise<T>;
|
||||
|
||||
thenCall(callback?: (err: Error, records: T) => void): Query<T>;
|
||||
|
||||
readonly [Symbol.toStringTag]: 'Promise';
|
||||
|
||||
Vendored
+2
@@ -124,6 +124,8 @@ export class AsyncResultLocator<T> extends EventEmitter implements Promise<T> {
|
||||
then<TResult1, TResult2>(onfulfilled?: ((value: T) => (PromiseLike<TResult1> | TResult1)) | null | undefined,
|
||||
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | null | undefined): Promise<TResult1 | TResult2>;
|
||||
|
||||
finally(onfinally?: () => void): Promise<T>;
|
||||
|
||||
readonly [Symbol.toStringTag]: "Promise";
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for koa-log 2.1
|
||||
// Project: https://github.com/vicanso/koa-log#readme
|
||||
// Definitions by: Uladzimir Havenchyk <https://github.com/havenchyk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Koa from 'koa';
|
||||
|
||||
declare function koaLog(type: string): Koa.Middleware;
|
||||
|
||||
declare namespace koaLog {
|
||||
namespace morgan {
|
||||
function cookie(ctx: Koa.BaseContext, key: string): string;
|
||||
|
||||
function date(ctx: Koa.BaseContext, format: string): string;
|
||||
|
||||
function format(name: string): string;
|
||||
|
||||
function length(ctx: Koa.BaseContext): number | undefined;
|
||||
|
||||
function method(ctx: Koa.BaseContext): string;
|
||||
|
||||
function referrer(ctx: Koa.BaseContext): string;
|
||||
|
||||
function status(ctx: Koa.BaseContext): number;
|
||||
|
||||
function token(name: string, fn: (ctx: Koa.BaseContext) => string): void;
|
||||
|
||||
function url(ctx: Koa.BaseContext): string;
|
||||
}
|
||||
}
|
||||
|
||||
export = koaLog;
|
||||
@@ -0,0 +1,10 @@
|
||||
import Koa = require('koa');
|
||||
import koaLogger = require('koa-log');
|
||||
|
||||
koaLogger.morgan.token('request-body', (ctx: Koa.BaseContext) => JSON.stringify(ctx.request.body));
|
||||
koaLogger.morgan.token('response-body', (ctx: Koa.BaseContext) => JSON.stringify(ctx.body));
|
||||
|
||||
const app = new Koa();
|
||||
app.use(
|
||||
koaLogger(':status :method :url took :response-time ms :request-body :response-body')
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"koa-log-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for list-stream 1.0
|
||||
// Project: https://github.com/rvagg/list-stream
|
||||
// Definitions by: Christian Sporer <https://github.com/IanStorm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Duplex, DuplexOptions } from "stream";
|
||||
|
||||
interface ListStreamMethod {
|
||||
(callback?: (err: Error, data: any[]) => void): ListStream;
|
||||
(options?: DuplexOptions, callback?: (err: Error, data: any[]) => void): ListStream;
|
||||
}
|
||||
|
||||
interface ListStreamConstructor extends ListStreamMethod {
|
||||
new(callback?: (err: Error, data: any[]) => void): ListStream;
|
||||
new(options?: DuplexOptions, callback?: (err: Error, data: any[]) => void): ListStream;
|
||||
|
||||
obj: ListStreamMethod;
|
||||
}
|
||||
|
||||
declare let ListStream: ListStreamConstructor;
|
||||
|
||||
interface ListStream extends Duplex {
|
||||
append(chunk: any): void;
|
||||
duplicate(): ListStream;
|
||||
end(): void;
|
||||
get(index: number): any;
|
||||
length: number;
|
||||
}
|
||||
|
||||
export = ListStream;
|
||||
@@ -0,0 +1,2 @@
|
||||
import "./test/import-tests";
|
||||
import "./test/require-tests";
|
||||
@@ -0,0 +1,54 @@
|
||||
import ListStream from "list-stream";
|
||||
|
||||
let chunk: any = "chunk";
|
||||
let listStream: ListStream;
|
||||
let num = 1;
|
||||
|
||||
listStream = ListStream((err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = ListStream({ objectMode: true }, (err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = new ListStream((err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = new ListStream({ objectMode: true }, (err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = ListStream.obj((err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
|
||||
listStream = ListStream.obj();
|
||||
listStream.write({ key: "value" });
|
||||
|
||||
listStream.append(chunk);
|
||||
|
||||
listStream = listStream.duplicate();
|
||||
|
||||
listStream.end();
|
||||
|
||||
chunk = listStream.get(num);
|
||||
|
||||
num = listStream.length;
|
||||
@@ -0,0 +1,54 @@
|
||||
import ListStream = require("list-stream");
|
||||
|
||||
let chunk: any = "chunk";
|
||||
let listStream: ListStream;
|
||||
let num = 1;
|
||||
|
||||
listStream = ListStream((err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = ListStream({ objectMode: true }, (err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = new ListStream((err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = new ListStream({ objectMode: true }, (err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
listStream = ListStream.obj((err: Error, data: any[]) => {
|
||||
if (err) { throw err; }
|
||||
console.log(data.length);
|
||||
for (const date of data) {
|
||||
console.log(date);
|
||||
}
|
||||
});
|
||||
|
||||
listStream = ListStream.obj();
|
||||
listStream.write({ key: "value" });
|
||||
|
||||
listStream.append(chunk);
|
||||
|
||||
listStream = listStream.duplicate();
|
||||
|
||||
listStream.end();
|
||||
|
||||
chunk = listStream.get(num);
|
||||
|
||||
num = listStream.length;
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"test/import-tests.ts",
|
||||
"test/require-tests.ts",
|
||||
"index.d.ts",
|
||||
"list-stream-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -99,6 +99,7 @@ export class OAuth2Server {
|
||||
|
||||
decision(options: DecisionOptions, parse: DecisionParseFunction): MiddlewareFunction;
|
||||
decision(parse: DecisionParseFunction): MiddlewareFunction;
|
||||
decision(): MiddlewareFunction;
|
||||
|
||||
token(options?: any): MiddlewareFunction;
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
declare namespace devices {
|
||||
interface Viewport {
|
||||
width: number;
|
||||
height: number;
|
||||
deviceScaleFactor: number;
|
||||
isMobile: boolean;
|
||||
hasTouch: boolean;
|
||||
isLandscape: boolean;
|
||||
}
|
||||
|
||||
interface Device {
|
||||
name: string;
|
||||
userAgent: string;
|
||||
viewport: Viewport;
|
||||
}
|
||||
}
|
||||
|
||||
declare const devices: {
|
||||
[key: string]: devices.Device;
|
||||
};
|
||||
|
||||
export = devices;
|
||||
Vendored
+1
-1
@@ -2044,7 +2044,7 @@ export interface BrowserOptions {
|
||||
* @default false
|
||||
*/
|
||||
isLandscape?: boolean;
|
||||
};
|
||||
} | null;
|
||||
/**
|
||||
* Slows down Puppeteer operations by the specified amount of milliseconds.
|
||||
* Useful so that you can see what is going on.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as puppeteer from "puppeteer";
|
||||
import { TimeoutError } from "puppeteer/Errors";
|
||||
import * as Devices from "puppeteer/DeviceDescriptors";
|
||||
|
||||
// Accessibility
|
||||
|
||||
@@ -118,6 +119,7 @@ puppeteer.launch().then(async browser => {
|
||||
});
|
||||
|
||||
await page.emulateMedia("screen");
|
||||
await page.emulate(Devices['test']);
|
||||
await page.pdf({ path: "page.pdf" });
|
||||
|
||||
await page.setRequestInterception(true);
|
||||
@@ -200,6 +202,13 @@ puppeteer.launch().then(async browser => {
|
||||
browser.close();
|
||||
})();
|
||||
|
||||
// Launching with default viewport disabled
|
||||
(async () => {
|
||||
await puppeteer.launch({
|
||||
defaultViewport: null
|
||||
});
|
||||
})();
|
||||
|
||||
// Test v0.12 features
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch({
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
},
|
||||
"files": [
|
||||
"Errors.d.ts",
|
||||
"DeviceDescriptors.d.ts",
|
||||
"index.d.ts",
|
||||
"puppeteer-tests.ts"
|
||||
]
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"prefer-declare-function": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
// Type definitions for rabbitmq-schema 2.0
|
||||
// Project: https://github.com/tjmehta/rabbitmq-schema
|
||||
// Definitions by: Alex Duka <https://github.com/rulezzz1987>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
interface Binding {
|
||||
destination: Exchange | Queue;
|
||||
source: Exchange;
|
||||
args?: object;
|
||||
routingPattern?: string;
|
||||
}
|
||||
|
||||
interface TopicBinding extends Binding {
|
||||
routingPattern: string;
|
||||
}
|
||||
|
||||
interface DirectBinding extends Binding {
|
||||
routingPattern: string;
|
||||
}
|
||||
|
||||
interface Topology {
|
||||
options?: object;
|
||||
}
|
||||
|
||||
interface Exchange extends Topology {
|
||||
exchange: string;
|
||||
type: string;
|
||||
bindings: Binding[];
|
||||
}
|
||||
|
||||
interface FanoutExchange extends Exchange {
|
||||
type: 'fanout';
|
||||
}
|
||||
|
||||
interface TopicExchange extends Exchange {
|
||||
type: 'topic';
|
||||
bindings: TopicBinding[];
|
||||
}
|
||||
|
||||
interface DirectExchange extends Exchange {
|
||||
type: 'direct';
|
||||
bindings: DirectBinding[];
|
||||
}
|
||||
|
||||
interface Queue extends Topology {
|
||||
queue: string;
|
||||
messageSchema: object;
|
||||
}
|
||||
|
||||
declare class RabbitMQSchema {
|
||||
constructor(schema: Topology | Topology[], parentPath?: string);
|
||||
|
||||
getExchanges(): Exchange[];
|
||||
|
||||
getBindings(): Binding[];
|
||||
|
||||
getQueues(): Queue[];
|
||||
|
||||
getDirectBindings(): DirectBinding[];
|
||||
|
||||
validate(schema: Topology | Topology[], parentPath?: string): void;
|
||||
|
||||
validateMessage<T>(exchangeName: string, routingPattern: string, message: T): T;
|
||||
|
||||
getQueueByName(name: string): Queue | void;
|
||||
|
||||
getExchangeByName(name: string): Exchange | void;
|
||||
}
|
||||
|
||||
export = RabbitMQSchema;
|
||||
@@ -0,0 +1,16 @@
|
||||
import RabbitMqSchema = require('rabbitmq-schema');
|
||||
|
||||
const topology = {};
|
||||
|
||||
const rabbitSchema = new RabbitMqSchema({}, '');
|
||||
|
||||
rabbitSchema.getExchanges();
|
||||
rabbitSchema.getBindings();
|
||||
rabbitSchema.getQueues();
|
||||
rabbitSchema.getDirectBindings();
|
||||
|
||||
rabbitSchema.getQueueByName('images.jpeg.get');
|
||||
rabbitSchema.getExchangeByName('images');
|
||||
|
||||
rabbitSchema.validate(topology);
|
||||
rabbitSchema.validateMessage('images', 'images.jpeg.get', {testMsg: 'ok'});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"rabbitmq-schema-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+9
-7
@@ -1,4 +1,4 @@
|
||||
// Type definitions for react-facebook-login 3.6
|
||||
// Type definitions for react-facebook-login 4.1
|
||||
// Project: https://github.com/keppelen/react-facebook-login
|
||||
// Definitions by: Alexandre Paré <https://github.com/apare>, Jan Karres <https://github.com/jankarres>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
interface ReactFacebookLoginProps {
|
||||
export interface ReactFacebookLoginProps {
|
||||
appId: string;
|
||||
callback(userInfo: ReactFacebookLoginInfo): void;
|
||||
onFailure?(response: ReactFacebookFailureResponse): void;
|
||||
@@ -18,7 +18,7 @@ interface ReactFacebookLoginProps {
|
||||
cssClass?: string;
|
||||
disableMobileRedirect?: boolean;
|
||||
fields?: string;
|
||||
icon?: string | React.ReactNode;
|
||||
icon?: React.ReactNode;
|
||||
isDisabled?: boolean;
|
||||
language?: string;
|
||||
onClick?(event: React.MouseEvent<HTMLDivElement>): void;
|
||||
@@ -32,6 +32,10 @@ interface ReactFacebookLoginProps {
|
||||
xfbml?: boolean;
|
||||
isMobile?: boolean;
|
||||
tag?: Node | React.Component<any>;
|
||||
returnScopes?: boolean;
|
||||
state?: string;
|
||||
authType?: string;
|
||||
responseType?: string;
|
||||
}
|
||||
|
||||
export interface ReactFacebookFailureResponse {
|
||||
@@ -45,14 +49,12 @@ export interface ReactFacebookLoginInfo {
|
||||
email?: string;
|
||||
}
|
||||
|
||||
interface ReactFacebookLoginState {
|
||||
export interface ReactFacebookLoginState {
|
||||
isSdkLoaded?: boolean;
|
||||
isProcessing?: boolean;
|
||||
}
|
||||
|
||||
declare class ReactFacebookLogin extends React.Component<
|
||||
export default class ReactFacebookLogin extends React.Component<
|
||||
ReactFacebookLoginProps,
|
||||
ReactFacebookLoginState
|
||||
> {}
|
||||
|
||||
export default ReactFacebookLogin;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
import FacebookLogin, { ReactFacebookLoginInfo, ReactFacebookFailureResponse } from 'react-facebook-login';
|
||||
import FacebookLogin, { ReactFacebookFailureResponse, ReactFacebookLoginInfo, ReactFacebookLoginProps } from 'react-facebook-login';
|
||||
|
||||
const responseFacebook = (response: ReactFacebookLoginInfo) => {
|
||||
console.log(response);
|
||||
@@ -106,3 +105,9 @@ class MyComponent2 extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
type FacebookLoginWrapperProps = ReactFacebookLoginProps & { className?: string };
|
||||
|
||||
export const FacebookLoginWrapper = ({ className, ...props }: FacebookLoginWrapperProps) => (
|
||||
<FacebookLogin {...props} cssClass={className} />
|
||||
);
|
||||
|
||||
Vendored
+6
@@ -11,6 +11,7 @@
|
||||
// Paul Melnikow <https://github.com/paulmelnikow>
|
||||
// Harry Cruse <https://github.com/crusectrl>
|
||||
// Andrew Palugniok <https://github.com/apalugniok>
|
||||
// Robert Stigsson <https://github.com/RobertStigsson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -45,6 +46,7 @@ export type StackOffsetType = 'sign' | 'expand' | 'none' | 'wiggle' | 'silhouett
|
||||
export type LineType =
|
||||
'basis' | 'basisClosed' | 'basisOpen' | 'linear' | 'linearClosed' | 'natural' |
|
||||
'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | CurveFactory;
|
||||
export type IfOverflowType = 'hidden' | 'visible' | 'discard' | 'extendDomain';
|
||||
export type AxisInterval = number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd';
|
||||
|
||||
export type PickedCSSStyleDeclarationKeys =
|
||||
@@ -363,6 +365,7 @@ export interface LegendPayload {
|
||||
value: any;
|
||||
id: any;
|
||||
type: LegendType;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export type BBoxUpdateCallback = (box: { width: number; height: number; }) => void;
|
||||
@@ -634,6 +637,7 @@ export interface ReferenceAreaProps extends Partial<PresentationAttributes> {
|
||||
yAxis?: object;
|
||||
isFront?: boolean;
|
||||
alwaysShow?: boolean;
|
||||
ifOverflow?: IfOverflowType;
|
||||
x1?: number | string;
|
||||
x2?: number | string;
|
||||
y1?: number | string;
|
||||
@@ -657,6 +661,7 @@ export interface ReferenceDotProps extends EventAttributes, Partial<Presentation
|
||||
yAxis?: ReferenceDotAxisConfiguration;
|
||||
isFront?: boolean;
|
||||
alwaysShow?: boolean;
|
||||
ifOverflow?: IfOverflowType;
|
||||
x?: number | string;
|
||||
y?: number | string;
|
||||
xAxisId?: string | number;
|
||||
@@ -677,6 +682,7 @@ export interface ReferenceLineProps extends Partial<PresentationAttributes<numbe
|
||||
yAxis?: object;
|
||||
isFront?: boolean;
|
||||
alwaysShow?: boolean;
|
||||
ifOverflow?: IfOverflowType;
|
||||
x?: number | string;
|
||||
y?: number | string;
|
||||
label?: string | number | ContentRenderer<any> | React.ReactElement<any>;
|
||||
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for rechoir 0.6
|
||||
// Project: https://github.com/tkellen/node-rechoir
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Extensions } from 'interpret';
|
||||
|
||||
export function prepare(
|
||||
config: Extensions,
|
||||
filepath: string,
|
||||
requireFrom?: string
|
||||
): true | Attempt[];
|
||||
|
||||
export interface Attempt {
|
||||
moduleName: string;
|
||||
module: any;
|
||||
error: Error | null;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { extensions as config } from 'interpret';
|
||||
import { prepare } from 'rechoir';
|
||||
|
||||
// $ExpectType true | Attempt[]
|
||||
prepare(config, './test/fixtures/test.coffee');
|
||||
prepare(config, './test/fixtures/test.coffee', './');
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"rechoir-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for sc-auth 5.0
|
||||
// Project: https://github.com/SocketCluster/sc-auth
|
||||
// Definitions by: Daniel Rose <https://github.com/DanielRose>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { VerifyOptions, VerifyCallback, Secret, SignCallback, SignOptions } from "jsonwebtoken";
|
||||
|
||||
export interface SCAuthEngine {
|
||||
verifyToken(signedToken: string, key: string | Buffer, options?: VerifyOptions, callback?: VerifyCallback): void;
|
||||
signToken(token: string | object | Buffer, key: Secret, options?: SignOptions, callback?: SignCallback): void;
|
||||
}
|
||||
|
||||
export class AuthEngine implements SCAuthEngine {
|
||||
constructor();
|
||||
|
||||
verifyToken(signedToken: string, key: string | Buffer, options?: VerifyOptions, callback?: VerifyCallback): void;
|
||||
signToken(token: string | object | Buffer, key: Secret, options?: SignOptions, callback?: SignCallback): void;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* This mostly delegates to jwt, so using its tests as base
|
||||
*/
|
||||
|
||||
import scAuth = require("sc-auth");
|
||||
import fs = require("fs");
|
||||
|
||||
let signedToken = "";
|
||||
let cert: Buffer;
|
||||
|
||||
interface TestObject {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const testObject = { foo: "bar" };
|
||||
|
||||
const authEngine = new scAuth.AuthEngine();
|
||||
|
||||
// sign with default (HMAC SHA256)
|
||||
authEngine.signToken(testObject, "shhhhh");
|
||||
|
||||
// sign with default (HMAC SHA256) and single audience
|
||||
authEngine.signToken(testObject, "shhhhh", { audience: "theAudience" });
|
||||
|
||||
// sign with default (HMAC SHA256) and multiple audiences
|
||||
authEngine.signToken(testObject, "shhhhh", {
|
||||
audience: ["audience1", "audience2"]
|
||||
});
|
||||
|
||||
// sign with default (HMAC SHA256) and a keyid
|
||||
authEngine.signToken(testObject, "shhhhh", { keyid: "theKeyId" });
|
||||
|
||||
// sign with RSA SHA256
|
||||
cert = fs.readFileSync("private.key"); // get private key
|
||||
authEngine.signToken(testObject, cert, { algorithm: "RS256" });
|
||||
|
||||
// sign with encrypted RSA SHA256 private key (only PEM encoding is supported)
|
||||
const privKey: Buffer = fs.readFileSync("encrypted_private.key"); // get private key
|
||||
const secret = { key: privKey.toString(), passphrase: "keypwd" };
|
||||
authEngine.signToken(testObject, secret, { algorithm: "RS256" }); // the algorithm option is mandatory in this case
|
||||
|
||||
// sign asynchronously
|
||||
authEngine.signToken(testObject, cert, { algorithm: "RS256" }, (err, token) => {
|
||||
signedToken = token;
|
||||
});
|
||||
|
||||
// verify a token symmetric
|
||||
authEngine.verifyToken(signedToken, "shhhhh", {}, (err, decoded) => {
|
||||
const result = decoded as TestObject;
|
||||
|
||||
console.log(result.foo); // bar
|
||||
});
|
||||
|
||||
// use external time for verifying
|
||||
authEngine.verifyToken(signedToken, "shhhhh", { clockTimestamp: 1 }, (err, decoded) => {
|
||||
const result = decoded as TestObject;
|
||||
|
||||
console.log(result.foo); // bar
|
||||
});
|
||||
|
||||
// invalid token
|
||||
authEngine.verifyToken(signedToken, "wrong-secret", {}, (err, decoded) => {
|
||||
console.log(err);
|
||||
|
||||
// decoded undefined
|
||||
});
|
||||
|
||||
// verify a token asymmetric
|
||||
cert = fs.readFileSync("public.pem"); // get public key
|
||||
authEngine.verifyToken(signedToken, cert, {}, (err, decoded) => {
|
||||
const result = decoded as TestObject;
|
||||
|
||||
console.log(result.foo); // bar
|
||||
});
|
||||
|
||||
// verify audience
|
||||
cert = fs.readFileSync("public.pem"); // get public key
|
||||
authEngine.verifyToken(signedToken, cert, { audience: "urn:foo" }, (err, decoded) => {
|
||||
// if audience mismatch, err == invalid audience
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// verify issuer
|
||||
cert = fs.readFileSync("public.pem"); // get public key
|
||||
authEngine.verifyToken(signedToken, cert, { audience: "urn:foo", issuer: "urn:issuer" }, (err, decoded) => {
|
||||
// if issuer mismatch, err == invalid issuer
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// verify algorithm
|
||||
cert = fs.readFileSync("public.pem"); // get public key
|
||||
authEngine.verifyToken(signedToken, cert, { algorithms: ["RS256"] }, (err, decoded) => {
|
||||
// if algorithm mismatch, err == invalid algorithm
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// verify without expiration check
|
||||
cert = fs.readFileSync("public.pem"); // get public key
|
||||
authEngine.verifyToken(signedToken, cert, { ignoreExpiration: true }, (err, decoded) => {
|
||||
// if ignoreExpration == false and token is expired, err == expired token
|
||||
console.log(err);
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sc-auth-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import { EventEmitter } from "events";
|
||||
import { SCBrokerClient } from "sc-broker";
|
||||
import { mapperFunction } from ".";
|
||||
|
||||
export class ClientCluster extends EventEmitter {
|
||||
constructor(clients: SCBrokerClient[]);
|
||||
|
||||
setMapper(mapper: mapperFunction): void;
|
||||
getMapper(): mapperFunction;
|
||||
}
|
||||
Vendored
+160
@@ -0,0 +1,160 @@
|
||||
// Type definitions for sc-broker-cluster 6.1
|
||||
// Project: https://github.com/SocketCluster/sc-broker-cluster
|
||||
// Definitions by: Daniel Rose <https://github.com/DanielRose>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { SCServerSocket, SCServer } from "socketcluster-server";
|
||||
import { BrokerStartInfo, BrokerExitInfo } from "socketcluster";
|
||||
import { SpliceOptions, QueryOptions } from "sc-broker";
|
||||
import { SCChannel } from "sc-channel";
|
||||
import { EventEmitter } from "events";
|
||||
import { AsyncResultArrayCallback } from "async";
|
||||
import { KeyChain, FlexiMap } from "fleximap";
|
||||
import { Keys } from "expirymanager";
|
||||
import { ClientCluster } from "./clientcluster";
|
||||
|
||||
export class AbstractDataClient extends EventEmitter {
|
||||
constructor(dataClient: ClientCluster);
|
||||
|
||||
set(keyChain: KeyChain, value: any, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
set(keyChain: KeyChain, value: any, callback?: (err?: Error) => void): void;
|
||||
|
||||
expire(keys: Keys, seconds: number, callback?: (err?: Error) => void): void;
|
||||
unexpire(keys: Keys, callback?: (err?: Error) => void): void;
|
||||
|
||||
add(keyChain: KeyChain, value: any, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
add(keyChain: KeyChain, value: any, callback?: (err?: Error) => void): void;
|
||||
|
||||
get(keyChain: KeyChain, callback: (err: Error | null, value: any) => void): void;
|
||||
|
||||
getRange(keyChain: KeyChain, fromIndex: number, toIndex: number, callback: (err: Error | null, value: any) => void): void;
|
||||
getRange(keyChain: KeyChain, fromIndex: number, callback: (err: Error | null, value: any) => void): void;
|
||||
|
||||
getAll(callback: (err: Error | null, value: any[] | object) => void): void;
|
||||
|
||||
count(keyChain: KeyChain, callback: (err: Error | null, value: number) => void): void;
|
||||
|
||||
remove(keyChain: KeyChain, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
remove(keyChain: KeyChain, callback?: (err?: Error) => void): void;
|
||||
|
||||
removeRange(keyChain: KeyChain, fromIndex: number, toIndex?: number, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
removeRange(keyChain: KeyChain, fromIndex: number, toIndex?: number, callback?: (err?: Error) => void): void;
|
||||
removeRange(keyChain: KeyChain, fromIndex: number, callback?: (err?: Error) => void): void;
|
||||
|
||||
removeAll(callback?: (err: Error) => void): void;
|
||||
|
||||
splice(keyChain: KeyChain, options?: SpliceOptions, callback?: (err?: Error) => void): void;
|
||||
splice(keyChain: KeyChain, callback?: (err?: Error) => void): void;
|
||||
|
||||
pop(keyChain: KeyChain, callback: (err: Error | null, data: any) => void): void;
|
||||
|
||||
hasKey(keyChain: KeyChain, callback: (err: Error | null, data: boolean) => void): void;
|
||||
|
||||
extractKeys(keyChain: KeyChain): string[];
|
||||
|
||||
extractValues(keyChain: KeyChain): any[];
|
||||
|
||||
exec(query: (datamap: FlexiMap) => void, options?: QueryOptions, callback?: (err: Error | null, data: any) => void): void;
|
||||
exec(query: (datamap: FlexiMap) => void, callback: (err: Error | null, data: any) => void): void;
|
||||
}
|
||||
|
||||
export type handlerFunction = (data: any) => void;
|
||||
|
||||
export type mapperFunction = (keyChain: KeyChain, method: string, clientIds: number[]) => number | number[];
|
||||
|
||||
/**
|
||||
* The exchange object is a top-level SCBrokerClient which lets you publish events and manipulate data within your brokers - It represents a cluster of 1 or more brokers.
|
||||
*/
|
||||
export class SCExchange extends AbstractDataClient {
|
||||
constructor(privateClientCluster: ClientCluster, publicClientCluster: ClientCluster, ioClusterClient: Client);
|
||||
|
||||
send(data: any, mapIndex: number | string | string[] | null, callback?: (err?: Error) => void): void;
|
||||
|
||||
publish(channelName: string, data: any, callback: (err?: Error) => void): void;
|
||||
|
||||
subscribe(channelName: string): SCChannel;
|
||||
unsubscribe(channelName: string): void;
|
||||
|
||||
channel(channelName: string): SCChannel;
|
||||
destroyChannel(channelName: string): void;
|
||||
|
||||
subscriptions(includePending?: boolean): string[];
|
||||
isSubscribed(channelName: string, includePending?: boolean): boolean;
|
||||
|
||||
watch(channelName: string, handler: handlerFunction): void;
|
||||
unwatch(channelName: string, handler?: handlerFunction): void;
|
||||
watchers(channelName: string): handlerFunction[];
|
||||
|
||||
setMapper(mapper: mapperFunction): void;
|
||||
getMapper(): mapperFunction;
|
||||
|
||||
map(keyChain: KeyChain, method: string): { type: string; targets: Client[] };
|
||||
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export interface SCBrokerClusterServerOptions {
|
||||
brokers: string[];
|
||||
debug?: boolean;
|
||||
inspect?: boolean;
|
||||
instanceId?: string;
|
||||
secretKey?: string;
|
||||
expiryAccuracy?: number;
|
||||
downgradeToUser: number | string;
|
||||
appBrokerControllerPath?: string;
|
||||
processTermTimeout?: number;
|
||||
ipcAckTimeout?: number;
|
||||
brokerOptions?: SCServer.SCServerOptions;
|
||||
}
|
||||
|
||||
export class Server extends EventEmitter {
|
||||
constructor(options: SCBrokerClusterServerOptions);
|
||||
|
||||
on(event: "brokerStart", listener: (brokerInfo: BrokerStartInfo) => void): this;
|
||||
on(event: "brokerExit", listener: (brokerInfo: BrokerExitInfo) => void): this;
|
||||
on(event: "brokerMessage", listener: (brokerId: string, data: any, callback: (err: Error | null, data: any) => void) => void): this;
|
||||
on(event: "ready", listener: () => void): this;
|
||||
on(event: "error", listener: (err?: Error) => void): this;
|
||||
|
||||
sendToBroker(brokerId: string, data: any, callback: (err: Error | null, data: any) => void): void;
|
||||
killBrokers(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export interface SCBrokerClusterClientOptions {
|
||||
brokers: string[];
|
||||
secretKey?: string;
|
||||
pubSubBatchDuration?: number;
|
||||
connectRetryErrorThreshold: number;
|
||||
}
|
||||
|
||||
export interface MessagePacket {
|
||||
channel: string;
|
||||
data: any;
|
||||
}
|
||||
|
||||
export class Client extends EventEmitter {
|
||||
constructor(options: SCBrokerClusterClientOptions);
|
||||
|
||||
exchange(): SCExchange;
|
||||
|
||||
options: SCBrokerClusterClientOptions;
|
||||
|
||||
on(event: "error", listener: (err?: Error) => void): this;
|
||||
on(event: "warning", listener: (warning?: Error) => void): this;
|
||||
on(event: "ready", listener: () => void): this;
|
||||
on(event: "message", listener: (packet: MessagePacket) => void): this;
|
||||
|
||||
destroy(callback: AsyncResultArrayCallback<SCExchange>): void;
|
||||
|
||||
subscribe(channel: string, callback: (err?: Error) => void): void;
|
||||
unsubscribe(channel: string, callback: () => void): void;
|
||||
unsubscribeAll(callback: () => void): void;
|
||||
isSubscribed(channel: string, includePending: boolean): boolean;
|
||||
|
||||
subscribeSocket(socket: SCServerSocket, channel: string, callback?: (err?: Error) => void): void;
|
||||
unsubscribeSocket(socket: SCServerSocket, channel: string, callback?: () => void): void;
|
||||
|
||||
setSCServer(scServer: SCServer): void;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Client } from "sc-broker-cluster";
|
||||
import { SCServer, SCServerSocket } from "socketcluster-server";
|
||||
import WebSocket = require("ws");
|
||||
|
||||
const client = new Client({
|
||||
brokers: [],
|
||||
secretKey: "secretKey",
|
||||
pubSubBatchDuration: 100,
|
||||
connectRetryErrorThreshold: 5
|
||||
});
|
||||
|
||||
client.on("error", err => {});
|
||||
client.on("warning", err => {});
|
||||
|
||||
const exchange = client.exchange();
|
||||
|
||||
const scServer = new SCServer();
|
||||
client.setSCServer(scServer);
|
||||
|
||||
client.once("ready", () => {});
|
||||
|
||||
const wsSocket = new WebSocket("address");
|
||||
const socket = new SCServerSocket("id", scServer, wsSocket);
|
||||
client.subscribeSocket(socket, "channelName", err => {});
|
||||
|
||||
client.unsubscribeSocket(socket, "channelName");
|
||||
|
||||
const data: any = {};
|
||||
exchange.publish("channelName", data, err => {});
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import SCBroker = require("sc-broker/scbroker");
|
||||
|
||||
export = SCBroker;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clientcluster.d.ts",
|
||||
"scbroker.d.ts",
|
||||
"sc-broker-cluster-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+165
@@ -0,0 +1,165 @@
|
||||
// Type definitions for sc-broker 5.1
|
||||
// Project: https://github.com/SocketCluster/sc-broker
|
||||
// Definitions by: Daniel Rose <https://github.com/DanielRose>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { SCServer } from "socketcluster-server";
|
||||
import { WorkerExitInfo } from "socketcluster";
|
||||
import { EventEmitter } from "events";
|
||||
import { KeyChain, FlexiMap } from "fleximap";
|
||||
import { Keys, Key } from "expirymanager";
|
||||
|
||||
export interface SCBrokerServerOptions {
|
||||
id?: string;
|
||||
instanceId?: string;
|
||||
debug?: boolean;
|
||||
inspect?: boolean;
|
||||
socketPath?: string;
|
||||
port?: number;
|
||||
expiryAccuracy?: number;
|
||||
downgradeToUser: number | string;
|
||||
brokerControllerPath?: string;
|
||||
processTermTimeout?: number;
|
||||
ipcAckTimeout?: number;
|
||||
secretKey?: string;
|
||||
brokerOptions?: SCServer.SCServerOptions;
|
||||
}
|
||||
|
||||
export interface SCBrokerServer extends EventEmitter {
|
||||
options: SCBrokerServerOptions;
|
||||
socketPath?: string;
|
||||
port?: number;
|
||||
ipcAckTimeout: number;
|
||||
|
||||
on(event: "error", listener: (err?: Error) => void): this;
|
||||
on(event: "brokerMessage", listener: (brokerId: string, data: any, callback: (err: Error | null, data: any) => void) => void): this;
|
||||
on(event: "ready", listener: (data: any) => void): this;
|
||||
on(event: "exit", listener: (data: WorkerExitInfo) => void): this;
|
||||
|
||||
sendToBroker(data: any, callback?: (err: Error | null, data: any, brokerId: string) => void): void;
|
||||
}
|
||||
|
||||
export function createServer(options?: SCBrokerServerOptions): SCBrokerServer;
|
||||
|
||||
export interface AutoReconnectOptions {
|
||||
initialDelay?: number;
|
||||
randomness?: number;
|
||||
multiplier?: number;
|
||||
maxDelay?: number;
|
||||
}
|
||||
|
||||
export interface SCBrokerClientOptions {
|
||||
secretKey?: string;
|
||||
timeout?: number;
|
||||
socketPath?: string;
|
||||
port?: number;
|
||||
host?: string;
|
||||
autoReconnect?: boolean;
|
||||
autoReconnectOptions?: AutoReconnectOptions;
|
||||
connectRetryErrorThreshold?: number;
|
||||
pubSubBatchDuration?: number;
|
||||
}
|
||||
|
||||
export interface QueryOptions {
|
||||
baseKey?: KeyChain;
|
||||
noAck?: boolean;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
export interface SpliceOptions {
|
||||
index?: number;
|
||||
count?: number;
|
||||
items?: any[];
|
||||
getValue?: boolean;
|
||||
noAck?: boolean;
|
||||
}
|
||||
|
||||
export interface SCBrokerClient extends EventEmitter {
|
||||
readonly CONNECTED: "connected";
|
||||
readonly CONNECTING: "connecting";
|
||||
readonly DISCONNECTED: "disconnected";
|
||||
|
||||
socketPath?: string;
|
||||
port?: number;
|
||||
host?: string;
|
||||
autoReconnect: boolean;
|
||||
autoReconnectOptions?: AutoReconnectOptions;
|
||||
connectRetryErrorThreshold: number;
|
||||
state: "connected" | "connecting" | "disconnected";
|
||||
connectAttempts: number;
|
||||
pendingReconnect: boolean;
|
||||
pendingReconnectTimeout: number | null;
|
||||
|
||||
on(event: "error", listener: (err?: Error) => void): this;
|
||||
on(event: "warning", listener: (warning?: Error) => void): this;
|
||||
on(event: "ready", listener: (data: any) => void): this;
|
||||
on(event: "message", listener: (channel: string, data: any) => void): this;
|
||||
on(event: "subscribeFail", listener: (err: Error | null, channel: string) => void): this;
|
||||
on(event: "subscribe", listener: (channel: string) => void): this;
|
||||
on(event: "unsubscribe", listener: () => void): this;
|
||||
|
||||
isConnected(): boolean;
|
||||
|
||||
subscribe(channel: string, ackCallback: (err?: Error) => void, force?: boolean): void;
|
||||
unsubscribe(channel: string, ackCallback: (err?: Error) => void): void;
|
||||
|
||||
subscriptions(includePending?: boolean): string[];
|
||||
isSubscribed(channel: string, includePending?: boolean): boolean;
|
||||
|
||||
publish(channel: string, data: any, callback: (err?: Error) => void): void;
|
||||
|
||||
send(data: any, callback: (err?: Error) => void): void;
|
||||
|
||||
set(keyChain: KeyChain, value: any, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
set(keyChain: KeyChain, value: any, callback?: (err?: Error) => void): void;
|
||||
|
||||
expire(keys: Keys, seconds: number, callback?: (err?: Error) => void): void;
|
||||
unexpire(keys: Keys, callback?: (err?: Error) => void): void;
|
||||
getExpiry(key: Key, callback?: (err?: Error) => void): number;
|
||||
|
||||
add(keyChain: KeyChain, value: any, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
add(keyChain: KeyChain, value: any, callback?: (err?: Error) => void): void;
|
||||
|
||||
concat(keyChain: KeyChain, value: any, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
concat(keyChain: KeyChain, value: any, callback?: (err?: Error) => void): void;
|
||||
|
||||
get(keyChain: KeyChain, callback: (err: Error | null, value: any) => void): void;
|
||||
|
||||
getRange(keyChain: KeyChain, fromIndex: number, toIndex: number, callback: (err: Error | null, value: any) => void): void;
|
||||
getRange(keyChain: KeyChain, fromIndex: number, callback: (err: Error | null, value: any) => void): void;
|
||||
|
||||
getAll(callback: (err: Error | null, value: any[] | object) => void): void;
|
||||
|
||||
count(keyChain: KeyChain, callback: (err: Error | null, value: number) => void): void;
|
||||
|
||||
exec(query: (datamap: FlexiMap) => void, options?: QueryOptions, callback?: (err: Error | null, data: any) => void): void;
|
||||
exec(query: (datamap: FlexiMap) => void, callback: (err: Error | null, data: any) => void): void;
|
||||
|
||||
query(query: (datamap: FlexiMap) => void, data?: any, callback?: (err: Error | null, data: any) => void): void;
|
||||
query(query: (datamap: FlexiMap) => void, callback: (err: Error | null, data: any) => void): void;
|
||||
|
||||
remove(keyChain: KeyChain, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
remove(keyChain: KeyChain, callback?: (err?: Error) => void): void;
|
||||
|
||||
removeRange(keyChain: KeyChain, fromIndex: number, toIndex?: number, getValue?: boolean, callback?: (err?: Error) => void): void;
|
||||
removeRange(keyChain: KeyChain, fromIndex: number, toIndex?: number, callback?: (err?: Error) => void): void;
|
||||
removeRange(keyChain: KeyChain, fromIndex: number, callback?: (err?: Error) => void): void;
|
||||
|
||||
removeAll(callback?: (err: Error) => void): void;
|
||||
|
||||
splice(keyChain: KeyChain, options?: SpliceOptions, callback?: (err?: Error) => void): void;
|
||||
splice(keyChain: KeyChain, callback?: (err?: Error) => void): void;
|
||||
|
||||
pop(keyChain: KeyChain, callback: (err: Error | null, data: any) => void): void;
|
||||
|
||||
hasKey(keyChain: KeyChain, callback: (err: Error | null, data: boolean) => void): void;
|
||||
|
||||
extractKeys(keyChain: KeyChain): string[];
|
||||
|
||||
extractValues(keyChain: KeyChain): any[];
|
||||
|
||||
end(callback: (err?: Error) => void): void;
|
||||
}
|
||||
|
||||
export function createClient(options?: SCBrokerClientOptions): SCBrokerClient;
|
||||
@@ -0,0 +1,58 @@
|
||||
import { SCServer, SCServerSocket } from "socketcluster-server";
|
||||
import SCBroker = require("sc-broker/scbroker");
|
||||
import { FlexiMap } from "fleximap";
|
||||
import { ExpiryManager } from "expirymanager";
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// SCBroker tests
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
const options: SCServer.SCServerOptions = { port: 80 };
|
||||
|
||||
let scBroker = new SCBroker();
|
||||
scBroker = new SCBroker(options);
|
||||
scBroker.options = { environment: "prod" };
|
||||
|
||||
const id: number = scBroker.id;
|
||||
const instanceId: number = scBroker.instanceId;
|
||||
const dataMap: FlexiMap = scBroker.dataMap;
|
||||
const dataExpirer: ExpiryManager = scBroker.dataExpirer;
|
||||
const subscriptions = scBroker.subscriptions;
|
||||
|
||||
const socket: SCServerSocket = subscriptions[1]["test"];
|
||||
|
||||
scBroker.on("subscribe", channel => {
|
||||
const subscribeChannel: string = channel;
|
||||
});
|
||||
scBroker.on("unsubscribe", channel => {
|
||||
const unsubscribeChannel: string = channel;
|
||||
});
|
||||
scBroker.on("publish", (channel, data) => {
|
||||
const publishChannel: string = channel;
|
||||
const publishData: any = data;
|
||||
});
|
||||
scBroker.on("masterMessage", (data, masterMessageResponse) => {
|
||||
const masterMessageData: any = data;
|
||||
masterMessageResponse(null, "test");
|
||||
masterMessageResponse(new Error(), null);
|
||||
});
|
||||
|
||||
scBroker.publish("testChannel", 123);
|
||||
|
||||
scBroker.exec(dataMap => {
|
||||
dataMap.set(["main", "message"], "Message");
|
||||
return dataMap.get(["main"]);
|
||||
});
|
||||
|
||||
scBroker.sendToMaster("data");
|
||||
scBroker.sendToMaster(123, (err, response) => {
|
||||
if (!err) {
|
||||
const answer = response;
|
||||
}
|
||||
});
|
||||
|
||||
class MyBroker extends SCBroker {
|
||||
run() {
|
||||
this.on("subscribe", channel => {});
|
||||
}
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
import { EventEmitter } from "events";
|
||||
import { SCServer, SCServerSocket } from "socketcluster-server";
|
||||
import { FlexiMap, KeyChain } from "fleximap";
|
||||
import { ExpiryManager } from "expirymanager";
|
||||
|
||||
export = SCBroker;
|
||||
|
||||
interface Subscriptions {
|
||||
[socketId: number]: {
|
||||
[channel: string]: SCServerSocket;
|
||||
};
|
||||
}
|
||||
|
||||
declare class SCBroker extends EventEmitter {
|
||||
id: number;
|
||||
options: SCServer.SCServerOptions;
|
||||
instanceId: number;
|
||||
dataMap: FlexiMap;
|
||||
dataExpirer: ExpiryManager;
|
||||
subscriptions: Subscriptions;
|
||||
|
||||
constructor(options?: SCServer.SCServerOptions);
|
||||
|
||||
on(event: "subscribe" | "unsubscribe", listener: (channel: string) => void): this;
|
||||
on(event: "publish", listener: (channel: string, data: any) => void): this;
|
||||
on(event: "masterMessage", listener: (data: any, respond: (err: Error | null, responseData: any) => void) => void): this;
|
||||
|
||||
publish(channel: string, message: any): void;
|
||||
run(): void;
|
||||
exec(query: (dataMap: FlexiMap, dataExpirer: ExpiryManager, subscriptions: Subscriptions) => any, baseKey?: KeyChain): any;
|
||||
sendToMaster(data: any, callback?: (err: Error | null, responseData: any) => void): void;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"scbroker.d.ts",
|
||||
"sc-broker-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for sc-channel 1.2
|
||||
// Project: https://github.com/SocketCluster/sc-channel
|
||||
// Definitions by: Daniel Rose <https://github.com/DanielRose>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import Emitter = require("component-emitter");
|
||||
import { SCExchange, handlerFunction } from "sc-broker-cluster";
|
||||
|
||||
export interface SCChannelOptions {
|
||||
waitForAuth?: boolean;
|
||||
batch?: boolean;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
export class SCChannel extends Emitter {
|
||||
readonly PENDING: "pending";
|
||||
readonly SUBSCRIBED: "subscribed";
|
||||
readonly UNSUBSCRIBED: "unsubscribed";
|
||||
|
||||
name: string;
|
||||
state: ChannelState;
|
||||
waitForAuth: boolean;
|
||||
batch: boolean;
|
||||
data: any;
|
||||
|
||||
constructor(name: string, client: SCExchange, options?: SCChannelOptions);
|
||||
|
||||
setOptions(options?: SCChannelOptions): void;
|
||||
getState(): "pending" | "subscribed" | "unsubscribed";
|
||||
|
||||
subscribe(options?: any): void;
|
||||
unsubscribe(): void;
|
||||
isSubscribed(includePending?: boolean): boolean;
|
||||
|
||||
publish(data: any, callback?: (err?: Error) => void): void;
|
||||
|
||||
watch(handler: handlerFunction): void;
|
||||
unwatch(handler?: handlerFunction): void;
|
||||
watchers(): handlerFunction[];
|
||||
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export type ChannelState = "pending" | "subscribed" | "unsubscribed";
|
||||
@@ -0,0 +1,33 @@
|
||||
import { SCChannel, SCChannelOptions } from "sc-channel";
|
||||
import { handlerFunction, Client, SCBrokerClusterClientOptions } from "sc-broker-cluster";
|
||||
|
||||
const clientOptions: SCBrokerClusterClientOptions = { brokers: [], connectRetryErrorThreshold: 0 };
|
||||
const client = new Client(clientOptions);
|
||||
|
||||
let channel = new SCChannel("channelName", client.exchange());
|
||||
const channelOptions: SCChannelOptions = {};
|
||||
channel = new SCChannel("channelName", client.exchange(), channelOptions);
|
||||
|
||||
channel.state = channel.PENDING;
|
||||
channel.state = channel.SUBSCRIBED;
|
||||
channel.state = channel.UNSUBSCRIBED;
|
||||
|
||||
const channelName: string = channel.name;
|
||||
|
||||
const handler: handlerFunction = () => { };
|
||||
|
||||
channel.watch(handler);
|
||||
channel.unwatch();
|
||||
|
||||
channel.subscribe();
|
||||
channel.subscribe(channelOptions);
|
||||
channel.unsubscribe();
|
||||
|
||||
const data: any = channel.data;
|
||||
|
||||
channel.emit("subscribe", channelName);
|
||||
channel.emit("unsubscribe", channelName);
|
||||
|
||||
channel.setOptions(channelOptions);
|
||||
|
||||
channel.publish(data);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sc-channel-tests.ts"
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user