Merge branch 'master' into types-2.0-2016-08-10

This commit is contained in:
Nathan Shively-Sanders
2016-08-10 16:17:43 -07:00
39 changed files with 1587 additions and 287 deletions

View File

@@ -0,0 +1,25 @@
/// <reference path="../node/node.d.ts"/>
/// <reference path="./alexa-sdk.d.ts" />
import * as Alexa from "alexa-sdk";
exports.handler = function(event: Alexa.RequestBody, context: Alexa.Context, callback: Function) {
let alexa = Alexa.handler(event, context);
alexa.registerHandlers(handlers);
alexa.execute();
};
let handlers: Alexa.Handlers = {
'LaunchRequest': function () {
var self: Alexa.Handler = this;
self.emit('SayHello');
},
'HelloWorldIntent': function () {
var self: Alexa.Handler = this;
self.emit('SayHello');
},
'SayHello': function () {
var self: Alexa.Handler = this;
self.emit(':tell', 'Hello World!');
}
};

132
alexa-sdk/alexa-sdk.d.ts vendored Normal file
View File

@@ -0,0 +1,132 @@
// Type definitions for Alexa SDK for Node.js v1.0.3
// Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
// Definitions by: Pete Beegle <https://github.com/petebeegle>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'alexa-sdk' {
export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject;
export function CreateStateHandler(state: string, obj: any): any;
export var StateString: string;
interface AlexaObject {
_event: any;
_context: any;
_callback: any;
state: any;
appId: any;
response: any;
dynamoDBTableName: any;
saveBeforeResponse: boolean;
registerHandlers: (...handlers: Handlers[]) => any;
execute: () => void;
}
interface Handlers {
[intent: string]: () => void;
}
interface Handler {
on: any;
emit(event: string, ...args: any[]): boolean;
emitWithState: any;
state: any;
handler: any;
event: RequestBody;
attributes: any;
context: any;
name: any;
isOverriden: any;
}
interface Context {
callbackWaitsForEmptyEventLoop: boolean;
logGroupName: string;
logStreamName: string;
functionName: string;
memoryLimitInMB: string;
functionVersion: string;
invokeid: string;
awsRequestId: string;
}
interface RequestBody {
version: string;
session: Session;
request: LaunchRequest | IntentRequest | SessionEndedRequest;
}
interface Session {
new: boolean;
sessionId: string;
attributes: any;
application: SessionApplication;
user: SessionUser;
}
interface SessionApplication {
applicationId: string;
}
interface SessionUser {
userId: string;
accessToken: string;
}
interface LaunchRequest extends IRequest {}
interface IntentRequest extends IRequest {
intent: Intent;
}
interface Intent {
name: string;
slots: any;
}
interface SessionEndedRequest extends IRequest{
reason: string;
}
interface IRequest {
type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
requestId: string;
timeStamp: string;
}
interface ResponseBody {
version: string;
sessionAttributes?: any;
response: Response;
}
interface Response {
outputSpeech?: OutputSpeech;
card?: Card;
reprompt?: Reprompt;
shouldEndSession: boolean;
}
interface OutputSpeech {
type: "PlainText" | "SSML";
text?: string;
ssml?: string;
}
interface Card {
type: "Simple" | "Standard" | "LinkAccount";
title?: string;
content?: string;
text?: string;
image?: Image;
}
interface Image {
smallImageUrl: string;
largeImageUrl: string;
}
interface Reprompt {
outputSpeech: OutputSpeech;
}
}

12
amcharts/index.d.ts vendored
View File

