Merge pull request #1 from DefinitelyTyped/master

Update local my own fork
This commit is contained in:
Luis Roberto Perez Rios
2016-09-20 18:48:32 -04:00
committed by GitHub
1011 changed files with 151575 additions and 26192 deletions
+52
View File
@@ -0,0 +1,52 @@
/// <reference path="3d-bin-packing.d.ts" />
import packer = require("3d-bin-packing");
import samchon = require("samchon-framework");
function main(): void
{
///////////////////////////
// CONSTRUCT OBJECTS
///////////////////////////
let wrapperArray: bws.packer.WrapperArray = new packer.WrapperArray();
let instanceArray: bws.packer.InstanceArray = new packer.InstanceArray();
// Wrappers
wrapperArray.push
(
new packer.Wrapper("Large", 1000, 40, 40, 15, 0),
new packer.Wrapper("Medium", 700, 20, 20, 10, 0),
new packer.Wrapper("Small", 500, 15, 15, 8, 0)
);
///////
// Each Instance is repeated #15
///////
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Eraser", 1, 2, 5));
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Book", 15, 30, 3));
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Drink", 3, 3, 10));
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Umbrella", 5, 5, 20));
// Wrappers also can be packed into another Wrapper.
instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Notebook-Box", 2000, 30, 40, 4, 2));
instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Tablet-Box", 2500, 20, 28, 2, 0));
///////////////////////////
// BEGINS PACKING
///////////////////////////
// CONSTRUCT PACKER
let my_packer: bws.packer.Packer = new packer.Packer(wrapperArray, instanceArray);
///////
// PACK (OPTIMIZE)
let result: bws.packer.WrapperArray = my_packer.optimize();
///////
///////////////////////////
// TRACE PACKING RESULT
///////////////////////////
let xml: samchon.library.XML = result.toXML();
console.log(xml.toString());
}
main();
+1500
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -401,6 +401,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii)
* [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000)
* [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped)
* [:link:](elasticsearch/elasticsearch.d.ts) [elasticsearch](https://www.elastic.co) by [Casper Skydt](https://github.com/CasperSkydt/DefinitelyTyped), [Blake Smith](https://github.com/bfsmith/DefinitelyTyped)
* [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan)
* [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io), [Milan Burda](https://github.com/miniak)
* [:link:](electron-builder/electron-builder.d.ts) [electron-builder](https://github.com/loopline-systems/electron-builder) by [Maxime LUCE](https://github.com/SomaticIT)
@@ -1123,10 +1124,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware)
* [:link:](moment-range/moment-range.d.ts) [Moment.js](https://github.com/gf3/moment-range) by [Bart van den Burg](https://github.com/Burgov), [Wilgert Velinga](https://github.com/wilgert)
* [:link:](mongodb/mongodb.d.ts) [MongoDB](https://github.com/mongodb/node-mongodb-native/tree/2.1) by [Federico Caselli](https://github.com/CaselIT)
* [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [horiuchi](https://github.com/horiuchi)
* [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [simonxca](https://github.com/simonxca), [horiuchi](https://github.com/horiuchi)
* [:link:](mongoose-auto-increment/mongoose-auto-increment.d.ts) [mongoose-auto-increment](https://github.com/codetunnel/mongoose-auto-increment) by [Aya Morisawa](https://github.com/AyaMorisawa)
* [:link:](mongoose-deep-populate/mongoose-deep-populate.d.ts) [mongoose-deep-populate](https://github.com/buunguyen/mongoose-deep-populate) by [Aya Morisawa](https://github.com/AyaMorisawa)
* [:link:](mongoose-mock/mongoose-mock.d.ts) [mongoose-mock](https://github.com/JohanObrink/mongoose-mock) by [jt000](https://github.com/jt000)
* [:link:](mongoose-promise/mongoose-promise.d.ts) [mongoose-promise](http://mongoosejs.com/docs/api.html#promise-js) by [simonxca](https://github.com/simonxca)
* [:link:](morgan/morgan.d.ts) [morgan](https://github.com/expressjs/morgan) by [James Roland Cabresos](https://github.com/staticfunction)
* [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode)
* [:link:](mousetrap/mousetrap.d.ts) [Mousetrap 1.5.x](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz)
-3
View File
@@ -77,9 +77,6 @@ declare namespace AceAjax {
onTextInput(text: any): void;
}
var KeyBinding: {
new(editor: Editor): KeyBinding;
}
export interface TextMode {
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
/// <reference path='../node/node.d.ts'/>
/// <reference path='../redis/redis.d.ts'/>
+3 -1
View File
@@ -20,4 +20,6 @@ Logging.level = 4;
auth.info("Logging message");
var userName: string = auth.getCachedUser().userName;
var userName: string = auth.getCachedUser().userName;
var postLogoutRedirectUrl = auth.config.postLogoutRedirectUri;
var isValidRequest = auth.getRequestInfo('hash').valid;
+29 -19
View File
@@ -13,29 +13,30 @@ declare module 'adal' {
declare namespace adal {
interface Config {
tenant?: string,
clientId: string,
redirectUri?: string,
cacheLocation?: string,
displayCall?: (urlNavigate: string) => any,
correlationId?: string,
loginResource?: string,
resource?: string
endpoints?: any // If you need to send CORS api requests.
extraQueryParameter?: string
tenant?: string;
clientId: string;
redirectUri?: string;
cacheLocation?: string;
displayCall?: (urlNavigate: string) => any;
correlationId?: string;
loginResource?: string;
resource?: string;
endpoints?: any; // If you need to send CORS api requests.
extraQueryParameter?: string;
postLogoutRedirectUri?: string; // redirect url after succesful logout operation
}
interface User {
userName: string,
profile: any
userName: string;
profile: any;
}
interface RequestInfo {
valid: boolean,
parameters: any,
stateMatch: boolean,
stateResponse: string,
requestType: string
valid: boolean;
parameters: any;
stateMatch: boolean;
stateResponse: string;
requestType: string;
}
interface Logging {
@@ -64,6 +65,10 @@ declare namespace adal {
* Saves the resulting Idtoken in localStorage.
*/
login(): void;
/**
* Indicates whether login is in progress now or not.
*/
loginInProgress(): boolean;
/**
@@ -131,9 +136,9 @@ declare namespace adal {
/**
* Gets requestInfo from given hash.
* @returns {string} error message related to login
* @returns {RequestInfo} for appropriate hash.
*/
getRequestInfo(hash: string): string;
getRequestInfo(hash: string): RequestInfo;
/**
* Saves token from hash that is received from redirect.
@@ -147,6 +152,11 @@ declare namespace adal {
*/
getResourceForEndpoint(endpoint: string): string;
/**
* Handles redirection after login operation.
* Gets access token from url and saves token to the (local/session) storage
* or saves error in case unsuccessful login.
*/
handleWindowCallback(): void;
log(level: number, message: string, error: any): void;
+10
View File
@@ -319,6 +319,11 @@ declare module "agenda" {
* The date/time the job last failed.
*/
failedAt: Date;
/**
* Job's state
*/
disabled: boolean
}
/**
@@ -409,6 +414,11 @@ declare module "agenda" {
* @param cb Called after the job has been saved to the database.
*/
touch(cb?: Callback): void;
/**
* Calculates next time the job should run
*/
computeNextRunAt(): Job;
}
interface JobOptions {
+74
View File
@@ -0,0 +1,74 @@
/// <reference path="ajv.d.ts" />
import * as Ajv from 'ajv';
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
var validate = ajv.compile({});
var valid = validate({});
if (!valid) console.log(validate.errors);
var valid = ajv.validate({}, {});
if (!valid) console.log(ajv.errors);
ajv.addSchema({}, 'mySchema');
var valid = ajv.validate('mySchema', {});
if (!valid) console.log(ajv.errorsText());
ajv.addKeyword('range', {
type: 'number', compile: function (sch, parentSchema) {
var min: any = sch[0];
var max: any = sch[1];
return parentSchema.exclusiveRange === true
? function (data) { return data > min && data < max; }
: function (data) { return data >= min && data <= max; }
}
});
var schema = { "range": [2, 4], "exclusiveRange": true };
var validate = ajv.compile(schema);
console.log(validate(2.01)); // true
console.log(validate(3.99)); // true
console.log(validate(2)); // false
console.log(validate(4)); // false
declare var request: any;
function loadSchema(uri: any, callback: any) {
request.json(uri, function (err: any, res: any, body: any) {
if (err || res.statusCode >= 400)
callback(err || new Error('Loading error: ' + res.statusCode));
else
callback(null, body);
});
}
var ajv = new Ajv({ loadSchema: loadSchema });
ajv.compileAsync(schema, function (err, validate) {
if (err) return;
var valid = validate({});
});
declare var knex: any;
function checkIdExists(schema: any, data: any) {
return knex(schema.table)
.select('id')
.where('id', data)
.then(function (rows: any) {
return true;
});
}
var validate = ajv.compile(schema);
(validate({ userId: 1, postId: 19 }) as PromiseLike<boolean>)
.then(function (valid) {
// "valid" is always true here
console.log('Data is valid');
}, function (err) {
if (!(err instanceof Ajv.ValidationError)) throw err;
// data is invalid
console.log('Validation errors:', err.errors);
});
var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' });
var validate = ajv.compile(schema); // transpiled es7 async function
(validate({}) as PromiseLike<any>).then(() => { }, () => { });
+112
View File
@@ -0,0 +1,112 @@
// Type definitions for ajv
// Project: https://github.com/epoberezkin/ajv
// Definitions by: York Yao <https://github.com/plantain-00/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "ajv" {
class Ajv {
/**
* Create Ajv instance.
*/
constructor(options?: Ajv.AjvOptions);
/**
* Generate validating function and cache the compiled schema for future use.
*/
compile(schema: any): Ajv.AjvValidate;
/**
* Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
*/
compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
/**
* Validate data using passed schema (it will be compiled and cached).
*/
validate(schema: any, data: any): boolean | PromiseLike<boolean>;
errors: Ajv.ValidationError[];
/**
* Add schema(s) to validator instance.
*/
addSchema(schema: any, key: string): void;
/**
* Adds meta schema(s) that can be used to validate other schemas.
* That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
*/
addMetaSchema(schema: any, key: string): void;
/**
* Validates schema.
* This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
*/
validateSchema(schema: any): Boolean;
/**
* Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
* Returned validating function has schema property with the reference to the original schema.
*/
getSchema(key: string): Ajv.AjvValidate;
/**
* Remove added/cached schema.
* Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
*/
removeSchema(schema: any): void;
/**
* Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
*/
addFormat(name: string, format: any): void;
/**
* Add custom validation keyword to Ajv instance.
*/
addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
errorsText(): any;
static ValidationError: Function;
}
namespace Ajv {
type AjvOptions = {
v5?: boolean;
allErrors?: boolean;
verbose?: boolean;
jsonPointers?: boolean;
uniqueItems?: boolean;
unicode?: boolean;
format?: string;
formats?: any;
schemas?: any;
missingRefs?: boolean;
loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
removeAdditional?: boolean;
useDefaults?: boolean;
coerceTypes?: boolean;
async?: any;
transpile?: string;
meta?: boolean;
validateSchema?: boolean;
addUsedSchema?: boolean;
inlineRefs?: boolean;
passContext?: boolean;
loopRequired?: number;
ownProperties?: boolean;
multipleOfPrecision?: boolean;
errorDataPath?: string,
messages?: boolean;
beautify?: boolean;
cache?: any;
}
type AjvValidate = ((data: any) => boolean | PromiseLike<boolean>) & {
errors: ValidationError[];
}
type AjxKeywordDefinition = {
async?: boolean;
type: string;
compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike<boolean>);
validate?: (schema: any, data: any) => boolean;
}
type ValidationError = {
keyword: string;
dataPath: string;
schemaPath: string;
params: any;
message: string;
schema: any;
parentSchema: any;
data: any;
}
}
export = Ajv;
}
+25
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
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;
}
}
+2 -2
View File
@@ -53,8 +53,8 @@ declare namespace AltJS {
export type Source = {[name:string]: () => SourceModel<any>};
export interface SourceModel<S> {
local(state:any):any;
remote(state:any):Promise<S>;
local(state:any, ...args: any[]):any;
remote(state:any, ...args: any[]):Promise<S>;
shouldFetch?(fetchFn:(...args:Array<any>) => boolean):void;
loading?:(args:any) => void;
success?:(state:S) => void;
+23 -1
View File
@@ -26,6 +26,22 @@ declare namespace AmCharts {
/** Clears all the charts on page, removes listeners and intervals. */
function clear();
/** Handle ready event */
function ready(Function): void;
/** 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
@@ -948,6 +964,10 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
@Default 150
*/
hideBalloonTime: number;
/** Allows changing language easily.
* Note, you should include the language.js file from amcharts/lang or ammap/lang folder and then use variable name used in this file, like chart.language = "de";
* Note, for maps this works differently - you use language only for country names, as there are no other strings in the maps application. */
language: string;
/** Legend of a chart. */
legend: AmLegend;
/** Reference to the div of the legend. */
@@ -976,6 +996,8 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
prefixesOfBigNumbers: any[];
/** Prefixes which are used to make small numbers shorter: 2μ instead of 0.000002, etc. Prefixes are used on value axes and in the legend. To enable prefixes, set usePrefixes property to true. [{number:1e-24, prefix:"y"},{number:1e-21, prefix:"z"},{number:1e-18, prefix:"a"},{number:1e-15, prefix:"f"},{number:1e-12, prefix:"p"},{number:1e-9, prefix:"n"},{number:1e-6, prefix:"μ"},{number:1e-3, prefix:"m"}] */
prefixesOfSmallNumbers: any[];
/** A config object for Responsive plugin. */
responsive: any;
/** Theme of a chart. Config files of themes can be found in amcharts/themes/ folder. More info about using themes. */
theme: string;
/** Thousands separator.
@@ -1003,7 +1025,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);
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.)
+87
View File
@@ -0,0 +1,87 @@
// Tests for Amplitude SDK TypeScript definitions
/// <reference path="amplitude-js.d.ts" />
module Amplitude.Tests {
function all() {
amplitude.init('YOUR_API_KEY_HERE', null, {
// optional configuration options
saveEvents: true,
includeUtm: true,
includeReferrer: true,
batchEvents: true,
eventUploadThreshold: 50
});
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE', null, () => {});
amplitude.logEvent('EVENT_IDENTIFIER_HERE');
amplitude.setUserId('USER_ID_HERE');
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE');
amplitude.setUserId(null); // not string 'null'
amplitude.setVersionName('VERSION_NAME_HERE');
amplitude.regenerateDeviceId();
amplitude.setDeviceId('CUSTOM_DEVICE_ID');
amplitude.logEvent('EVENT_IDENTIFIER_HERE', {
'color': 'blue',
'age': 20,
'key': 'value'
});
amplitude.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { });
let identify = new amplitude.Identify().set('gender', 'female').set('age', 20);
amplitude.identify(identify);
identify = new amplitude.Identify().setOnce('sign_up_date', '08/24/2015');
amplitude.identify(identify);
identify = new amplitude.Identify().setOnce('sign_up_date', '09/14/2015');
amplitude.identify(identify);
identify = new amplitude.Identify().unset('gender').unset('age');
amplitude.identify(identify);
identify = new amplitude.Identify().add('karma', 1).add('friends', 1);
amplitude.identify(identify);
identify = new amplitude.Identify().append('ab-tests', 'new-user-test').append('some_list', [1, 2, 3, 4, 'values']);
amplitude.identify(identify);
identify = new amplitude.Identify().prepend('ab-tests', 'new-user-test').prepend('some_list', [1, 2, 3, 4, 'values']);
amplitude.identify(identify);
identify = new amplitude.Identify()
.set('karma', 10)
.add('karma', 1)
.unset('karma');
amplitude.identify(identify);
identify = new amplitude.Identify()
.set('colors', ['rose', 'gold'])
.append('ab-tests', 'campaign_a')
.append('existing_list', [4, 5]);
amplitude.identify(identify);
amplitude.setUserProperties({
gender: 'female',
age: 20
});
amplitude.clearUserProperties();
amplitude.setOptOut(true);
amplitude.setOptOut(false);
amplitude.setGroup('orgId', '15');
amplitude.setGroup('sport', ['soccer', 'tennis']);
// TODO: Implement those.
/*
var revenue = new amplitude.Revenue().setProductId('com.company.productId').setPrice(3.99).setQuantity(3);
amplitude.logRevenueV2(revenue);
amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
*/
}
}
+61
View File
@@ -0,0 +1,61 @@
// Type definitions for Amplitude SDK 2.12.1
// Project: https://github.com/amplitude/Amplitude-Javascript
// Definitions by: Arvydas Sidorenko <https://github.com/Asido>
// Definitions: https://github.com/Asido/DefinitelyTyped
declare module amplitude {
interface Config {
batchEvents?: boolean;
cookieExpiration?: number;
cookieName?: string;
deviceId?: string;
domain?: string;
eventUploadPeriodMillis?: number;
eventUploadThreshold?: number;
includeReferrer?: boolean;
includeUtm?: boolean;
language?: string;
optOut?: boolean;
platform?: string;
saveEvents?: boolean;
savedMaxCount?: number;
sessionTimeout?: number;
uploadBatchSize?: number;
}
export class Identify {
set(key: string, value: any): Identify;
setOnce(key: string, value: any): Identify;
add(key: string, value: number): Identify;
append(key: string, value: any): Identify;
prepend(key: string, value: any): Identify;
unset(key: string): Identify;
}
export function init(apiKey: string): void;
export function init(apiKey: string, userId: string): void;
export function init(apiKey: string, userId: string, options: Config): void;
export function init(apiKey: string, userId: string, options: Config, callback: () => void): void;
export function setVersionName(version: string): void;
export function setUserId(userId: string): void;
export function setDeviceId(id: string): void;
export function regenerateDeviceId(): void;
export function identify(identify: Identify): void;
export function setUserProperties(properties: Object): void;
export function clearUserProperties(): void;
export function setOptOut(optOut: boolean): void;
export function setGroup(groupType: string, groupName: string | string[]): void;
export function logEvent(event: string): void;
export function logEvent(event: string, data: Object): void;
export function logEvent(event: string, data: Object, callback: (httpCode: number, response: any) => void): void;
export var options: Config;
}
+5
View File
@@ -14,6 +14,11 @@ declare namespace angular.environment {
* loads the correct environment variables.
*/
check: () => void;
/**
* Retrieves the correct version of a
* variable for the current environment.
*/
read: (key: string) => any;
}
interface Service {
/**
+157
View File
@@ -0,0 +1,157 @@
/// <reference path="./angular-es.d.ts" />
//
// @Component
//
import { Component } from 'angular-es';
@Component({
selector: '',
template: ''
})
class MyComponentController {
}
//
// @Config
//
import { Config } from 'angular-es';
@Config()
class MyConfig {
}
//
// @Constant
//
import { Constant } from 'angular-es';
@Constant('MyConstant')
class MyConstant {
foo = 'foo';
bar = 'bar';
}
//
// @Controller
//
import { Controller } from 'angular-es';
@Controller('MyController')
class MyController {
}
//
// @Decorator
//
import { Decorator } from 'angular-es';
@Decorator('MyServiceDecorator')
class MyServiceDecorator {
}
//
// @Directive
//
import { Directive } from 'angular-es';
@Directive('MyDirective')
class MyDirective {
}
//
// @Factory
//
import { Factory } from 'angular-es';
@Factory('MyFactory')
class MyFactory {
}
//
// @Filter
//
import { Filter } from 'angular-es';
@Filter('MyFilter')
class MyFilter {
}
//
// @Inject
//
import { Inject } from 'angular-es';
@Inject('fooBar')
class MyFooService {
@Inject('bazBar')
myMethod(bazBar: Object) {
}
constructor(fooBar: Object) {
}
}
//
// @InjectAsProperty
//
import { InjectAsProperty } from 'angular-es';
@InjectAsProperty('fooBar')
class MyFooBarService {
fooBar: Object;
myMethod() {
this.fooBar !== undefined;
}
}
//
// @Module
//
import { Module } from 'angular-es';
@Module('my.module')
@Service('MyModuleService')
class MyModuleService {
}
//
// @Provider
//
import { Provider } from 'angular-es';
@Provider('MyProvider')
class MyProvider {
}
//
// @Run
//
import { Run } from 'angular-es';
@Run()
class MyRunBlock {
}
//
// @Service
//
import { Service } from 'angular-es';
@Service('MyService')
class MyService {
}
//
// @Value
//
import { Value } from 'angular-es';
@Value('MyValue')
class MyValue {
}
+187
View File
@@ -0,0 +1,187 @@
// Type definitions for angular-es v0.0.3
// Project: https://github.com/mbutsykin/angular-es
// Definitions by: mbutsykin <https://github.com/mbutsykin/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'angular-es' {
interface ClassDecorator {
<TFunction extends Function>(target: TFunction): TFunction|void;
}
interface MethodDecorator {
<T>(target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>|void;
}
/**
* Decorated target
*/
interface ngESDecorator extends ClassDecorator, MethodDecorator {
(target: Object|Function,
ngName?: string,
ngArguments?: Array<any>,
ngType?: string,
injectAsProperty?: Array<string>): void;
}
/**
* Component interface
* @see https://docs.angularjs.org/guide/component
*/
interface iComponent {
template: string,
selector: string,
controllerAs?: string,
require?: string,
templateUrl?: string,
transclude?: string,
bindings?: Object
}
/**
* Register component
*
* @param {Object<iComponent>} component - component config
*
* @returns {ngESDecorator} - decorated class
*/
function Component(component: iComponent): ngESDecorator;
/**
* Register config block
*/
function Config(): ngESDecorator;
/**
* Register constant
*
* @param {string} name - constant name
*
* @returns {ngESDecorator} - decorated class
*/
function Constant(name: string): ngESDecorator;
/**
* Register controller
*
* @param {string} name - controller name
*
* @returns {ngESDecorator} - decorated class
*/
function Controller(name: string): ngESDecorator;
/**
* Register decorator
*
* @param {string} name - provider name to decorate
*
* @returns {ngESDecorator} - decorated class
*/
function Decorator(name: string): ngESDecorator;
/**
* Register directive
*
* @param {string} name - directive selector, can be in hyphen-case
*
* @returns {ngESDecorator} - decorated class
*/
function Directive(name: string): ngESDecorator;
/**
* Register factory
*
* @param {string} name - factory name
*
* @returns {ngESDecorator} - decorated class
*/
function Factory(name: string): ngESDecorator;
/**
* Register filter
*
* @param {string} name - filter name
*
* @returns {ngESDecorator} - decorated class
*/
function Filter(name: string): ngESDecorator;
/**
* Add $inject property to target
*
* @param {Array<string>} dependencies - dependencies to inject
*
* @returns {ngESDecorator} - decorated class
*/
function Inject(...dependencies: Array<string>): ngESDecorator;
/**
* Inject dependencies as properties to target
*
* @param {Array<string>} dependencies - dependencies to inject
*
* @returns {ngESDecorator} - decorated class
*/
function InjectAsProperty(...dependencies: Array<string>): ngESDecorator;
/**
* Attach target to the specified module
*
* @param {string} name - module name
*
* @returns {ngESDecorator} - decorated class
*/
function Module(name: string): ngESDecorator;
/**
* Register provider
*
* @param {string} name - provider name
*
* @returns {ngESDecorator} - decorated class
*/
function Provider(name: string): ngESDecorator;
/**
* Register run block
*
* @returns {ngESDecorator} - decorated class
*/
function Run(): ngESDecorator;
/**
* Register service
*
* @param {string} name - service name
*
* @returns {ngESDecorator} - decorated class
*/
function Service(name: string): ngESDecorator;
/**
* Register value
*
* @param {string} name - value name
*
* @returns {ngESDecorator} - decorated class
*/
function Value(name: string): ngESDecorator;
export {
Component,
Config,
Constant,
Controller,
Decorator,
Directive,
Factory,
Filter,
Inject,
InjectAsProperty,
Module,
Provider,
Run,
Service,
Value,
}
}
@@ -0,0 +1,31 @@
/// <reference path="angular-feature-flags.d.ts" />
let myApp = angular.module('myApp', ['feature-flags']);
const flagsData: Array<angular.featureflags.FlagData> = [
{
key: '1',
active: true,
name: 'flag1',
description: 'This is the first flag'
},
{
key: '2',
active: false,
name: 'flag2',
description: 'This is the second flag'
}
];
myApp.config(function (featureFlagsProvider: angular.featureflags.FeatureFlagsProvider) {
featureFlagsProvider.setInitialFlags(flagsData);
});
myApp.run(function ($q: angular.IQService, $http: angular.IHttpService, featureFlags: angular.featureflags.FeatureFlagsService) {
let deferred = $q.defer();
deferred.resolve(flagsData);
featureFlags.set(deferred.promise);
featureFlags.set($http.get('/data/flags.json'));
});
+38
View File
@@ -0,0 +1,38 @@
// Type definitions for angular-feature-flags 1.4.0
// Project: https://github.com/mjt01/angular-feature-flags
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare namespace angular.featureflags {
export interface FlagData {
/**
* Unique key that is used from the markup to resolve whether a flag is active or not.
*/
key: string;
/**
* Boolean value for enabling/disabling the feature
*/
active: boolean;
/**
* A short name of the flag (only visible in the list of flags)
*/
name: string;
/**
* A long description of the flag to further explain the feature being toggled (only visible in the list of flags)
*/
description: string;
}
export interface FeatureFlagsProvider {
setInitialFlags(flags: Array<FlagData>): void;
}
export interface FeatureFlagsService {
set(flagsPromise: angular.IPromise<FlagData> | angular.IHttpPromise<FlagData>): void;
}
}
+3 -3
View File
@@ -51,12 +51,12 @@ declare namespace angular.gettext {
/** Get the correct pluralized (but untranslated) string for the value of n. */
getStringForm(string: string, n: number): string;
/** Translate a string with the given context. Uses Angular.JS interpolation, so something like this will do what you expect:
/** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect:
* var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" });
* // var hello will be "Hallo Ruben!" in Dutch.
* The context parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster.
* The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster.
*/
getString(string: string, context?: any): string;
getString(string: string, scope?: any, context?: string): string;
/** Translate a plural string with the given context. */
getPlural(n: number, string: string, stringPlural: string, context?: any): string;
+15
View File
@@ -15,3 +15,18 @@ var $jwtInterceptor: ng.jwt.IJwtInterceptor;
$jwtInterceptor.tokenGetter = () => {
return expToken;
}
var authManager: ng.jwt.IAuthManagerServiceProvider;
// Indicate the user is authenticated
authManager.authenticate();
// Indicate the user is unauthenticated
authManager.unauthenticate();
// Keep the user authenticated
authManager.checkAuthOnRefresh();
// Redirect the user on unauthorized requests
authManager.redirectWhenUnauthenticated();
+7
View File
@@ -27,4 +27,11 @@ declare namespace angular.jwt {
interface IJwtInterceptor {
tokenGetter(...params : any[]): string;
}
interface IAuthManagerServiceProvider {
authenticate(): void;
unauthenticate(): void;
checkAuthOnRefresh(): void;
redirectWhenUnauthenticated(): void;
}
}
+32 -2
View File
@@ -30,7 +30,11 @@ myApp.config((
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => {
$scope['openBottomSheet'] = () => {
$mdBottomSheet.show({
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>'
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>',
clickOutsideToClose: true,
disableBackdrop: true,
disableParentScroll: false,
parent: () => {}
});
};
$scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide');
@@ -115,15 +119,41 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
$scope['close'] = () => $mdSidenav(componentId).close();
$scope['isOpen'] = $mdSidenav(componentId).isOpen();
$scope['isLockedOpen'] = $mdSidenav(componentId).isLockedOpen();
$scope['asyncLookup'] = $mdSidenav(componentId, true).then((instance) => {
instance.toggle();
instance.open();
instance.close();
instance.isOpen();
instance.isLockedOpen();
});
$scope['onClose'] = $mdSidenav(componentId).onClose(() => {});
});
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
$scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!'));
$scope['openToast'] = () => {
$mdToast.show($mdToast.simple().textContent('Hello!'));
$mdToast.updateTextContent('New Content');
}
$scope['customToast'] = () => {
var options = {
hideDelay: 3000,
position: 'top right',
controller : 'ToastCtrl',
templateUrl : 'toast-template.html',
toastClass: 'my-class'
};
$mdToast.show(options);
}
});
myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService) => {
$scope['createPanel'] = () => {
var config = {
id: 'myPanel',
template: '<h1>Hello!</h1>',
hasBackdrop: true,
disableParentScroll: true,
+44 -15
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module)
// Type definitions for Angular Material 1.1.0-rc5+ (angular.material module)
// Project: https://github.com/angular/material
// Definitions by: Alex Staroselsky <https://github.com/AlStar01>, Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -19,11 +19,12 @@ declare namespace angular.material {
preserveScope?: boolean; // default: false
controller?: string|Function;
locals?: {[index: string]: any};
targetEvent?: MouseEvent;
resolve?: {[index: string]: angular.IPromise<any>}
clickOutsideToClose?: boolean;
disableBackdrop?: boolean;
escapeToClose?: boolean;
resolve?: {[index: string]: () => angular.IPromise<any>};
controllerAs?: string;
bindToController?: boolean;
parent?: string|Element|JQuery; // default: root node
parent?: Function|string|Object; // default: root node
disableParentScroll?: boolean; // default: true
}
@@ -52,7 +53,7 @@ declare namespace angular.material {
controller(controller?: string|Function): T;
locals(locals?: {[index: string]: any}): T;
bindToController(bindToController?: boolean): T; // default: false
resolve(resolve?: {[index: string]: angular.IPromise<any>}): T;
resolve(resolve?: {[index: string]: () => angular.IPromise<any>}): T;
controllerAs(controllerAs?: string): T;
parent(parent?: string|Element|JQuery): T; // default: root node
onComplete(onComplete?: Function): T;
@@ -90,7 +91,7 @@ declare namespace angular.material {
controller?: string|Function;
locals?: {[index: string]: any};
bindToController?: boolean; // default: false
resolve?: {[index: string]: angular.IPromise<any>}
resolve?: {[index: string]: () => angular.IPromise<any>}
controllerAs?: string;
parent?: string|Element|JQuery; // default: root node
onShowing?: Function;
@@ -131,9 +132,11 @@ declare namespace angular.material {
close(): angular.IPromise<void>;
isOpen(): boolean;
isLockedOpen(): boolean;
onClose(onClose: Function): void;
}
interface ISidenavService {
(component: string, enableWait: boolean): angular.IPromise<ISidenavObject>;
(component: string): ISidenavObject;
}
@@ -160,10 +163,11 @@ declare namespace angular.material {
preserveScope?: boolean; // default: false
hideDelay?: number; // default (ms): 3000
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
toastClass?: string;
controller?: string|Function;
locals?: {[index: string]: any};
bindToController?: boolean; // default: false
resolve?: {[index: string]: angular.IPromise<any>}
resolve?: {[index: string]: () => angular.IPromise<any>}
controllerAs?: string;
parent?: string|Element|JQuery; // default: root node
}
@@ -173,7 +177,8 @@ declare namespace angular.material {
showSimple(content: string): angular.IPromise<any>;
simple(): ISimpleToastPreset;
build(): IToastPreset<any>;
updateContent(): void;
updateContent(newContent: string): void;
updateTextContent(newContent: string): void
hide(response?: any): void;
cancel(response?: any): void;
}
@@ -245,6 +250,7 @@ declare namespace angular.material {
extendPalette(name: string, palette: IPalette): IPalette;
setDefaultTheme(theme: string): void;
alwaysWatchTheme(alwaysWatch: boolean): void;
setNonce(nonce: string): void;
}
interface IDateLocaleProvider {
@@ -288,14 +294,16 @@ declare namespace angular.material {
}
interface IPanelConfig {
id?: string;
template?: string;
templateUrl?: string;
controller?: string|Function;
controllerAs?: string;
bindToController?: boolean; // default: true
locals?: {[index: string]: any};
resolve?: {[index: string]: angular.IPromise<any>}
resolve?: {[index: string]: () => angular.IPromise<any>}
attachTo?: string|JQuery|Element;
propagateContainerEvents?: boolean;
panelClass?: string;
zIndex?: number; // default: 80
position?: IPanelPosition;
@@ -328,16 +336,18 @@ declare namespace angular.material {
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'
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;
@@ -357,5 +367,24 @@ declare namespace angular.material {
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,
};
}
}
+10 -9
View File
@@ -1,10 +1,11 @@
/// <reference path="./angular-permission.d.ts" />
import permission = angular.permission;
import permissionNamespace = angular.permission;
import { permission, ngPermission, uiPermission } from "angular-permission";
angular
.module('fooModule', ['permission', 'user'])
.run(function (PermissionStore: permission.PermissionStore, User: any) {
.module('fooModule', [permission, ngPermission, uiPermission, 'user'])
.run(function (PermissionStore: permissionNamespace.PermissionStore, User: any) {
// Define anonymous permission
PermissionStore
.definePermission('anonymous', function (stateParams) {
@@ -22,8 +23,8 @@ angular
hasPermissionDefinition(permission: string) : angular.IPromise<any>;
}
angular.module('barModule', ['permission', 'user'])
.run(function (PermissionStore: permission.PermissionStore, User: BackendUserService, $q: angular.IQService) {
angular.module('barModule', [permission, 'user'])
.run(function (PermissionStore: permissionNamespace.PermissionStore, User: BackendUserService, $q: angular.IQService) {
PermissionStore
// Define user permission calling back-end
.definePermission('user', function (stateParams) {
@@ -64,14 +65,14 @@ angular
PermissionStore.removePermissionDefinition('user');
let permissions: Array<permission.Permission> = PermissionStore.getStore();
let permissions: Array<permissionNamespace.Permission> = PermissionStore.getStore();
});
angular
.module('fooModule', ['permission', 'user'])
.run(function (RoleStore: permission.RoleStore, User: any) {
.module('fooModule', [permission, 'user'])
.run(function (RoleStore: permissionNamespace.RoleStore, User: any) {
RoleStore
// Permission array validated role
// Library will internally validate if 'user' and 'editor' permissions are valid when checking if role is valid
@@ -88,5 +89,5 @@ angular
RoleStore.removeRoleDefinition('user');
let roles: Array<permission.Role> = RoleStore.getStore();
let roles: Array<permissionNamespace.Role> = RoleStore.getStore();
});
+6
View File
@@ -173,3 +173,9 @@ declare namespace angular.permission {
options?: angular.ui.IStateOptions;
}
}
declare module "angular-permission" {
export var permission: string;
export var ngPermission: string;
export var uiPermission: string;
}
+3 -2
View File
@@ -13,7 +13,7 @@ declare module "angular-translate" {
declare namespace angular.translate {
interface ITranslationTable {
[key: string]: any;
[key: string]: string | ITranslationTable;
}
interface ILanguageKeyAlias {
@@ -95,8 +95,9 @@ declare namespace angular.translate {
use(key: string): ITranslateProvider;
storageKey(): string;
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
uniformLanguageTag(options: string | Object): ITranslateProvider;
useUrlLoader(url: string): ITranslateProvider;
useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider;
useStaticFilesLoader(options: IStaticFilesLoaderOptions | { files: IStaticFilesLoaderOptions[] }): ITranslateProvider;
useLoader(loaderFactory: string, options?: any): ITranslateProvider;
useLocalStorage(): ITranslateProvider;
useCookieStorage(): ITranslateProvider;
+18
View File
@@ -393,6 +393,24 @@ declare namespace angular.ui.bootstrap {
*/
windowTopClass?: string;
/**
* Appends the modal to a specific element.
*
* @default 'body'
*/
appendTo?: angular.IAugmentedJQuery;
/**
* A string reference to the component to be rendered that is registered with Angular's compiler. If using a directive, the directive must have `restrict: 'E'` and a template or templateUrl set.
*
* It supports these bindings:
* - `close` - A method that can be used to close a modal, passing a result. The result must be passed in this format: `{$value: myResult}`
* - `dismiss` - A method that can be used to dismiss a modal, passing a result. The result must be passed in this format: `{$value: myRejectedResult}`
* - `modalInstance` - The modal instance. This is the same `$uibModalInstance` injectable found when using `controller`.
* - `resolve` - An object of the modal resolve values. See [UI Router resolves] for details.
*/
component?: string;
}
interface IModalStackService {
@@ -0,0 +1,30 @@
/// <reference path="angular-ui-notification.d.ts" />
function TestNotifications(NotificationProvider: angular.uiNotification.INotificationProvider, Notification: angular.uiNotification.INotificationService) {
NotificationProvider.setOptions({
delay: 10000,
startTop: 20,
startRight: 10,
verticalSpacing: 20,
horizontalSpacing: 20,
positionX: 'left',
positionY: 'bottom'
});
Notification.primary('Primary notification');
Notification('Primary notification');
Notification.success('Success notification');
Notification({message: 'Warning notification'}, 'warning');
Notification({message: 'Primary notification', title: 'Primary notification'});
Notification.error({message: 'Error notification 1s', delay: 1000});
Notification.success({message: 'Success notification<br>Some other <b>content</b><br><a href="https://github.com/alexcrack/angular-ui-notification">This is a link</a><br><img src="https://angularjs.org/img/AngularJS-small.png">', title: 'Html content'});
Notification.error({message: 'Error Bottom Right', positionY: 'bottom', positionX: 'right'});
Notification.error({message: 'Error notification 1s', replaceMessage: true});
}
+82
View File
@@ -0,0 +1,82 @@
// Type definitions for angular-ui-notification
// Project: https://github.com/alexcrack/angular-ui-notification
// Definitions by: Kamil Rojewski <https://github.com/krojew/DefinitelyTyped>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace angular.uiNotification {
// Taken from angular to avoid dependency
interface IPromise<T> {
/**
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
* The successCallBack may return IPromise<void> for when a $q.reject() needs to be returned
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
*/
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
/**
* Shorthand for promise.then(null, errorCallback)
*/
catch<TResult>(onRejected: (reason: any) => IPromise<TResult>|TResult): IPromise<TResult>;
/**
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
*
* Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
*/
finally(finallyCallback: () => any): IPromise<T>;
}
type XPosition = 'right'|'left'|'center';
type YPosition = 'top'|'bottom';
type MessageType = 'primary'|'info'|'success'|'warning'|'error';
interface IGlobalMessageOptions {
delay?: number;
startTop?: number;
startRight?: number;
verticalSpacing?: number;
horizontalSpacing?: number;
positionX?: XPosition;
positionY?: YPosition;
replaceMessage?: boolean;
templateUrl?: string;
onClose?: (element: any) => any;
closeOnClick?: boolean;
maxCount?: number;
}
interface IMessageOptions {
title?: string;
message?: string;
templateUrl?: string;
delay?: number;
type?: MessageType;
positionX?: XPosition;
positionY?: YPosition;
replaceMessage?: boolean;
closeOnClick?: boolean;
}
interface INotificationScope {
kill(isHard: boolean): void;
}
interface INotificationProvider {
setOptions(options: IGlobalMessageOptions): void;
}
type Message = string|IMessageOptions;
interface INotificationService {
primary(message: Message): IPromise<INotificationScope>;
info(message: Message): IPromise<INotificationScope>;
success(message: Message): IPromise<INotificationScope>;
warning(message: Message): IPromise<INotificationScope>;
error(message: Message): IPromise<INotificationScope>;
clearAll(): void;
(message: Message, type?: MessageType): IPromise<INotificationScope>;
}
}
+5 -4
View File
@@ -1,6 +1,7 @@
/// <reference path="angular-ui-router.d.ts" />
var myApp = angular.module('testModule');
import uiRouterModule from "angular-ui-router";
var myApp = angular.module("testModule", [uiRouterModule]);
interface MyAppScope extends ng.IScope {
items: string[];
@@ -141,7 +142,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
private $state: ng.ui.IStateService
) {
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
this.onStateNotFound(event, unfoundState, fromState, fromParams));
}
@@ -164,14 +165,14 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
});
}
}
private onStateNotFound(event: ng.IAngularEvent,
unfoundState: ng.ui.IUnfoundState,
fromState: ng.ui.IState,
fromParams: {}) {
var unfoundTo: string = unfoundState.to;
var unfoundToParams: {} = unfoundState.toParams;
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
}
private stateServiceTest() {
+6 -8
View File
@@ -7,13 +7,7 @@
// Support for AMD require and CommonJS
declare module 'angular-ui-router' {
// Since angular-ui-router adds providers for a bunch of
// injectable dependencies, it doesn't really return any
// actual data except the plain string 'ui.router'.
//
// As such, I don't think anybody will ever use the actual
// default value of the module. So I've only included the
// the types. (@xogeny)
export default "ui.router";
export type IState = angular.ui.IState;
export type IStateProvider = angular.ui.IStateProvider;
export type IUrlMatcher = angular.ui.IUrlMatcher;
@@ -44,6 +38,10 @@ declare namespace angular.ui {
* Function, returns HTML content string
*/
templateProvider?: Function | Array<string|Function>;
/**
* String, component name
*/
component?: string;
/**
* A controller paired to the state. Function, annotated array or name as String
*/
@@ -105,7 +103,7 @@ declare namespace angular.ui {
toParams: {},
options: IStateOptions
}
interface IStateProvider extends angular.IServiceProvider {
state(name:string, config:IState): IStateProvider;
state(config:IState): IStateProvider;
+3 -2
View File
@@ -42,9 +42,10 @@ declare namespace angular.ui {
*/
topVisibleScope: ng.IRepeatScope;
/**
* calling this method reinitializes and reloads the scroller content.
* calling this method reinitializes and reloads the scroller content.
* @param startIndex is an integer indicating what item index the scroller will use to start the load process.
*/
reload(): void;
reload(startIndex?: number): void;
/**
* Replaces the item in the buffer at the given index with the new items.
*
+25 -1
View File
@@ -2,11 +2,35 @@
let dummySocket: ng.websocket.IWebSocket;
let dummyPromise: ng.IPromise<void>;
let dummyScope: ng.IScope;
let provider: ng.websocket.IWebSocketProvider = (url: string) => {
let provider: ng.websocket.IWebSocketProvider = (url: string, protocols?:string[] | ng.websocket.IWebSocketConfigOptions, options?: ng.websocket.IWebSocketConfigOptions) => {
return dummySocket;
}
let socketWithProtocol = provider("wss://localhost", "protocol");
let socketWithProtocols = provider("wss://localhost", ["protocol-a", "protocol-b"]);
let socketWithOptions = provider("wss://localhost", {
scope: dummyScope,
rootScopeFailOver: true,
useApplyAsync: true,
initialTimeout: 100,
maxTimeout: 300000,
reconnectIfNotNormalClose: true,
binaryType: "blob"
});
let socketWithProtocolAndOptions = provider("wss://localhost", "protocol", {
scope: dummyScope,
rootScopeFailOver: true,
useApplyAsync: true,
initialTimeout: 100,
maxTimeout: 300000,
reconnectIfNotNormalClose: true,
binaryType: "blob"
});
let socket = provider("wss://localhost");
socket.onOpen((event) => {})
+13 -1
View File
@@ -7,6 +7,18 @@
declare namespace angular.websocket {
/**
* Options available to be specified for IWebSocketProvider.
*/
type IWebSocketConfigOptions = {
scope?: ng.IScope;
rootScopeFailOver?: boolean;
useApplyAsync?: boolean;
initialTimeout?: number;
maxTimeout?: number;
binaryType?: "blob" | "arraybuffer";
reconnectIfNotNormalClose?: boolean;
}
interface IWebSocketProvider {
/**
* Creates and opens an IWebSocket instance.
@@ -14,7 +26,7 @@ declare namespace angular.websocket {
* @param url url to connect to
* @return websocket instance
*/
(url: string): IWebSocket;
(url: string, protocols?: string | string[] | IWebSocketConfigOptions, options?: IWebSocketConfigOptions): IWebSocket;
}
/** Options available to be specified for IWebSocket.onMessage */
@@ -0,0 +1,15 @@
/// <reference path="angular-xeditable.d.ts" />
var myApp = angular.module('testModule', ['xeditable']);
myApp.run(["editableOptions", (editableOptions: angular.xeditable.IEditableOptions) => {
editableOptions.activate = "select";
editableOptions.activationEvent = "click";
editableOptions.blurElem = "ignore";
editableOptions.blurForm = "submit";
editableOptions.buttons = "no";
editableOptions.icon_set = "font-awesome";
editableOptions.isDisabled = true;
editableOptions.theme = "bs3";
}]);
+98
View File
@@ -0,0 +1,98 @@
// Type definitions for Angular xEditable 0.2.0 (angular.xeditable module)
// Project: https://vitalets.github.io/angular-xeditable/
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare namespace angular.xeditable {
interface IEditableOptions {
/**
* Theme. Possible values `bs3`, `bs2`, `default`
*/
theme: string;
/**
* Icon Set. Possible values `font-awesome`, `default`.
*/
icon_set: string;
/**
* Whether to show buttons for single editalbe element.
* Possible values `right` (default), `no`.
*/
buttons: string;
/**
* Default value for `blur` attribute of single editable element.
* Can be `cancel|submit|ignore`.
*/
blurElem: string;
/**
* Default value for `blur` attribute of editable form.
* Can be `cancel|submit|ignore`.
*/
blurForm: string;
/**
* How input elements get activated. Possible values: `focus|select|none`.
*/
activate: string;
/**
* Whether to disable x-editable. Can be overloaded on each element.
*/
isDisabled: boolean;
/*
* Event, on which the edit mode gets activated.
* Can be any event.
*/
activationEvent: string;
}
interface IEditableFormController extends angular.IFormController {
/**
* Shows form with editable controls.
*/
$show(): void;
/**
* Hides form with editable controls without saving.
*/
$hide(): void;
/**
* Sets focus on form field specified by `name`.<br/>
* When trying to set the focus on a form field of a new row in the editable table, the `$activate` call needs to be wrapped in a `$timeout` call so that the form is rendered before the `$activate` function is called.
*
* @param name name of field
*/
$activate(name: string): void;
/**
* Triggers `oncancel` event and calls `$hide()`.
*/
$cancel(): void;
$setWaiting(value: boolean): void;
/**
* Shows error message for particular field.
*
* @param name name of field
* @param msg error message
*/
$setError(name: string, msg: string): void;
$submit(): void;
$save(): void;
}
}
+1 -1
View File
@@ -69,8 +69,8 @@ declare namespace angular.animate {
* @param value If provided then set the animation on or off.
* @returns current animation state
*/
enabled(value?: boolean): boolean;
enabled(element: JQuery, value?: boolean): boolean;
enabled(value: boolean): boolean;
/**
* Cancels the provided animation.
+1 -1
View File
@@ -476,7 +476,7 @@ declare namespace angular {
// Supplement IComponentOptions from angular.d.ts with router-specific
// fields.
interface IComponentOptions {
$canActivate?: () => boolean;
$canActivate?: (...args: any[]) => boolean | angular.IPromise<boolean>;
$routeConfig?: RouteDefinition[];
}
}
+14 -3
View File
@@ -42,15 +42,20 @@ declare namespace angular.resource {
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): IResourceClass<IResource<any>>;
actions?: IActionHash, options?: IResourceOptions): IResourceClass<IResource<any>>;
<T, U>(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): U;
actions?: IActionHash, options?: IResourceOptions): U;
<T>(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): IResourceClass<T>;
actions?: IActionHash, options?: IResourceOptions): IResourceClass<T>;
}
// Hash of action descriptors allows custom action names
interface IActionHash {
[action: string]: IActionDescriptor
}
// Just a reference to facilitate describing new actions
@@ -186,6 +191,12 @@ declare namespace angular {
/** creating a resource service factory */
factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<any>): IModule;
}
namespace auto {
interface IInjectorService {
get(name: '$resource'): ng.resource.IResourceService;
}
}
}
interface Array<T>
+28 -2
View File
@@ -867,6 +867,26 @@ angular.module('docsTabsExample', [])
};
});
angular.module('multiSlotTranscludeExample', [])
.directive('dropDownMenu', function() {
return {
transclude: {
button: 'button',
list: 'ul',
},
link: function(scope, element, attrs, ctrl, transclude) {
// without scope
transclude().appendTo(element);
transclude(clone => clone.appendTo(element));
// with scope
transclude(scope, clone => clone.appendTo(element));
transclude(scope, clone => clone.appendTo(element), element, 'button');
transclude(scope, null, element, 'list').addClass('drop-down-list').appendTo(element);
}
};
});
angular.module('componentExample', [])
.component('counter', {
require: {'ctrl': '^ctrl'},
@@ -1098,6 +1118,12 @@ function parseTyping() {
}
}
function parseWithParams() {
var $parse: angular.IParseService;
var compiledExp = $parse('a.b.c', () => null);
var compiledExp = $parse('a.b.c', null, false);
}
function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjectorService {
if (mode === 'debug') {
return angular.bootstrap(element, ['main', function($provide: ng.auto.IProvideService) {
@@ -1105,11 +1131,11 @@ function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjector
$delegate['debug'] = true;
});
}, 'debug-helpers'], {
debugInfoEnabled: true
strictDi: true
});
}
return angular.bootstrap(element, ['main'], {
debugInfoEnabled: false
strictDi: false
});
}
+40 -16
View File
@@ -1,6 +1,6 @@
// Type definitions for Angular JS 1.5
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Georgii Dolzhykov <http://github.com/thorn0>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -41,7 +41,6 @@ declare namespace angular {
interface IAngularBootstrapConfig {
strictDi?: boolean;
debugInfoEnabled?: boolean;
}
///////////////////////////////////////////////////////////////////////////
@@ -119,14 +118,15 @@ declare namespace angular {
fromJson(json: string): any;
identity<T>(arg?: T): T;
injector(modules?: any[], strictDi?: boolean): auto.IInjectorService;
isArray(value: any): boolean;
isDate(value: any): boolean;
isArray(value: any): value is Array<any>;
isDate(value: any): value is Date;
isDefined(value: any): boolean;
isElement(value: any): boolean;
isFunction(value: any): boolean;
isNumber(value: any): boolean;
isObject(value: any): boolean;
isString(value: any): boolean;
isFunction(value: any): value is Function;
isNumber(value: any): value is number;
isObject(value: any): value is Object;
isObject<T>(value: any): value is T;
isString(value: any): value is string;
isUndefined(value: any): boolean;
lowercase(str: string): string;
@@ -388,6 +388,7 @@ declare namespace angular {
$invalid: boolean;
$submitted: boolean;
$error: any;
$name: string;
$pending: any;
$addControl(control: INgModelController | IFormController): void;
$removeControl(control: INgModelController | IFormController): void;
@@ -874,7 +875,7 @@ declare namespace angular {
// see http://docs.angularjs.org/api/ng.$parseProvider
///////////////////////////////////////////////////////////////////////////
interface IParseService {
(expression: string): ICompiledExpression;
(expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression;
}
interface IParseProvider {
@@ -986,7 +987,10 @@ declare namespace angular {
// DocumentService
// see http://docs.angularjs.org/api/ng.$document
///////////////////////////////////////////////////////////////////////////
interface IDocumentService extends JQuery {}
interface IDocumentService extends JQuery {
// Must return intersection type for index signature compatibility with JQuery
[index: number]: HTMLElement & Document;
}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
@@ -1255,7 +1259,7 @@ declare namespace angular {
// This corresponds to $transclude (and also the transclude function passed to link).
interface ITranscludeFunction {
// If the scope is provided, then the cloneAttachFn must be as well.
(scope: IScope, cloneAttachFn: ICloneAttachFunction): JQuery;
(scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
// If one argument is provided, then it's assumed to be the cloneAttachFn.
(cloneAttachFn?: ICloneAttachFunction): JQuery;
}
@@ -1408,6 +1412,16 @@ declare namespace angular {
* Absolute or relative URL of the resource that is being requested.
*/
url: string;
/**
* Event listeners to be bound to the XMLHttpRequest object.
* To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block.
*/
eventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
/**
* Event listeners to be bound to the XMLHttpRequest upload object.
* To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block.
*/
uploadEventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
}
interface IHttpHeadersGetter {
@@ -1716,13 +1730,19 @@ declare namespace angular {
* Whether transclusion is enabled. Enabled by default.
*/
transclude?: boolean | string | {[slot: string]: string};
/**
* Requires the controllers of other directives and binds them to this component's controller.
* The object keys specify the property names under which the required controllers (object values) will be bound.
* Note that the required controllers will not be available during the instantiation of the controller,
* but they are guaranteed to be available just before the $onInit method is executed!
*/
require?: {[controller: string]: string};
}
interface IComponentTemplateFn {
( $element?: JQuery, $attrs?: IAttributes ): string;
}
/**
* Components have a well-defined lifecycle Each component can implement "lifecycle hooks". These are methods that
* will be called at certain points in the life of the component.
@@ -1736,12 +1756,12 @@ declare namespace angular {
*/
$onInit?(): void;
/**
* Called whenever one-way bindings are updated. The changesObj is a hash whose keys are the names of the bound
* properties that have changed, and the values are an {@link IChangesObject} object of the form
* Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound
* properties that have changed, and the values are an {@link IChangesObject} object of the form
* { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
* cloning the bound value to prevent accidental mutation of the outer value.
*/
$onChanges?(changesObj: {[property:string]: IChangesObject}): void;
$onChanges?(onChangesObj: IOnChangesObject): void;
/**
* Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
* watches and event handlers.
@@ -1757,6 +1777,10 @@ declare namespace angular {
*/
$postLink?(): void;
}
interface IOnChangesObject {
[property: string]: IChangesObject;
}
interface IChangesObject {
currentValue: any;
@@ -1816,7 +1840,7 @@ declare namespace angular {
bindToController?: boolean | Object;
link?: IDirectiveLinkFn | IDirectivePrePost;
multiElement?: boolean;
name?: string;
directiveName?: string;
priority?: number;
/**
* @deprecated
+1 -1
View File
@@ -886,7 +886,7 @@ declare namespace angular {
// see http://docs.angularjs.org/api/ng.$parseProvider
///////////////////////////////////////////////////////////////////////////
interface IParseService {
(expression: string): ICompiledExpression;
(expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression;
}
interface IParseProvider {
+2 -2
View File
@@ -3,7 +3,7 @@
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
declare module "anydb-sql-migrations" {
@@ -31,4 +31,4 @@ declare module "anydb-sql-migrations" {
items: MigrationTask[];
}) => any) => Promise<any>;
};
}
}
+82
View File
@@ -0,0 +1,82 @@
/// <reference path="../react/react.d.ts" />
/// <reference path="./aphrodite.d.ts" />
import * as React from "react";
import { StyleSheet, css, StyleSheetServer, StyleSheetTestUtils } from "aphrodite";
const styles = StyleSheet.create({
red: {
backgroundColor: 'red'
},
blue: {
backgroundColor: 'blue'
},
hover: {
':hover': {
backgroundColor: 'red'
}
},
small: {
'@media (max-width: 600px)': {
backgroundColor: 'red',
}
}
});
const coolFont = {
fontFamily: "CoolFont",
fontStyle: "normal",
fontWeight: "normal",
src: "url('coolfont.woff2') format('woff2')"
};
const withFont = StyleSheet.create({
headingText: {
fontFamily: coolFont,
fontSize: 20
},
bodyText: {
fontFamily: [coolFont, "sans-serif"],
fontSize: 12
}
});
class App extends React.Component<{}, {}> {
render() {
return <div>
<span className={css(styles.red)}>
This is red.
</span>
<span className={css(styles.hover)}>
This turns red on hover.
</span>
<span className={css(styles.small)}>
This turns red when the browser is less than 600px width.
</span>
<span className={css(styles.red, styles.blue)}>
This is blue.
</span>
<span className={css(styles.blue, styles.small)}>
This is blue and turns red when the browser is less than
600px width.
</span>
<span className={css(withFont.bodyText)}>
With font
</span>
</div>;
}
}
const output = StyleSheetServer.renderStatic(() => {
return "test";
});
output.css.content;
output.css.renderedClassNames;
output.html;
StyleSheet.rehydrate(output.css.renderedClassNames);
StyleSheetTestUtils.suppressStyleInjection();
StyleSheetTestUtils.clearBufferAndResumeStyleInjection();
+76
View File
@@ -0,0 +1,76 @@
// Type definitions for Aphrodite 0.5.0
// Project: https://github.com/Khan/aphrodite
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../react/react.d.ts" />
declare module "aphrodite" {
import * as React from "react";
/**
* Aphrodite style declaration
*/
export interface StyleDeclaration {
[key: string]: React.CSSProperties;
}
interface StyleSheetStatic {
/**
* Create style sheet
*/
create<T extends StyleDeclaration>(styles: T): T;
/**
* Rehydrate class names from server renderer
*/
rehydrate(renderedClassNames: string[]): void;
}
export var StyleSheet: StyleSheetStatic;
/**
* Get class names from passed styles
*/
export function css(...styles: any[]): string;
interface StaticRendererResult {
html: string;
css: {
content: string;
renderedClassNames: string[];
}
}
/**
* Utilities for using Aphrodite server-side.
*/
interface StyleSheetServerStatic {
renderStatic(renderFunc: () => string): StaticRendererResult;
}
export var StyleSheetServer: StyleSheetServerStatic;
interface StyleSheetTestUtilsStatic {
/**
* Prevent styles from being injected into the DOM.
*
* This is useful in situations where you'd like to test rendering UI
* components which use Aphrodite without any of the side-effects of
* Aphrodite happening. Particularly useful for testing the output of
* components when you have no DOM, e.g. testing in Node without a fake DOM.
*
* Should be paired with a subsequent call to
* clearBufferAndResumeStyleInjection.
*/
suppressStyleInjection(): void;
/**
* Opposite method of preventStyleInject.
*/
clearBufferAndResumeStyleInjection(): void;
}
export var StyleSheetTestUtils: StyleSheetTestUtilsStatic;
}
declare module "aphrodite/no-important" {
export * from "aphrodite";
}
+67
View File
@@ -0,0 +1,67 @@
/// <reference path="apigee-access.d.ts"/>
import apigee from "apigee-access";
//Sample code from
// https://www.npmjs.com/package/apigee-access
var request: any = null;
// Variables
var val1 = apigee.getVariable(request, 'TestVariable');
apigee.setIntVariable(request, 'TestVariable', '123');
apigee.setIntVariable(request, 'TestVariable2', 42);
apigee.deleteVariable(request, 'TestVariable');
// Mode
console.log('The deployment mode is ' + apigee.getMode());
// Cache
var cache = apigee.getCache('cache');
var customCache = apigee.getCache('MyCustomCache',
{ resource: 'MyCustomrResource' });
cache.put('key2', 'Hello, World!', 120);
cache.put('key4', 'Hello, World!', function (err: any) {
});
cache.get('key', function (err: any, data: any) {
});
cache.remove('key');
// Secure Vault
var orgVault = apigee.getVault('vault1', 'organization');
orgVault.get('key1', function (err: any, secretValue: any) {
});
// Quota Service
var quota = apigee.getQuota();
quota.apply({ identifier: 'Foo', allow: 10, timeUnit: 'hour' },
function (err: any, result: any) {
console.log('Quota applied: %j', result);
});
quota.apply({
identifier: 'Foo',
timeUnit: 'hour',
allow: 100
}, quotaResult);
quota.apply({
identifier: 'Bar',
timeUnit: 'minute',
interval: 5,
allow: 500
}, quotaResult);
quota.apply({
identifier: 'Foo',
timeUnit: 'hour',
allow: 100,
weight: 10
}, quotaResult);
function quotaResult(err: any, r: any) {
if (err) { console.error('Quota failed'); }
}
+58
View File
@@ -0,0 +1,58 @@
// Type definitions for apigee-access
// Project: https://www.npmjs.com/package/apigee-access
// Definitions by: Casper Skydt <https://github.com/CasperSkydt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module ApigeeAccess {
function getVariable(request: any, name: string): string | number | boolean;
function setVariable(request: any, name: string, value: string | number | boolean ): void;
function setIntVariable(request: any, name: string, value: string | number): void;
function deleteVariable(request: any, name: string): void;
function getCache(name: string, options?: CacheOptions): any;
function getVault(name: string, scope?: "organization" | "environment"): SecureVault;
function getQuota(options?: any): QuotaService;
function getMode(): "apigee" | "standalone";
interface CacheOptions{
resource?: string;
scope?: "global" | "application" | "exclusive";
defaultTtl?: number;
timeout?: number;
}
interface Cache{
put(key: string, data: any, ttl?: number, callback?: (err: any) => void): void;
get(key: string, callback: (err: any, data: any) => void): void;
remove(key: string, callback?: (err: any) => void): void;
}
interface SecureVault{
getKeys(callback: (err: any, data: any) => void): void;
get(key: string, callback: (err: any, data: any) => void): void;
}
interface QuotaService{
apply(options?: QuotaServiceApplyOptions, callback?: (err: any, data: QuotaServiceApplyCallbackData) => void): void;
}
interface QuotaServiceApplyOptions{
identifier: string;
timeUnit: "minute" | "hour" | "day" | "week" | "month";
allow: number;
interval?: number;
weight?: number;
}
interface QuotaServiceApplyCallbackData{
used: number;
allowed: number;
isAllowed: boolean;
expiryTime: number;
timestamp: number;
}
}
declare module "apigee-access"{
export default ApigeeAccess;
}
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="app-root-path.d.ts" />
import * as root from 'app-root-path';
let resolvedPath: string;
resolvedPath = root.resolve('../dir');
resolvedPath = root.path;
resolvedPath = root.toString();
let resolvedModule: any = root.require('app-root-path');
root.setPath('C:\\app-root');
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for app-root-path 1.2.1
// Project: https://github.com/inxilpro/node-app-root-path
// Definitions by: Shant Marouti <https://github.com/shantmarouti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'app-root-path' {
interface RootPath {
/**
* Application root directory absolute path
* @type {string}
*/
path: string;
/**
* Resolves relative path from root to absolute path
* @param {string} pathToModule
* @returns {string}
*/
resolve(pathToModule: string): string;
/**
* Resolve module by relative addressing from root
* @param {string} pathToModule
* @returns {*}
*/
require(pathToModule: string): any;
/**
* Explicitly set root path
* @param {string} explicitlySetPath
*/
setPath(explicitlySetPath: string): void;
toString(): string;
}
var RootPath: RootPath;
export = RootPath;
}
+7 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for ApplicationInsights-JS v0.22.14
// Type definitions for ApplicationInsights-JS v0.23.2
// Project: https://github.com/Microsoft/ApplicationInsights-JS
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -788,3 +788,9 @@ declare module Microsoft.ApplicationInsights {
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
}
}
declare module 'applicationinsights-js' {
export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
}
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
+162 -44
View File
@@ -1,4 +1,4 @@
// Type definitions for ArcGIS API for JavaScript v3.16
// Type definitions for ArcGIS API for JavaScript v3.17
// Project: http://js.arcgis.com
// Definitions by: Esri <http://www.esri.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -18,7 +18,6 @@ declare module "esri" {
import BasemapLayer = require("esri/dijit/BasemapLayer");
import Symbol = require("esri/symbols/Symbol");
import BookmarkItem = require("esri/dijit/BookmarkItem");
import Units = require("esri/units");
import Color = require("esri/Color");
import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase");
import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol");
@@ -45,6 +44,7 @@ declare module "esri" {
import QueryTask = require("esri/tasks/QueryTask");
import TextSymbol = require("esri/symbols/TextSymbol");
import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask");
import WMSLayerInfo = require("esri/layers/WMSLayerInfo");
import WMTSLayerInfo = require("esri/layers/WMTSLayerInfo");
export interface AGSMouseEvent extends MouseEvent {
@@ -354,7 +354,7 @@ declare module "esri" {
/** Radius of the circle. */
radius?: number;
/** Unit of the radius. */
radiusUnit?: Units;
radiusUnit?: string;
}
export interface CircleOptions2 {
/** The center point of the circle. */
@@ -366,7 +366,7 @@ declare module "esri" {
/** The radius of the circle. */
radius?: number;
/** Unit of the radius. */
radiusUnit?: Units;
radiusUnit?: string;
}
export interface ClassedColorSliderOptions {
/** Data map containing renderer information. */
@@ -643,6 +643,8 @@ declare module "esri" {
minStops?: number;
/** When true, stops on the route are re-ordered to provide an optimal route. */
optimalRoute?: boolean;
/** If specified, this specifies the portal where the produced route layers are going to be stored and accessed. */
portalUrl?: string;
/** URL link to a custom print page. */
printPage?: string;
/** If available, this print task is used to display an overview map of the route on the directions print page (Added at v3.11). */
@@ -677,6 +679,8 @@ declare module "esri" {
showReturnToStartOption?: boolean;
/** Display the 'Show Reverse Stops' button. */
showReverseStopsButton?: boolean;
/** Applicable if the widget works with a Network Analyst Server federated with ArcGIS Online or Portal. */
showSaveButton?: boolean;
/** Highlight the route segment when a directions step is clicked. */
showSegmentHighlight?: boolean;
/** Display a popup with segment details when a direction step is clicked. */
@@ -911,6 +915,8 @@ declare module "esri" {
layer: FeatureLayer;
}
export interface FeatureTableOptions {
/** The number of features a service will try to fetch. */
batchCount?: number;
/** Object defining the date options specifically for formatting date and time editors. */
dateOptions?: any;
/** Sets the editing state for the FeatureTable. */
@@ -931,12 +937,18 @@ declare module "esri" {
menuFunctions?: any[];
/** Attribute fields to include in the FeatureTable. */
outFields?: string[];
/** Displays or hides the attachment column. */
showAttachments?: boolean;
/** Displays the data type of the field right under the field label. */
showDataTypes?: boolean;
/** Displays or hides total number of features and selected number of features in the grid header. */
showFeatureCount?: boolean;
/** Displays or hides the FeatureTable header. */
showGridHeader?: boolean;
/** Displays or hides 'Options' drop-down menu of the FeatureTable. */
showGridMenu?: boolean;
/** Displays or hides the 'Statistics' option in column menus for numeric fields. */
showStatistics?: boolean;
/** Enables an interaction between the map and the feature table. */
syncSelection?: boolean;
/** Enables pan/zoom to selected features on the map when the table in 'sync selection' mode. */
@@ -1187,10 +1199,20 @@ declare module "esri" {
gdbVersion?: string;
}
export interface ImageServiceMeasureOptions {
/** The angular unit in which directions of line segments will be calculated. */
angularUnit?: string;
/** The area unit in which areas of polygons will be calculated. */
areaUnit?: string;
/** Defines whether to show the widget result in a popup or in the widget's result area when the widget has 'toolbar' layout. */
displayMeasureResultInPopup?: boolean;
/** Symbol to be used when drawing a polygon or extent. */
fillSymbol?: SimpleFillSymbol;
/** Image service layer with which the toolbar is associated. */
layer: ArcGISImageServiceLayer;
/** Defines the layout of the widget. */
layout?: string;
/** The linear unit in which height, length, or perimeters will be calculated. */
linearUnit?: string;
/** Symbol to be used when drawing a line. */
lineSymbol?: SimpleLineSymbol;
/** Map instance with which the toolbar is associate. */
@@ -1402,9 +1424,9 @@ declare module "esri" {
/** Flag for showing full list of units in the Location tool. */
advancedLocationUnits?: boolean;
/** The default area unit for the measure area tool. */
defaultAreaUnit?: Units;
defaultAreaUnit?: string;
/** The default length unit for the measure distance tool. */
defaultLengthUnit?: Units;
defaultLengthUnit?: string;
/** Allows the user to immediately measure previously-created geometry on dijit creation. */
geometry?: Point | Polyline | Polygon;
/** Line symbol used to draw the lines for the measure line and measure distance tools. */
@@ -2190,6 +2212,28 @@ declare module "esri" {
/** The well-known ID of the spatial reference used by the WFSLayer. */
wkid?: string;
}
export interface WMSLayerInfoOptions {
/** All the bounding extents defined for this layer. */
allExtents?: Extent[];
/** A description of the WMS layer. */
description?: string;
/** The extent of the WMS Layer. */
extent?: Extent;
/** The URL to the legend image. */
legendURL?: string;
/** The name of the WMS layer. */
name: string;
/** Returns true if the layer can be queried and the service supports GetFeatureInfo with either text/html or text/plain formats. */
queryable?: boolean;
/** Indicates if this layer should be included in the popup. */
showPopup?: boolean;
/** All the spatial references defined for this layer. */
spatialReferences?: SpatialReference[];
/** WMSLayerInfos of the layer's sub layers. */
subLayers?: WMSLayerInfo[];
/** The title of the WMS layer. */
title?: string;
}
export interface WMSLayerOptions {
/** Specify the map image format, valid options are png,jpg,bmp,gif,svg. */
format?: string;
@@ -3732,6 +3776,8 @@ declare module "esri/dijit/Directions" {
maxStopsReached: boolean;
/** Read-only: The graphic for the calculated route. */
mergedRouteGraphic: Graphic;
/** If specified, this specifies the portal where the produced route layers are going to be stored and accessed. */
portalUrl: string;
/** Routing parameters for the widget. */
routeParams: RouteParameters;
/** Routing task for the widget. */
@@ -3744,6 +3790,8 @@ declare module "esri/dijit/Directions" {
showClearButton: boolean;
/** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */
showMilesKilometersOption: boolean;
/** Applicable if the widget works with a Network Analyst Server federated with ArcGIS Online or Portal. */
showSaveButton: boolean;
/** If true, and supported by the service, then two toggle button groups are shown: one to allow user to choose between driving a car, a truck, or walking, and one more group to choose between fastest or shortest routes. */
showTravelModesOption: boolean;
/** An array of graphics that define the stop locations along the route. */
@@ -3792,6 +3840,11 @@ declare module "esri/dijit/Directions" {
* @param index The index of the route segment to highlight.
*/
highlightSegment(index: number): void;
/**
* Loads a stored route layer from either ArcGIS Online or Portal
* @param itemId The itemId of the stored route layer from either ArcGIS Online or Portal.
*/
loadRoute(itemId: string): any;
/**
* Remove the stop at the specified index.
* @param index The index of the stop to remove.
@@ -3801,6 +3854,16 @@ declare module "esri/dijit/Directions" {
removeStops(): any;
/** Resets the directions widget removing any directions, stops and map graphics. */
reset(): any;
/**
* Specify the language used for the directions.
* @param locale The locale used for the directions.
*/
setDirectionsLanguage(locale: string): any;
/**
* Specify the length units used for the directions widget.
* @param units The length units used for the directions widget.
*/
setDirectionsLengthUnits(units: string): any;
/**
* If widget runs with Travel Modes enabled, call this method to switch to particular Travel mode programmatically.
* @param travelModeName Travel mode.
@@ -3843,10 +3906,16 @@ declare module "esri/dijit/Directions" {
on(type: "directions-finish", listener: (event: { result: RouteResult; target: Directions }) => void): esri.Handle;
/** Fires when the route services starts to calculate the route. */
on(type: "directions-start", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fires after a user clicks the Save or Save as New button and subsequently does not have permission to create an item in ArcGIS Online or Portal. */
on(type: "feature-collection-created", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fires when the directions widget has fully loaded. */
on(type: "load", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fires when the widget starts or stops listening for map clicks. */
on(type: "map-click-active", listener: (event: { mapClickActive: boolean; target: Directions }) => void): esri.Handle;
/** Fires after a user clicks the Save or Save as New button for the first time in order to store a new route in either ArcGIS Online or Portal. */
on(type: "route-item-created", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fires when a existing route layer item is successfully updated in ArcGIS Online or Portal after user clicks the Save button. */
on(type: "route-item-updated", listener: (event: { target: Directions }) => void): esri.Handle;
/** Fired when you hover over a route segment in the directions display. */
on(type: "segment-highlight", listener: (event: { graphic: Graphic; target: Directions }) => void): esri.Handle;
/** Fires when a route segment is selected in the directions display. */
@@ -3901,6 +3970,8 @@ declare module "esri/dijit/FeatureTable" {
/** Creates an instance of the FeatureTable widget within the provided DOM node. */
class FeatureTable {
/** The number of features a service will try to fetch. */
batchCount: number;
/** Read-only: A reference to the column objects and their parameters. */
columns: any[];
/** Read-only: Reference to the dataStore used by the dGrid. */
@@ -3909,6 +3980,8 @@ declare module "esri/dijit/FeatureTable" {
dateOptions: any;
/** Sets the editing state for the FeatureTable. */
editable: boolean;
/** Event trigger(s) used to display editing interface for an individual cell. */
editOn: string | any;
/** Read-only: Number of records displayed in FeatureTable. */
featureCount: number;
/** The featureLayer that the table is associated with. */
@@ -3937,12 +4010,18 @@ declare module "esri/dijit/FeatureTable" {
selectedRowIds: number[];
/** Read-only: Each element in the array is an object that contains name-value pair of fields and field values associated with the selected rows. */
selectedRows: any[];
/** Displays the data type of the field right under the field label in the column header. */
/** Displays or hides the attachment column. */
showAttachments: boolean;
/** Displays or hides the data type of the field right under the field label in the column header. */
showDataTypes: boolean;
/** Displays or hides total number of features and selected number of features in the grid header. */
showFeatureCount: boolean;
/** Displays or hides the FeatureTable header. */
showGridHeader: boolean;
/** Displays or hides 'Options' drop-down menu of the FeatureTable. */
showGridMenu: boolean;
/** Displays or hides the 'Statistics' option in column menus for numeric fields. */
showStatistics: boolean;
/** Enables an interaction between the map and the feature table. */
syncSelection: boolean;
/** Enables pans to selected features on the map when the table in 'sync selection' mode. */
@@ -3953,6 +4032,29 @@ declare module "esri/dijit/FeatureTable" {
* @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into.
*/
constructor(params: esri.FeatureTableOptions, srcNodeRef: Node | string);
/** Removes all current selections including subsets from filterSelectedRecords(). */
clearSelection(): void;
/** Destroys the FeatureTable widget. */
destroy(): void;
/**
* Allows users to see the sub-set of currently selected records (uses dGrid.query).
* @param toggle When true only a subset of currently selected features will be displayed in the FeatureTable.
*/
filterSelectedRecords(toggle: boolean): void;
/**
* Queries and gets selected features from the FeatureLayer instead of the store.
* @param id Array of row ids
*/
getFeatureDataById(id: number[]): any;
/**
* Gets row object by the row ID.
* @param id row ID
*/
getRowDataById(id: number): any;
/** Refreshes the data in the grid. */
refresh(): void;
/** Resizes the grid's container. */
resize(): void;
/** Finalizes the creation of the widget. */
startup(): void;
/** Fires when the grid column is resized. */
@@ -4286,8 +4388,13 @@ declare module "esri/dijit/ImageServiceMeasure" {
/**
* Creates an instance of the ImageServiceMeasure widget.
* @param params An Object containing constructor options.
* @param srcNode Reference or id of the HTML element where the widget should be rendered.
*/
constructor(params: esri.ImageServiceMeasureOptions);
constructor(params: esri.ImageServiceMeasureOptions, srcNode: Node | string);
/** Destroys the ImageServiceMeasure widget. */
destroy(): void;
/** Finalizes the creation of the widget. */
startup(): void;
}
export = ImageServiceMeasure;
}
@@ -4528,9 +4635,14 @@ declare module "esri/dijit/LayerSwipe" {
declare module "esri/dijit/Legend" {
import esri = require("esri");
import Map = require("esri/map");
/** The legend dijit displays a label and symbol for some or all of the layers in the map. */
class Legend {
/** Specify a subset of the layers in the map to display in the legend. */
layerInfos: any[];
/** Reference to the map. */
map: Map;
/**
* Creates a new Legend dijit.
* @param params Parameters used to configure the dijit.
@@ -4555,7 +4667,7 @@ declare module "esri/dijit/LocateButton" {
import Symbol = require("esri/symbols/Symbol");
import Graphic = require("esri/graphic");
/** LocateButton provides a simple button to locate and zoom to the users current location. */
/** LocateButton provides a simple button to locate and zoom to the user's location. */
class LocateButton {
/** Centers the map to the location when a new position is returned. */
centerAt: boolean;
@@ -6767,7 +6879,7 @@ declare module "esri/dijit/editing/Add" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
/** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
/** This class is used with the UndoManager to provide undo/redo functionality of Add operations when editing. */
class Add extends OperationBase {
/**
* Create a new Add operation.
@@ -6810,7 +6922,7 @@ declare module "esri/dijit/editing/Cut" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
/** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
/** This class is used with the UndoManager to provide undo/redo functionality of Cut operations when editing. */
class Cut extends OperationBase {
/**
* Create a new Cut operation.
@@ -6829,7 +6941,7 @@ declare module "esri/dijit/editing/Delete" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
/** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
/** This class is used with the UndoManager to provide undo/redo functionality of Delete operations when editing. */
class Delete extends OperationBase {
/**
* Create a new Delete operation.
@@ -6929,7 +7041,7 @@ declare module "esri/dijit/editing/Union" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
/** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
/** This class is used with the UndoManager to provide undo/redo functionality of Union operations when editing. */
class Union extends OperationBase {
/**
* Create a new Union operation.
@@ -6948,7 +7060,7 @@ declare module "esri/dijit/editing/Update" {
import esri = require("esri");
import OperationBase = require("esri/OperationBase");
/** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */
/** This class is used with the UndoManager to provide undo/redo functionality of Update operations when editing. */
class Update extends OperationBase {
/**
* Create a new Update operation.
@@ -8353,8 +8465,9 @@ declare module "esri/geometry/webMercatorUtils" {
/**
* Converts geometry from Web Mercator units to geographic units.
* @param geometry The geometry to convert.
* @param isLinear Indicates whether to work with linear values, i.e., do not normalize.
*/
webMercatorToGeographic(geometry: Geometry): Geometry;
webMercatorToGeographic(geometry: Geometry, isLinear?: boolean): Geometry;
/**
* Translates the given Web Mercator coordinates to Longitude and Latitude.
* @param x The x coordinate value to convert.
@@ -10809,8 +10922,6 @@ declare module "esri/layers/VectorTileLayer" {
initialExtent: Extent;
/** The spatial reference of the layer. */
spatialReference: SpatialReference;
/** The style object of the service with fully qualified URLs for glyphs and sprite. */
style: any;
/** Contains information about the tiling scheme for the layer. */
tileInfo: TileInfo;
/** The URL to the vector tile service or style JSON that will be used to draw the layer. */
@@ -10821,6 +10932,8 @@ declare module "esri/layers/VectorTileLayer" {
* @param options Optional parameters.
*/
constructor(url: string | any, options?: esri.VectorTileLayerOptions);
/** Returns an object that contains the current style information for the layer. */
getStyle(): any;
/**
* Changes the style properties used to render the layers.
* @param styleUrl A url to a JSON file containing the stylesheet information to render the layer.
@@ -10835,14 +10948,15 @@ declare module "esri/layers/VectorTileLayer" {
declare module "esri/layers/WFSLayer" {
import esri = require("esri");
import GraphicsLayer = require("esri/layers/GraphicsLayer");
import Field = require("esri/layers/Field");
import Extent = require("esri/geometry/Extent");
import Graphic = require("esri/graphic");
import InfoTemplate = require("esri/InfoTemplate");
import Renderer = require("esri/renderers/Renderer");
/** (Currently in beta) A layer for OGC Web Feature Services (WFS). */
class WFSLayer {
/** (Currently in beta) A layer for OGC Web Feature Services (WFS). */
class WFSLayer extends GraphicsLayer {
/** An array of fields in the layer. */
fields: Field[];
/** The full extent of the layer. */
@@ -10864,17 +10978,11 @@ declare module "esri/layers/WFSLayer" {
* @param options See options table below for full descriptions of the properties needed for this object.
*/
constructor(options: esri.WFSLayerOptions);
/** Creates the getFeature parameter based on the version, nsLayerName, nsGeometryFieldName, mode, wkid, inverseFilter, maxFeatures constructor parameters. */
buildRequest(): string;
/**
* Gets the WFS layer capabilities.
* @param callback An array of WFS layers in JSON format.
* Creates a WFSLayer using the provided JSON object.
* @param json The input JSON.
*/
getCapabilities(callback?: Function): void;
/** Performs the getFeature request. */
getFeature(): void;
/** Returns a JSON Object containing all of the WFS parameters. */
getWFSParameters(): any;
fromJson(json: Object): void;
/** Redraws all the graphics in the layer. */
redraw(): void;
/** Refreshes the features in the WFS layer. */
@@ -10885,8 +10993,8 @@ declare module "esri/layers/WFSLayer" {
setPointSymbol(): void;
/** Sets the default polygon symbol to be used if no renderer is specified. */
setPolygonSymbol(): void;
/** Sets the WFS parameters using the provided JSON Object. */
setWFSParameters(): void;
/** Converts the WFSLayer instance to a JSON object. */
toJson(): any;
}
export = WFSLayer;
}
@@ -10952,6 +11060,7 @@ declare module "esri/layers/WMSLayer" {
}
declare module "esri/layers/WMSLayerInfo" {
import esri = require("esri");
import Extent = require("esri/geometry/Extent");
/** The WMSLayerInfo class defines and provides information about layers in a WMS service. */
@@ -10966,6 +11075,10 @@ declare module "esri/layers/WMSLayerInfo" {
legendURL: string;
/** The layer name. */
name: string;
/** Returns true if the layer can be queried and the service supports GetFeatureInfo with either text/html or text/plain formats */
queryable: boolean;
/** Indicates if this layer should be included in the popup. */
showPopup: boolean;
/** An array of WKIDs of all spatial references defined for the layer. */
spatialReferences: number[];
/** WMSLayerInfos of the layer's sub layers. */
@@ -10974,9 +11087,9 @@ declare module "esri/layers/WMSLayerInfo" {
title: string;
/**
* Creates a new WMSLayerInfo object.
* @param layer WMSLayerInfo layer object.
* @param options See options list for parameters.
*/
constructor(layer: any);
constructor(options?: esri.WMSLayerInfoOptions);
}
export = WMSLayerInfo;
}
@@ -11584,7 +11697,7 @@ declare module "esri/opsdashboard/DataSourceProxy" {
displayFieldName: string;
/** Read-only: The collection of fields. */
fields: Field[];
/** The geometry type. */
/** Read-only: The geometry type. */
geometryType: string;
/** Read-only: The id of the data source. */
id: string;
@@ -11611,8 +11724,8 @@ declare module "esri/opsdashboard/DataSourceProxy" {
executeQuery(query: Query): any;
/** An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. */
getAdvancedQueryCapabilities(): any;
/** Retrieve the associated data source that supports selection. */
getAssociatedSelectionDataSourceProxy(): any;
/** Retrieve the associated id of the data source that supports selection. */
getAssociatedSelectionDataSourceId(): any;
/** Get the associated popupInfo for the data source if any available. */
getPopupInfo(): any;
/** Get the associated render object for the data source if any available. */
@@ -11666,12 +11779,17 @@ declare module "esri/opsdashboard/ExtensionBase" {
static POLYLINE: any;
/** Read-only: Indicates if the host application is the Windows Operations Dashboard. */
isNative: boolean;
/** Read Only: It will list all of the Portal helper services. */
portalHelperServices: string;
/** Read-only: The URL to the ArcGIS.com site or in-house portal that you are currently signed in to. */
portalUrl: string;
/** Get the collection of data sources from the host application. */
getDataSourceProxies(): any;
/** Get the data source corresponding to the data source id from the host application. */
getDataSourceProxy(): any;
/**
* Get the data source corresponding to the data source id from the host application.
* @param dataSourceId The data source id
*/
getDataSourceProxy(dataSourceId: string): any;
/** Get the collection of map widgets from the host application. */
getMapWidgetProxies(): any;
/**
@@ -11791,7 +11909,7 @@ declare module "esri/opsdashboard/GraphicsLayerProxy" {
minScale: number;
/** Read-only: The current host graphics layer opacity ratio. */
opacity: number;
/** The current renderer used by the host graphics layer. */
/** Read-only: The current renderer used by the host graphics layer. */
renderer: Renderer;
/** Read-only: The current host graphics layer visibility. */
visible: boolean;
@@ -11928,8 +12046,6 @@ declare module "esri/opsdashboard/MapWidgetProxy" {
destroyGraphicsLayerProxy(graphicsLayerProxy: GraphicsLayerProxy): void;
/** Gets the current host map extent. */
getMapExtent(): any;
/** Called by the host application when the extent of the host map has changed. */
mapExtentChanged(): void;
/**
* Pans the map to a new location.
* @param mapPoint A new location with the same spatial reference as the host map.
@@ -14088,7 +14204,7 @@ declare module "esri/tasks/FindTask" {
url: string;
/**
* Creates a new FindTask object.
* @param url URL to the ArcGIS Server REST resource that represents a layer in a service.
* @param url URL to the ArcGIS Server REST resource that represents a map service.
* @param options Optional parameters.
*/
constructor(url: string, options?: esri.FindTaskOptions);
@@ -15343,6 +15459,8 @@ declare module "esri/tasks/RouteParameters" {
startTimeIsUTC: boolean;
/** The set of stops loaded as network locations during analysis. */
stops: any;
/** If true , the TimeWindowStart and TimeWindowEnd attributes of a stop are in UTC time (milliseconds). */
timeWindowsAreUTC: boolean;
/** Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. */
travelMode: any;
/** If true, the hierarchy attribute for the network should be used in analysis. */
@@ -16696,7 +16814,7 @@ declare module "esri/tasks/query" {
static SPATIAL_REL_TOUCHES: any;
/** The feature from feature class 1 is completely enclosed by the feature from feature class 2. */
static SPATIAL_REL_WITHIN: any;
/** Distance to buffer input geometry. */
/** Buffer distance for input geometries. */
distance: number;
/** The geometry to apply to the spatial filter. */
geometry: Geometry;
@@ -16738,7 +16856,7 @@ declare module "esri/tasks/query" {
text: string;
/** Specify a time extent for the query. */
timeExtent: TimeExtent;
/** Distance unit. */
/** The unit for calculating the buffer distance. */
units: string;
/** A where clause for the query. */
where: string;
@@ -17055,7 +17173,7 @@ declare module "esri/toolbars/navigation" {
* @param symbol The SimpleFillSymbol used for the rubber band zoom.
*/
setZoomSymbol(symbol: Symbol): void;
/** Zoom to full extent of base layer. */
/** Zoom to initial extent of base layer. */
zoomToFullExtent(): void;
/** Zoom to next extent in extent history. */
zoomToNextExtent(): void;
+1 -1
View File
@@ -24,7 +24,7 @@ declare module "archiver" {
interface Archiver extends STREAM.Transform {
pipe(writeStream: FS.WriteStream): void;
append(readStream: FS.ReadStream, name: nameInterface): void;
append(source: FS.ReadStream | Buffer | string, name: nameInterface): void;
finalize(): void;
}
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
/// <reference path="../request/request.d.ts" />
declare module "asana" {
-7
View File
@@ -392,13 +392,6 @@ function (results) {
]);
});
var sys;
var iterator = async.iterator([
function () { sys.p('one'); },
function () { sys.p('two'); },
function () { sys.p('three'); }
]);
async.parallel([
async.apply(fs.writeFile, 'testfile1', 'test1'),
async.apply(fs.writeFile, 'testfile2', 'test2'),
+46 -6
View File
@@ -1,4 +1,4 @@
// Type definitions for Async 1.4.2
// Type definitions for Async 2.0.1
// Project: https://github.com/caolan/async
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>, Joe Herman <https://github.com/Penryn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -37,6 +37,13 @@ interface AsyncQueue<T> {
pause(): void
resume(): void;
kill(): void;
workersList(): {
data: T,
callback: Function
}[];
error(error: Error, data: any): void;
unsaturated(): void;
buffer: number;
}
interface AsyncPriorityQueue<T> {
@@ -54,6 +61,14 @@ interface AsyncPriorityQueue<T> {
pause(): void;
resume(): void;
kill(): void;
workersList(): {
data: T,
priority: number,
callback: Function
}[];
error(error: Error, data: any): void;
unsaturated(): void;
buffer: number;
}
interface AsyncCargo {
@@ -85,6 +100,9 @@ interface Async {
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapValuesLimit<T, R>(obj: {[name: string]: T}, limit: number, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapValues<T, R>(obj: {[name: string]: T}, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapValuesSeries: typeof async.mapValues;
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
select<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
filterSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
@@ -100,11 +118,17 @@ interface Async {
reduceRight<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
foldr<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
detect<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
find: typeof async.detect;
detectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
findSeries: typeof async.detectSeries;
detectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
findLimit: typeof async.detectLimit;
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback?: AsyncResultArrayCallback<T>): any;
some<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
someLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
anyLimit: typeof async.someLimit;
someSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
anySeries: typeof async.someSeries;
any<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
every<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
everyLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
@@ -134,18 +158,35 @@ interface Async {
queue<T>(worker: AsyncWorker<T>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo;
auto(tasks: any, callback?: (error: Error, results: any) => void): void;
auto(tasks: any, concurrency?: number, callback?: (error: Error, results: any) => void): void;
autoInject(tasks: any, callback?: (error: Error, results: any) => void): void;
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: (error: Error, results: any) => void): void;
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: (error: Error, results: any) => void): void;
iterator(tasks: Function[]): Function;
retryable<T>(opts: number | {times: number, interval: number}, task: AsyncFunction<T>): AsyncFunction<T>;
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
nextTick(callback: Function): void;
setImmediate(callback: Function): void;
nextTick(callback: Function, ...args: any[]): void;
setImmediate: typeof async.nextTick;
allLimit<T>(arr: T[], limit: number, iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any;
everySeries<T>(arr: T[], iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any
allSeries: typeof async.everySeries;
reflect<T>(fn: AsyncFunction<T>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T>(tasks: AsyncFunction<T>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
timeout<T>(fn: AsyncFunction<T>, milliseconds: number, info: any): AsyncFunction<T>;
times<T> (n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesSeries<T>(n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesLimit<T>(n: number, limit: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
transform<T, R>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
race<T>(tasks: (AsyncFunction<T>)[], callback: AsyncResultCallback<T>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
unmemoize(fn: Function): Function;
@@ -155,7 +196,6 @@ interface Async {
wrapSync(fn: Function): Function;
log(fn: Function, ...arguments: any[]): void;
dir(fn: Function, ...arguments: any[]): void;
noConflict(): Async;
}
declare var async: Async;
+6
View File
@@ -946,9 +946,14 @@ declare namespace AtomCore {
registry: any;
repository: Object;
scopeName: string;
tokenizeLines: (text: string) => any;
// TBD
}
interface IGrammars {
grammarForScopeName(scope: string): IGrammar;
}
interface IPane /* extends Theorist.Model */ {
itemForURI: (uri:string)=>IEditor;
@@ -1302,6 +1307,7 @@ declare namespace AtomCore {
deserializers:IDeserializerManager;
config: IConfig;
commands: ICommandRegistry;
grammars: IGrammars;
keymaps: IKeymapManager;
keymap: IKeymapManager;
packages: IPackageManager;
+23
View File
@@ -0,0 +1,23 @@
/// <reference path="auth0-js.d.ts" />
var auth0 = new Auth0({
domain: 'mine.auth0.com',
clientID: 'dsa7d77dsa7d7',
callbackURL: 'http://my-app.com/callback',
callbackOnLocationHash: true
});
auth0.login({
connection: 'google-oauth2',
popup: true,
popupOptions: {
width: 450,
height: 800
}
}, (err, profile, idToken, accessToken, state) => {
if (err) {
alert("something went wrong: " + err.message);
return;
}
alert('hello ' + profile.name);
});
+133
View File
@@ -0,0 +1,133 @@
// Type definitions for Auth0.js
// Project: https://github.com/auth0/auth0.js
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** Extensions to the browser Window object. */
interface Window {
/** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
token: string;
}
/** This is the interface for the main Auth0 client. */
interface Auth0Static {
new(options: Auth0ClientOptions): Auth0Static;
changePassword(options: any, callback?: Function): void;
decodeJwt(jwt: string): any;
login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
logout(query: string): void;
getConnections(callback?: Function): void;
refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getProfile(id_token: string, callback?: Function): Auth0UserProfile;
getSSOData(withActiveDirectories: any, callback?: Function): void;
parseHash(hash: string): Auth0DecodedHash;
signup(options: Auth0SignupOptions, callback: Function): void;
validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
}
/** Represents constructor options for the Auth0 client. */
interface Auth0ClientOptions {
clientID: string;
callbackURL: string;
callbackOnLocationHash?: boolean;
domain: string;
forceJSONP?: boolean;
}
/** Represents a normalized UserProfile. */
interface Auth0UserProfile {
email: string;
email_verified: boolean;
family_name: string;
gender: string;
given_name: string;
locale: string;
name: string;
nickname: string;
picture: string;
user_id: string;
/** Represents one or more Identities that may be associated with the User. */
identities: Auth0Identity[];
user_metadata?: any;
app_metadata?: any;
}
/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
interface MicrosoftUserProfile extends Auth0UserProfile {
emails: string[];
}
/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
interface Office365UserProfile extends Auth0UserProfile {
tenantid: string;
upn: string;
}
/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
interface AdfsUserProfile extends Auth0UserProfile {
issuer: string;
}
/** Represents multiple identities assigned to a user. */
interface Auth0Identity {
access_token: string;
connection: string;
isSocial: boolean;
provider: string;
user_id: string;
}
interface Auth0DecodedHash {
access_token: string;
id_token: string;
profile: Auth0UserProfile;
state: any;
}
interface Auth0PopupOptions {
width: number;
height: number;
}
interface Auth0LoginOptions {
auto_login?: boolean;
connection?: string;
email?: string;
username?: string;
password?: string;
popup?: boolean;
popupOptions?: Auth0PopupOptions;
}
interface Auth0SignupOptions extends Auth0LoginOptions {
auto_login: boolean;
}
interface Auth0Error {
code: any;
details: any;
name: string;
message: string;
status: any;
}
/** Represents the response from an API Token Delegation request. */
interface Auth0DelegationToken {
/** The length of time in seconds the token is valid for. */
expires_in: string;
/** The JWT for delegated access. */
id_token: string;
/** The type of token being returned. Possible values: "Bearer" */
token_type: string;
}
declare var Auth0: Auth0Static;
declare module "auth0-js" {
export = Auth0
}
+161 -9
View File
@@ -1,13 +1,165 @@
/// <reference path="../auth0/auth0.d.ts" />
/// <reference path="../auth0-js/auth0-js.d.ts" />
/// <reference path="auth0.lock.d.ts" />
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);
+99 -56
View File
@@ -1,9 +1,69 @@
// 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 path="../auth0/auth0.d.ts" />
/// <reference path="../auth0-js/auth0-js.d.ts" />
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;
@@ -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;
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference path="../auth0/auth0.d.ts" />
/// <reference path="../auth0-js/auth0-js.d.ts" />
/// <reference path="auth0.widget.d.ts" />
var widget: Auth0WidgetStatic = new Auth0Widget({
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../auth0/auth0.d.ts" />
/// <reference path="../auth0-js/auth0-js.d.ts" />
interface Auth0WidgetStatic {
+48 -20
View File
@@ -1,23 +1,51 @@
/// <reference path="../auth0/auth0.d.ts" />
/// <reference path="auth0.d.ts" />
var auth0 = new Auth0({
domain: 'mine.auth0.com',
clientID: 'dsa7d77dsa7d7',
callbackURL: 'http://my-app.com/callback',
callbackOnLocationHash: true
import * as auth0 from 'auth0';
const management = new auth0.ManagementClient({
token: '{YOUR_API_V2_TOKEN}',
domain: '{YOUR_ACCOUNT}.auth0.com'
});
auth0.login({
connection: 'google-oauth2',
popup: true,
popupOptions: {
width: 450,
height: 800
}
}, (err, profile, idToken, accessToken, state) => {
if (err) {
alert("something went wrong: " + err.message);
return;
}
alert('hello ' + profile.name);
});
const auth = new auth0.AuthenticationClient({
domain: '{YOUR_ACCOUNT}.auth0.com',
clientId: '{OPTIONAL_CLIENT_ID}'
});
// Using a callback.
management.getUsers((err: Error, users: auth0.User[]) => {
if (err) {
// Handle error.
}
console.log(users);
});
// Using a Promise.
management
.getUsers()
.then((users) => {
console.log(users);
})
.catch((err) => {
// Handle the error.
});
management
.createUser({
connection: 'My-Connection',
email: 'hi@me.co',
}).then((user) => {
console.log(user);
}).catch((err) => {
// Handle the error.
});
auth
.requestChangePasswordEmail({
connection: 'My-Connection',
email: 'hi@me.co',
}).then((response) => {
console.log(response);
}).catch((err) => {
// Handle the error.
});
+81 -117
View File
@@ -1,131 +1,95 @@
// Type definitions for Auth0.js
// Project: http://auth0.com
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Type definitions for auth0 v2.3.1
// Project: https://github.com/auth0/node-auth0
// Definitions by: Seth Westphal <https://github.com/westy92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** Extensions to the browser Window object. */
interface Window {
/** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
/// <reference path="../bluebird/bluebird.d.ts" />
declare module "auth0" {
import * as Promise from 'bluebird';
export interface ManagementClientOptions {
token: string;
}
domain?: string;
}
/** This is the interface for the main Auth0 client. */
interface Auth0Static {
new(options: Auth0ClientOptions): Auth0Static;
changePassword(options: any, callback?: Function): void;
decodeJwt(jwt: string): any;
login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
logout(query: string): void;
getConnections(callback?: Function): void;
getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getProfile(id_token: string, callback?: Function): Auth0UserProfile;
getSSOData(withActiveDirectories: any, callback?: Function): void;
parseHash(hash: string): Auth0DecodedHash;
signup(options: Auth0SignupOptions, callback: Function): void;
validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
}
/** Represents constructor options for the Auth0 client. */
interface Auth0ClientOptions {
clientID: string;
callbackURL: string;
callbackOnLocationHash?: boolean;
domain: string;
forceJSONP?: boolean;
}
/** Represents a normalized UserProfile. */
interface Auth0UserProfile {
email: string;
family_name: string;
gender: string;
given_name: string;
locale: string;
name: string;
nickname: string;
picture: string;
user_id: string;
/** Represents one or more Identities that may be associated with the User. */
identities: Auth0Identity[];
user_metadata?: any;
app_metadata?: any;
}
/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
interface MicrosoftUserProfile extends Auth0UserProfile {
emails: string[];
}
/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
interface Office365UserProfile extends Auth0UserProfile {
tenantid: string;
upn: string;
}
/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
interface AdfsUserProfile extends Auth0UserProfile {
issuer: string;
}
/** Represents multiple identities assigned to a user. */
interface Auth0Identity {
access_token: string;
export interface UserData {
connection: string;
isSocial: boolean;
provider: string;
user_id: string;
}
interface Auth0DecodedHash {
access_token: string;
id_token: string;
profile: Auth0UserProfile;
state: any;
}
interface Auth0PopupOptions {
width: number;
height: number;
}
interface Auth0LoginOptions {
auto_login?: boolean;
connection?: string;
email?: string;
username?: string;
password?: string;
popup?: boolean;
popupOptions?: Auth0PopupOptions;
}
phone_number?: string;
user_metadata?: {};
email_verified?: boolean;
app_metadata?: {};
}
interface Auth0SignupOptions extends Auth0LoginOptions {
auto_login: boolean;
}
export interface GetUsersData {
per_page?: number;
page?: number;
include_totals?: boolean;
sort?: string;
connection?: string;
fields?: string;
include_fields?: boolean;
q?: string;
search_engine?: string;
}
interface Auth0Error {
code: any;
details: any;
name: string;
message: string;
status: any;
}
export interface User {
email?: string;
email_verified?: boolean;
username?: string;
phone_number?: string;
phone_verified?: boolean;
user_id?: string;
created_at?: string;
updated_at?: string;
identities?: Identity[];
app_metadata?: {};
user_metadata?: {};
picture?: string;
name?: string;
nickname?: string;
multifactor?: string[];
last_ip?: string;
last_login?: string;
logins_count?: number;
blocked?: boolean;
}
/** Represents the response from an API Token Delegation request. */
interface Auth0DelegationToken {
/** The length of time in seconds the token is valid for. */
expires_in: string;
/** The JWT for delegated access. */
id_token: string;
/** The type of token being returned. Possible values: "Bearer" */
token_type: string;
}
export interface Identity {
connection: string;
user_id: string;
provider: string;
isSocial: boolean;
}
declare var Auth0: Auth0Static;
export class ManagementClient {
constructor(options: ManagementClientOptions);
getUsers(params?: GetUsersData): Promise<User[]>;
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
createUser(data: UserData): Promise<User>;
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
}
export interface AuthenticationClientOptions {
clientId?: string;
domain: string;
}
export interface RequestChangePasswordEmailData {
connection: string;
email: string;
}
export class AuthenticationClient {
constructor(options: AuthenticationClientOptions);
requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise<string>;
requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
}
declare module "auth0" {
export = Auth0
}
+2 -1
View File
@@ -45,7 +45,7 @@ declare namespace autobahn {
interface IInvocation {
caller?: number;
progress?: boolean;
progress?: (args : any[], kwargs : any) => void;
procedure: string;
}
@@ -163,6 +163,7 @@ declare namespace autobahn {
}
interface IPublishOptions {
acknowledge?: boolean;
exclude?: number[];
eligible?: number[];
disclose_me?: Boolean;
@@ -0,0 +1,43 @@
/// <reference path="autobind-decorator.d.ts" />
import autobind = require('autobind-decorator');
class Test {
public static what: string = 'static';
@autobind
public static test(): void {
console.log(this.what);
}
public constructor(public what: string) {
this.what = what;
}
@autobind
public test(): void {
console.warn(this.what);
}
}
const tester: Test = new Test('bind');
const { test } = tester;
tester.test(); // warns 'bind'.
test(); // warns 'bind'.
Test.test(); // logs 'static'.
@autobind
class Component {
public constructor(private someMember: string) {
this.someMember = someMember;
}
public someMethod(): void {
console.error(this.someMember);
}
}
const component: Component = new Component('React vs Angular2');
const { someMethod } = component;
component.someMethod(); // errors 'React vs Angular2'
someMethod(); // errors 'React vs Angular2'
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for autobind-decorator v1.3.3
// Project: https://github.com/andreypopp/autobind-decorator
// Definitions by: Ivo Stratev <https://github.com/NoHomey/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'autobind-decorator' {
function autobind<TFunction extends Function>(target: TFunction): TFunction | void;
function autobind<T extends Function>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
export = autobind;
}
@@ -0,0 +1 @@
--experimentalDecorators
+10
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
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;
}
+4 -2
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "avoscloud-sdk" {
namespace AV{
namespace AV {
var applicationId: string;
var applicationKey: string;
@@ -301,6 +301,7 @@ declare module "avoscloud-sdk" {
fetch<T>(options?: Object.FetchOptions): Promise<T>;
get(attr: string): any;
getACL(): ACL;
getObjectId(): string;
has(attr: string): boolean;
hasChanged(attr: string): boolean;
increment(attr: string, amount?: number): any;
@@ -529,6 +530,7 @@ declare module "avoscloud-sdk" {
constructor(objectClass: any);
static and(...var_args: Query[]): Query;
static or(...var_args: Query[]): Query;
addAscending(key: string): Query;
@@ -628,7 +630,7 @@ declare module "avoscloud-sdk" {
signUp<T>(attrs: any, options?: SuccessFailureOptions): Promise<T>;
logIn<T>(options?: SuccessFailureOptions): Promise<T>;
fetch<T>(options?: SuccessFailureOptions): Promise<T>;
save<T>(arg1: any, arg2: any, arg3: any): Promise<T>;
save<T>(arg1?: any, arg2?: any, arg3?: any): Promise<T>;
authenticated(): boolean;
isCurrent(): boolean;
+40
View File
@@ -0,0 +1,40 @@
/// <reference path="aws-lambda.d.ts" />
import lambda = require('aws-lambda');
var str: string;
var date: Date;
var anyObj: any;
var num: number;
var identity: lambda.CognitoIdentity;
var error: Error;
var b: boolean;
var clientCtx: lambda.ClientContext;
/* Context */
var context: lambda.Context;
b = context.callbackWaitsForEmptyEventLoop;
str = context.functionName;
str = context.functionVersion;
str = context.invokedFunctionArn;
num = context.memoryLimitInMB;
str = context.awsRequestId;
str = context.logGroupName;
str = context.logStreamName;
identity = context.identity;
clientCtx = context.clientContext;
/* CognitoIdentity */
var identity: lambda.CognitoIdentity;
str = identity.cognitoIdentityId;
str = identity.cognitoIdentityPoolId;
/* Callback */
function callback(cb: lambda.Callback) {
cb();
cb(null);
cb(error);
cb(null, anyObj);
}
+68
View File
@@ -0,0 +1,68 @@
// Type definitions for AWS Lambda
// Project: http://docs.aws.amazon.com/lambda
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "aws-lambda" {
// Context
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
interface Context {
// Properties
callbackWaitsForEmptyEventLoop: boolean;
functionName: string;
functionVersion: string;
invokedFunctionArn: string;
memoryLimitInMB: number;
awsRequestId: string;
logGroupName: string;
logStreamName: string;
identity?: CognitoIdentity;
clientContext?: ClientContext;
// Functions
getRemainingTimeInMillis(): number;
// Functions for compatibility with earlier Node.js Runtime v0.10.42
log(message: string, object: any): void;
fail(message: string): void;
succeed(message: string): void;
succeed(object: any): void;
succeed(message: string, object: any): void;
}
interface CognitoIdentity {
cognitoIdentityId: string;
cognitoIdentityPoolId: string;
}
interface ClientContext {
client: ClientContextClient;
Custom?: any;
env: ClientContextEnv;
}
interface ClientContextClient {
installationId: string;
appTitle: string;
appVersionName: string;
appVersionCode: string;
appPackageName: string;
}
interface ClientContextEnv {
platformVersion: string;
platform: string;
make: string;
model: string;
locale: string;
}
/**
* Optional callback parameter.
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
*
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
*/
export type Callback = (error?: Error, result?: any) => void;
}
+2156 -1358
View File
File diff suppressed because it is too large Load Diff
+91
View File
@@ -0,0 +1,91 @@
/// <reference path="axe-core.d.ts" />
var context:any = document
var $fixture:any = {}
// axe.a11yCheck config
axe.a11yCheck(context, {}, (results) => {
// axe's results object
console.log(results.passes.length)
console.log(results.violations.length)
});
// axe.a11yCheck include/exclude
axe.a11yCheck({include: [['#id1'], ['#id2']]}, {}, (results) => {
console.log(results)
})
axe.a11yCheck({exclude: [$fixture[0]]}, {}, (results) => {
console.log(results)
})
var tagConfigRunOnly: axe.RunOnly = {
type: 'tag',
values: ['wcag2a']
}
var tagConfig = {
runOnly: tagConfigRunOnly
}
axe.a11yCheck(context, tagConfig, (results) => {
console.log(results)
})
var includeExcludeTagsRunOnly: axe.RunOnly = {
type: 'tags',
value: {
include: ['wcag2a', 'wcag2aa'],
exclude: ['experimental']
}
}
var includeExcludeTagsConfig = {
runOnly: includeExcludeTagsRunOnly
}
axe.a11yCheck(context, includeExcludeTagsConfig, (results) => {
console.log(results)
})
var someRulesConfig = {
rules: {
"color-contrast": {enabled: 'false'},
"heading-order": {enabled: 'true'}
}
}
axe.a11yCheck(context, someRulesConfig, (results) => {
console.log(results)
})
// axe.configure
var spec: axe.Spec = {
branding: {
brand: 'foo',
application: 'bar'
},
reporter: 'v1',
checks: [{
id: 'custom-check',
evaluate: function() {
return true
}
}],
rules: [{
id: 'custom-rule',
any: ['custom-check']
}]
}
axe.configure(spec)
axe.reset()
axe.getRules(['wcag2aa'])
typeof axe.getRules() === 'object'
// Plugins
var pluginSrc: axe.AxePlugin = {
id: 'doStuff',
run: (data:any, callback:Function) => {
callback()
},
commands: [{
id: 'run-doStuff',
callback: (data:any, callback:Function) => {
axe.plugins['doStuff'].run(data, callback)
}
}]
}
axe.registerPlugin(pluginSrc)
axe.cleanup()
+159
View File
@@ -0,0 +1,159 @@
// Type definitions for axe-core 2.0.5
// Project: https://github.com/dequelabs/axe-core
// Definitions by: Marcy Sutton <https://github.com/marcysutton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace axe {
export type ImpactValue = "minor" | "moderate" | "serious" | "critical";
export type TagValue = "wcag2a" | "wcag2aa" | "section508" | "best-practice";
export type ReporterVersion = "v1" | "v2";
export type RunOnlyType = "rule" | "rules" | "tag" | "tags";
export interface ElementContext {
node?: Object,
selector?: string,
include?: any[],
exclude?: any[]
}
export interface RunOnly {
type: RunOnlyType,
value?: {
include?: string[],
exclude?: string[]
}
values?: TagValue[]
}
export interface AxeResults {
url: string,
timestamp: string,
passes: Pass[],
violations: Violation[]
}
export interface Pass {
description: string,
help: string,
helpUrl: string,
id: string,
impact: ImpactValue,
tags: TagValue[],
nodes: NodeResult[]
}
export interface Violation {
description: string,
help: string,
helpUrl: string,
id: string,
impact: ImpactValue,
tags: TagValue[],
nodes: NodeResult[]
}
export interface NodeResult {
html: string,
impact: ImpactValue,
target: string[],
any: CheckResult[],
all: CheckResult[],
none: CheckResult[]
}
export interface CheckResult {
id: string,
impact: string,
message: string,
data: any,
relatedNodes?: RelatedNode[]
}
export interface RelatedNode {
target: string[],
html: string
}
export interface Spec {
branding?: {
brand: string,
application: string
},
reporter?: ReporterVersion,
checks?: Check[],
rules?: Rule[]
}
export interface Check {
id: string,
evaluate: Function,
after?: Function,
options?: any,
matches?: string,
enabled?: boolean
}
export interface Rule {
id: string,
selector?: string,
excludeHidden?: boolean,
enabled?: boolean,
pageLevel?: boolean,
any?: string[],
all?: string[],
none?: string[],
tags?: string[],
matches?: string
}
export interface AxePlugin {
id: string,
run(...args:any[]): any,
commands: {
id: string,
callback(...args:any[]): void
}[],
cleanup?(callback:Function): void
}
export let plugins: any
/**
* Starts analysis on the current document and its subframes
*
* @param {Object} context The `Context` specification object @see Context
* @param {Array} options Options passed into rules or checks, temporarily modifyint them.
* @param {Function} callback The function to invoke when analysis is complete.
* @returns {Object} results The aXe results object
*/
export function a11yCheck(context: ElementContext, options: {runOnly?: RunOnly, rules?: Object}, callback: (results:AxeResults) => void): AxeResults
/**
* Method for configuring the data format used by aXe. Helpful for adding new
* rules, which must be registered with the library to execute.
* @param {Spec} Spec Object with valid `branding`, `reporter`, `checks` and `rules` data
*/
export function configure(spec: Spec): void
/**
* Searches and returns rules that contain a tag in the list of tags.
* @param {Array} tags Optional array of tags
* @return {Array} Array of rules
*/
export function getRules(tags?: string[]): Object[]
/**
* Restores the default axe configuration
*/
export function reset(): void
/**
* Function to register a plugin configuration in document and its subframes
* @param {Object} plugin A plugin configuration object
*/
export function registerPlugin(plugin: AxePlugin): void
/**
* Function to clean up plugin configuration in document and its subframes
*/
export function cleanup(): void
}
// axe is also available as a module
declare module "axe-core" {
export = axe;
}
+18 -1
View File
@@ -72,6 +72,13 @@ table.read.use([function () {}, function () {}]);
table.read.use(function () {}, function () {});
table.use(function () {}).use(function () {}).read(function () {}).use(function () {})
table.access = undefined;
table.access = 'authenticated';
table.read.access = 'anonymous';
table.update.access = 'disabled';
table.delete.access = 'authenticated';
table.insert.access = 'authenticated';
// Express.Table, instantiated from the static require('azure-mobile-apps').table()
// This is going to be interesting if we ever support more than one provider
var table2 = mobileApps.table();
@@ -84,4 +91,14 @@ mobileApps.logger.debug('a debug message')
// Query
queries.create('table').where({ x: 10 }).select('col1,col2');
mobileApps.query.create('table');
mobileApps.query.create('table');
// custom sql query
mobileApp.api.add('query', { authorize: true, get: (req, res, next) => {
req.azureMobile.data.execute({
sql: "SELECT * FROM TODOITEM WHERE COMPLETE = :complete",
parameters: [
{ name: 'complete', value: 1 }
]
}).then(x => {});
}, delete: function () {} });
+20 -1
View File
@@ -47,6 +47,7 @@ declare namespace Azure.MobileApps {
interface Table {
authorize?: boolean;
access?: AccessType;
autoIncrement?: boolean;
dynamicSchema?: boolean;
name: string;
@@ -66,8 +67,11 @@ declare namespace Azure.MobileApps {
(operationHandler: (context: Context) => void): Table;
use(...middleware: Middleware[]): Table;
use(middleware: Middleware[]): Table;
access: AccessType;
}
type AccessType = 'anonymous' | 'authenticated' | 'disabled';
interface Tables {
configuration: Configuration;
add(name: string, definition?: Table | TableDefinition): void;
@@ -215,7 +219,7 @@ declare namespace Azure.MobileApps {
item: any;
req: Express.Request;
res: Express.Response;
data: (table: TableDefinition) => Data.Table;
data: ContextData;
tables: (tableName: string) => Data.Table;
user: User;
push: typeof nh;
@@ -223,6 +227,21 @@ declare namespace Azure.MobileApps {
execute(): Thenable<any>;
}
interface ContextData {
(table: TableDefinition): Data.Table;
execute(q: SqlQueryDefinition): Thenable<any>;
}
interface SqlQueryDefinition {
sql: string;
parameters?: SqlParameterDefinition[];
}
interface SqlParameterDefinition {
name: string;
value: any;
}
interface TableDefinition {
authorize?: boolean;
autoIncrement?: boolean;
@@ -17,7 +17,7 @@ declare namespace Microsoft.WindowsAzure {
login(provider: string, token: string): asyncPromise;
login(provider: string, callback: (error: any, user: User) => void ): void;
login(provider: string): asyncPromise;
logout(): void;
logout(): asyncPromise;
getTable(tableName: string): MobileServiceTable;
withFilter(serviceFilter: (request: any, next: (request: any, callback: (error: any, response: any) => void) => void, callback: (error: any, response: any) => void) => void): MobileServiceClient;
/**
+26 -2
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
@@ -109,9 +109,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, ... };
@@ -147,7 +153,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;
@@ -178,6 +191,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 {
@@ -208,6 +222,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;
@@ -221,10 +236,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.
@@ -314,6 +331,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[];
@@ -330,9 +349,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;
+1 -1
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
+88
View File
@@ -0,0 +1,88 @@
/// <reference path="backlog-js.d.ts" />
import * as backlogjs from 'backlog-js';
const host = 'example.backlog.jp';
const apiKey = 'apiKey';
const clientId = 'clientId';
const clientSecret = 'clientSecret';
const redirectUri = 'redirectUri';
const state = 'state';
const code = 'code';
const refreshToken = 'refreshToken';
const configure = { host, apiKey }
const credentials = { clientId, clientSecret }
const oauth2 = new backlogjs.OAuth2(credentials);
oauth2.getAuthorizationURL({ host, redirectUri, state });
oauth2.getAccessToken({ host, code, redirectUri }).then(data => {}).catch(err => {});
oauth2.refreshAccessToken({ host, refreshToken }).then(data => {}).catch(err => {});
const backlog = new backlogjs.Backlog(configure);
backlog.getSpace().then(data => { }).catch(err => { });
backlog.getSpaceActivities({
activityTypeId: [
backlogjs.Option.ActivityType.IssueCreated,
backlogjs.Option.ActivityType.IssueUpdated
],
minId: 1,
maxId: 2,
count: 3,
order: "asc"
}).then(data => { }).catch(err => { });
backlog.getSpaceDiskUsage().then(data => { }).catch(err => { });
backlog.getSpaceIcon().then(data => { }).catch(err => { });
backlog.postSpaceAttachment(new FormData()).then(data => { }).catch(err => { });
backlog.getUsers().then(data => { }).catch(err => { });
backlog.getUser(1).then(data => { }).catch(err => { });
backlog.postUser({
userId: 'string',
password: 'string',
name: 'string',
mailAddress: 'string',
roleType: backlogjs.Option.User.RoleType.Admin
}).then(data => { }).catch(err => { });
backlog.patchUser(1, {
password: 'string',
name: 'string',
mailAddress: 'string',
roleType: backlogjs.Option.User.RoleType.Admin
}).then(data => { }).catch(err => { });
backlog.deleteUser(1).then(data => { }).catch(err => { });
backlog.getMyself().then(data => { }).catch(err => { });
backlog.getUserActivities(1, {
activityTypeId: [
backlogjs.Option.ActivityType.IssueCreated,
backlogjs.Option.ActivityType.IssueUpdated
],
minId: 1,
maxId: 2,
count: 3,
order: "asc"
}).then(data => { }).catch(err => { });
backlog.getUserStars(1, {
minId: 1,
maxId: 2,
count: 3,
order: "asc"
}).then(data => { }).catch(err => { });
backlog.getUserStarsCount(1, {
since: 'YYYY-MM-DD',
until: 'YYYY-MM-DD'
}).then(data => { }).catch(err => { });
backlog.getRecentlyViewedIssues({
order: 'asc',
offset: 1,
count: 2
}).then(data => { }).catch(err => { });
backlog.getRecentlyViewedProjects({
order: 'asc',
offset: 1,
count: 2
}).then(data => { }).catch(err => { });
backlog.getRecentlyViewedWikis({
order: 'asc',
offset: 1,
count: 2
}).then(data => { }).catch(err => { });
backlog.getUserIcon(1).then(data => {}).catch(err => {});
+695
View File
@@ -0,0 +1,695 @@
// Type definitions for backlog-js 0.9.0
// Project: https://github.com/nulab/backlog-js
// Definitions by: Yuichi Watanabe <https://github.com/vvatanabe>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../isomorphic-fetch/isomorphic-fetch.d.ts" />
/// <reference path="../node_modules/typescript/lib/lib.es6.d.ts" />
declare module 'backlog-js' {
class Request {
private configure;
constructor(configure: {
host: string;
apiKey?: string;
accessToken?: string;
timeout?: number;
});
get<T>(path: string, params?: any): Promise<T>;
post<T>(path: string, params?: any): Promise<T>;
put<T>(path: string, params: any): Promise<T>;
patch<T>(path: string, params: any): Promise<T>;
delete<T>(path: string, params?: any): Promise<T>;
request(options: {
method: string;
path: string;
params?: Params | FormData;
}): Promise<IResponse>;
checkStatus(response: IResponse): Promise<IResponse>;
parseJSON<T>(response: IResponse): Promise<T>;
private toFormData(params);
private toQueryString(params);
webAppBaseURL: string;
restBaseURL: string;
}
type Params = {
[index: string]: number | string | number[] | string[];
};
export class Backlog extends Request {
constructor(configure: {
host: string;
apiKey?: string;
accessToken?: string;
timeout?: number;
});
getSpace(): Promise<any>;
getSpaceActivities(params: Option.Space.GetActivitiesParams): Promise<any>;
getSpaceNotification(): Promise<any>;
putSpaceNotification(params: Option.Space.PutSpaceNotificationParams): Promise<any>;
getSpaceDiskUsage(): Promise<any>;
getSpaceIcon(): Promise<Entity.File.FileData>;
postSpaceAttachment(form: FormData): Promise<IResponse>;
getUsers(): Promise<any>;
getUser(userId: number): Promise<any>;
postUser(params: Option.User.PostUserParams): Promise<any>;
patchUser(userId: number, params: Option.User.PatchUserParams): Promise<any>;
deleteUser(userId: number): Promise<any>;
getMyself(): Promise<any>;
getUserActivities(userId: number, params: Option.User.GetUserActivitiesParams): Promise<any>;
getUserStars(userId: number, params: Option.User.GetUserStarsParams): Promise<any>;
getUserStarsCount(userId: number, params: Option.User.GetUserStarsCountParams): Promise<any>;
getRecentlyViewedIssues(params: Option.User.GetRecentlyViewedParams): Promise<any>;
getRecentlyViewedProjects(params: Option.User.GetRecentlyViewedParams): Promise<any>;
getRecentlyViewedWikis(params: Option.User.GetRecentlyViewedParams): Promise<any>;
getUserIcon(userId: number): Promise<Entity.File.FileData>;
getGroups(params: Option.Group.GetGroupsParams): Promise<any>;
postGroups(params: Option.Group.PostGroupsParams): Promise<any>;
getGroup(groupId: number): Promise<any>;
patchGroup(groupId: number, params: Option.Group.PatchGroupParams): Promise<any>;
deleteGroup(groupId: number): Promise<any>;
getStatuses(): Promise<any>;
getResolutions(): Promise<any>;
getPriorities(): Promise<any>;
postProject(params: Option.Project.PostProjectParams): Promise<any>;
getProjects(params?: Option.Project.GetProjectsParams): Promise<any>;
getProject(projectIdOrKey: string): Promise<any>;
patchProject(projectIdOrKey: string, params: Option.Project.PatchProjectParams): Promise<any>;
deleteProject(projectIdOrKey: string): Promise<any>;
getProjectActivities(projectIdOrKey: string, params: Option.Space.GetActivitiesParams): Promise<any>;
getProjectUsers(projectIdOrKey: string): Promise<any>;
deleteProjectUsers(projectIdOrKey: string, params: Option.Project.DeleteProjectUsersParams): Promise<any>;
postProjectAdministrators(projectIdOrKey: string, params: Option.Project.PostProjectAdministrators): Promise<any>;
getProjectAdministrators(projectIdOrKey: string): Promise<any>;
deleteProjectAdministrators(projectIdOrKey: string, params: Option.Project.DeleteProjectAdministrators): Promise<any>;
getIssueTypes(projectIdOrKey: string): Promise<any>;
postIssueType(projectIdOrKey: string, params: Option.Project.PostIssueTypeParams): Promise<any>;
patchIssueType(projectIdOrKey: string, id: number, params: Option.Project.PatchIssueTypeParams): Promise<any>;
deleteIssueType(projectIdOrKey: string, id: number, params: Option.Project.DeleteIssueTypeParams): Promise<any>;
getCategories(projectIdOrKey: string): Promise<any>;
postCategories(projectIdOrKey: string, params: Option.Project.PostCategoriesParams): Promise<any>;
patchCategories(projectIdOrKey: string, id: number, params: Option.Project.PatchCategoriesParams): Promise<any>;
deleteCategories(projectIdOrKey: string, id: number): Promise<any>;
getVersions(projectIdOrKey: string): Promise<any>;
postVersions(projectIdOrKey: string, params: Option.Project.PostVersionsParams): Promise<any>;
patchVersions(projectIdOrKey: string, id: number, params: Option.Project.PatchVersionsParams): Promise<any>;
deleteVersions(projectIdOrKey: string, id: number): Promise<any>;
getCustomFields(projectIdOrKey: string): Promise<any>;
postCustomField(projectIdOrKey: string, params: Option.Project.PostCustomFieldParams | Option.Project.PostCustomFieldWithNumericParams | Option.Project.PostCustomFieldWithDateParams | Option.Project.PostCustomFieldWithListParams): Promise<any>;
patchCustomField(projectIdOrKey: string, id: number, params: Option.Project.PatchCustomFieldParams | Option.Project.PatchCustomFieldWithNumericParams | Option.Project.PatchCustomFieldWithDateParams | Option.Project.PatchCustomFieldWithListParams): Promise<any>;
deleteCustomField(projectIdOrKey: string, id: number): Promise<any>;
postCustomFieldItem(projectIdOrKey: string, id: number, params: Option.Project.PostCustomFieldItemParams): Promise<any>;
patchCustomFieldItem(projectIdOrKey: string, id: number, itemId: number, params: Option.Project.PatchCustomFieldItemParams): Promise<any>;
deleteCustomFieldItem(projectIdOrKey: string, id: number, params: Option.Project.PostCustomFieldItemParams): Promise<any>;
getSharedFiles(projectIdOrKey: string, path: string, params: Option.Project.GetSharedFilesParams): Promise<any>;
getProjectsDiskUsage(projectIdOrKey: string): Promise<any>;
getWebhooks(projectIdOrKey: string): Promise<any>;
postWebhook(projectIdOrKey: string, params: Option.Project.PostWebhookParams): Promise<any>;
getWebhook(projectIdOrKey: string, webhookId: string): Promise<any>;
patchWebhook(projectIdOrKey: string, webhookId: string, params: Option.Project.PatchWebhookParams): Promise<any>;
deleteWebhook(projectIdOrKey: string, webhookId: string): Promise<any>;
postIssue(params: Option.Issue.PostIssueParams): Promise<any>;
patchIssue(issueIdOrKey: string, params: Option.Issue.PatchIssueParams): Promise<any>;
getIssues(params?: Option.Issue.GetIssuesParams): Promise<any>;
getIssue(issueIdOrKey: string): Promise<any>;
getIssuesCount(params?: Option.Issue.GetIssuesParams): Promise<any>;
deleteIssuesCount(issueIdOrKey: string): Promise<any>;
getIssueComments(issueIdOrKey: string, params: Option.Issue.GetIssueCommentsParams): Promise<any>;
postIssueComments(issueIdOrKey: string, params: Option.Issue.PostIssueCommentsParams): Promise<any>;
getIssueCommentsCount(issueIdOrKey: string): Promise<any>;
getIssueComment(issueIdOrKey: string, commentId: number): Promise<any>;
patchIssueComment(issueIdOrKey: string, commentId: number, params: Option.Issue.PatchIssueCommentParams): Promise<any>;
getIssueCommentNotifications(issueIdOrKey: string, commentId: number): Promise<any>;
postIssueCommentNotifications(issueIdOrKey: string, commentId: number, prams: Option.Issue.IssueCommentNotifications): Promise<any>;
getIssueAttachments(issueIdOrKey: string): Promise<any>;
deleteIssueAttachment(issueIdOrKey: string, attachmentId: string): Promise<any>;
getIssueSharedFiles(issueIdOrKey: string): Promise<any>;
linkIssueSharedFiles(issueIdOrKey: string, params: Option.Issue.LinkIssueSharedFilesParams): Promise<any>;
unlinkIssueSharedFile(issueIdOrKey: string, id: number): Promise<any>;
getWikis(projectIdOrKey: number): Promise<any>;
getWikisCount(projectIdOrKey: number): Promise<any>;
getWikisTags(projectIdOrKey: number): Promise<any>;
postWiki(params: Option.Wiki.PostWikiParams): Promise<any>;
getWiki(wikiId: number): Promise<any>;
patchWiki(wikiId: number, params: Option.Wiki.PatchWikiParams): Promise<any>;
deleteWiki(wikiId: number, mailNotify: boolean): Promise<any>;
getWikisAttachments(wikiId: number): Promise<any>;
postWikisAttachments(wikiId: number, attachmentId: number[]): Promise<any>;
deleteWikisAttachments(wikiId: number, attachmentId: number): Promise<any>;
getWikisSharedFiles(wikiId: number): Promise<any>;
linkWikisSharedFiles(wikiId: number, fileId: number[]): Promise<any>;
unlinkWikisSharedFiles(wikiId: number, id: number): Promise<any>;
getWikisHistory(wikiId: number, params: Option.Wiki.GetWikisHistoryParams): Promise<any>;
getWikisStars(wikiId: number): Promise<any>;
postStar(params: Option.Project.PostStarParams): Promise<any>;
getNotifications(params: Option.Notification.GetNotificationsParams): Promise<any>;
getNotificationsCount(params: Option.Notification.GetNotificationsCountParams): Promise<any>;
resetNotificationsMarkAsRead(): Promise<any>;
markAsReadNotification(id: number): Promise<any>;
getGitRepositories(projectIdOrKey: string): Promise<any>;
getGitRepository(projectIdOrKey: string, repoIdOrName: string): Promise<any>;
getPullRequests(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.GetPullRequestsParams): Promise<any>;
getPullRequestsCount(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.GetPullRequestsParams): Promise<any>;
postPullRequest(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.PostPullRequestParams): Promise<any>;
getPullRequest(projectIdOrKey: string, repoIdOrName: string, number: number): Promise<any>;
patchPullRequest(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.PatchPullRequestParams): Promise<any>;
getPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.GetPullRequestCommentsParams): Promise<any>;
postPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.PostPullRequestCommentsParams): Promise<any>;
getPullRequestCommentsCount(projectIdOrKey: string, repoIdOrName: string, number: number): Promise<any>;
patchPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, commentId: number, params: Option.PullRequest.PatchPullRequestCommentsParams): Promise<any>;
getPullRequestAttachments(projectIdOrKey: string, repoIdOrName: string, number: number): Promise<any>;
deletePullRequestAttachment(projectIdOrKey: string, repoIdOrName: string, number: number, attachmentId: number): Promise<any>;
getProjectIcon(projectIdOrKey: string): Promise<Entity.File.FileData>;
getSharedFile(projectIdOrKey: string, sharedFileId: number): Promise<Entity.File.FileData>;
getIssueAttachment(issueIdOrKey: string, attachmentId: number): Promise<Entity.File.FileData>;
getWikiAttachment(wikiId: number, attachmentId: number): Promise<Entity.File.FileData>;
getPullRequestAttachment(projectIdOrKey: string, repoIdOrName: string, number: number, attachmentId: number): Promise<Entity.File.FileData>;
private download(path);
private upload(path, params);
private parseFileData(response);
}
export class OAuth2 {
private credentials;
private timeout;
constructor(credentials: Option.OAuth2.Credentials, timeout?: number);
getAuthorizationURL(options: {
host: string;
redirectUri?: string;
state?: string;
}): string;
getAccessToken(options: {
host: string;
code: string;
redirectUri?: string;
}): Promise<Entity.OAuth2.AccessToken>;
refreshAccessToken(options: {
host: string;
refreshToken: string;
}): Promise<Entity.OAuth2.AccessToken>;
}
import { PassThrough } from 'stream';
export namespace Entity {
export namespace File {
export type FileData = NodeFileData | BrowserFileData;
export interface NodeFileData {
body: PassThrough;
url: string;
filename: string;
}
export interface BrowserFileData {
body: any;
url: string;
blob?: () => Promise<Blob>;
}
}
export namespace OAuth2 {
export interface AccessToken {
access_token: string;
token_type: string;
expires_in: number;
refresh_token: string;
}
}
}
export namespace Option {
export type Order = "asc" | "desc";
export enum ActivityType {
Undefined = -1,
IssueCreated = 1,
IssueUpdated = 2,
IssueCommented = 3,
IssueDeleted = 4,
WikiCreated = 5,
WikiUpdated = 6,
WikiDeleted = 7,
FileAdded = 8,
FileUpdated = 9,
FileDeleted = 10,
SvnCommitted = 11,
GitPushed = 12,
GitRepositoryCreated = 13,
IssueMultiUpdated = 14,
ProjectUserAdded = 15,
ProjectUserRemoved = 16,
NotifyAdded = 17,
PullRequestAdded = 18,
PullRequestUpdated = 19,
PullRequestCommented = 20,
PullRequestMerged = 21,
}
export namespace Notification {
export interface GetNotificationsParams {
minId?: number;
maxId?: number;
count?: number;
order?: Order;
}
export interface GetNotificationsCountParams {
alreadyRead: boolean;
resourceAlreadyRead: boolean;
}
}
export namespace Space {
export interface GetActivitiesParams {
activityTypeId?: ActivityType[];
minId?: number;
maxId?: number;
count?: number;
order?: Order;
}
export interface PutSpaceNotificationParams {
content: string;
}
}
export namespace User {
export interface PostUserParams {
userId: string;
password: string;
name: string;
mailAddress: string;
roleType: RoleType;
}
export interface PatchUserParams {
password?: string;
name?: string;
mailAddress?: string;
roleType?: RoleType;
}
export enum RoleType {
Admin = 1,
User = 2,
Reporter = 3,
Viewer = 4,
GuestReporter = 5,
GuestViewer = 6,
}
export interface GetUserActivitiesParams {
activityTypeId?: ActivityType[];
minId?: number;
maxId?: number;
count?: number;
order?: Order;
}
export interface GetUserStarsParams {
minId?: number;
maxId?: number;
count?: number;
order?: Order;
}
export interface GetUserStarsCountParams {
since?: string;
until?: string;
}
export interface GetRecentlyViewedParams {
order?: Order;
offset?: number;
count?: number;
}
}
export namespace Group {
export interface GetGroupsParams {
order?: Order;
offset?: number;
count?: number;
}
export interface PostGroupsParams {
name: string;
members?: string[];
}
export interface PatchGroupParams {
name?: string;
members?: string[];
}
}
export namespace Project {
export type TextFormattingRule = "backlog" | "markdown";
export interface PostProjectParams {
name: string;
key: string;
chartEnabled: boolean;
projectLeaderCanEditProjectLeader?: boolean;
subtaskingEnabled: boolean;
textFormattingRule: TextFormattingRule;
}
export interface PatchProjectParams {
name?: string;
key?: string;
chartEnabled?: boolean;
subtaskingEnabled?: boolean;
projectLeaderCanEditProjectLeader?: boolean;
textFormattingRule?: TextFormattingRule;
archived?: boolean;
}
export interface GetProjectsParams {
archived?: boolean;
all?: boolean;
}
export interface DeleteProjectUsersParams {
userId: number;
}
export interface PostProjectAdministrators {
userId: number;
}
export interface DeleteProjectAdministrators {
userId: number;
}
export type IssueTypeColor = "#e30000" | "#990000" | "#934981" | "#814fbc" | "#2779ca" | "#007e9a" | "#7ea800" | "#ff9200" | "#ff3265" | "#666665";
export interface PostIssueTypeParams {
name: string;
color: IssueTypeColor;
}
export interface PatchIssueTypeParams {
name?: string;
color?: IssueTypeColor;
}
export interface DeleteIssueTypeParams {
substituteIssueTypeId: number;
}
export interface PostCategoriesParams {
name: string;
}
export interface PatchCategoriesParams {
name: string;
}
export interface PostVersionsParams {
name: string;
description: string;
startDate: string;
releaseDueDate: string;
}
export interface PatchVersionsParams {
name: string;
description?: string;
startDate?: string;
releaseDueDate?: string;
archived?: boolean;
}
export interface PostCustomFieldParams {
typeId: FieldType;
name: string;
applicableIssueTypes?: number[];
description?: string;
required?: boolean;
}
export interface PostCustomFieldWithNumericParams extends PostCustomFieldParams {
min?: number;
max?: number;
initialValue?: number;
unit?: string;
}
export interface PostCustomFieldWithDateParams extends PostCustomFieldParams {
min?: string;
max?: string;
initialValueType?: number;
initialDate?: string;
initialShift?: number;
}
export interface PostCustomFieldWithListParams extends PostCustomFieldParams {
items?: string[];
allowInput?: boolean;
allowAddItem?: boolean;
}
export interface PatchCustomFieldParams {
name?: string;
applicableIssueTypes?: number[];
description?: string;
required?: boolean;
}
export interface PatchCustomFieldWithNumericParams extends PatchCustomFieldParams {
min?: number;
max?: number;
initialValue?: number;
unit?: string;
}
export interface PatchCustomFieldWithDateParams extends PatchCustomFieldParams {
min?: string;
max?: string;
initialValueType?: number;
initialDate?: string;
initialShift?: number;
}
export interface PatchCustomFieldWithListParams extends PatchCustomFieldParams {
items?: string[];
allowInput?: boolean;
allowAddItem?: boolean;
}
export interface PostCustomFieldItemParams {
name: string;
}
export interface PatchCustomFieldItemParams {
name: string;
}
export interface GetSharedFilesParams {
order?: Order;
offset?: number;
count?: number;
}
export interface PostWebhookParams {
name?: string;
description?: string;
hookUrl?: string;
allEvent?: boolean;
activityTypeIds?: number[];
}
export interface PatchWebhookParams {
name?: string;
description?: string;
hookUrl?: string;
allEvent?: boolean;
activityTypeIds?: number[];
}
export enum FieldType {
Text = 1,
TextArea = 2,
Numeric = 3,
Date = 4,
SingleList = 5,
MultipleList = 6,
CheckBox = 7,
Radio = 8,
}
export interface PostStarParams {
issueId?: number;
commentId?: number;
wikiId?: number;
pullRequestId?: number;
pullRequestCommentId?: number;
}
}
export namespace Issue {
export interface PostIssueParams {
projectId: number;
summary: string;
priorityId: number;
issueTypeId: number;
parentIssueId?: number;
description?: string;
startDate?: string;
dueDate?: string;
estimatedHours?: number;
actualHours?: number;
categoryId?: number[];
versionId?: number[];
milestoneId?: number[];
assigneeId?: number;
notifiedUserId?: number[];
attachmentId?: number[];
[customField_: string]: any;
}
export interface PatchIssueParams {
summary?: string;
parentIssueId?: number;
description?: string;
statusId?: number;
resolutionId?: number;
startDate?: string;
dueDate?: string;
estimatedHours?: number;
actualHours?: number;
issueTypeId?: number;
categoryId?: number[];
versionId?: number[];
milestoneId?: number[];
priorityId?: number;
assigneeId?: number;
notifiedUserId?: number[];
attachmentId?: number[];
comment?: string;
[customField_: string]: any;
}
export interface GetIssuesParams {
projectId?: number[];
issueTypeId?: number[];
categoryId?: number[];
versionId?: number[];
milestoneId?: number[];
statusId?: number[];
priorityId?: number[];
assigneeId?: number[];
createdUserId?: number[];
resolutionId?: number[];
parentChild?: ParentChildType;
attachment?: boolean;
sharedFile?: boolean;
sort?: SortKey;
order?: Order;
offset?: number;
count?: number;
createdSince?: string;
createdUntil?: string;
updatedSince?: string;
updatedUntil?: string;
startDateSince?: string;
startDateUntil?: string;
dueDateSince?: string;
dueDateUntil?: string;
id?: number[];
parentIssueId?: number[];
keyword: string;
[customField_: string]: any;
}
export enum ParentChildType {
All = 0,
NotChild = 1,
Child = 2,
NotChildNotParent = 3,
Parent = 4,
}
export type SortKey = "issueType" | "category" | "version" | "milestone" | "summary" | "status" | "priority" | "attachment" | "sharedFile" | "created" | "createdUser" | "updated" | "updatedUser" | "assignee" | "startDate" | "dueDate" | "estimatedHours" | "actualHours" | "childIssue";
export interface GetIssueCommentsParams {
minId?: number;
maxId?: number;
count?: number;
order?: Order;
}
export interface PostIssueCommentsParams {
content: string;
notifiedUserId?: number[];
attachmentId?: number[];
}
export interface PatchIssueCommentParams {
content: string;
}
export interface IssueCommentNotifications {
notifiedUserId: number[];
}
export interface LinkIssueSharedFilesParams {
fileId: number[];
}
}
export namespace PullRequest {
export interface GetPullRequestsParams {
statusId?: number[];
assigneeId?: number[];
issueId?: number[];
createdUserId?: number[];
offset?: number;
count?: number;
}
export interface PostPullRequestParams {
summary: string;
description: string;
base: string;
branch: string;
issueId?: number;
assigneeId?: number;
notifiedUserId?: number[];
attachmentId?: number[];
}
export interface PatchPullRequestParams {
summary?: string;
description?: string;
issueId?: number;
assigneeId?: number;
notifiedUserId?: number[];
comment?: string[];
}
export interface GetPullRequestCommentsParams {
minId?: number;
maxId?: number;
count?: number;
order?: Order;
}
export interface PostPullRequestCommentsParams {
content: string;
notifiedUserId?: number[];
}
export interface PatchPullRequestCommentsParams {
content: string;
}
}
export namespace Wiki {
export interface PostWikiParams {
projectId: number;
name: string;
content: string;
mailNotify?: boolean;
}
export interface PatchWikiParams {
name?: string;
content?: string;
mailNotify?: boolean;
}
export interface GetWikisHistoryParams {
minId?: number;
maxId?: number;
count?: number;
order?: Order;
}
}
export namespace OAuth2 {
export interface Credentials {
clientId: string;
clientSecret: string;
}
}
}
export namespace Error {
export class BacklogError extends global.Error {
private _name;
private _url;
private _status;
private _body;
private _response;
constructor(name: BacklogErrorNameType, response: IResponse, body?: {
errors: BacklogErrorMessage[];
});
name: BacklogErrorNameType;
url: string;
status: number;
body: {
errors: BacklogErrorMessage[];
};
response: IResponse;
}
export class BacklogApiError extends BacklogError {
constructor(response: IResponse, body?: {
errors: BacklogErrorMessage[];
});
}
export class BacklogAuthError extends BacklogError {
constructor(response: IResponse, body?: {
errors: BacklogErrorMessage[];
});
}
export class UnexpectedError extends BacklogError {
constructor(response: IResponse);
}
export interface BacklogErrorMessage {
message: string;
code: number;
errorInfo: string;
moreInfo: string;
}
export type BacklogErrorNameType = 'BacklogApiError' | 'BacklogAuthError' | 'UnexpectedError';
}
}
+24
View File
@@ -0,0 +1,24 @@
/// <reference path="./base16.d.ts" />
import * as base16 from 'base16';
const colorScheme: base16.ColorScheme = base16.solarized
const scheme: string = colorScheme.scheme
const author: string = colorScheme.author
const base00: string = colorScheme.base00
const base01: string = colorScheme.base01
const base02: string = colorScheme.base02
const base03: string = colorScheme.base03
const base04: string = colorScheme.base04
const base05: string = colorScheme.base05
const base06: string = colorScheme.base06
const base07: string = colorScheme.base07
const base08: string = colorScheme.base08
const base09: string = colorScheme.base09
const base0A: string = colorScheme.base0A
const base0B: string = colorScheme.base0B
const base0C: string = colorScheme.base0C
const base0D: string = colorScheme.base0D
const base0E: string = colorScheme.base0E
const base0F: string = colorScheme.base0F
+70
View File
@@ -0,0 +1,70 @@
// Type definitions for base16-js 1.0.0
// Project: https://github.com/gaearon/base16-js
// Definitions by: Alec Hill <https://github.com/alechill>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'base16' {
/**
* Type describing a syntax highlighting scheme as a JS object, as used in redux dev tools
* Based on https://github.com/chriskempson/base16
*/
export interface ColorScheme {
scheme: string
author: string
base00: string
base01: string
base02: string
base03: string
base04: string
base05: string
base06: string
base07: string
base08: string
base09: string
base0A: string
base0B: string
base0C: string
base0D: string
base0E: string
base0F: string
}
// predefined schemes...
export var threezerotwofour: ColorScheme
export var apathy: ColorScheme
export var ashes: ColorScheme
export var atelierDune: ColorScheme
export var atelierForest: ColorScheme
export var atelierHeath: ColorScheme
export var atelierLakeside: ColorScheme
export var atelierSeaside: ColorScheme
export var bespin: ColorScheme
export var brewer: ColorScheme
export var bright: ColorScheme
export var chalk: ColorScheme
export var codeschool: ColorScheme
export var colors: ColorScheme
export var eighties: ColorScheme
export var embers: ColorScheme
export var flat: ColorScheme
export var google: ColorScheme
export var grayscale: ColorScheme
export var greenscreen: ColorScheme
export var harmonic: ColorScheme
export var hopscotch: ColorScheme
export var isotope: ColorScheme
export var marrakesh: ColorScheme
export var monokai: ColorScheme
export var ocean: ColorScheme
export var paraiso: ColorScheme
export var pop: ColorScheme
export var railscasts: ColorScheme
export var shapeshifter: ColorScheme
export var solarized: ColorScheme
export var summerfruit: ColorScheme
export var tomorrow: ColorScheme
export var tube: ColorScheme
export var twilight: ColorScheme
}
+74
View File
@@ -0,0 +1,74 @@
// Type definitions for base64url v2.0.0
// Project: https://github.com/brianloveswords/base64url
// Definitions by: Stepan Miroshin <https://github.com/microshine>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/**
* For encoding and decoding base64url!
* v2.0.0
*/
/**
* Encoding type
*/
declare type Encoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "utf16le" | "base64" | "binary" | "hex"
interface IBase64Url {
/**
* Encode input to base64url
* @param {string} input Incoming input
* @param {Encoding} encoding Default 'utf8'
* @return {string}
*/
(input: string, encoding?: Encoding): string;
/**
* Encode input to base64url
* @param {Buffer} input Incoming value
*/
(inout: Buffer): string;
/**
* Encode input to base64url
*
* @param {string} input Incoming input
* @param {Encoding} encoding Default 'utf8'
* @returns {string}
*/
encode(input: string, encoding?: Encoding): string;
/**
* Encode input to base64url
* @param {Buffer} input Incoming value
*/
encode(input: Buffer): string;
/**
* Convert a base64url encoded string into a raw string.
* @param {string} base64url base64url encoded string
* @param {Encoding} encoding Encoding defaults to 'utf8'
* @returns {string}
*/
decode(base64url: string, encoding?: string): string;
/**
* Convert a base64url encoded string to a base64 encoded string
* @param {string | Buffer} base64url base64url encoded value
* @returns {string}
*/
toBase64(base64url: string | Buffer): string;
/**
* Convert a base64 encoded string to a base64url encoded string
* @param {string} base64 encoded string
* @returns {string}
*/
fromBase64(base64: string): string;
/**
* Convert a base64url encoded string to a Buffer
* @param {string} base64url encoded string
* @returns {Buffer}
*/
toBuffer(base64url: string): Buffer;
}
declare module "base64url" {
const base64url: IBase64Url;
export = base64url;
}
+26
View File
@@ -0,0 +1,26 @@
/// <reference path="./base64url.d.ts" />
import * as base64url from "base64url";
// default
let str = base64url("some value");
str = base64url("some value", "hex");
str = base64url(new Buffer("some value"));
// encode
str = base64url.encode("some value");
str = base64url.encode("some value", "hex");
str = base64url.encode(new Buffer("some value"));
// decode
str = base64url.decode("ADA=");
str = base64url.decode("ADA=", "binary");
// toBase64
str = base64url.toBase64("ADA=");
str = base64url.toBase64(new Buffer("ADA=", "base64"));
// fromBase64
str = base64url.fromBase64("ADA=");
let buf = base64url.toBase64("ADA=");
@@ -0,0 +1,12 @@
/// <reference path="bazinga-translator.d.ts" />
Translator.fallback = 'en';
Translator.defaultDomain = 'messages';
Translator.add("test", "it work", "frontend", "en");
Translator.trans('key', {}, 'frontend');
Translator.trans('key', {"foo": "bar"}, 'DOMAIN_NAME');
Translator.transChoice('key', 1, {}, 'frontend');
Translator.transChoice('key', 123, {"foo": "bar"}, 'DOMAIN_NAME');
+99
View File
@@ -0,0 +1,99 @@
// Type definitions for Translator
// Project: https://github.com/willdurand/BazingaJsTranslationBundle
// Definitions by: Alex <https://github.com/alexndlm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface BazingaTranslator {
/**
* The current locale.
*
* @type {String}
*/
locale: string;
/**
* Fallback locale.
*
* @type {String}
*/
fallback: string;
/**
* Placeholder prefix.
*
* @type {String}
*/
placeHolderPrefix: string;
/**
* Placeholder suffix.
*
* @type {String}
*/
placeHolderSuffix: string;
/**
* Default domain.
*
* @type {String}
*/
defaultDomain: string;
/**
* Plural separator.
*
* @type {String}
*/
pluralSeparator: string;
/**
* Adds a translation entry.
*
* @param {String} id The message id
* @param {String} message The message to register for the given id
* @param {String} [domain] The domain for the message or null to use the default
* @param {String} [locale] The locale or null to use the default
*
* @return {Object} Translator
*/
add(id: string, message: string, domain: string, locale: string): BazingaTranslator;
/**
* Translates the given message.
*
* @param {String} id The message id
* @param {Object} [parameters] An array of parameters for the message
* @param {String} [domain] The domain for the message or null to guess it
* @param {String} [locale] The locale or null to use the default
*
* @return {String} The translated string
*/
trans(id: string, parameters: any, domain: string, locale?: string): string;
/**
* Translates the given choice message by choosing a translation according to a number.
*
* @param {String} id The message id
* @param {Number} number The number to use to find the indice of the message
* @param {Object} [parameters] An array of parameters for the message
* @param {String} [domain] The domain for the message or null to guess it
* @param {String} [locale] The locale or null to use the default
*
* @return {String} The translated string
*/
transChoice(id: string, number: number, parameters: any, domain: string, locale?: string): string,
/**
* Loads translations from JSON.
*
* @param {String} data A JSON string or object literal
*
* @return {Object} Translator
*/
fromJSON(data: string): BazingaTranslator;
reset(): void;
}
declare var Translator: BazingaTranslator;
+18 -16
View File
@@ -1,27 +1,29 @@
/// <reference path="./bezier-js.d.ts" />
function test() {
var bezierjs: typeof BezierJs;
var bezier = new bezierjs.Bezier([1,2,3,4]);
var bezier = new bezierjs.Bezier([1, 2, 3, 4]);
var cap = new bezierjs.BezierCap([]);
var point: BezierJs.Point = { x: 0, y: 0 };
var utils = bezier.getUtils();
var line: BezierJs.Line = { p1: { x:0, y: 0}, p2: {x:1, y: 1}};
var line: BezierJs.Line = { p1: { x: 0, y: 0 }, p2: { x: 1, y: 1 } };
var abc: BezierJs.ABC = { A: null, B: null, C: null };
var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1 };
var bbox: BezierJs.BBox = bezier.bbox();
var closest: BezierJs.Closest = { mdist: 1, mpos: 0 };
var inflection: BezierJs.Inflection = { values: null, x: [0], y: [0], z:[0] };
var closest: BezierJs.Closest = { mdist: 1, mpos: 0 };
var inflection: BezierJs.Inflection = { values: null, x: [0], y: [0], z: [0] };
var minmax: BezierJs.MinMax = { min: 0, max: 0 };
var offset: BezierJs.Offset = { x: 0, y: 0, c: point, n: point };
var pair: BezierJs.Pair = { left: bezier, right: bezier };
var poly: BezierJs.PolyBezier = bezier.outline(1);
var projection: BezierJs.Projection = { x: 0, y: 0, t: 9, d: 4 };
var shape: BezierJs.Shape = { startcap: cap, endcap: cap, forward: bezier, back: bezier, bbox: bbox };
var shape: BezierJs.Shape = {
startcap: cap, endcap: cap, forward: bezier, back: bezier, bbox: bbox, intersections: function (shape) { return [[0]]; }
};
var split: BezierJs.Split = { left: bezier, right: bezier, span: [point] };
bezier.arcs();
bezier.clockwise;
bezier.compute(.5);
@@ -36,10 +38,10 @@ function test() {
bezier.length();
bezier.lineIntersects(line);
bezier.normal(0);
bezier.offset(1,2);
bezier.offset(1, 2);
bezier.on(point, 0);
bezier.order = 5;
bezier.outlineshapes(1,3);
bezier.outlineshapes(1, 3);
bezier.overlaps(bezier);
bezier.point(9);
bezier.project(point);
@@ -52,9 +54,9 @@ function test() {
bezier.split(0.5).left;
bezier.toSVG();
bezier.update();
cap.virtual = true;
poly.addCurve(bezier);
poly.bbox();
poly.curve(7);
@@ -62,12 +64,12 @@ function test() {
poly.length();
poly.offset(9).points[0].y;
poly.points[0];
utils.abcratio(0, 1);
utils.align([point], line);
utils.angle(point, point, point);
utils.approximately(5, 7, .001);
utils.arcfn(1, function(){});
utils.arcfn(1, function () { });
utils.bboxoverlap(bbox, bbox);
utils.between(0, 0, 1);
utils.closest([point], point);
@@ -78,7 +80,7 @@ function test() {
utils.findbbox([bezier]);
utils.getccenter(point, point, point);
utils.getminmax(bezier, 'x', [0]);
utils.length(function(){});
utils.length(function () { });
utils.lerp(1, point, point);
utils.lli(offset, offset);
utils.lli4(point, point, point, point);
@@ -92,5 +94,5 @@ function test() {
utils.roots([point], line);
utils.round(.999, .001);
utils.shapeintersections(shape, bbox, shape, bbox);
}
+10 -9
View File
@@ -57,6 +57,7 @@ declare module BezierJs {
back: Bezier;
endcap: BezierCap;
bbox: BBox;
intersections: (shape: Shape) => string[][] | number[][];
}
interface ABC {
A: Point;
@@ -76,8 +77,8 @@ declare module BezierJs {
*
*/
class Bezier {
clockwise: boolean;
private _linear;
clockwise: boolean;
_3d: boolean;
_t1: number;
_t2: number;
@@ -124,16 +125,16 @@ declare module BezierJs {
overlaps(curve: Bezier): boolean;
offset(t: number, d?: number): Offset | Bezier[];
simple(): boolean;
reduce(): any[];
reduce(): Bezier[];
scale(d: Function): Bezier;
scale(d: number): Bezier;
outline(d1: number, d2?: number, d3?: number, d4?: number): PolyBezier;
outlineshapes(d1: number, d2: number): Shape[];
intersects(curve: Bezier): string[] | number[];
outlineshapes(d1: number, d2: number, curveIntersectionThreshold?: number): Shape[];
intersects(curve: Bezier, curveIntersectionThreshold?: number): string[] | number[];
intersects(curve: Line): string[] | number[];
lineIntersects(line: Line): number[];
selfintersects(): string[];
curveintersects(c1: Bezier[], c2: Bezier[]): string[];
selfintersects(curveIntersectionThreshold?: number): string[];
curveintersects(c1: Bezier[], c2: Bezier[], curveIntersectionThreshold?: number): string[];
arcs(errorThreshold?: number): Arc[];
private _error(pc, np1, s, e);
private _iterate(errorThreshold, circles);
@@ -165,8 +166,8 @@ declare module BezierJs.utils {
function lli(v1: Offset, v2: Offset): Point;
function makeline(p1: Point, p2: Point): Bezier;
function findbbox(sections: Bezier[]): BBox;
function shapeintersections(s1: Shape, bbox1: BBox, s2: Shape, bbox2: BBox): string[][] | number[][];
function makeshape(forward: Bezier, back: Bezier): Shape;
function shapeintersections(s1: Shape, bbox1: BBox, s2: Shape, bbox2: BBox, curveIntersectionThreshold?: number): string[][] | number[][];
function makeshape(forward: Bezier, back: Bezier, curveIntersectionThreshold?: number): Shape;
function getminmax(curve: Bezier, d: string, list: number[]): MinMax;
function align(points: Point[], line: Line): Point[];
function roots(points: Point[], line: Line): number[];
@@ -174,7 +175,7 @@ declare module BezierJs.utils {
function inflections(points: Point[]): number[];
function bboxoverlap(b1: BBox, b2: BBox): boolean;
function expandbox(bbox: BBox, _bbox: BBox): void;
function pairiteration(c1: Bezier, c2: Bezier): string[];
function pairiteration(c1: Bezier, c2: Bezier, curveIntersectionThreshold?: number): string[];
function getccenter(p1: Point, p2: Point, p3: Point): Arc;
}
declare module BezierJs {
+17 -1
View File
@@ -12,6 +12,7 @@
*/
import BigJS = BigJsLibrary.BigJS;
function constructorTests() {
var x = new Big(9) // '9'
var y = new Big(x) // '9'
@@ -247,4 +248,19 @@ function testMultipleConstructors() {
x.div(3) // 1.667
y.div(3) // 1.6666666667
}
}
function multipleTypesAccepted(n: number | BigJS | string) {
var y = Big(n)
.minus(n)
.mod(n)
.plus(n)
.times(n);
y.cmp(n);
y.eq(n);
y.gt(n);
y.gte(n);
y.lt(n);
y.lte(n);
y.div(n)
}
+16 -82
View File
@@ -25,23 +25,11 @@ declare namespace BigJsLibrary {
RM: RoundingMode;
}
type BigNumberInputType = number | string | BigJS;
interface BigJS_Constructors {
/** A decimal value. */
new (value: number): BigJS;
/** A decimal value.
String values may be in exponential, as well as normal (non-exponential) notation. There is no limit to the number of digits of a string value (other than that of Javascript's maximum array size), but the largest recommended exponent magnitude is 1e+6. Infinity, NaN and hexadecimal literal strings, e.g. '0xff', are not valid.
String values in octal literal form will be interpreted as decimals, e.g. '011' is 11, not 9. */
new (value: string): BigJS;
/** A decimal value. */
new (value: BigJS): BigJS;
/** A decimal value. */
(value: number): BigJS;
/** A decimal value.
String values may be in exponential, as well as normal (non-exponential) notation. There is no limit to the number of digits of a string value (other than that of Javascript's maximum array size), but the largest recommended exponent magnitude is 1e+6. Infinity, NaN and hexadecimal literal strings, e.g. '0xff', are not valid.
String values in octal literal form will be interpreted as decimals, e.g. '011' is 11, not 9. */
(value: string): BigJS;
/** A decimal value. */
(value: BigJS): BigJS;
new (value: BigNumberInputType): BigJS;
(value: BigNumberInputType): BigJS;
/** A decimal value. */
(): BigJS;
@@ -57,85 +45,35 @@ declare namespace BigJsLibrary {
1 = If the value of this Big number is greater than the value of n
-1 = If the value of this Big number is less than the value of n
0 = If this Big number and n have the same value */
cmp(n: number): number;
/** Compare
@returns {Number}
1 = If the value of this Big number is greater than the value of n
-1 = If the value of this Big number is less than the value of n
0 = If this Big number and n have the same value */
cmp(n: string): number;
/** Compare
@returns {Number}
1 = If the value of this Big number is greater than the value of n
-1 = If the value of this Big number is less than the value of n
0 = If this Big number and n have the same value */
cmp(n: BigJS): number;
cmp(n: BigNumberInputType): number;
/** Returns a Big number whose value is the value of this Big number divided by n. */
div(n: number): BigJS;
/** Returns a Big number whose value is the value of this Big number divided by n. */
div(n: string): BigJS;
/** Returns a Big number whose value is the value of this Big number divided by n. */
div(n: BigJS): BigJS;
div(n: BigNumberInputType): BigJS;
/** Returns true if the value of this Big equals the value of n, otherwise returns false. */
eq(n: number): boolean;
/** Returns true if the value of this Big equals the value of n, otherwise returns false. */
eq(n: string): boolean;
/** Returns true if the value of this Big equals the value of n, otherwise returns false. */
eq(n: BigJS): boolean;
eq(n: BigNumberInputType): boolean;
/** Returns true if the value of this Big is greater than the value of n, otherwise returns false. */
gt(n: number): boolean;
/** Returns true if the value of this Big is greater than the value of n, otherwise returns false. */
gt(n: string): boolean;
/** Returns true if the value of this Big is greater than the value of n, otherwise returns false. */
gt(n: BigJS): boolean;
gt(n: BigNumberInputType): boolean;
/** Returns true if the value of this Big is greater than or equal to the value of n, otherwise returns false. */
gte(n: number): boolean;
/** Returns true if the value of this Big is greater than or equal to the value of n, otherwise returns false. */
gte(n: string): boolean;
/** Returns true if the value of this Big is greater than or equal to the value of n, otherwise returns false. */
gte(n: BigJS): boolean;
gte(n: BigNumberInputType): boolean;
/** Returns true if the value of this Big is less than the value of n, otherwise returns false. */
lt(n: number): boolean;
/** Returns true if the value of this Big is less than the value of n, otherwise returns false. */
lt(n: string): boolean;
/** Returns true if the value of this Big is less than the value of n, otherwise returns false. */
lt(n: BigJS): boolean;
lt(n: BigNumberInputType): boolean;
/** Returns true if the value of this Big is less than or equal to the value of n, otherwise returns false. */
lte(n: number): boolean;
/** Returns true if the value of this Big is less than or equal to the value of n, otherwise returns false. */
lte(n: string): boolean;
/** Returns true if the value of this Big is less than or equal to the value of n, otherwise returns false. */
lte(n: BigJS): boolean;
lte(n: BigNumberInputType): boolean;
/** Returns a Big number whose value is the value of this Big number minus n. */
minus(n: number): BigJS;
/** Returns a Big number whose value is the value of this Big number minus n. */
minus(n: string): BigJS;
/** Returns a Big number whose value is the value of this Big number minus n. */
minus(n: BigJS): BigJS;
minus(n: BigNumberInputType): BigJS;
/** Returns a Big number whose value is the value of this Big number modulo n, i.e. the integer remainder of dividing this Big number by n.
The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */
mod(n: number): BigJS;
/** Returns a Big number whose value is the value of this Big number modulo n, i.e. the integer remainder of dividing this Big number by n.
The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */
mod(n: string): BigJS;
/** Returns a Big number whose value is the value of this Big number modulo n, i.e. the integer remainder of dividing this Big number by n.
The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */
mod(n: BigJS): BigJS;
The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */
mod(n: BigNumberInputType): BigJS;
/** Returns a Big number whose value is the value of this Big number plus n. */
plus(n: number): BigJS;
/** Returns a Big number whose value is the value of this Big number plus n. */
plus(n: string): BigJS;
/** Returns a Big number whose value is the value of this Big number plus n. */
plus(n: BigJS): BigJS;
plus(n: BigNumberInputType): BigJS;
/** Returns a Big number whose value is the value of this Big number raised to the power exp.
If exp is negative and the result has more fraction digits than is specified by Big.DP, it will be rounded to Big.DP decimal places using rounding mode Big.RM.
@@ -156,11 +94,7 @@ declare namespace BigJsLibrary {
sqrt(): BigJS;
/** Returns a Big number whose value is the value of this Big number times n. */
times(n: number): BigJS;
/** Returns a Big number whose value is the value of this Big number times n. */
times(n: string): BigJS;
/** Returns a Big number whose value is the value of this Big number times n. */
times(n: BigJS): BigJS;
times(n: BigNumberInputType): BigJS;
/** Returns a string representing the value of this Big number in exponential notation to a fixed number of decimal places dp. */
toExponential(): string;
+773
View File
@@ -0,0 +1,773 @@
///<reference path="blessed.d.ts" />
import * as blessed from 'blessed';
let screen: blessed.Widgets.Screen = null;
// https://github.com/chjj/blessed/blob/master/test/widget-autopad.js
screen = blessed.screen({
dump: __dirname + '/logs/autopad.log',
smartCSR: true,
autoPadding: true,
warnings: true
});
var box1 = blessed.box({
parent: screen,
top: 'center',
left: 'center',
width: 20,
height: 10,
border: 'line'
});
var box2 = blessed.box({
parent: box1,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line'
});
screen.key('q', function() {
return screen.destroy();
});
screen.render();
// https://github.com/chjj/blessed/blob/master/test/widget-bigtext.js
screen = blessed.screen({
dump: __dirname + '/logs/bigtext.log',
smartCSR: true,
warnings: true
});
var box = blessed.bigtext({
parent: screen,
content: 'Hello',
shrink: true,
width: '80%',
// height: '80%',
height: 'shrink',
// width: 'shrink',
border: 'line',
fch: ' ',
ch: '\u2592',
style: {
fg: 'red',
bg: 'blue',
bold: false
}
});
screen.key('q', function() {
return screen.destroy();
});
screen.render();
// https://github.com/chjj/blessed/blob/master/test/widget-csr.js
screen = blessed.screen({
dump: __dirname + '/logs/csr.log',
smartCSR: true,
warnings: true
});
var lorem = require('fs').readFileSync(__dirname + '/git.diff', 'utf8');
var cleanSides = screen.cleanSides;
function expectClean(value: any) {
screen.cleanSides = function(el: blessed.widget.Element) {
var ret = cleanSides.apply(this, arguments);
if (ret !== value) {
throw new Error('Failed. Expected '
+ value + ' from cleanSides. Got '
+ ret + '.');
}
return ret;
};
}
var btext = blessed.box({
parent: screen,
left: 'center',
top: 'center',
width: '80%',
height: '80%',
style: {
bg: 'green'
},
border: 'line',
content: 'CSR should still work.'
});
let _oscroll = btext.scroll;
btext.scroll = function(offset, always) {
expectClean(true);
return _oscroll(offset, always);
};
var text = blessed.scrollabletext({
parent: screen,
content: lorem,
border: 'line',
left: 'center',
top: 'center',
draggable: true,
width: '50%',
height: '50%',
mouse: true,
keys: true,
vi: true
});
_oscroll = text.scroll;
text.scroll = function(offset, always) {
var el = this;
var value = true;
if (el.left < 0) value = true;
if (el.top < 0) value = false;
if (el.left + el.width > screen.width) value = true;
if (el.top + el.height > screen.height) value = false;
expectClean(value);
return _oscroll(offset, always);
};
text.focus();
screen.key('q', function() {
return screen.destroy();
});
screen.render();
// https://github.com/chjj/blessed/blob/master/test/widget-dock-noborder.js
screen = blessed.screen({
dump: __dirname + '/logs/dock.log',
smartCSR: true,
dockBorders: true,
warnings: true
});
blessed.box({
parent: screen,
left: -1,
top: -1,
width: '50%+1',
height: '50%+1',
border: 'line',
content: 'Foo'
});
blessed.box({
parent: screen,
left: '50%-1',
top: -1,
width: '50%+3',
height: '50%+1',
content: 'Bar',
border: 'line'
});
blessed.box({
parent: screen,
left: -1,
top: '50%-1',
width: '50%+1',
height: '50%+3',
border: 'line',
content: 'Foo'
});
blessed.listtable({
parent: screen,
left: '50%-1',
top: '50%-1',
width: '50%+3',
height: '50%+3',
border: 'line',
align: 'center',
tags: true,
keys: true,
vi: true,
mouse: true,
style: {
header: {
fg: 'blue',
bold: true
},
cell: {
fg: 'magenta',
selected: {
bg: 'blue'
}
}
},
data: [
[ 'Animals', 'Foods', 'Times', 'Numbers' ],
[ 'Elephant', 'Apple', '1:00am', 'One' ],
[ 'Bird', 'Orange', '2:15pm', 'Two' ],
[ 'T-Rex', 'Taco', '8:45am', 'Three' ],
[ 'Mouse', 'Cheese', '9:05am', 'Four' ]
]
}).focus();
screen.key('q', function() {
return screen.destroy();
});
screen.render();
// https://raw.githubusercontent.com/chjj/blessed/master/example/simple-form.js
var form = blessed.form({
parent: screen,
keys: true,
left: 0,
top: 0,
width: 30,
height: 4,
bg: 'green',
content: 'Submit or cancel?'
});
var submit = blessed.button({
parent: form,
mouse: true,
keys: true,
padding: {
left: 1,
right: 1
},
left: 10,
top: 2,
shrink: true,
name: 'submit',
content: 'submit',
style: {
bg: 'blue',
focus: {
bg: 'red'
},
hover: {
bg: 'red'
}
}
});
var cancel = blessed.button({
parent: form,
mouse: true,
keys: true,
padding: {
left: 1,
right: 1
},
left: 20,
top: 2,
shrink: true,
name: 'cancel',
content: 'cancel',
style: {
bg: 'blue',
focus: {
bg: 'red'
},
hover: {
bg: 'red'
}
}
});
// https://github.com/chjj/blessed/blob/master/test/widget-layout.js
screen = blessed.screen({
dump: __dirname + '/logs/layout.log',
smartCSR: true,
autoPadding: true,
warnings: true
});
var layout = blessed.layout({
parent: screen,
top: 'center',
left: 'center',
width: '50%',
height: '50%',
border: 'line',
layout: process.argv[2] === 'grid' ? 'grid' : 'inline',
style: {
bg: 'red',
border: {
fg: 'blue'
}
}
});
var box1 = blessed.box({
parent: layout,
top: 'center',
left: 'center',
width: 20,
height: 10,
border: 'line',
content: '1'
});
var box2 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '2'
});
var box3 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '3'
});
var box4 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '4'
});
var box5 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '5'
});
var box6 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '6'
});
var box7 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '7'
});
var box8 = blessed.box({
parent: layout,
top: 'center',
left: 'center',
width: 20,
height: 10,
border: 'line',
content: '8'
});
var box9 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '9'
});
var box10 = blessed.box({
parent: layout,
top: 'center',
left: 'center',
width: 20,
height: 10,
border: 'line',
content: '10'
});
var box11 = blessed.box({
parent: layout,
top: 0,
left: 0,
width: 10,
height: 5,
border: 'line',
content: '11'
});
var box12 = blessed.box({
parent: layout,
top: 'center',
left: 'center',
width: 20,
height: 10,
border: 'line',
content: '12'
});
if (process.argv[2] !== 'grid') {
for (var i = 0; i < 10; i++) {
blessed.box({
parent: layout,
// width: i % 2 === 0 ? 10 : 20,
// height: i % 2 === 0 ? 5 : 10,
width: Math.random() > 0.5 ? 10 : 20,
height: Math.random() > 0.5 ? 5 : 10,
border: 'line',
content: (i + 1 + 12) + ''
});
}
}
screen.key('q', function() {
return screen.destroy();
});
screen.render();
// https://github.com/chjj/blessed/blob/master/test/widget-form.js
screen = blessed.screen({
dump: __dirname + '/logs/form.log',
warnings: true
});
type FormData = {
radio1: boolean;
radio2: boolean;
text: string;
check: boolean;
};
var form2 = blessed.form<FormData>({
parent: screen,
mouse: true,
keys: true,
vi: true,
left: 0,
top: 0,
width: '100%',
//height: 12,
style: {
bg: 'green',
border: {
inverse: true
},
scrollbar: {
inverse: true
}
},
content: 'foobar',
scrollable: true,
scrollbar: {
ch: ' '
}
//alwaysScroll: true
});
form2.on('submit', (data) => {
output.setContent(JSON.stringify(data, null, 2));
screen.render();
});
form2.key('d', function() {
form2.scroll(1, true);
screen.render();
});
form2.key('u', function() {
form2.scroll(-1, true);
screen.render();
});
var set = blessed.radioset({
parent: form2,
left: 1,
top: 1,
shrink: true,
//padding: 1,
//content: 'f',
style: {
bg: 'magenta'
}
});
var radio1 = blessed.radiobutton({
parent: set,
mouse: true,
keys: true,
shrink: true,
style: {
bg: 'magenta'
},
height: 1,
left: 0,
top: 0,
name: 'radio1',
content: 'radio1'
});
var radio2 = blessed.radiobutton({
parent: set,
mouse: true,
keys: true,
shrink: true,
style: {
bg: 'magenta'
},
height: 1,
left: 15,
top: 0,
name: 'radio2',
content: 'radio2'
});
var text2 = blessed.textbox({
parent: form2,
mouse: true,
keys: true,
style: {
bg: 'blue'
},
height: 1,
width: 20,
left: 1,
top: 3,
name: 'text'
});
text2.on('focus', function() {
text2.readInput();
});
var check = blessed.checkbox({
parent: form2,
mouse: true,
keys: true,
shrink: true,
style: {
bg: 'magenta'
},
height: 1,
left: 28,
top: 1,
name: 'check',
content: 'check'
});
var check2 = blessed.checkbox({
parent: form2,
mouse: true,
keys: true,
shrink: true,
style: {
bg: 'magenta'
},
height: 1,
left: 28,
top: 14,
name: 'foooooooo2',
content: 'foooooooo2'
});
var submit = blessed.button({
parent: form2,
mouse: true,
keys: true,
shrink: true,
padding: {
left: 1,
right: 1
},
left: 29,
top: 3,
name: 'submit',
content: 'submit',
style: {
bg: 'blue',
focus: {
bg: 'red'
}
}
});
submit.on('press', function() {
form2.submit();
});
var box1 = blessed.box({
parent: form2,
left: 1,
top: 10,
height: 10,
width: 10,
content: 'one',
style: {
bg: 'cyan'
}
});
var box2 = blessed.box({
parent: box1,
left: 1,
top: 2,
height: 8,
width: 9,
content: 'two',
style: {
bg: 'magenta'
}
});
var box3 = blessed.box({
parent: box2,
left: 1,
top: 2,
height: 6,
width: 8,
content: 'three',
style: {
bg: 'yellow'
}
});
var box4 = blessed.box({
parent: box3,
left: 1,
top: 2,
height: 4,
width: 7,
content: 'four',
style: {
bg: 'blue'
}
});
var output = blessed.scrollabletext({
parent: form2,
mouse: true,
keys: true,
left: 0,
top: 20,
height: 5,
right: 0,
style: {
bg: 'red'
},
content: 'foobar'
});
var bottom = blessed.line({
parent: form2,
type: 'line',
orientation: 'horizontal',
left: 0,
right: 0,
top: 50,
style: {
fg: 'blue'
}
});
screen.key('q', function() {
return screen.destroy();
});
form2.focus();
form2.submit();
screen.render();
// https://github.com/chjj/blessed/blob/master/test/widget-table.js
screen = blessed.screen({
dump: __dirname + '/logs/table.log',
autoPadding: false,
fullUnicode: true,
warnings: true
});
var DU = '杜';
var JUAN = '鹃';
var table = blessed.table({
//parent: screen,
top: 'center',
left: 'center',
data: null,
border: 'line',
align: 'center',
tags: true,
//width: '80%',
width: 'shrink',
style: {
border: {
fg: 'red'
},
header: {
fg: 'blue',
bold: true
},
cell: {
fg: 'magenta'
}
}
});
var data1 = [
[ 'Animals', 'Foods', 'Times' ],
[ 'Elephant', 'Apple', '1:00am' ],
[ 'Bird', 'Orange', '2:15pm' ],
[ 'T-Rex', 'Taco', '8:45am' ],
[ 'Mouse', 'Cheese', '9:05am' ]
];
data1[1][0] = '{red-fg}' + data1[1][0] + '{/red-fg}';
data1[2][0] += ' (' + DU + JUAN + ')';
var data2 = [
[ 'Animals', 'Foods', 'Times', 'Numbers' ],
[ 'Elephant', 'Apple', '1:00am', 'One' ],
[ 'Bird', 'Orange', '2:15pm', 'Two' ],
[ 'T-Rex', 'Taco', '8:45am', 'Three' ],
[ 'Mouse', 'Cheese', '9:05am', 'Four' ]
];
data2[1][0] = '{red-fg}' + data2[1][0] + '{/red-fg}';
data2[2][0] += ' (' + DU + JUAN + ')';
screen.key('q', function() {
return screen.destroy();
});
table.setData(data2);
screen.append(table);
screen.render();
setTimeout(function() {
table.setData(data1);
screen.render();
}, 3000);
+2812 -1247
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,5 +1,5 @@
/// <reference path="../node/node.d.ts" />
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
/// <reference path="blue-tape.d.ts" />
import tape = require('blue-tape');
+2 -2
View File
@@ -1,5 +1,5 @@
/// <reference path="bluebird-retry.d.ts" />
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path="../bluebird/bluebird-2.0.d.ts" />
import Promise = require('bluebird');
import retry = require('bluebird-retry');
@@ -32,4 +32,4 @@ var options:retry.Options = {
interval: 500
};
retry(logFail, options);
retry(logFail, options);

Some files were not shown because too many files have changed in this diff Show More