@@ -30,6 +30,16 @@ declare namespace AmCharts {
/** Create chart by params. */
function makeChart(selector: string, params: any, delay?: number): AmChart;
/** Set a method to be called before initializing the chart.
* When the method is called, the chart instance is passed as an attribute.
* You can use this feature to preprocess chart data or do some other things you need
* before initializing the chart.
* @param {Function} handler - The method to be called.
* @param {string[]} types - Which chart types should call this method. Defaults to all
* if none is passed.
*/
function addInitHandler(handler: Function, types: string[]);
/** AmPieChart class creates pie/donut chart. In order to display pie chart you need to set at least three properties - dataProvider, titleField and valueField.
@example
var chartData = [{title:"Pie I have eaten",value:70},{title:"Pie I haven\'t eaten",value:30}];
@@ -1019,7 +1029,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
bold - specifies if text is bold (true/false),
url - url
*/
addLabel(x: number, y: number, text: string, align: string, size: number, color: string, rotation: number, alpha: number, bold: boolean, url: string): void;
addLabel(x: number|string, y: number|string, text: string, align: string, size?: number, color?: string, rotation?: number, alpha?: number, bold?: boolean, url?: string);
/** Adds a legend to the chart.
By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter.
(NOTE: This method will not work on StockPanel.)

View File

@@ -291,12 +291,13 @@ declare module 'angular' {
interface IPanelConfig {
template?: string;
templateUrl?: string;
controller?: string | Function;
controller?: string|Function;
controllerAs?: string;
bindToController?: boolean; // default: true
locals?: { [index: string]: any };
resolve?: { [index: string]: angular.IPromise<any> }
attachTo?: string | JQuery | Element;
locals?: {[index: string]: any};
resolve?: {[index: string]: angular.IPromise<any>}
attachTo?: string|JQuery|Element;
propagateContainerEvents?: boolean;
panelClass?: string;
zIndex?: number; // default: 80
position?: IPanelPosition;
@@ -312,7 +313,7 @@ declare module 'angular' {
onOpenComplete?: Function;
onRemoving?: Function;
onDomRemoved?: Function;
origin?: string | JQuery | Element;
origin?: string|JQuery|Element;
}
interface IPanelRef {
@@ -329,16 +330,18 @@ declare module 'angular' {
addClass(newClass: string): void;
removeClass(oldClass: string): void;
toggleClass(toggleClass: string): void;
focusOnOpen(): void;
updatePosition(position: IPanelPosition): void;
}
interface IPanelPosition {
absolute(): IPanelPosition;
relativeTo(someElement: string | JQuery | Element): IPanelPosition;
top(opt_top: string): IPanelPosition; // default: '0'
bottom(opt_bottom: string): IPanelPosition; // default: '0'
left(opt_left: string): IPanelPosition; // default: '0'
right(opt_right: string): IPanelPosition; // default: '0'
relativeTo(someElement: string|JQuery|Element): IPanelPosition;
top(top?: string): IPanelPosition; // default: '0'
bottom(bottom?: string): IPanelPosition; // default: '0'
start(start?: string): IPanelPosition; // default: '0'
end(end?: string): IPanelPosition; // default: '0'
left(left?: string): IPanelPosition; // default: '0'
right(right?: string): IPanelPosition; // default: '0'
centerHorizontally(): IPanelPosition;
centerVertically(): IPanelPosition;
center(): IPanelPosition;
@@ -358,6 +361,25 @@ declare module 'angular' {
open(opt_config: IPanelConfig): angular.IPromise<IPanelRef>;
newPanelPosition(): IPanelPosition;
newPanelAnimation(): IPanelAnimation;
xPosition: {
CENTER: string,
ALIGN_START: string,
ALIGN_END: string,
OFFSET_START: string,
OFFSET_END: string,
};
yPosition: {
CENTER: string,
ALIGN_TOPS: string,
ALIGN_BOTTOMS: string,
ABOVE: string,
BELOW: string,
};
animation: {
SLIDE: string,
SCALE: string,
FADE: string,
};
}
}
}

View File

@@ -1,13 +1,165 @@
/// <reference types="auth0" />
var lock: Auth0LockStatic = new Auth0Lock("dsa7d77dsa7d7", "mine.auth0.com");
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
const DOMAIN = "YOUR_DOMAIN_AT.auth0.com";
lock.showSignin({
connections: ["facebook", "google-oauth2", "twitter", "Username-Password-Authentication"],
icon: "https://contoso.com/logo-32.png",
socialBigButtons: true
},
() => {
// The Auth0 Widget is now loaded.
var lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN);
lock.show();
lock.hide();
lock.logout(() => {});
// The examples below are lifted from auth0-lock documentation on Github
// "on" event-driven example
lock.on("authenticated", function(authResult : any) {
lock.getProfile(authResult.idToken, function(error, profile) {
if (error) {
// Handle error
return;
}
localStorage.setItem("idToken", authResult.idToken);
localStorage.setItem("profile", JSON.stringify(profile));
});
});
// test theme
var themeOptions : Auth0LockConstructorOptions = {
theme: {
logo: "https://example.com/assets/logo.png",
primaryColor: "green"
}
};
new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions);
// test authentication
var authOptions : Auth0LockConstructorOptions = {
auth: {
params: { state: "foo" },
redirect: true,
redirectUrl: "some url",
responseType: "token",
sso: true
}
};
new Auth0Lock(CLIENT_ID, DOMAIN, authOptions);
// test multi-variant example
var multiVariantOptions : Auth0LockConstructorOptions = {
container: "myContainer",
closable: false,
languageDictionary: {
signUpTerms: "I agree to the <a href='/terms' target='_new'>terms of service</a> ...",
title: "My Company",
},
autofocus: false
};
new Auth0Lock(CLIENT_ID, DOMAIN, multiVariantOptions);
// test text-field additional sign up field
var textFieldOptions : Auth0LockConstructorOptions = {
additionalSignUpFields: [{
name: "address",
placeholder: "enter your address",
// The following properties are optional
icon: "https://example.com/assests/address_icon.png",
prefill: "street 123",
validator: function(input : string) {
return {
valid: input.length >= 10,
hint: "Must have 10 or more chars" // optional
};
}
}]
};
new Auth0Lock(CLIENT_ID, DOMAIN, textFieldOptions);
// test select-field additional sign up field
var selectFieldOptions : Auth0LockConstructorOptions = {
additionalSignUpFields: [{
type: "select",
name: "location",
placeholder: "choose your location",
options: [
{value: "us", label: "United States"},
{value: "fr", label: "France"},
{value: "ar", label: "Argentina"}
],
// The following properties are optional
icon: "https://example.com/assests/location_icon.png",
prefill: "us"
}]
};
new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptions);
// test select-field additional sign up field with callbacks for
var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = {
additionalSignUpFields: [{
type: "select",
name: "location",
placeholder: "choose your location",
options: function(cb) {
// obtain options, in case of error you call cb with the error in the
// first arg instead of null
let options = [
{value: "us", label: "United States"},
{value: "fr", label: "France"},
{value: "ar", label: "Argentina"}
];
cb(null, options);
},
icon: "https://example.com/assests/location_icon.png",
prefill: function(cb) {
// obtain prefill, in case of error you call cb with the error in the
// first arg instead of null
let prefill = "us";
cb(null, prefill);
}
}]
}
new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptionsWithCallbacks);
// test Avatar options
var avatarOptions : Auth0LockConstructorOptions = {
avatar: {
url: (email : string, cb : Auth0LockAvatarUrlCallback) => {
// obtain url for email, in case of error you call cb with the error in
// the first arg instead of null
let url = "url";
cb(null, url);
},
displayName: (email : string, cb : Auth0LockAvatarDisplayNameCallback) => {
// obtain displayName for email, in case of error you call cb with the
// error in the first arg instead of null
let displayName = "displayName";
cb(null, displayName);
}
}
};
new Auth0Lock(CLIENT_ID, DOMAIN, avatarOptions);

153
auth0-lock/index.d.ts vendored
View File

@@ -1,10 +1,70 @@
// Type definitions for Auth0Widget.js
// Type definitions for auth0-lock v10.0.1
// Project: http://auth0.com
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions by: Brian Caruso <https://github.com/carusology>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="auth0" />
interface Auth0LockAdditionalSignUpFieldOption {
value: string;
label: string;
}
type Auth0LockAdditionalSignUpFieldOptionsCallback =
(error: Auth0Error, options: Auth0LockAdditionalSignUpFieldOption[]) => void;
type Auth0LockAdditionalSignUpFieldOptionsFunction =
(callback: Auth0LockAdditionalSignUpFieldOptionsCallback) => void;
type Auth0LockAdditionalSignUpFieldPrefillCallback =
(error: Auth0Error, prefill: string) => void;
type Auth0LockAdditionalSignUpFieldPrefillFunction =
(callback: Auth0LockAdditionalSignUpFieldPrefillCallback) => void;
interface Auth0LockAdditionalSignUpField {
icon?: string;
name: string;
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction;
placeholder: string;
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction;
type?: "select" | "text";
validator?: (input: string) => { valid: boolean; hint?: string };
}
type Auth0LockAvatarUrlCallback = (error: Auth0Error, url: string) => void;
type Auth0LockAvatarDisplayNameCallback = (error: Auth0Error, displayName: string) => void;
interface Auth0LockAvatarOptions {
url: (email: string, callback: Auth0LockAvatarUrlCallback) => void;
displayName: (email: string, callback: Auth0LockAvatarDisplayNameCallback) => void;
}
interface Auth0LockThemeOptions {
logo?: string;
primaryColor?: string;
}
// https://auth0.com/docs/libraries/lock/v10/sending-authentication-parameters
interface Auth0LockAuthParamsOptions {
access_token?: any;
connection_scopes?: any;
device?: any;
nonce?: any;
protocol?: any;
request_id?: any;
scope?: string;
state?: string;
}
interface Auth0LockAuthOptions {
params?: Auth0LockAuthParamsOptions;
redirect?: boolean;
redirectUrl?: string;
responseType?: string;
sso?: boolean;
}
interface Auth0LockPopupOptions {
width: number;
height: number;
@@ -12,68 +72,51 @@ interface Auth0LockPopupOptions {
top: number;
}
interface Auth0LockOptions {
authParams?: any;
callbackURL?: string;
connections?: string[];
container?: string;
closable?: boolean;
dict?: any;
defaultUserPasswordConnection?: string;
defaultADUsernameFromEmailPrefix?: boolean;
disableResetAction?: boolean;
disableSignupAction?: boolean;
focusInput?: boolean;
forceJSONP?: boolean;
gravatar?: boolean;
integratedWindowsLogin?: boolean;
icon?: string;
loginAfterSignup?: boolean;
popup?: boolean;
popupOptions?: Auth0LockPopupOptions;
rememberLastLogin?: boolean;
resetLink?: string;
responseType?: string;
signupLink?: string;
socialBigButtons?: boolean;
sso?: boolean;
theme?: string;
usernameStyle?: any;
}
interface Auth0LockConstructorOptions {
cdn?: string;
additionalSignUpFields?: Auth0LockAdditionalSignUpField[];
allowedConnections?: string[];
allowForgotPassword?: boolean;
allowLogin?: boolean;
allowSignUp?: boolean;
assetsUrl?: string;
useCordovaSocialPlugins?: boolean;
auth?: Auth0LockAuthOptions;
autoclose?: boolean;
autofocus?: boolean;
avatar?: Auth0LockAvatarOptions;
closable?: boolean;
container?: string;
defaultADUsernameFromEmailPrefix?: string;
defaultDatabaseConnection?: string;
defaultEnterpriseConnection?: string;
forgotPasswordLink?: string;
initialScreen?: "login" | "signUp" | "forgotPassword";
language?: string;
languageDictionary?: any;
loginAfterSignup?: boolean;
mustAcceptTerms?: boolean;
popupOptions?: Auth0LockPopupOptions;
prefill?: { email?: string, username?: string};
rememberLastLogin?: boolean;
signupLink?: string;
socialButtonStyle?: "big" | "small";
theme?: Auth0LockThemeOptions;
usernameStyle?: string;
}
interface Auth0LockStatic {
new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
getProfile(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void) : void;
show(): void;
show(options: Auth0LockOptions): void;
show(callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
show(options: Auth0LockOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
hide(): void;
logout(query: any): void;
showSignin(): void;
showSignin(options: Auth0LockOptions): void;
showSignin(callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
showSignin(options: Auth0LockOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
showSignup(): void;
showSignup(options: Auth0LockOptions): void;
showSignup(callback: (error?: Auth0Error) => void) : void;
showSignup(options: Auth0LockOptions, callback: (error?: Auth0Error) => void) : void;
showReset(): void;
showReset(options: Auth0LockOptions): void;
showReset(callback: (error?: Auth0Error) => void) : void;
showReset(options: Auth0LockOptions, callback: (error?: Auth0Error) => void) : void;
hide(callback: () => void): void;
logout(callback: () => void): void;
getClient(): Auth0Static;
on(event: "show", callback: () => void) : void;
on(event: "hide", callback: () => void) : void;
on(event: "unrecoverable_error", callback: (error: Auth0Error) => void) : void;
on(event: "authorization_error", callback: (error: Auth0Error) => void) : void;
on(event: "authenticated", callback: (authResult: any) => void) : void;
on(event: string, callback: (...args: any[]) => void) : void;
}
declare var Auth0Lock: Auth0LockStatic;

View File

@@ -0,0 +1,10 @@
/// <reference path="autosize.d.ts" />
// from a NodeList
autosize(document.querySelectorAll('textarea'));
// from a single Node
autosize(document.querySelector('textarea'));
// from a single element
autosize(document.getElementById('my-textarea'));

17
autosize/autosize.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
// Type definitions for jquery.autosize 3.0.7
// Project: http://www.jacklmoore.com/autosize/
// Definitions by: Aaron T. King <https://github.com/kingdango>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace autosize {
interface AutosizeStatic {
(el: Element): void;
(el: NodeList): void;
}
}
declare var autosize: autosize.AutosizeStatic;
declare module 'autosize' {
export = autosize;
}

9
aws-sdk/index.d.ts vendored
View File

@@ -314,7 +314,8 @@ export declare class ECS {
export declare class DynamoDB {
constructor(options?: any);
endpoint: Endpoint;
createTable(params: any, next: (err: any, data: any) => void): void;
deleteTable(params: any, next: (err: any, data: any) => void): void;
}
// ==========================================================
@@ -350,10 +351,10 @@ export declare module DynamoDB {
ConditionalOperator?: "AND" | "OR";
Expected?: {
[someKey: string]: {
AttributeValueList: any[];
ComparisonOperator: _DDBDC_ComparisonOperator;
AttributeValueList?: any[];
ComparisonOperator?: _DDBDC_ComparisonOperator;
Exists: boolean;
Value: any;
Value?: any;
}
}
}

28
backbone/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for Backbone 1.0.0
// Type definitions for Backbone 1.3.3
// Project: http://backbonejs.org/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Natan Vivo <https://github.com/nvivo/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -114,9 +114,15 @@ declare namespace Backbone {
attributes: any;
changed: any[];
cidPrefix: string;
cid: string;
collection: Collection<any>;
private _changing: boolean;
private _previousAttributes : any;
private _pending: boolean;
/**
* Default attributes for the model. It can be an object hash or a method returning an object hash.
* For assigning an object hash, do it like this: this.defaults = <any>{ attribute: value, ... };
@@ -152,7 +158,14 @@ declare namespace Backbone {
/*private*/ set(attributeName: string, value: any, options?: ModelSetOptions): Model;
set(obj: any, options?: ModelSetOptions): Model;
changedAttributes(attributes?: any): any[];
/**
* Return an object containing all the attributes that have changed, or
* false if there are no changed attributes. Useful for determining what
* parts of a view need to be updated and/or what attributes need to be
* persisted to the server. Unset attributes will be set to undefined.
* You can also pass an attributes object to diff against the model,
* determining if there *would be* a change. */
changedAttributes(attributes?: any): any;
clear(options?: Silenceable): any;
clone(): Model;
destroy(options?: ModelDestroyOptions): any;
@@ -183,6 +196,7 @@ declare namespace Backbone {
omit(fn: (value: any, key: any, object: any) => any): any;
chain(): any;
isEmpty(): boolean;
matches(attrs: any): boolean;
}
class Collection<TModel extends Model> extends ModelBase {
@@ -213,6 +227,7 @@ declare namespace Backbone {
* Get a model from a collection, specified by an id, a cid, or by passing in a model.
**/
get(id: number|string|Model): TModel;
has(key: number|string|Model): boolean;
create(attributes: any, options?: ModelSaveOptions): TModel;
pluck(attribute: string): any[];
push(model: TModel, options?: AddOptions): TModel;
@@ -226,10 +241,12 @@ declare namespace Backbone {
unshift(model: TModel, options?: AddOptions): TModel;
where(properties: any): TModel[];
findWhere(properties: any): TModel;
modelId(attrs: any) : any
private _prepareModel(attributes?: any, options?: any): any;
private _removeReference(model: TModel): void;
private _onModelEvent(event: string, model: TModel, collection: Collection<TModel>, options: any): void;
private _isModel(obj: any) : obj is Model;
/**
* Return a shallow copy of this collection's models, using the same options as native Array#slice.
@@ -319,6 +336,8 @@ declare namespace Backbone {
navigate(fragment: string, options?: NavigateOptions): Router;
navigate(fragment: string, trigger?: boolean): Router;
execute(callback: Function, args: any[], name: string) : void;
private _bindRoutes(): void;
private _routeToRegExp(route: string): RegExp;
private _extractParameters(route: RegExp, fragment: string): string[];
@@ -335,9 +354,14 @@ declare namespace Backbone {
getHash(window?: Window): string;
getFragment(fragment?: string): string;
decodeFragment(fragment: string): string;
getSearch(): string;
stop(): void;
route(route: string, callback: Function): number;
checkUrl(e?: any): void;
getPath(): string;
matchRoot(): boolean;
atRoot(): boolean;
loadUrl(fragmentOverride?: string): boolean;
navigate(fragment: string, options?: any): boolean;
static started: boolean;

View File

@@ -24,6 +24,14 @@ declare namespace Chai {
value(text: string): Assertion;
}
interface Include {
text(text: string|string[]): Assertion;
html(text: string|string[]): Assertion;
}
}

View File

@@ -49,5 +49,43 @@ function printDiff(diff:jsdiff.IDiffResult[]) {
console.log(addLineHeader(" ", part.value));
}
});
}
}
function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
var verifyPatch = jsdiff.parsePatch(
jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr,
"old", "new", { context: 1 }));
if (JSON.stringify(verifyPatch) !== JSON.stringify(uniDiff)) {
console.error("Patch did not match uniDiff");
}
}
function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
var verifyApply = [
jsdiff.applyPatch(oldStr, uniDiff),
jsdiff.applyPatch(oldStr, [uniDiff])
];
jsdiff.applyPatches([uniDiff], {
loadFile: (index: number, callback: (err: Error, data: string) => void) => {
callback(undefined, one);
},
patched: (index: number, content: string) => {
verifyApply.push(content);
},
complete: (err?: Error) => {
if (err) {
console.error(err);
}
verifyApply.forEach(result => {
if (result !== newStr) {
console.error("Result did not match newStr");
}
});
}
});
}
verifyPatchMethods(one, other, uniDiff);
var uniDiff = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other,
"old", "new", { context: 1 });
verifyApplyMethods(one, other, uniDiff);

32
diff/index.d.ts vendored
View File

@@ -19,6 +19,22 @@ declare namespace JsDiff {
componenets: IDiffResult[];
}
interface IHunk {
oldStart: number;
oldLines: number;
newStart: number;
newLines: number;
lines: string[];
}
interface IUniDiff {
oldFileName: string;
newFileName: string;
oldHeader: string;
newHeader: string;
hunks: IHunk[];
}
class Diff {
ignoreWhitespace:boolean;
@@ -49,9 +65,21 @@ declare namespace JsDiff {
function diffCss(oldStr:string, newStr:string):IDiffResult[];
function createPatch(fileName:string, oldStr:string, newStr:string, oldHeader:string, newHeader:string):string;
function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
function applyPatch(oldStr:string, uniDiff:string):string;
function createTwoFilesPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
function structuredPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): IUniDiff;
function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string;
function applyPatches(uniDiff: IUniDiff[], options: {
loadFile: (index: number, callback: (err: Error, data: string) => void) => void,
patched: (index: number, content: string) => void,
complete: (err?: Error) => void
}): void;
function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[];
function convertChangesToXML(changes:IDiffResult[]):string;

View File

@@ -192,9 +192,10 @@ declare module "express-serve-static-core" {
* req.accepts('html, json');
* // => "json"
*/
accepts(type: string): string;
accepts(type: string[]): string;
accepts(): string[];
accepts(type: string): string | boolean;
accepts(type: string[]): string | boolean;
accepts(...type: string[]): string | boolean;
/**
* Returns the first accepted charset of the specified character sets,
@@ -204,7 +205,10 @@ declare module "express-serve-static-core" {
* For more information, or if you have issues or concerns, see accepts.
* @param charset
*/
acceptsCharsets(charset?: string | string[]): string[];
acceptsCharsets(): string[];
acceptsCharsets(charset: string): string | boolean;
acceptsCharsets(charset: string[]): string | boolean;
acceptsCharsets(...charset: string[]): string | boolean;
/**
* Returns the first accepted encoding of the specified encodings,
@@ -214,7 +218,10 @@ declare module "express-serve-static-core" {
* For more information, or if you have issues or concerns, see accepts.
* @param encoding
*/
acceptsEncodings(encoding?: string | string[]): string[];
acceptsEncodings(): string[];
acceptsEncodings(encoding: string): string | boolean;
acceptsEncodings(encoding: string[]): string | boolean;
acceptsEncodings(...encoding: string[]): string | boolean;
/**
* Returns the first accepted language of the specified languages,
@@ -225,7 +232,10 @@ declare module "express-serve-static-core" {
*
* @param lang
*/
acceptsLanguages(lang?: string | string[]): string[];
acceptsLanguages(): string[];
acceptsLanguages(lang: string): string | boolean;
acceptsLanguages(lang: string[]): string | boolean;
acceptsLanguages(...lang: string[]): string | boolean;
/**
* Parse Range header field,

View File

@@ -48,6 +48,26 @@ router.delete(pathRE);
router.use((req, res, next) => { next(); })
router.route('/users')
.get((req, res, next) => {
let types: string[] = req.accepts();
let type: string | boolean = req.accepts('json');
type = req.accepts(['json', 'text']);
type = req.accepts('json', 'text');
let charsets: string[] = req.acceptsCharsets();
let charset: string | boolean = req.acceptsCharsets('utf-8');
charset = req.acceptsCharsets(['utf-8', 'utf-16']);
charset = req.acceptsCharsets('utf-8', 'utf-16');
let encodings: string[] = req.acceptsEncodings();
let encoding: string | boolean = req.acceptsEncodings('gzip');
encoding = req.acceptsEncodings(['gzip', 'deflate']);
encoding = req.acceptsEncodings('gzip', 'deflate');
let languages: string[] = req.acceptsLanguages();
let language: string | boolean = req.acceptsLanguages('en');
language = req.acceptsLanguages(['en', 'ja']);
language = req.acceptsLanguages('en', 'ja');
res.send(req.query['token']);
});

View File

@@ -0,0 +1,7 @@
/// <reference path="get-port.d.ts" />
import * as getPort from "get-port";
getPort().then(port => {
console.log(port);
});

9
get-port/get-port.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for ajv
// Project: https://github.com/sindresorhus/get-port
// Definitions by: York Yao <https://github.com/plantain-00/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "get-port" {
var getPort: () => PromiseLike<number>
export = getPort;
}

71
handlebars/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for Handlebars v3.0.3
// Type definitions for Handlebars v4.0.5
// Project: http://handlebarsjs.com/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -15,14 +15,25 @@ declare namespace Handlebars {
export function Exception(message: string): void;
export function log(level: number, obj: any): void;
export function parse(input: string): hbs.AST.Program;
export function compile(input: any, options?: any): HandlebarsTemplateDelegate;
export function compile(input: any, options?: CompileOptions): HandlebarsTemplateDelegate;
export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification;
export function template(precompilation: TemplateSpecification): HandlebarsTemplateDelegate;
export function create(): typeof Handlebars;
export var SafeString: typeof hbs.SafeString;
export var escapeExpression: typeof hbs.Utils.escapeExpression;
export var Utils: typeof hbs.Utils;
export var logger: Logger;
export var templates: HandlebarsTemplates;
export var helpers: any;
export function registerDecorator(name: string, fn: Function): void;
export function registerDecorator(obj: {[name: string] : Function}): void;
export function unregisterDecorator(name: string): void;
export function noConflict(): typeof Handlebars;
export module AST {
export var helpers: hbs.AST.helpers;
}
@@ -32,6 +43,9 @@ declare namespace Handlebars {
Program(program: hbs.AST.Program): void;
BlockStatement(block: hbs.AST.BlockStatement): void;
PartialStatement(partial: hbs.AST.PartialStatement): void;
PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void;
DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void;
Decorator(decorator: hbs.AST.Decorator): void;
MustacheStatement(mustache: hbs.AST.MustacheStatement): void;
ContentStatement(content: hbs.AST.ContentStatement): void;
CommentStatement(comment?: hbs.AST.CommentStatement): void;
@@ -52,6 +66,9 @@ declare namespace Handlebars {
Program(program: hbs.AST.Program): void;
BlockStatement(block: hbs.AST.BlockStatement): void;
PartialStatement(partial: hbs.AST.PartialStatement): void;
PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void;
DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void;
Decorator(decorator: hbs.AST.Decorator): void;
MustacheStatement(mustache: hbs.AST.MustacheStatement): void;
ContentStatement(content: hbs.AST.ContentStatement): void;
CommentStatement(comment?: hbs.AST.CommentStatement): void;
@@ -81,6 +98,37 @@ interface HandlebarsTemplates {
[index: string]: HandlebarsTemplateDelegate;
}
interface TemplateSpecification {
}
interface CompileOptions {
data?: boolean;
compat?: boolean;
knownHelpers?: {
helperMissing?: boolean;
blockHelperMissing?: boolean;
each?: boolean;
if?: boolean;
unless?: boolean;
with?: boolean;
log?: boolean;
lookup?: boolean;
}
knownHelpersOnly?: boolean;
noEscape?: boolean;
strict?: boolean;
assumeObjects?: boolean;
preventIndent?: boolean;
ignoreStandalone?: boolean;
explicitPartialContext?: boolean;
}
interface PrecompileOptions extends CompileOptions {
srcName?: string;
destName?: string;
}
declare namespace hbs {
class SafeString {
constructor(str: string);
@@ -89,6 +137,12 @@ declare namespace hbs {
namespace Utils {
function escapeExpression(str: string): string;
function createFrame(obj: Object): Object;
function isEmpty(obj: any) : boolean;
function extend(obj: any, ...source: any[]): any;
function toString(obj: any): string;
function isArray(obj: any): boolean;
function isFunction(obj: any): boolean;
}
}
@@ -137,6 +191,8 @@ declare namespace hbs {
strip: StripFlags;
}
interface Decorator extends MustacheStatement { }
interface BlockStatement extends Statement {
path: PathExpression;
params: Expression[];
@@ -148,6 +204,8 @@ declare namespace hbs {
closeStrip: StripFlags;
}
interface DecoratorBlock extends BlockStatement { }
interface PartialStatement extends Statement {
name: PathExpression | SubExpression;
params: Expression[];
@@ -156,6 +214,15 @@ declare namespace hbs {
strip: StripFlags;
}
interface PartialBlockStatement extends Statement {
name: PathExpression | SubExpression;
params: Expression[],
hash: Hash,
program: Program,
openStrip: StripFlags,
closeStrip: StripFlags
}
interface ContentStatement extends Statement {
value: string;
original: StripFlags;

View File

@@ -0,0 +1,39 @@
/// <reference path="hellosign-embedded.d.ts" />
HelloSign.init('abc123');
// some options
HelloSign.open({
url: 'http://example.org',
messageListener: (e: HelloSign.MessageEvent) => {
if (e.event === HelloSign.EVENT_SIGNED) {
console.log('signed');
}
},
uxVersion: 2
});
// all options
HelloSign.open({
url: 'http://example.org',
redirectUrl: 'https://github.com/DefinitelyTyped/DefinitelyTyped',
allowCancel: true,
messageListener: (e: HelloSign.MessageEvent) => {
if (e.event === HelloSign.EVENT_SIGNED) {
console.log('signed');
}
},
userCulture: HelloSign.CULTURES.EN_US,
debug: true,
skipDomainVerification: true,
container: document.getElementById('#hellosign-container'),
height: 1326,
hideHeader: true,
uxVersion: 2,
requester: 'hellosign@example.org',
whiteLabelingOptions: {
"page_background_color": "#f7f8f9"
}
});
HelloSign.close();

View File

@@ -0,0 +1,193 @@
// Type definitions for hellosign-embedded v1.0.3
// Project: https://github.com/HelloFax/hellosign-embedded
// Definitions by: Brian Surowiec <https://github.com/xt0rted/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module HelloSign {
interface MessageEvent {
event: string;
}
interface ClientCultures {
/**
* English (United States)
*
* @default en_US
*/
EN_US: string;
/**
* French (France)
*
* @default fr_FR
*/
FR_FR: string;
/**
* German (Germany)
*
* @default de_DE
*/
DE_DE: string;
/**
* Swedish (Sweden)
*
* @default sv_SE
*/
SV_SE: string;
/**
* Chinese (China)
*
* @default zh_CN
*/
ZH_CN: string;
/**
* Danish (Denmark)
*
* @default da_DK
*/
DA_DK: string;
/**
* Dutch (The Netherlands)
* @default nl_NL
*/
NL_NL: string;
/**
* The available client UI cultures
*/
supportedCultures: string[];
}
interface OpenParameters {
/**
* The url to open in the child frame
*/
url?: string;
/**
* Where to go after the signature is completed
*/
redirectUrl?: string;
/**
* Whether a cancel button should be displayed
*
* @default true
*/
allowCancel?: boolean;
/**
* A listener for X-window messages coming from the child frame
*/
messageListener?: (eventData: MessageEvent) => void;
/**
* One of the HelloSign.CULTURES.supportedCultures
*
* @default HelloSign.CULTURES.EN_US
*/
userCulture?: string;
/**
* When true, debugging statements will be written to the console
*
* @default false
*/
debug?: boolean;
/**
* When true, domain verification step will be skipped if and only if the Signature Request was created with test_mode=1
*
* @default false
*/
skipDomainVerification?: boolean;
/**
* DOM element that will contain the iframe on the page (defaults to document.body)
*/
container?: Element;
/**
* Height of the iFrame (only applicable when a container is specified)
*/
height?: number;
/**
* When true, the header will be hidden.
* This is only functional for customers with embedded branding enabled.
*
* @default false
*/
hideHeader?: boolean;
/**
* The version of the embedded user experience to display to signers (1 = legacy, 2 = responsive).
* This option is only honored if your account has accessed the API prior to Nov 14, 2015.
*/
uxVersion?: number;
/**
* The email of the person issuing a signature request.
* Required for allowing 'Me + Others' requests
*/
requester?: string;
/**
* An associative array to be used to customize the app's signer page
*/
whiteLabelingOptions?: Object;
}
interface HelloSignStatic {
/**
* The available client UI cultures
*/
CULTURES: ClientCultures;
/**
* The signature request was signed
*
* @default signature_request_signed
*/
EVENT_SIGNED: string;
/**
* The user closed the iFrame before completing
*
* @default signature_request_canceled
*/
EVENT_CANCELED: string;
/**
* An error occurred in the iFrame
*
* @default error
*/
EVENT_ERROR: string;
/**
* Initialize using your HelloSign API client ID.
*
* @param appClientId The API client ID the request is for.
*/
init(appClientId: string): void;
/**
* Open the signing window.
*
* @param params The options to use when opening the signing window.
*/
open(params: OpenParameters): void;
/**
* Close the signing window.
*/
close(): void;
}
}
declare var HelloSign: HelloSign.HelloSignStatic;

View File

@@ -3183,6 +3183,14 @@ interface HighchartsPointEvents {
* @since 1.2.0
*/
update?: (event: Event) => boolean|void;
/**
* Fires when the legend item belonging to the pie point (slice) is clicked.
* The this keyword refers to the point itself. One parameter, event, is passed to the function.
* This contains common event information based on jQuery or MooTools depending on which library is used as the base for Highcharts.
* The default action is to toggle the visibility of the point. This can be prevented by calling event.preventDefault().
*/
legendItemClick?: (event: Event) => boolean | void;
}
interface HighchartsHalo {

View File

@@ -0,0 +1,146 @@
/// <reference path="json-editor.d.ts" />
var element = document.getElementById('editor_holder');
var editor = new JSONEditor(element, {});
// Set an option globally
JSONEditor.defaults.options.theme = 'bootstrap2';
// Set an option during instantiation
editor = new JSONEditor(element, {
theme: 'bootstrap2'
});
editor.on('ready', function () {
// Now the api methods will be available
editor.validate();
});
var editor2 = new JSONEditor<{ name: string; }>(element, {});
editor2.setValue({ name: "John Smith" });
var value = editor2.getValue();
console.log(value.name) // Will log "John Smith"
// Get a reference to a node within the editor
var name2 = editor.getEditor('root.name');
// `getEditor` will return null if the path is invalid
if (name2) {
name2.setValue("John Smith");
console.log(name2.getValue());
}
var errors = editor.validate();
if (errors.length) {
// errors is an array of objects, each with a `path`, `property`, and `message` parameter
// `property` is the schema keyword that triggered the validation error (e.g. "minLength")
// `path` is a dot separated path into the JSON object (e.g. "root.path.to.field")
console.log(errors);
}
else {
// It's valid!
}
// Validate an arbitrary value against the editor's schema
var errors = editor.validate({
value: {
to: "test"
}
});
editor.on('change', function () {
// Do something
});
editor.off('change', function () {
// Do something
});
editor.watch('path.to.field', function () {
// Do something
});
editor.unwatch('path.to.field', function () {
// Do something
});
// Disable entire form
editor.disable();
// Disable part of the form
editor.getEditor('root.location').disable();
// Enable entire form
editor.enable();
// Enable part of the form
editor.getEditor('root.location').enable();
// Check if form is currently enabled
if (editor.isEnabled()) alert("It's editable!");
editor.destroy();
JSONEditor.defaults.options.theme = 'foundation5';
JSONEditor.plugins.sceditor.emoticonsEnabled = false;
JSONEditor.plugins.epiceditor.basePath = 'epiceditor';
JSONEditor.plugins.ace.theme = 'twilight';
JSONEditor.defaults.editors.object.options.collapsed = true;
JSONEditor.defaults.options.template = 'handlebars';
var myengine = {
compile: function (template: any) {
// Compile should return a render function
return function (vars: any) {
// A real template engine would render the template here
var result = template;
return result;
}
}
};
// Set globally
JSONEditor.defaults.options.template = myengine;
// Override a specific translation
JSONEditor.defaults.languages.en.error_minLength =
"This better be at least {{0}} characters long or else!";
// Create your own language mapping
// Any keys not defined here will fall back to the "en" language
JSONEditor.defaults.languages.es = {
error_notset: "propiedad debe existir"
};
JSONEditor.defaults.language = "es";
JSONEditor.defaults.resolvers.unshift(function (schema) {
if (schema.type === "object" && schema.format === "location") {
return "location";
}
// If no valid editor is returned, the next resolver function will be used
});
JSONEditor.plugins.selectize.enable = true;
JSONEditor.defaults.custom_validators.push(function (schema, value, path) {
var errors: JSONEditorError[] = [];
if (schema.format === "date") {
if (!/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value)) {
// Errors must be an object with `path`, `property`, and `message`
errors.push({
path: path,
property: 'format',
message: 'Dates must be in the format "YYYY-MM-DD"'
});
}
}
return errors;
});

184
json-editor/json-editor.d.ts vendored Normal file
View File

@@ -0,0 +1,184 @@
// Type definitions for json-editor
// Project: https://github.com/jdorn/json-editor
// Definitions by: York Yao <https://github.com/plantain-00/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type JSONEditorOptions<TValue> = {
/**
* If true, JSON Editor will load external URLs in $ref via ajax.
*/
ajax?: boolean;
/**
* If true, remove all "add row" buttons from arrays.
*/
disable_array_add?: boolean;
/**
* If true, remove all "delete row" buttons from arrays.
*/
disable_array_delete?: boolean;
/**
* If true, remove all "move up" and "move down" buttons from arrays.
*/
disable_array_reorder?: boolean;
/**
* If true, remove all collapse buttons from objects and arrays.
*/
disable_collapse?: boolean;
/**
* If true, remove all Edit JSON buttons from objects.
*/
disable_edit_json?: boolean;
/**
* If true, remove all Edit Properties buttons from objects.
*/
disable_properties?: boolean;
/**
* The first part of the `name` attribute of form inputs in the editor. An full example name is `root[person][name]` where "root" is the form_name_root.
*/
form_name_root?: string;
/**
* The icon library to use for the editor.
*/
iconlib?: boolean;
/**
* If true, objects can only contain properties defined with the properties keyword.
*/
no_additional_properties?: boolean;
/**
* An object containing schema definitions for URLs. Allows you to pre-define external schemas.
*/
refs?: any;
/**
* If true, all schemas that don't explicitly set the required property will be required.
*/
required_by_default?: boolean;
/**
* If true, makes oneOf copy properties over when switching.
*/
keep_oneof_values?: boolean;
/**
* A valid JSON Schema to use for the editor. Version 3 and Version 4 of the draft specification are supported.
*/
schema?: any;
/**
* When to show validation errors in the UI. Valid values are interaction, change, always, and never.
*/
show_errors?: "interaction" | "change" | "always" | "never";
/**
* Seed the editor with an initial value. This should be valid against the editor's schema.
*/
startval?: TValue;
/**
* The JS template engine to use.
*/
template?: string | { compile: (template: string) => (vars: any) => string };
/**
* The CSS theme to use.
*/
theme?: string;
/**
* If true, only required properties will be included by default.
*/
display_required_only?: boolean;
}
type JSONEditorError = {
path: string;
property: string;
message: string;
}
type JSONEditorObjectOptions = {
/**
* If set to true, the editor will start collapsed
*/
collapsed?: boolean;
/**
* If set to true, the collapse button will be hidden
*/
disable_collapse?: boolean;
/**
* If set to true, the Edit JSON button will be hidden
*/
disable_edit_json?: boolean;
/**
* If set to true, the Edit Properties button will be hidden
*/
disable_properties?: boolean;
}
type JSONEditorArrayOptions = {
/**
* If set to true, the editor will start collapsed
*/
collapsed?: boolean;
/**
* If set to true, the "add row" button will be hidden
*/
disable_array_add?: boolean;
/**
* If set to true, all of the "delete" buttons will be hidden
*/
disable_array_delete?: boolean;
/**
* If set to true, just the "delete all rows" button will be hidden
*/
disable_array_delete_all_rows?: boolean;
/**
* If set to true, just the "delete last row" buttons will be hidden
*/
disable_array_delete_last_row?: boolean;
/**
* If set to true, the "move up/down" buttons will be hidden
*/
disable_array_reorder?: boolean;
/**
* If set to true, the collapse button will be hidden
*/
disable_collapse?: boolean;
}
declare class JSONEditor<TValue> {
public static defaults: {
options: JSONEditorOptions<any>;
editors: {
object: {
options: JSONEditorObjectOptions;
};
array: {
options: JSONEditorArrayOptions;
}
};
languages: any;
language: string;
resolvers: ((schema: any) => string)[];
custom_validators: (((schema: any, value: string, path: string) => JSONEditorError[]))[];
};
public static plugins: {
sceditor: {
emoticonsEnabled: boolean;
};
epiceditor: {
basePath: string;
};
ace: {
theme: string;
};
selectize: {
enable: boolean;
};
};
constructor(element: HTMLElement, options: JSONEditorOptions<TValue>);
public on(event: string, fn: Function): JSONEditor<TValue>;
public off(event: string, fn: Function): JSONEditor<TValue>;
public watch(event: string, fn: Function): JSONEditor<TValue>;
public unwatch(event: string, fn: Function): JSONEditor<TValue>;
public validate(value?: TValue): JSONEditorError[];
public setValue(value: TValue): void;
public getValue(): TValue;
public getEditor(name: string): JSONEditor<TValue>;
public disable(): void;
public enable(): void;
public isEnabled(): boolean;
public destroy(): void;
}
declare module "json-editor" {
export = JSONEditor;
}

View File

@@ -0,0 +1,26 @@
/// <reference path="../aws-sdk/aws-sdk.d.ts" />
/// <reference path="nodemailer-ses-transport.d.ts" />
import * as AWS from 'aws-sdk';
import * as sesTransport from 'nodemailer-ses-transport';
var opts: sesTransport.SesOptions = {
ses: new AWS.SES(),
rateLimit: 5,
maxConnections: 3,
};
var transport: nodemailer.Transport = sesTransport(opts);
// setup e-mail data with unicode symbols
var mailOptions: nodemailer.SendMailOptions = {
from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address
to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world ✔', // plaintext body
html: '<b>Hello world ✔</b>' // html body
};
transport.send(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => {
// nothing
});

View File

@@ -0,0 +1,29 @@
// Type definitions for nodemailer-ses-transport 1.4.0
// Project: https://github.com/andris9/nodemailer-ses-transport
// Definitions by: Seth Westphal <https://github.com/westy92/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../aws-sdk/aws-sdk.d.ts" />
/// <reference path="../nodemailer/nodemailer.d.ts" />
declare module "nodemailer-ses-transport" {
import * as AWS from 'aws-sdk';
namespace sesTransport {
export interface SesOptions {
ses?: AWS.SES;
accessKeyId?: string;
secretAccessKey?: string;
sessionToken?: string;
region?: string;
httpOptions?: AWS.HttpOptions;
rateLimit?: number;
maxConnections?: number;
}
}
function sesTransport(options: sesTransport.SesOptions): nodemailer.Transport;
export = sesTransport;
}

186
nodemailer/index.d.ts vendored
View File

@@ -4,14 +4,11 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/// <reference path="nodemailer-types.d.ts" />
/// <reference types="bluebird" />
import directTransport = require("nodemailer-direct-transport");
import smtpTransport = require("nodemailer-smtp-transport");
export type Transport = nodemailer.Transport;
export type SendMailOptions = nodemailer.SendMailOptions;
export type SentMessageInfo = nodemailer.SentMessageInfo;
import * as Promise from 'bluebird';
/**
* Transporter plugin
@@ -25,28 +22,39 @@ export interface Plugin {
*/
export interface Transporter {
/**
* Send a mail with callback
*/
* Send a mail with callback
*/
sendMail(mail: SendMailOptions, callback: (error: Error, info: SentMessageInfo) => void): void;
/**
* Send a mail
* Send a mail
* return Promise
*/
*/
sendMail(mail: SendMailOptions): Promise<SentMessageInfo>;
/**
* Attach a plugin. 'compile' and 'stream' plugins can be attached with use(plugin) method
*
* @param step is a string, either 'compile' or 'stream' thatd defines when the plugin should be hooked
* @param pluginFunc is a function that takes two arguments: the mail object and a callback function
*/
use(step: string, plugin: Plugin): void;
/**
* Send mail using a template.
*/
templateSender(template?: any, defaults?: any): (mailData: any, context: any) => Promise<SentMessageInfo>;
/**
* Send mail using a template with a callback.
*/
templateSender(template?: any, defaults?: any, callback?: (error: Error, info: SentMessageInfo) => void): void;
/**
* Verifies connection with server
*/
verify(callback: (error: Error, success?: boolean) => void): void;
/**
* Attach a plugin. 'compile' and 'stream' plugins can be attached with use(plugin) method
*
* @param step is a string, either 'compile' or 'stream' thatd defines when the plugin should be hooked
* @param pluginFunc is a function that takes two arguments: the mail object and a callback function
*/
use(step: string, plugin: Plugin): void;
/**
* Verifies connection with server
*/
verify(callback: (error: Error, success?: boolean) => void): void;
/**
* Verifies connection with server
@@ -71,3 +79,141 @@ export declare function createTransport(options?: smtpTransport.SmtpOptions, def
* Create a transporter from a given implementation
*/
export declare function createTransport(transport: Transport, defaults?: Object): Transporter;
export interface AttachmentObject {
/**
* filename to be reported as the name of the attached file, use of unicode is allowed
*/
filename?: string;
/**
* optional content id for using inline images in HTML message source
*/
cid?: string;
/**
* Pathname or URL to use streaming
*/
path?: string;
/**
* String, Buffer or a Stream contents for the attachment
*/
content: string|Buffer|NodeJS.ReadableStream;
/**
* If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, 'binary' etc. Useful if you want to use binary attachments in a JSON formatted e-mail object.
*/
encoding?: string;
/**
* optional content type for the attachment, if not set will be derived from the filename property
*/
contentType?: string;
/**
* optional content disposition type for the attachment, defaults to 'attachment'
*/
contentDisposition?: string;
}
export interface SendMailOptions {
/**
* The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name <sender@server.com>', see here for details
*/
from?: string;
/**
* An e-mail address that will appear on the Sender: field
*/
sender?: string;
/**
* Comma separated list or an array of recipients e-mail addresses that will appear on the To: field
*/
to?: string|string[];
/**
* Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field
*/
cc?: string|string[];
/**
* Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field
*/
bcc?: string|string[];
/**
* An e-mail address that will appear on the Reply-To: field
*/
replyTo?: string;
/**
* The message-id this message is replying
*/
inReplyTo?: string;
/**
* Message-id list (an array or space separated string)
*/
references?: string|string[];
/**
* The subject of the e-mail
*/
subject?: string;
/**
* The plaintext version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
*/
text?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
/**
* The HTML version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
*/
html?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
/**
* An object or array of additional header fields (e.g. {"X-Key-Name": "key value"} or [{key: "X-Key-Name", value: "val1"}, {key: "X-Key-Name", value: "val2"}])
*/
headers?: any;
/**
* An array of attachment objects (see below for details)
*/
attachments?: AttachmentObject[];
/**
* An array of alternative text contents (in addition to text and html parts) (see below for details)
*/
alternatives?: AttachmentObject[];
/**
* optional Message-Id value, random value will be generated if not set
*/
messageId?: string;
/**
* optional Date value, current UTC string will be used if not set
*/
date?: Date;
/**
* optional transfer encoding for the textual parts (defaults to 'quoted-printable')
*/
encoding?: string;
}
export interface SentMessageInfo {
/**
* most transports should return the final Message-Id value used with this property
*/
messageId: string;
/**
* includes the envelope object for the message
*/
envelope: any;
/**
* is an array returned by SMTP transports (includes recipient addresses that were accepted by the server)
*/
accepted: string[];
/**
* is an array returned by SMTP transports (includes recipient addresses that were rejected by the server)
*/
rejected: string[];
/**
* is an array returned by Direct SMTP transport. Includes recipient addresses that were temporarily rejected together with the server response
*/
pending?: string[];
/**
* is a string returned by SMTP transports and includes the last SMTP response from the server
*/
response: string;
}
/**
* This is what you implement to create a new transporter yourself
*/
export interface Transport {
name: string;
version: string;
send(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void;
close(): void;
}

View File

@@ -41,4 +41,21 @@ transporter.sendMail(mailOptions, (error: Error, info: nodemailer.SentMessageInf
// promise send mail without callback
transporter
.sendMail(mailOptions)
.then(info => info.messageId)
.then(info => info.messageId)
// create template based sender function
var sendPwdReset = transporter.templateSender({
subject: 'Password reset for {{username}}!',
text: 'Hello, {{username}}, Please go here to reset your password: {{ reset }}',
html: '<b>Hello, <strong>{{username}}</strong>, Please <a href="{{ reset }}">go here to reset your password</a>: {{ reset }}</p>'
}, {
from: 'sender@example.com',
});
// use template based sender to send a message
sendPwdReset({
to: 'receiver@example.com'
}, {
username: 'Node Mailer',
reset: 'https://www.example.com/reset?token=<unique-single-use-token>'
})
.then(info => info.messageId);

View File

@@ -1,149 +0,0 @@
// Type definitions for Nodemailer 1.3.2
// Project: https://github.com/andris9/Nodemailer
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare namespace nodemailer {
export interface AttachmentObject {
/**
* filename to be reported as the name of the attached file, use of unicode is allowed
*/
filename?: string;
/**
* optional content id for using inline images in HTML message source
*/
cid?: string;
/**
* Pathname or URL to use streaming
*/
path?: string;
/**
* String, Buffer or a Stream contents for the attachment
*/
content: string|Buffer|NodeJS.ReadableStream;
/**
* If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, 'binary' etc. Useful if you want to use binary attachments in a JSON formatted e-mail object.
*/
encoding?: string;
/**
* optional content type for the attachment, if not set will be derived from the filename property
*/
contentType?: string;
/**
* optional content disposition type for the attachment, defaults to 'attachment'
*/
contentDisposition?: string;
}
export interface SendMailOptions {
/**
* The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name <sender@server.com>', see here for details
*/
from?: string;
/**
* An e-mail address that will appear on the Sender: field
*/
sender?: string;
/**
* Comma separated list or an array of recipients e-mail addresses that will appear on the To: field
*/
to?: string|string[];
/**
* Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field
*/
cc?: string|string[];
/**
* Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field
*/
bcc?: string|string[];
/**
* An e-mail address that will appear on the Reply-To: field
*/
replyTo?: string;
/**
* The message-id this message is replying
*/
inReplyTo?: string;
/**
* Message-id list (an array or space separated string)
*/
references?: string|string[];
/**
* The subject of the e-mail
*/
subject?: string;
/**
* The plaintext version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
*/
text?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
/**
* The HTML version of the message as an Unicode string, Buffer, Stream or an object {path: '...'}
*/
html?: string|Buffer|NodeJS.ReadableStream|AttachmentObject;
/**
* An object or array of additional header fields (e.g. {"X-Key-Name": "key value"} or [{key: "X-Key-Name", value: "val1"}, {key: "X-Key-Name", value: "val2"}])
*/
headers?: any;
/**
* An array of attachment objects (see below for details)
*/
attachments?: AttachmentObject[];
/**
* An array of alternative text contents (in addition to text and html parts) (see below for details)
*/
alternatives?: AttachmentObject[];
/**
* optional Message-Id value, random value will be generated if not set
*/
messageId?: string;
/**
* optional Date value, current UTC string will be used if not set
*/
date?: Date;
/**
* optional transfer encoding for the textual parts (defaults to 'quoted-printable')
*/
encoding?: string;
}
export interface SentMessageInfo {
/**
* most transports should return the final Message-Id value used with this property
*/
messageId: string;
/**
* includes the envelope object for the message
*/
envelope: any;
/**
* is an array returned by SMTP transports (includes recipient addresses that were accepted by the server)
*/
accepted: string[];
/**
* is an array returned by SMTP transports (includes recipient addresses that were rejected by the server)
*/
rejected: string[];
/**
* is an array returned by Direct SMTP transport. Includes recipient addresses that were temporarily rejected together with the server response
*/
pending?: string[];
/**
* is a string returned by SMTP transports and includes the last SMTP response from the server
*/
response: string;
}
/**
* This is what you implement to create a new transporter yourself
*/
export interface Transport {
name: string;
version: string;
send(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void;
close(): void;
}
}

5
page/index.d.ts vendored
View File

@@ -86,6 +86,11 @@ declare namespace PageJS {
*
*/
redirect(page: string): void;
/**
* Replace `path` with optional `state` object.
*
*/
replace(path: string, state?: any, init?: boolean, dispatch?: boolean): Context;
/**
* Navigate to the given path.
*

8
pikaday/index.d.ts vendored
View File

@@ -14,6 +14,14 @@ declare class Pikaday {
constructor(options: Pikaday.PikadayOptions);
/**
* Extends the existing configuration options for Pikaday object with the options provided.
* Can be used to change/extend the configurations on runtime.
* @param options full/partial configuration options.
* @returns {} extended configurations.
*/
config(options: Pikaday.PikadayOptions): Pikaday.PikadayOptions;
/**
* Returns the selected date in a string format. If Moment.js exists
* (recommended) then Pikaday can return any format that Moment

View File

@@ -108,6 +108,18 @@ declare namespace ReactBootstrap {
var ButtonGroup: React.ClassicComponentClass<ButtonGroupProps>;
// <SafeAnchor />
interface SafeAnchorProps extends React.HTMLProps<SafeAnchor> {
href?: string;
onClick?: React.MouseEventHandler;
disabled?: boolean;
role?: string;
componentClass?: React.ReactType;
}
type SafeAnchor = React.ClassicComponent<SafeAnchorProps, {}>;
const SafeAnchor: React.ClassicComponentClass<SafeAnchorProps>;
// <Checkbox />
interface CheckboxProps extends React.HTMLProps<Checkbox> {
bsClass?: string;

View File

@@ -13,7 +13,7 @@ import {
OverlayTrigger, Popover, ProgressBar,
Nav, NavItem, Navbar, NavDropdown,
Tabs, Tab, Pager, PageItem,
Pagination, Alert, Carousel,
Pagination, Alert, Carousel, SafeAnchor,
Grid, Row, Col, Thumbnail, Image,
Label, Badge, Jumbotron, PageHeader,
Glyphicon, Table, Form, FormGroup,
@@ -633,6 +633,14 @@ export class ReactBootstrapTest extends Component<any, any> {
</div>
</div>
<div style={style}>
<Pagination
buttonComponentClass={( props:any ) =>
<SafeAnchor href="/test" disabled role="role"/>
}
maxButtons={10}/>
</div>
<div style={style}>
<Alert bsStyle='warning'>
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.

View File

@@ -3,7 +3,7 @@
import Swipeable = require('react-swipeable');
import React = require('react');
var SampleComponent = React.createClass({
render: function () {
return (
@@ -18,7 +18,8 @@ var SampleComponent = React.createClass({
onSwipedDown={this.swipedDown}
onSwipedLeft={this.swipedLeft}
onSwiped={this.handleSwipeAction}
preventDefaultTouchmoveEvent={false}>
preventDefaultTouchmoveEvent={false}
nodeName={"swipe"}>
<div>
This element can be swiped
</div>

View File

@@ -39,6 +39,7 @@ declare namespace ReactSwipeableModule {
flickThreshold?: number;
delta?: number;
preventDefaultTouchmoveEvent?: boolean;
nodeName?: string;
}
interface ReactSwipeable extends React.ComponentClass<Props> { }

View File

@@ -5,8 +5,8 @@
* This file contains all of the example code that was on http://senecajs.org as of Mon June 16, 2016.
*/
import SENECA = require('seneca')
var seneca = SENECA()
import * as SENECA from 'seneca'
var seneca: SENECA.Instance = SENECA()
seneca.add({ cmd: 'salestax' }, function (args, callback) {
var rate = 0.23

31
seneca/seneca.d.ts vendored
View File

@@ -6,18 +6,13 @@
declare module "seneca" {
type UnknownType = any;
function SNS(options?: SNS.Options): SNS.Instance;
namespace SNS {
// function s(options?: Options): Seneca;
type UnknownType = any;
// what does seneca do about logging?
function log(): void;
// module s {
interface Options {
[plugin_name: string]: any;
tag?: string;
@@ -125,8 +120,8 @@ declare module "seneca" {
}
interface Optioner {
set: (input: string | Options) => Options;
get: () => Options;
set: (input: string | Options) => Options;
get: () => Options;
}
type ExecutorWorker = (callback: any) => void;
@@ -171,10 +166,11 @@ declare module "seneca" {
type EntityListCallback = (error: Error, result: any[]) => void;
interface Seneca {
interface Instance {
version: string;
(options?: Options): Seneca;
options(options: Options): void;
error(handler: GlobalErrorHandler): void;
@@ -196,7 +192,7 @@ declare module "seneca" {
make(zone: string, base: string, entity_canon: string, properties?: any): Entity;
// @param name reference to plugin provided object
export(name: string): void;
export(name: string): PluginModule;
pin(pattern: Pattern): void;
}
@@ -222,10 +218,9 @@ declare module "seneca" {
remove$(id: DatabaseID | EntityDataWithQuery, callback: EntityRemoveCallback): void;
list$(query: EntityDataWithQuery, callback: EntityListCallback): void;
}
}
// }
var sen: Seneca
export = sen;
export = SNS;
}

6
ui-grid/index.d.ts vendored
View File

@@ -3877,6 +3877,10 @@ declare namespace uiGrid {
term?: string;
/** String that will be set to the <input>.placeholder attribute */
placeholder?: string;
/**
* String that will be set to the <input>.ariaLabel attribute. This is what is read as a label to screen reader users.
*/
ariaLabel?: string;
/**
* set this to true if you have defined a custom function in condition,
* and your custom function doesn't require a term
@@ -3901,7 +3905,7 @@ declare namespace uiGrid {
* If set to true then the 'x' button that cancels/clears the filter will not be shown.
* @default false
*/
disableCancelButton?: boolean;
disableCancelFilterButton?: boolean;
}
export interface ISelectOption {
value: number | string;

View File

@@ -33,13 +33,14 @@ columnDef.filter = {
condition: 2,
term: 'yes',
placeholder: 'testing',
ariaLabel: 'testing',
noTerm: false,
flags: {
caseSensitive: true
},
type: 1,
selectOptions: [{value: 4, label: 'test'}],
disableCancelButton: false
disableCancelFilterButton: false
};
columnDef.filter.condition = (searchTerm: string, cellValue: any, row: uiGrid.IGridRow, column: uiGrid.IGridColumn): boolean => {
return true;

3
videojs/index.d.ts vendored
View File

@@ -48,6 +48,9 @@ interface VideoJSPlayer {
on(eventName: string, callback: () => void ): void;
off(eventName: string, callback: () => void ): void;
dispose(): void;
addRemoteTextTrack(options : {}) : HTMLTrackElement;
removeRemoteTextTrack(track : HTMLTrackElement) : void;
poster(val?: string) : string|VideoJSPlayer;
}
interface VideoJSStatic {