Merge branch 'types-2.0' of https://github.com/DefinitelyTyped/DefinitelyTyped into types-2.0

* 'types-2.0' of https://github.com/DefinitelyTyped/DefinitelyTyped: (212 commits)
  Adding typing for disposable-email-domains
  Fix tests, rename things to `index.d.ts`, use `<reference types="xxx">`, and add `tsconfig.json`s.
  Add d3-scale-chromatic definitions and tests.
  Fix tabs
  Added missing method sync()
  adds type parameter to mongoose.types.array fixes #11291
  Update react-native.d.ts
  [knex] Fix MigratorConfig according to docs.
  Switch to an optional Page.Lookup value param since only Xrm.Utility.openQuickCreate expects a param
  Remove unneeded fields from package.json
  Add optional parameter to SuccessCallbackDelegate so openQuickCreate test will pass
  Comment out openQuickCreate test. Not sure why it fails
  Add null for optional parameters
  Change type of newRecord to Page.LookupValue
  Fix test for openQuickCreate to pass Travis build
  Removed optional flag from parameters from .every() methods.
  Adding typing for koa-logger
  consistently indentations
  removed randomColor (windows casesensitive problem)
  added string unions for luminosity, hue, format Hue can also be a number
  ...

# Conflicts:
#	pg-pool/index.d.ts
#	pg-pool/tsconfig.json
This commit is contained in:
Leo Liang
2016-09-23 12:35:17 +08:00
711 changed files with 31673 additions and 16491 deletions
-2
View File
@@ -1,5 +1,3 @@
/// <reference path="3d-bin-packing.d.ts" />
import packer = require("3d-bin-packing");
import samchon = require("samchon-framework");
+5 -5
View File
@@ -3,11 +3,11 @@
// Definitions by: Jeongho Nam <http://samchon.org>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../typescript-stl/typescript-stl.d.ts" />
/// <reference path="../samchon-framework/samchon-framework.d.ts" />
/// <reference path="../react/react-global.d.ts" />
/// <reference path="../react-data-grid/react-data-grid.d.ts" />
/// <reference path="../threejs/three.d.ts" />
/// <reference types="typescript-stl" />
/// <reference types="samchon-framework" />
/// <reference types="react" />
/// <reference types="react-data-grid" />
/// <reference types="three" />
declare module "3d-bin-packing"
{
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"3d-bin-packing.d.ts",
"3d-bin-packing-tests.ts"
]
}
+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)
@@ -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;
}
}
+4 -1
View File
@@ -132,7 +132,10 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
});
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 = {
+2 -1
View File
@@ -175,7 +175,8 @@ declare module 'angular' {
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;
}
@@ -1,5 +1,3 @@
///<reference path="angular-q-spread.d.ts"/>
interface IMyService {
getFirstname(): ng.IPromise<string>;
getLastname(): ng.IPromise<string>;
+2 -2
View File
@@ -3,9 +3,9 @@
// Definitions by: rafw87 <https://github.com/rafw87>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
import * as a from "angular";
declare module angular {
declare module "angular" {
interface IPromise<T> {
/**
This method can be used as a replacement for then. Similarly, it takes two parameters, a callback when all promises are resolved and a callback for failure. The resolve callback is going to be called with the result of the list of promises passed to $q.all as separate parameters instead of one parameters which is an array.
+19
View File
@@ -0,0 +1,19 @@
{
"files": [
"angular-q-spread.d.ts",
"angular-q-spread-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": false
}
}
+14 -3
View File
@@ -39,15 +39,20 @@ declare module 'angular' {
(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
@@ -181,6 +186,12 @@ declare module '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;
}
}
}
declare global {
+14 -3
View File
@@ -379,18 +379,29 @@ declare module 'angular' {
* @default 'model-open'
*/
openedClass?: string;
/**
* CSS class(es) to be added to the top modal window.
*/
*/
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 {
+2 -1
View File
@@ -46,8 +46,9 @@ declare module 'angular' {
topVisibleScope: ng.IRepeatScope;
/**
* 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.
*
+129 -127
View File
@@ -3,155 +3,157 @@
// Definitions by: Nick Veys <https://github.com/nickveys>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path='../angularjs/angular.d.ts' />
import * as ng from "angular";
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.
*
* @param url url to connect to
* @return websocket instance
*/
(url: string, protocols?: string | string[] | IWebSocketConfigOptions, options?: IWebSocketConfigOptions): IWebSocket;
}
/** Options available to be specified for IWebSocket.onMessage */
type IWebSocketMessageOptions = {
declare module "angular" {
namespace websocket {
/**
* If specified, only messages that match the filter will cause the message event
* to be fired.
* Options available to be specified for IWebSocketProvider.
*/
filter?: string | RegExp;
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.
*
* @param url url to connect to
* @return websocket instance
*/
(url: string, protocols?: string | string[] | IWebSocketConfigOptions, options?: IWebSocketConfigOptions): IWebSocket;
}
/** If true, each message handled will safely call `$rootScope.$digest()`. */
autoApply?: boolean;
}
/** Options available to be specified for IWebSocket.onMessage */
type IWebSocketMessageOptions = {
/** Type corresponding to onMessage callbaks stored in $Websocket#onMessageCallbacks instance. */
type IWebSocketMessageHandler = {
fn: (evt: MessageEvent) => void;
pattern: string | RegExp;
autoApply: boolean;
}
/**
* If specified, only messages that match the filter will cause the message event
* to be fired.
*/
filter?: string | RegExp;
/** Type corresponding to items stored in $WebSocket#sendQueue instance. */
type IWebSocketQueueItem = {
message: any;
defered: ng.IPromise<void>;
}
/** If true, each message handled will safely call `$rootScope.$digest()`. */
autoApply?: boolean;
}
interface IWebSocket {
/** Type corresponding to onMessage callbaks stored in $Websocket#onMessageCallbacks instance. */
type IWebSocketMessageHandler = {
fn: (evt: MessageEvent) => void;
pattern: string | RegExp;
autoApply: boolean;
}
/**
* Adds a callback to be executed each time a socket connection is opened for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onOpen(callback: (event: Event) => void): IWebSocket;
/** Type corresponding to items stored in $WebSocket#sendQueue instance. */
type IWebSocketQueueItem = {
message: any;
defered: ng.IPromise<void>;
}
/**
* Adds a callback to be executed each time a socket connection is closed for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onClose(callback: (event: CloseEvent) => void): IWebSocket;
interface IWebSocket {
/**
* Adds a callback to be executed each time a socket connection is closed for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onError(callback: (event: Event) => void): IWebSocket;
/**
* Adds a callback to be executed each time a socket connection is opened for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onOpen(callback: (event: Event) => void): IWebSocket;
/**
* Adds a callback to be executed each time a socket connection has an error for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onMessage(callback: (event: MessageEvent) => void, options?: IWebSocketMessageOptions): IWebSocket;
/**
* Adds a callback to be executed each time a socket connection is closed for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onClose(callback: (event: CloseEvent) => void): IWebSocket;
/**
* Closes the underlying socket, as long as no data is still being sent from the client.
*
* @param force if `true`, force close even if data is still being sent
* @returns this instance, for method chaining
*/
close(force?: boolean): IWebSocket;
/**
* Adds a callback to be executed each time a socket connection is closed for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onError(callback: (event: Event) => void): IWebSocket;
/**
* Adds data to a queue, and attempts to send if the socket is ready.
*
* @param data data to send, if this is an object, it will be stringified before sending
*/
send(data: string | {}): ng.IPromise<any>;
/**
* Adds a callback to be executed each time a socket connection has an error for
* this instance.
*
* @param event event object
* @returns this instance, for method chaining
*/
onMessage(callback: (event: MessageEvent) => void, options?: IWebSocketMessageOptions): IWebSocket;
/**
* WebSocket instance.
*/
socket: WebSocket;
/**
* Closes the underlying socket, as long as no data is still being sent from the client.
*
* @param force if `true`, force close even if data is still being sent
* @returns this instance, for method chaining
*/
close(force?: boolean): IWebSocket;
/**
* Queue of send calls to be made on socket when socket is able to receive data.
*/
sendQueue: IWebSocketQueueItem[];
/**
* Adds data to a queue, and attempts to send if the socket is ready.
*
* @param data data to send, if this is an object, it will be stringified before sending
*/
send(data: string | {}): ng.IPromise<any>;
/**
* List of callbacks to be executed when the socket is opened.
*/
onOpenCallbacks: ((evt: Event) => void)[];
/**
* WebSocket instance.
*/
socket: WebSocket;
/**
* List of callbacks to be executed when a message is received from the socket.
*/
onMessageCallbacks: IWebSocketMessageHandler[];
/**
* Queue of send calls to be made on socket when socket is able to receive data.
*/
sendQueue: IWebSocketQueueItem[];
/**
* List of callbacks to be executed when an error is received from the socket.
*/
onErrorCallbacks: ((evt: Event) => void)[];
/**
* List of callbacks to be executed when the socket is opened.
*/
onOpenCallbacks: ((evt: Event) => void)[];
/**
* List of callbacks to be executed when the socket is closed.
*/
onCloseCallbacks: ((evt: CloseEvent) => void)[];
/**
* List of callbacks to be executed when a message is received from the socket.
*/
onMessageCallbacks: IWebSocketMessageHandler[];
/**
* Returns either the readyState value from the underlying WebSocket instance
* or a proprietary value representing the internal state
*/
readyState: number;
/**
* List of callbacks to be executed when an error is received from the socket.
*/
onErrorCallbacks: ((evt: Event) => void)[];
/**
* The initial timeout.
*/
initialTimeout: number;
/**
* List of callbacks to be executed when the socket is closed.
*/
onCloseCallbacks: ((evt: CloseEvent) => void)[];
/**
* Maximun timeout used to determine reconnection delay.
*/
maxTimeout: number;
/**
* Returns either the readyState value from the underlying WebSocket instance
* or a proprietary value representing the internal state
*/
readyState: number;
/**
* The initial timeout.
*/
initialTimeout: number;
/**
* Maximun timeout used to determine reconnection delay.
*/
maxTimeout: number;
}
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"files": [
"angular-websocket.d.ts",
"angular-websocket-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": false
}
}
+81 -81
View File
@@ -3,96 +3,96 @@
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
import * as angular from "angular";
declare namespace angular.xeditable {
declare module "angular" {
namespace xeditable {
interface IEditableOptions {
interface IEditableOptions {
/**
* Theme. Possible values `bs3`, `bs2`, `default`
*/
theme: string;
/**
* Theme. Possible values `bs3`, `bs2`, `default`
*/
theme: string;
/**
* Icon Set. Possible values `font-awesome`, `default`.
*/
icon_set: 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;
/**
* 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 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;
/**
* 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;
/**
* 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;
/**
* 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;
}
/*
* 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;
}
}
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;
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"files": [
"angular-xeditable.d.ts",
"angular-xeditable-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": false
}
}
+20
View File
@@ -866,6 +866,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'},
+1 -1
View File
@@ -1261,7 +1261,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;
}
+6
View File
@@ -946,10 +946,15 @@ 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;
items:any[];
@@ -1302,6 +1307,7 @@ declare namespace AtomCore {
deserializers:IDeserializerManager;
config: IConfig;
commands: ICommandRegistry;
grammars: IGrammars;
keymaps: IKeymapManager;
keymap: IKeymapManager;
packages: IPackageManager;
+1 -1
View File
@@ -92,7 +92,7 @@ interface Auth0LockConstructorOptions {
initialScreen?: "login" | "signUp" | "forgotPassword";
language?: string;
languageDictionary?: any;
loginAfterSignup?: boolean;
loginAfterSignUp?: boolean;
mustAcceptTerms?: boolean;
popupOptions?: Auth0LockPopupOptions;
prefill?: { email?: string, username?: string};
+459 -4
View File
@@ -47,6 +47,51 @@ interface AwsError extends Error {
stack: string;
}
export interface RetryDelayOption {
base?: number;
customBackoff?: (retryCount: number) => number;
}
export interface Ebs {
SnapshotId?: string;
VolumeSize?: number;
VolumeType?: string;
DeleteOnTermination?: boolean;
Iops?: number;
Encrypted?: boolean;
}
export interface BlockDeviceMapping {
VirtualName?: string;
DeviceName: string;
Ebs?: Ebs;
NoDevice?: boolean;
}
export interface InstanceMonitoring {
SpotPrice?: string;
Enabled?: boolean;
}
export interface Filter {
Name?: string;
Values?: boolean;
}
export interface StepAdjustment {
scalingAdjustment: number;
metricIntervalLowerBound?: number;
metricIntervalUpperBound?: number;
}
export interface Tags {
resourceId?: string;
resourceType?: string;
key: string;
value?: string;
propagateAtLaunch?: boolean;
}
export interface Services {
autoscaling?: any;
cloudformation?: any;
@@ -143,7 +188,65 @@ export declare class Lambda {
updateFunctionConfiguration(params: Lambda.UpdateFunctionConfigurationParams, callback: (err: AwsError, data: any) => void): void;
}
export declare class SQS {
export class AutoScaling {
constructor(options?: any);
endpoint: Endpoint;
attachInstances(params: AutoScaling.AttachInstancesParams, callback: (err: AwsError, data: any) => void): void;
attachLoadBalancers(params: AutoScaling.AttachLoadBalancersParams, callback: (err: AwsError, data: any) => void): void;
attachLoadBalancerTargetGroups(param: AutoScaling.AttachLoadBalancerTargetGroupsParams, callback: (err: AwsError, data: any) => void): void;
completeLifecycleAction(param: AutoScaling.CompleteLifecycleActionParams, callback: (err: AwsError, data: any) => void): void;
createAutoScalingGroup(param: AutoScaling.CreateAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void;
createLaunchConfiguration(param: AutoScaling.CreateLaunchConfigurationParams, callback: (err: AwsError, data: any) => void): void;
createOrUpdateTags(param: AutoScaling.CreateOrUpdateTagsParams, callback: (err: AwsError, data: any) => void): void;
deleteAutoScalingGroup(param: AutoScaling.DeleteAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void;
deleteLaunchConfiguration(param: AutoScaling.DeleteLaunchConfigurationParams, callback: (err: AwsError, data: any) => void): void;
deleteLifecycleHook(param: AutoScaling.DeleteLifecycleHookParams, callback: (err: AwsError, data: any) => void): void;
deleteNotificationConfiguration(param: AutoScaling.DeleteNotificationConfigurationParams, callback: (err: AwsError, data: any) => void): void;
deletePolicy(param: AutoScaling.DeletePolicyParams, callback: (err: AwsError, data: any) => void): void;
deleteScheduledAction(param: AutoScaling.DeleteScheduledActionParams, callback: (err: AwsError, data: any) => void): void;
deleteTags(param: AutoScaling.DeleteTagsParams, callback: (err: AwsError, data: any) => void): void;
describeAccountLimits(callback: (err: AwsError, data: any) => void): void;
describeAdjustmentTypes(callback: (err: AwsError, data: any) => void): void;
describeAutoScalingGroups(param: AutoScaling.DescribeAutoScalingGroupsParams, callback: (err: AwsError, data: any) => void): void;
describeAutoScalingInstances(param: AutoScaling.DescribeAutoScalingInstancesParams, callback: (err: AwsError, data: any) => void): void;
describeAutoScalingNotificationTypes(callback: (err: AwsError, data: any) => void): void;
describeLaunchConfigurations(param: AutoScaling.DescribeLaunchConfigurationsParams, callback: (err: AwsError, data: any) => void): void;
describeLifecycleHooks(param: AutoScaling.DescribeLifecycleHooksParams, callback: (err: AwsError, data: any) => void): void;
describeLifecycleHookTypes(callback: (err: AwsError, data: any) => void): void;
describeLoadBalancers(param: AutoScaling.DescribeLoadBalancersParams, callback: (err: AwsError, data: any) => void): void;
describeLoadBalancerTargetGroups(param: AutoScaling.DescribeLoadBalancerTargetGroupsParams, callback: (err: AwsError, data: any) => void): void;
describeMetricCollectionTypes(callback: (err: AwsError, data: any) => void): void;
describeNotificationConfigurations(param: AutoScaling.DescribeNotificationConfigurationsParams, callback: (err: AwsError, data: any) => void): void;
describePolicies(param: AutoScaling.DescribePoliciesParams, callback: (err: AwsError, data: any) => void): void;
describeScalingActivities(param: AutoScaling.DescribeScalingActivitiesParams, callback: (err: AwsError, data: any) => void): void;
describeScalingProcessTypes(callback: (err: AwsError, data: any) => void): void;
describeScheduledActions(param: AutoScaling.DescribeScheduledActionsParams, callback: (err: AwsError, data: any) => void): void;
describeTags(param: AutoScaling.DescribeTagsParams, callback: (err: AwsError, data: any) => void): void;
describeTerminationPolicyTypes(callback: (err: AwsError, data: any) => void): void;
detachInstances(param: AutoScaling.DetachInstancesParams, callback: (err: AwsError, data: any) => void): void;
detachLoadBalancers(param: AutoScaling.DetachLoadBalancersParams, callback: (err: AwsError, data: any) => void): void;
detachLoadBalancerTargetGroups(param: AutoScaling.DetachLoadBalancerTargetGroupsParams, callback: (err: AwsError, data: any) => void): void;
disableMetricsCollection(param: AutoScaling.DisableMetricsCollectionParams, callback: (err: AwsError, data: any) => void): void;
enableMetricsCollection(param: AutoScaling.EnableMetricsCollectionParams, callback: (err: AwsError, data: any) => void): void;
enterStandby(param: AutoScaling.EnterStandbyParams, callback: (err: AwsError, data: any) => void): void;
executePolicy(param: AutoScaling.ExecutePolicyParams, callback: (err: AwsError, data: any) => void): void;
exitStandby(param: AutoScaling.ExitStandbyParams, callback: (err: AwsError, data: any) => void): void;
putLifecycleHook(param: AutoScaling.PutLifecycleHookParams, callback: (err: AwsError, data: any) => void): void;
putNotificationConfiguration(param: AutoScaling.PutNotificationConfigurationParams, callback: (err: AwsError, data: any) => void): void;
putScalingPolicy(param: AutoScaling.PutScalingPolicyParams, callback: (err: AwsError, data: any) => void): void;
putScheduledUpdateGroupAction(param: AutoScaling.PutScheduledUpdateGroupActionParams, callback: (err: AwsError, data: any) => void): void;
recordLifecycleActionHeartbeat(params: AutoScaling.RecordLifecycleActionHeartbeatParams, callback: (err: AwsError, data: any) => void): void;
resumeProcesses(params: AutoScaling.ResumeProcessesParams, callback: (err: AwsError, data: any) => void): void;
setDesiredCapacity(params: AutoScaling.SetDesiredCapacityParams, callback: (err: AwsError, data: any) => void): void;
setInstanceHealth(params: AutoScaling.SetInstanceHealthParams, callback: (err: AwsError, data: any) => void): void;
setInstanceProtection(params: AutoScaling.SetInstanceProtectionParams, callback: (err: AwsError, data: any) => void): void;
suspendProcesses(params: AutoScaling.SuspendProcessesParams, callback: (err: AwsError, data: any) => void): void;
terminateInstanceInAutoScalingGroup(params: AutoScaling.TerminateInstanceInAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void;
updateAutoScalingGroup(params: AutoScaling.UpdateAutoScalingGroupParams, callback: (err: AwsError, data: any) => void): void;
}
export class SQS {
constructor(options?: any);
endpoint: Endpoint;
@@ -232,7 +335,12 @@ export declare class S3 {
listObjects(params: s3.ListObjectRequest, callback: (err: Error, data: s3.ListObjectResponse) => void): void;
listObjectsV2(params: s3.ListObjectV2Request, callback: (err: Error, data: s3.ListObjectV2Response) => void): void;
waitFor(state: string, params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void;
}
createMultipartUpload(params: any, callback: (err: Error, data: any) => void): void;
uploadPart(params: any, callback: (err: Error, data: any) => void): void;
listParts(params: any, callback: (err: Error, data: any) => void): void;
completeMultipartUpload(params: any, callback: (err: Error, data: any) => void): void;
}
export class STS {
@@ -243,7 +351,7 @@ export class STS {
*/
assumeRole(params: sts.AssumeRoleParams, callback: (err: any, data: any) => void): void;
/**
* Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response.
* Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response.
*/
assumeRoleWithSAML(params: sts.AssumeRoleWithSAMLParams, callback: (err: any, data: any) => void): void;
@@ -586,8 +694,355 @@ export declare module Lambda {
}
}
export declare module SQS {
export module AutoScaling {
export interface AutoScalingOptions {
params?: any;
endpoint?: string;
accessKeyId?: string;
secretAccessKey?: string;
sessionToken?: Credentials;
credentials?: Credentials;
credentialProvider?: any;
region?: string;
maxRetries?: number;
maxRedirects?: number;
sslEnabled?: boolean;
paramValidation?: boolean;
computeChecksums?: boolean;
convertResponseTypes?: boolean;
correctClockSkew?: boolean;
s3ForcePathStyle?: boolean;
s3BucketEndpoint?: boolean;
s3DisableBodySigning?: boolean;
retryDelayOptions?: RetryDelayOption;
httpOptions?: HttpOptions;
apiVersion?: string;
apiVersions?: { [serviceName: string]: string };
logger?: Logger;
systemClockOffset?: number;
signatureVersion?: string;
signatureCache?: boolean;
}
export interface AttachInstancesParams {
AutoScalingGroupName: string;
InstanceIds: string[];
}
export interface AttachLoadBalancersParams {
AutoScalingGroupName: string;
LoadBalancerNames: string[];
}
export interface AttachLoadBalancerTargetGroupsParams {
AutoScalingGroupName: string;
TargetGroupARNs: string[];
}
export interface CompleteLifecycleActionParams {
AutoScalingGroupName: string;
LifecycleActionResult: string;
LifecycleHookName: string;
lifecycleActionToken?: string;
InstanceId?: string;
}
export interface CreateAutoScalingGroupParams {
AutoScalingGroupName: string;
MinSize: number;
MaxSize: number;
LaunchConfigurationName?: string;
InstanceId?: string;
DesiredCapacity?: number;
DefaultCooldown?: number;
AvailabilityZones?: string[];
LoadBalancerNames?: string[];
TargetGroupARNs?: string[];
HealthCheckType?: string;
HealthCheckGracePeriod?: number;
PlacementGroup?: string;
VPCZoneIdentifier?: string;
TerminationPolicies?: string;
NewInstancesProtectedFromScaleIn?: boolean;
Tags?: Tags;
}
export interface CreateLaunchConfigurationParams {
LaunchConfigurationName: string;
AssociatePublicIpAddress?: boolean;
ImageId?: string;
KeyName?: string;
SecurityGroups?: string[];
ClassicLinkVPCId?: string;
ClassicLinkVPCSecurityGroups?: string[];
UserData?: string;
InstanceId?: string;
InstanceType?: string;
KernelId?: string;
RamdiskId?: string;
BlockDeviceMappings?: BlockDeviceMapping[];
InstanceMonitoring?: InstanceMonitoring;
SpotPrice?: string;
IamInstanceProfile?: string;
EbsOptimized?: boolean;
PlacementTenancy?: string;
}
export interface CreateOrUpdateTagsParams {
Tags: Tags[];
}
export interface DeleteAutoScalingGroupParams {
AutoScalingGroupName: string;
ForceDelete?: boolean;
}
export interface DeleteLaunchConfigurationParams {
LaunchConfigurationName: string;
}
export interface DeleteLifecycleHookParams {
AutoScalingGroupName: string;
LifecycleHookName: string;
}
export interface DeleteNotificationConfigurationParams {
AutoScalingGroupName: string;
TopicARN: string;
}
export interface DeletePolicyParams {
PolicyName: string;
AutoScalingGroupName?: string;
}
export interface DeleteScheduledActionParams {
AutoScalingGroupName: string;
ScheduledActionName: string;
}
export interface DeleteTagsParams {
Tags: Tags[];
}
export interface DescribeAutoScalingGroupsParams {
AutoScalingGroupName?: string;
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeAutoScalingInstancesParams {
InstanceIds?: string[];
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeLaunchConfigurationsParams {
LaunchConfigurationNames?: string[];
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeLifecycleHooksParams {
AutoScalingGroupName: string;
LifecycleHookNames?: string[];
}
export interface DescribeLoadBalancersParams {
AutoScalingGroupName: string;
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeLoadBalancerTargetGroupsParams {
AutoScalingGroupName: string;
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeNotificationConfigurationsParams {
AutoScalingGroupName?: string;
NextToken?: string;
MaxRecords?: number;
}
export interface DescribePoliciesParams {
AutoScalingGroupName?: string;
PolicyNames?: string[];
PolicyTypes?: string[];
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeScalingActivitiesParams {
AutoScalingGroupName?: string;
ActivityIds?: string[];
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeScheduledActionsParams {
AutoScalingGroupName?: string;
ScheduledActionNames?: string[];
StartTime?: Date;
EndTime?: Date;
NextToken?: string;
MaxRecords?: number;
}
export interface DescribeTagsParams {
Filters?: Filter[];
NextToken?: string;
MaxRecords?: number;
}
export interface DetachInstancesParams {
AutoScalingGroupName: string;
ShouldDecrementDesiredCapacity: boolean;
InstanceIds?: string[];
}
export interface DetachLoadBalancersParams {
AutoScalingGroupName: string;
LoadBalancerNames: string;
}
export interface DetachLoadBalancerTargetGroupsParams {
AutoScalingGroupName: string;
TargetGroupARNs: string[];
}
export interface DisableMetricsCollectionParams {
AutoScalingGroupName: string;
Metrics?: string[];
}
export interface EnableMetricsCollectionParams {
AutoScalingGroupName: string;
Granularity: string;
Metrics?: string[];
}
export interface EnterStandbyParams {
AutoScalingGroupName: string;
ShouldDecrementDesiredCapacity: boolean;
InstanceIds?: string[];
}
export interface ExecutePolicyParams {
PolicyName: string;
AutoScalingGroupName?: string;
HonorCooldown?: boolean;
MetricValue?: number;
BreachThreshold?: number;
}
export interface ExitStandbyParams {
AutoScalingGroupName: string;
InstanceIds?: string[];
}
export interface PutLifecycleHookParams {
AutoScalingGroupName: string;
LifecycleHookName: string;
LifecycleTransition?: string;
RoleARN?: string;
NotificationTargetARN?: string;
NotificationMetadata?: string;
HeartbeatTimeout?: number;
DefaultResult?: string;
}
export interface PutNotificationConfigurationParams {
AutoScalingGroupName: string;
NotificationTypes: string[];
TopicARN: string;
}
export interface PutScalingPolicyParams {
AutoScalingGroupName: string;
AdjustmentType: string;
PolicyName: string;
PolicyType?: string;
MinAdjustmentStep?: number;
MinAdjustmentMagnitude?: number;
ScalingAdjustment?: number;
Cooldown?: number;
MetricAggregationType?: string;
StepAdjustments?: StepAdjustment[];
EstimatedInstanceWarmup: number;
}
export interface PutScheduledUpdateGroupActionParams {
AutoScalingGroupName: string;
ScheduledActionName: string;
Time?: Date;
StartTime?: Date;
EndTime?: Date;
Recurrence?: string;
MinSize?: number;
MaxSize?: number;
DesiredCapacity?: number;
}
export interface RecordLifecycleActionHeartbeatParams {
AutoScalingGroupName: string;
LifecycleHookName: string;
LifecycleActionToken?: string;
InstanceId?: string;
}
export interface ResumeProcessesParams {
AutoScalingGroupName: string;
ScalingProcesses?: string[];
}
export interface SetDesiredCapacityParams {
AutoScalingGroupName: string;
DesiredCapacity: number;
HonorCooldown?: boolean;
}
export interface SetInstanceHealthParams {
HealthStatus: string;
InstanceId: string;
ShouldRespectGracePeriod?: boolean;
}
export interface SetInstanceProtectionParams {
AutoScalingGroupName: string;
InstanceIds: string[];
ProtectedFromScaleIn: boolean;
}
export interface SuspendProcessesParams {
AutoScalingGroupName: string;
ScalingProcesses?: string[];
}
export interface TerminateInstanceInAutoScalingGroupParams {
InstanceId: string;
ShouldDecrementDesiredCapacity: boolean;
}
export interface UpdateAutoScalingGroupParams {
AutoScalingGroupName: string;
LaunchConfigurationName: string;
MinSize: number;
MaxSize: number;
DesiredCapacity: number;
DefaultCooldown: number;
AvailabilityZones: string[];
HealthCheckType: string;
HealthCheckGracePeriod: number;
PlacementGroup: string;
VPCZoneIdentifier: string;
TerminationPolicies: string[];
NewInstancesProtectedFromScaleIn?: boolean;
}
}
export module SQS {
export interface SqsOptions {
params?: any;
endpoint?: string;
+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;
}
@@ -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();
+4
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;
@@ -1,6 +1,5 @@
///<reference path="./backbone-fetch-cache.d.ts" />
import * as Backbone from "backbone-fetch-cache";
import * as Backbone from "backbone";
import * as BackboneFetchCache from "backbone-fetch-cache";
// static methods / properties
-189
View File
@@ -1,189 +0,0 @@
// Type definitions for backbone-fetch-cache 1.4.0
// Project: https://github.com/madglory/backbone-fetch-cache
// Definitions by: delphinus <https://github.com/delphinus35/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../backbone/backbone.d.ts" />
declare namespace BackboneFetchCache {
interface SuperMethods {
modelFetch(options?: Backbone.ModelFetchOptions): JQueryXHR;
modelSync(...arg: any[]): JQueryXHR;
collectionFetch(options?: Backbone.CollectionFetchOptions): JQueryXHR;
}
interface GetCacheOptions {
data?: any;
url?: string;
}
interface SetCacheOptions extends GetCacheOptions {
cache: boolean;
expires: boolean | number;
prefill: boolean;
prefillExpires: boolean | number;
}
interface Cache {
expires: number;
lastSync: number;
prefillExpires: number;
value: any;
}
interface GetCacheKeyObject {
getCacheKey?: (opts?: GetCacheOptions) => string;
url?: () => string;
}
type GetCacheKeyOptions = string | {url: string} | GetCacheKeyObject;
interface Static {
/**
* Global flag to enable/disable caching
*/
enabled: boolean;
/**
* By default the cache is persisted in localStorage (if available).
* Set Backbone.fetchCache.localStorage = false to disable this.
*/
localStorage: boolean;
/**
* Sometimes you just need to clear a cached item manually.
* Backbone.fetchCache.clearItem() can be called safely from anywhere
* in your application. It will take your backbone Model or Collection,
* a function that returns the key String, or the key String itself. If
* you pass in a Model or Collection, the .getCacheKey() method will be
* checked before the url property.
*/
clearItem(...args: any[]): any;
/**
* You can explicitly fetch a cached item, without having to call the
* models/collection fetch. This might be useful for debugging and
* testing.
*/
getCache(key: () => string, opts?: GetCacheOptions): Cache;
getCache(key: GetCacheKeyOptions, opts?: GetCacheOptions): Cache;
getCacheKey(key: () => string, opts?: GetCacheOptions): string;
getCacheKey(key: GetCacheKeyOptions, opts?: GetCacheOptions): string;
/**
* If you want to know when was the last (server) sync of a given key, you can use.
*/
getLastSync(key: () => string, opts?: GetCacheOptions): number;
getLastSync(key: GetCacheKeyOptions, opts?: GetCacheOptions): number;
getLocalStorage(): void;
getLocalStorageKey(): string;
/**
* When setting items in localStorage, the browser may throw a
* QUOTA_EXCEEDED_ERR, meaning the store is full. Backbone.fetchCache
* tries to work around this problem by deleting what it considers the
* most stale item to make space for the new data. The staleness of
* data is determined by the sorting function priorityFn, which by
* default returns the oldest item.
*/
priorityFn(a: Cache, b: Cache): number;
reset(): void;
setCache(instance: () => string, opts?: SetCacheOptions, attrs?: any): void;
setCache(instance: GetCacheKeyOptions, opts?: SetCacheOptions, attrs?: any): void;
setLocalStorage(...args: any[]): any;
_superMethods: SuperMethods;
}
}
declare module Backbone {
var fetchCache: BackboneFetchCache.Static;
/**
* The most used API hook for Backbone Fetch Cache is the Model and
* Collection #.fetch() method. Here are the options you can pass into that
* method to get behaviour particular to Backbone Fetch Cache.
*/
interface ModelFetchWithCacheOptions extends ModelFetchOptions {
/**
* Calls to modelInstance.fetch or collectionInstance.fetch will be
* fulfilled from the cache (if possible) when cache: true is set in
* the options hash.
*/
cache?: boolean;
context?: any;
/**
* Cache values expire after 5 minutes by default. You can adjust this
* by passing expires: <seconds> to the fetch call. Set to false to
* never expire.
*/
expires?: number;
/**
* This option allows the model/collection to be populated from the
* cache immediately and then be updated once the call to fetch has
* completed. The initial cache hit calls the prefillSuccess callback
* and then the AJAX success/error callbacks are called as normal when
* the request is complete. This allows the page to render something
* immediately and then update it after the request completes. (Note:
* the prefillSuccess callback will not fire if the data is not found
* in the cache.)
*
* prefill and prefillExpires options can be used with the promises
* interface like so (note: the progress event will not fire if the
* data is not found in the cache.).
*
* prefillExpires affects prefill in the following ways:
*
* 1. If the cache doesn't hold the requested data, just fetch it
* (usual behaviour)
* 2. If the cache holds an expired version of the requested data, just
* fetch it (usual behaviour)
* 3. If the cache holds requested data that is neither expired nor
* prefill expired, just return it and don't do a fetch / prefill
* callback (usual cache behavior, unusual prefill behaviour)
* 4. If the cache holds requested data that isn't expired but is
* prefill expired, use the prefill callback and do a fetch (usual
* prefill behaviour)
*/
prefill?: boolean;
prefillExpires?: number;
prefillSuccess?: (self: any, attributes: any, opts: ModelFetchWithCacheOptions) => void;
}
interface CollectionFetchWithCacheOptions extends ModelFetchWithCacheOptions {
prefillSuccess?: (self: any) => void;
}
interface ModelWithCache extends Model {
fetch(options?: ModelFetchWithCacheOptions): JQueryXHR;
}
interface CollectionWithCache extends Collection<Model> {
fetch(options?: CollectionFetchWithCacheOptions): JQueryXHR;
}
}
declare module "backbone-fetch-cache" {
export = Backbone;
}
+183
View File
@@ -0,0 +1,183 @@
// Type definitions for backbone-fetch-cache 1.4.0
// Project: https://github.com/madglory/backbone-fetch-cache
// Definitions by: delphinus <https://github.com/delphinus35/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Backbone from "backbone";
interface SuperMethods {
modelFetch(options?: Backbone.ModelFetchOptions): JQueryXHR;
modelSync(...arg: any[]): JQueryXHR;
collectionFetch(options?: Backbone.CollectionFetchOptions): JQueryXHR;
}
interface GetCacheOptions {
data?: any;
url?: string;
}
interface SetCacheOptions extends GetCacheOptions {
cache: boolean;
expires: boolean | number;
prefill: boolean;
prefillExpires: boolean | number;
}
interface Cache {
expires: number;
lastSync: number;
prefillExpires: number;
value: any;
}
interface GetCacheKeyObject {
getCacheKey?: (opts?: GetCacheOptions) => string;
url?: () => string;
}
type GetCacheKeyOptions = string | {url: string} | GetCacheKeyObject;
interface Static {
/**
* Global flag to enable/disable caching
*/
enabled: boolean;
/**
* By default the cache is persisted in localStorage (if available).
* Set Backbone.fetchCache.localStorage = false to disable this.
*/
localStorage: boolean;
/**
* Sometimes you just need to clear a cached item manually.
* Backbone.fetchCache.clearItem() can be called safely from anywhere
* in your application. It will take your backbone Model or Collection,
* a function that returns the key String, or the key String itself. If
* you pass in a Model or Collection, the .getCacheKey() method will be
* checked before the url property.
*/
clearItem(...args: any[]): any;
/**
* You can explicitly fetch a cached item, without having to call the
* models/collection fetch. This might be useful for debugging and
* testing.
*/
getCache(key: () => string, opts?: GetCacheOptions): Cache;
getCache(key: GetCacheKeyOptions, opts?: GetCacheOptions): Cache;
getCacheKey(key: () => string, opts?: GetCacheOptions): string;
getCacheKey(key: GetCacheKeyOptions, opts?: GetCacheOptions): string;
/**
* If you want to know when was the last (server) sync of a given key, you can use.
*/
getLastSync(key: () => string, opts?: GetCacheOptions): number;
getLastSync(key: GetCacheKeyOptions, opts?: GetCacheOptions): number;
getLocalStorage(): void;
getLocalStorageKey(): string;
/**
* When setting items in localStorage, the browser may throw a
* QUOTA_EXCEEDED_ERR, meaning the store is full. Backbone.fetchCache
* tries to work around this problem by deleting what it considers the
* most stale item to make space for the new data. The staleness of
* data is determined by the sorting function priorityFn, which by
* default returns the oldest item.
*/
priorityFn(a: Cache, b: Cache): number;
reset(): void;
setCache(instance: () => string, opts?: SetCacheOptions, attrs?: any): void;
setCache(instance: GetCacheKeyOptions, opts?: SetCacheOptions, attrs?: any): void;
setLocalStorage(...args: any[]): any;
_superMethods: SuperMethods;
}
declare module "backbone" {
var fetchCache: Static;
/**
* The most used API hook for Backbone Fetch Cache is the Model and
* Collection #.fetch() method. Here are the options you can pass into that
* method to get behaviour particular to Backbone Fetch Cache.
*/
interface ModelFetchWithCacheOptions extends ModelFetchOptions {
/**
* Calls to modelInstance.fetch or collectionInstance.fetch will be
* fulfilled from the cache (if possible) when cache: true is set in
* the options hash.
*/
cache?: boolean;
context?: any;
/**
* Cache values expire after 5 minutes by default. You can adjust this
* by passing expires: <seconds> to the fetch call. Set to false to
* never expire.
*/
expires?: number;
/**
* This option allows the model/collection to be populated from the
* cache immediately and then be updated once the call to fetch has
* completed. The initial cache hit calls the prefillSuccess callback
* and then the AJAX success/error callbacks are called as normal when
* the request is complete. This allows the page to render something
* immediately and then update it after the request completes. (Note:
* the prefillSuccess callback will not fire if the data is not found
* in the cache.)
*
* prefill and prefillExpires options can be used with the promises
* interface like so (note: the progress event will not fire if the
* data is not found in the cache.).
*
* prefillExpires affects prefill in the following ways:
*
* 1. If the cache doesn't hold the requested data, just fetch it
* (usual behaviour)
* 2. If the cache holds an expired version of the requested data, just
* fetch it (usual behaviour)
* 3. If the cache holds requested data that is neither expired nor
* prefill expired, just return it and don't do a fetch / prefill
* callback (usual cache behavior, unusual prefill behaviour)
* 4. If the cache holds requested data that isn't expired but is
* prefill expired, use the prefill callback and do a fetch (usual
* prefill behaviour)
*/
prefill?: boolean;
prefillExpires?: number;
prefillSuccess?: (self: any, attributes: any, opts: ModelFetchWithCacheOptions) => void;
}
interface CollectionFetchWithCacheOptions extends ModelFetchWithCacheOptions {
prefillSuccess?: (self: any) => void;
}
interface ModelWithCache extends Model {
fetch(options?: ModelFetchWithCacheOptions): JQueryXHR;
}
interface CollectionWithCache extends Collection<Model> {
fetch(options?: CollectionFetchWithCacheOptions): JQueryXHR;
}
}
export as namespace BackboneFetchCache;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"backbone-fetch-cache-tests.ts"
]
}
+1 -1
View File
@@ -58,7 +58,7 @@ declare namespace Backbone {
interface ModelSetOptions extends Silenceable, Validable {
}
interface ModelFetchOptions extends PersistenceOptions, ModelSetOptions, Parseable {
export interface ModelFetchOptions extends PersistenceOptions, ModelSetOptions, Parseable {
}
interface ModelSaveOptions extends Silenceable, Waitable, Validable, Parseable, PersistenceOptions {
-2
View File
@@ -1,5 +1,3 @@
/// <reference path="backlog-js.d.ts" />
import * as backlogjs from 'backlog-js';
const host = 'example.backlog.jp';
-695
View File
@@ -1,695 +0,0 @@
// 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';
}
}
+690
View File
@@ -0,0 +1,690 @@
// 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 types="node" />
/// <reference types="isomorphic-fetch" />
declare 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';
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"backlog-js-tests.ts"
]
}
+22
View File
@@ -0,0 +1,22 @@
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
+66
View File
@@ -0,0 +1,66 @@
// 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
/**
* 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
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"base16-tests.ts"
]
}
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Ché Coxshall <https://github.com/CheCoxshall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference types="jquery" />
interface JQuery {
fileinput: (options?: BootstrapFileInput.FileInputOptions) => JQuery;
+18
View File
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"bootstrap-fileinput.d.ts"
]
}
@@ -1,19 +1,10 @@
import Bowser = require('bowser');
Bowser.msedge === true;
Bowser.test(['msie']) === true;
Bowser.a === Bowser.c;
Bowser.osversion > 10;
Bowser.osversion === '10.1A';
bowser.msedge === true;
bowser.test(['msie']) === true;
bowser.a === bowser.c;
bowser.osversion > 10;
bowser.osversion === '10.1A';
bowser.compareVersions(['9.0', '10']);
bowser() === <BowserModule.IBowserDetection>{android: true, x: true};
bowser() === {android: true, x: true};
bowser.check({msie: "11"}, window.navigator.userAgent);
bowser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent);
+9
View File
@@ -0,0 +1,9 @@
import Bowser = require('bowser');
Bowser.msedge === true;
Bowser.test(['msie']) === true;
Bowser.a === Bowser.c;
Bowser.osversion > 10;
Bowser.osversion === '10.1A';
+3 -3
View File
@@ -3,11 +3,11 @@
// Definitions by: Paulo Cesar <https://github.com/pocesar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var def: BowserModule.IBowser;
export = def;
declare const bowser: bowser.IBowser;
export = bowser;
export as namespace bowser;
declare namespace BowserModule {
declare namespace bowser {
export interface IBowserOS {
mac: boolean;
+2 -1
View File
@@ -14,6 +14,7 @@
},
"files": [
"index.d.ts",
"bowser-tests.ts"
"bowser-tests-module.ts",
"bowser-tests-global.ts"
]
}
+3 -1
View File
@@ -5,9 +5,10 @@
/// <reference types="node" />
declare var browserify: BrowserifyConstructor;
declare var browserify: browserify.BrowserifyConstructor;
export = browserify;
declare namespace browserify {
/**
* Options pertaining to an individual file.
*/
@@ -173,3 +174,4 @@ interface BrowserifyObject extends NodeJS.EventEmitter {
*/
pipeline: any;
}
}
+36
View File
@@ -0,0 +1,36 @@
/// <reference path="bunnymq.d.ts"/>
import * as bunnymq from "bunnymq";
// Basic usage
var instance = bunnymq({ host: 'amqp://localhost' });
// Publisher
instance.producer.produce('queue:name', 'Hello World!');
// Subscriber
instance.consumer.consume('queue:name', message => { });
// RPC Support
instance.producer.produce('queue:name', { message: 'content' }, { rpc: true })
.then(function (consumerResponse) {
console.log(consumerResponse);
});
// Routing keys
instance.producer.produce('queue:name', { message: 'content' }, { routingKey: 'my-routing-key' });
// Config
var custom = bunnymq({
host: 'amqp://localhost',
//number of fetched messages at once on the channel
prefetch: 5,
//requeue put back message into the broker if consumer crashes/trigger exception
requeue: true,
//time between two reconnect (ms)
timeout: 1000,
consumerSuffix: '',
//generate a hostname so we can track this connection on the broker (rabbitmq management plugin)
hostname: "",
//the transport to use to debug. if provided, bunnymq will show some logs
transport: new Object()
});
+120
View File
@@ -0,0 +1,120 @@
// Type definitions for node-bunnymq 2.2.1
// Project: https://github.com/dial-once/node-bunnymq
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "bunnymq" {
namespace bunnymq {
export type ConsumerCallback = (message: Object) => void;
/**
* Consumer.
* @interface
*/
export interface Consumer {
/**
* Handle messages from a named queue.
* @param {string} queue A named queue.
* @param {ConsumerCallback} callback A callback.
*/
consume(queue: string, callback: ConsumerCallback): void;
}
/**
* bunnymq instance.
* @interface
*/
export interface Instance {
/**
* Consumer.
* @type {Consumer}
*/
consumer: Consumer;
/**
* Producer.
* @type {Producer}
*/
producer: Producer;
}
/**
* Options.
* @interface
*/
export interface Options {
/**
* Consumer suffix.
* @type {string}
*/
consumerSuffix?: string;
/**
* Host.
* @type {string}
*/
host?: string;
/**
* Hostname.
* @type {string}
*/
hostname?: string;
/**
* Number of fetched messages at once on the channel.
* @type {number}
*/
prefetch?: number;
/**
* Requeue put back message into the broker if consumer crashes/trigger exception.
* @type {boolean}
*/
requeue?: boolean;
/**
* Time between two reconnect (in milliseconds).
* @type {number}
*/
timeout?: number;
/**
* Transport.
* @type {any}
*/
transport?: any;
}
/**
* Producer.
* @inteface
*/
export interface Producer {
/**
* Send messages to a named queue.
* @param {string} queue A named queue.
* @param {Object} message A message.
* @return {Object} The consumer response.
*/
produce(queue: string, message: Object, options?: ProducerOptions): PromiseLike<Object>;
}
/**
* Options for producer.
* @interface
*/
export interface ProducerOptions {
routingKey?: string;
rpc?: boolean;
}
}
/**
* Constructor.
* @param {Options} [options] Options.
* @return {Instance} A instance of bunnymq.
*/
function bunnymq(options?: bunnymq.Options): bunnymq.Instance;
export = bunnymq;
}
+39
View File
@@ -0,0 +1,39 @@
/// <reference path="busboy.d.ts"/>
/// <reference path="../node/node.d.ts" />
import * as Busboy from 'busboy';
import * as http from 'http';
import * as util from 'util';
function serverFn(req: http.ServerRequest, res: http.ServerResponse) {
if (req.method === 'POST') {
var busboy = new Busboy({ headers: req.headers });
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
console.log('File [' + fieldname + ']: filename: ' + filename + ', encoding: ' + encoding + ', mimetype: ' + mimetype);
file.on('data', function(data: Buffer) {
console.log('File [' + fieldname + '] got ' + data.length + ' bytes');
});
file.on('end', function() {
console.log('File [' + fieldname + '] Finished');
});
});
busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) {
console.log('Field [' + fieldname + ']: value: ' + util.inspect(val));
});
busboy.on('finish', function() {
console.log('Done parsing form!');
res.writeHead(303, { Connection: 'close', Location: '/' });
res.end();
});
req.pipe(busboy);
} else if (req.method === 'GET') {
res.writeHead(200, { Connection: 'close' });
res.end('<html><head></head><body>\
<form method="POST" enctype="multipart/form-data">\
<input type="text" name="textfield"><br />\
<input type="file" name="filefield"><br />\
<input type="submit">\
</form>\
</body></html>');
}
}
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for busboy v0.2.13
// Project: https://www.npmjs.com/package/busboy
// Definitions by: Jacob Baskin <https://github.com/jacobbaskin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare namespace busboy {
interface Options {
headers: any;
}
interface BusboyConfig {
headers?: any;
highWaterMark?: number;
fileHwm?: number;
defCharset?: string;
preservePath?: boolean;
limits?: {
fieldNameSize?: number;
fieldSize?: number;
fields?: number;
fileSize?: number;
files?: number;
parts?: number;
headerPairs?: number;
};
}
interface Busboy extends NodeJS.WritableStream {
on(event: 'field',
listener: (
fieldname: string,
val: any,
fieldnameTruncated: boolean,
valTruncated: boolean,
encoding: string,
mimetype: string) => void): this;
on(event: 'file',
listener: (
fieldname: string,
file: NodeJS.ReadableStream,
filename: string,
encoding: string,
mimetype: string) => void): this;
on(event: 'finish', callback: () => void): this;
on(event: 'partsLimit', callback: () => void): this;
on(event: 'filesLimit', callback: () => void): this;
on(event: 'fieldsLimit', callback: () => void): this;
on(event: string, listener: Function): this;
}
interface BusboyConstructor {
new (options: BusboyConfig): Busboy;
}
}
declare module 'busboy' {
const temp: busboy.BusboyConstructor;
export = temp;
}
+1 -1
View File
@@ -681,7 +681,7 @@ declare namespace c3 {
* Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge.
* If undefined returned, the row of that value will be skipped.
*/
value?: (name: string, ratio: number, id: string, index: number) => string;
value?: (value: any, ratio: number, id: string, index: number) => string;
};
/**
* Set custom position for the tooltip. This option can be used to modify the tooltip position by returning object that has top and left.
+20
View File
@@ -0,0 +1,20 @@
/// <reference path="canvas-gauges.d.ts" />
import {
LinearGaugeOptions,
RadialGaugeOptions,
LinearGauge,
RadialGauge
} from 'canvas-gauges';
let linearOptions: LinearGaugeOptions = {
renderTo: document.createElement('canvas')
};
let radialOptions: RadialGaugeOptions = {
renderTo: 'gauge-id'
};
new LinearGauge(linearOptions);
new RadialGauge(radialOptions);
console.log(document.gauges.length);
+263
View File
@@ -0,0 +1,263 @@
// Type definitions for canvas-gauges
// Project: https://github.com/Mikhus/canvas-gauges
// Definitions by: Mikhus <https://github.com/Mikhus>
// Definitions: https://github.com/Mikhus/DefinitelyTyped
declare namespace CanvasGauges {
export type RenderTarget = string|HTMLElement;
export interface AnimationRule {
(percent: number): number;
}
export interface Highlight {
from: number,
to: number,
color: string
}
export type MajorTicks = string[]|number[];
export interface GenericOptions {
renderTo: RenderTarget,
width?: number,
height?: number,
minValue?: number,
maxValue?: number,
value?: number,
units?: string|boolean,
majorTicks?: MajorTicks,
minorTicks?: number,
strokeTicks?: boolean,
animatedValue?: boolean,
title?: string|boolean,
borders?: boolean,
valueInt?: number,
valueDec?: number,
majorTicksInt?: number,
majorTicksDec?: number,
animation?: boolean,
animationDuration?: number,
animationRule?: string|AnimationRule,
colorPlate?: string,
colorMajorTicks?: string,
colorMinorTicks?: string,
colorTitle?: string,
colorUnits?: string,
colorNumbers?: string,
colorNeedle?: string,
colorNeedleEnd?: string,
colorValueText?: string,
colorValueTextShadow?: string,
colorBorderShadow?: string,
colorBorderOuter?: string,
colorBorderOuterEnd?: string,
colorBorderMiddle?: string,
colorBorderMiddleEnd?: string,
colorBorderInner?: string,
colorBorderInnerEnd?: string,
colorValueBoxRect?: string,
colorValueBoxRectEnd?: string,
colorValueBoxBackground?: string,
colorValueBoxShadow?: string,
colorNeedleShadowUp?: string,
colorNeedleShadowDown?: string,
needle?: boolean,
needleShadow?: boolean,
needleType?: string,
needleStart?: number,
needleEnd?: number,
needleWidth?: number,
borderOuterWidth?: number,
borderMiddleWidth?: number,
borderInnerWidth?: number,
borderShadowWidth?: number,
valueBox?: boolean,
valueBoxStroke?: number,
valueText?: string,
valueTextShadow?: boolean,
valueBoxBorderRadius?: number,
highlights?: Highlight[],
fontNumbers?: string,
fontTitle?: string,
fontUnits?: string,
fontValue?: string,
fontTitleSize?: number,
fontValueSize?: number,
fontUnitsSize?: number,
fontNumbersSize?: number
}
export interface RadialGaugeOptions extends GenericOptions {
ticksAngle?: number,
startAngle?: number,
colorNeedleCircleOuter?: string,
colorNeedleCircleOuterEnd?: string,
colorNeedleCircleInner?: string,
colorNeedleCircleInnerEnd?: string,
needleCircleSize?: number,
needleCircleInner?: boolean,
needleCircleOuter?: boolean,
animationTarget?: string
}
export interface LinearGaugeOptions extends GenericOptions {
borderRadius?: number,
barBeginCircle?: number,
barWidth?: number,
barStrokeWidth?: number,
barProgress?: boolean,
colorBar?: string,
colorBarEnd?: string,
colorBarStroke?: string,
colorBarProgress?: string,
colorBarProgressEnd?: string,
tickSide?: string,
needleSide?: string,
numberSide?: string,
ticksWidth?: number,
ticksWidthMinor?: number,
ticksPadding?: number,
barLength?: number
}
export interface DrawEventCallback {
(percent: number): any;
}
export interface EndEventCallback {
(): any;
}
export interface rules {
linear: AnimationRule,
quad: AnimationRule,
dequad: AnimationRule,
quint: AnimationRule,
dequint: AnimationRule,
cycle: AnimationRule,
decycle: AnimationRule,
bounce: AnimationRule,
debounce: AnimationRule,
elastic: AnimationRule,
delastic: AnimationRule
}
export class Animation {
public duration: number;
public rule: string|AnimationRule;
public draw: DrawEventCallback;
public end: EndEventCallback;
public static rules: rules;
constructor(rule?: string|AnimationRule, duration?: number,
draw?: DrawEventCallback, end?: EndEventCallback);
public animate(draw?: DrawEventCallback, end?: EndEventCallback): any;
public destroy(): any;
}
export class SmartCanvas {
public element: HTMLCanvasElement;
public elementClone: HTMLCanvasElement;
public context: CanvasRenderingContext2D;
public contextClone: CanvasRenderingContext2D;
public drawWidth: number;
public drawHeight: number;
public drawX: number;
public drawY: number;
public minSide: number;
public width: number;
public height: number;
constructor(element: HTMLCanvasElement,
width?: number,
height?: number);
public init(): any;
public onRedraw(): any;
public destroy(): any;
public commit(): SmartCanvas;
public redraw(): SmartCanvas;
public pixelRatio: number;
public static redraw(): any;
public static collection: Array<SmartCanvas>;
}
export class DomObserver {
public Type: BaseGauge;
public mutationsObserved: boolean;
public isObservable: boolean;
public options: GenericOptions;
public element: string;
public type: string;
constructor(options: GenericOptions,
element: string,
type: string);
public isValidNode(node: Node|HTMLElement): boolean;
public traverse(): any;
public observe(records: MutationRecord[]): any;
public process(node: Node|HTMLElement): BaseGauge;
public static parse(value: any): any;
public static toDashed(camelCase: string): string;
public static toAttributeName(str: string): string;
static domReady(handler: Function): any;
}
export abstract class BaseGauge {
public type: BaseGauge;
public options: GenericOptions;
public canvas: SmartCanvas;
public animation: Animation;
public value: number;
constructor(options: GenericOptions);
public update(options: GenericOptions): BaseGauge;
public destroy(): any;
public abstract draw(): BaseGauge;
public static initialize(type: string, options: GenericOptions): any;
}
export class RadialGauge extends BaseGauge {
public type: RadialGauge;
public options: RadialGaugeOptions;
constructor(options: RadialGaugeOptions);
public draw(): RadialGauge;
}
export class LinearGauge extends BaseGauge {
public type: LinearGauge;
public options: LinearGaugeOptions;
constructor(options: LinearGaugeOptions);
public draw(): LinearGauge;
}
export interface Collection extends Array<BaseGauge> {
get: (id: number | string) => BaseGauge;
}
}
declare module 'canvas-gauges' {
export = CanvasGauges;
}
interface Document {
gauges: CanvasGauges.Collection;
}
interface Window {
BaseGauge: CanvasGauges.BaseGauge;
RadialGauge: CanvasGauges.RadialGauge;
LinearGauge: CanvasGauges.LinearGauge;
}
+5 -5
View File
@@ -3,7 +3,7 @@
// Definitions by: Matt Lewis <https://github.com/mattlewis92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../chai/chai.d.ts" />
/// <reference types="chai" />
declare namespace Chai {
@@ -24,13 +24,13 @@ declare namespace Chai {
value(text: string): Assertion;
}
interface Include {
text(text: string|string[]): Assertion;
html(text: string|string[]): Assertion;
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"chai-dom.d.ts",
"chai-dom-tests.ts"
]
}
+3 -3
View File
@@ -1,7 +1,7 @@
/// <reference path="../react/react.d.ts" />
/// <reference types="react" />
/// <reference path="./chai-enzyme.d.ts" />
/// <reference path="../enzyme/enzyme.d.ts" />
/// <reference path="../chai/chai.d.ts" />
/// <reference types="enzyme" />
/// <reference types="chai" />
import * as React from "react";
import * as chaiEnzyme from "chai-enzyme";
+4 -4
View File
@@ -4,12 +4,12 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../enzyme/enzyme.d.ts" />
/// <reference path="../chai/chai.d.ts" />
/// <reference path="../react/react.d.ts" />
/// <reference types="enzyme" />
/// <reference types="chai" />
/// <reference types="react" />
declare namespace Chai {
type EnzymeSelector = string | __React.StatelessComponent<any> | __React.ComponentClass<any> | { [key: string]: any };
type EnzymeSelector = string | React.StatelessComponent<any> | React.ComponentClass<any> | { [key: string]: any };
interface Match {
/**
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"chai-enzyme.d.ts",
"chai-enzyme-tests.tsx"
]
}
+8
View File
@@ -114,8 +114,16 @@ declare namespace Chance {
capitalize(str: string): string;
mixin(desc: MixinDescriptor): any;
pad(num: number, width: number, padChar?: string): string;
/**
* @deprecated Use pickone
*/
pick<T>(arr: T[]): T;
pickone<T>(arr: T[]): T;
/**
* @deprecated Use pickset
*/
pick<T>(arr: T[], count: number): T[];
pickset<T>(arr: T[], count: number): T[];
set: Setter;
shuffle<T>(arr: T[]): T[];
+124
View File
@@ -0,0 +1,124 @@
/// <reference path="change-emitter.d.ts"/>
import { createChangeEmitter, ChangeEmitterOf0 } from "change-emitter";
function usage() {
// https://github.com/acdlite/change-emitter#usage
const emitter = createChangeEmitter()
// Called `listen` instead of `subscribe` to avoid confusion with observable spec
const unlisten = emitter.listen((...args) => {
console.log(args)
})
emitter.emit(1, 2, 3) // logs `[1, 2, 3]`
unlisten()
emitter.emit(4, 5, 6) // doesn't log
}
function largerExample() {
// https://github.com/acdlite/change-emitter#larger-example
const createStore = (reducer: Function, initialState: any) => {
let state = initialState
const emitter = createChangeEmitter()
function dispatch(action: any) {
state = reducer(state, action)
emitter.emit()
return action
}
function getState() {
return state
}
return {
dispatch,
getState,
subscribe: emitter.listen
}
}
}
function untypedEmitter() {
const { emit, listen } = createChangeEmitter();
const unlisten0 = listen(() => {/* do something */});
const unlisten1 = listen(value => {/* do something with value */});
const unlisten2 = listen((value1, value2) => {/* do something with values */});
const unlistenArgs = listen((...args: any[]) => {/* do something with values */});
emit();
emit("hello");
emit("hello", "world");
emit(1, 2, 3, 4, 5);
unlisten0();
unlisten1();
unlisten2();
unlistenArgs();
}
function emitterOf0Args() {
const { emit, listen }: ChangeEmitterOf0 = createChangeEmitter();
const unlisten = listen(() => { });
// const unlisten = listen(value => {}); // SYNTAX ERROR
emit();
// emit("hello"); // SYNTAX ERROR
unlisten();
}
function emitterOf1Args() {
const { emit, listen } = createChangeEmitter<string>();
const unlisten = listen(value => { value.length });
emit("hello");
unlisten();
}
function emitterOf2Args() {
const { emit, listen } = createChangeEmitter<string, boolean>();
const unlisten = listen((value, success) => { value.length > 0 === success });
emit("hello", true);
unlisten();
}
function emitterOf3Args() {
const { emit, listen } = createChangeEmitter<string, boolean, number>();
const unlisten = listen((value, success, count) => { value.length > count === success });
emit("hello", true, 3);
unlisten();
}
function emitterOf4Args() {
const { emit, listen } = createChangeEmitter<string, boolean, number, Date>();
const unlisten = listen((v1, v2, v3, v4) => { });
emit("hello", true, 3, new Date());
unlisten();
}
function emitterOf5Args() {
const { emit, listen } = createChangeEmitter<string, boolean, number, Date, string>();
const unlisten = listen((v1, v2, v3, v4, v5) => { });
emit("hello", true, 3, new Date(), "world");
unlisten();
}
+58
View File
@@ -0,0 +1,58 @@
// Type definitions for change-emitter v0.1.2
// Project: https://github.com/acdlite/change-emitter
// Definitions by: Iskander Sierra <https://github.com/iskandersierra>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'change-emitter' {
type Unlisten = () => void;
type Listener = (...args: any[]) => void;
type ListenerOf0 = () => void;
type ListenerOf1<T> = (value: T) => void;
type ListenerOf2<T1, T2> = (value1: T1, value2: T2) => void;
type ListenerOf3<T1, T2, T3> = (value1: T1, value2: T2, value3: T3) => void;
type ListenerOf4<T1, T2, T3, T4> = (value1: T1, value2: T2, value3: T3, value4: T4) => void;
type ListenerOf5<T1, T2, T3, T4, T5> = (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => void;
interface ChangeEmitter {
listen(listener: Listener): Unlisten;
emit(...args: any[]): void;
}
interface ChangeEmitterOf1<T> {
listen(listener: ListenerOf1<T>): Unlisten;
emit(value: T): void;
}
interface ChangeEmitterOf0 {
listen(listener: ListenerOf0): Unlisten;
emit(): void;
}
interface ChangeEmitterOf2<T1, T2> {
listen(listener: ListenerOf2<T1, T2>): Unlisten;
emit(value1: T1, value2: T2): void;
}
interface ChangeEmitterOf3<T1, T2, T3> {
listen(listener: ListenerOf3<T1, T2, T3>): Unlisten;
emit(value1: T1, value2: T2, value3: T3): void;
}
interface ChangeEmitterOf4<T1, T2, T3, T4> {
listen(listener: ListenerOf4<T1, T2, T3, T4>): Unlisten;
emit(value1: T1, value2: T2, value3: T3, value4: T4): void;
}
interface ChangeEmitterOf5<T1, T2, T3, T4, T5> {
listen(listener: ListenerOf5<T1, T2, T3, T4, T5>): Unlisten;
emit(value1: T1, value2: T2, value3: T3, value4: T4, value5: T5): void;
}
export function createChangeEmitter(): ChangeEmitter;
export function createChangeEmitter<T>(): ChangeEmitterOf1<T>;
export function createChangeEmitter<T1, T2>(): ChangeEmitterOf2<T1, T2>;
export function createChangeEmitter<T1, T2, T3>(): ChangeEmitterOf3<T1, T2, T3>;
export function createChangeEmitter<T1, T2, T3, T4>(): ChangeEmitterOf4<T1, T2, T3, T4>;
export function createChangeEmitter<T1, T2, T3, T4, T5>(): ChangeEmitterOf5<T1, T2, T3, T4, T5>;
}
+1 -1
View File
@@ -73,7 +73,7 @@ interface ChartOptions {
onClick?: (any?: any) => any;
title?: ChartTitleOptions;
legend?: ChartLegendOptions;
tooltip?: ChartTooltipOptions;
tooltips?: ChartTooltipOptions;
hover?: ChartHoverOptions;
animation?: ChartAnimationOptions;
elements?: ChartElementsOptions;
+44 -11
View File
@@ -26,6 +26,7 @@ function bookmarksExample() {
return list;
}
function dumpNode(bookmarkNode, query) {
var span = $('<span>');
if (bookmarkNode.title) {
if (query && !bookmarkNode.children) {
if (String(bookmarkNode.title).indexOf(query) == -1) {
@@ -42,7 +43,6 @@ function bookmarksExample() {
anchor.click(function () {
chrome.tabs.create({ url: bookmarkNode.url });
});
var span = $('<span>');
var options = bookmarkNode.children ?
$('<span>[<a href="#" id="addlink">Add</a>]</span>') :
$('<span>[<a id="editlink" href="#">Edit</a> <a id="deletelink" ' +
@@ -146,7 +146,7 @@ function pageRedder() {
function printPage() {
chrome.browserAction.onClicked.addListener(function (tab) {
var action_url = "javascript:window.print();";
chrome.tabs.update(tab.id, { url: action_url });
chrome.tabs.update(tab.id!, { url: action_url });
});
}
@@ -173,10 +173,10 @@ function catBlock () {
// contrived settings example
function proxySettings() {
chrome.proxy.settings.get({ incognito: false }, (details) => {
chrome.proxy.settings.get({ incognito: true }, (details) => {
var val = details.value;
var level: string = details.levelOfControl;
var incognito: boolean = details.incognitoSpecific;
var incognito: boolean = details.incognitoSpecific!;
});
// bare minimum set call
@@ -254,11 +254,44 @@ function testOptionsPage() {
});
}
chrome.storage.sync.get("myKey", function (loadedData) {
var myValue: { x: number } = loadedData["myKey"];
});
// https://developer.chrome.com/extensions/storage#type-StorageArea
function testStorage() {
function getCallback(loadedData: { [key: string]: any; }) {
var myValue: { x: number } = loadedData["myKey"];
}
chrome.storage.onChanged.addListener(function (changes) {
var myNewValue: { x: number } = changes["myKey"].newValue;
var myOldValue: { x: number } = changes["myKey"].oldValue;
});
chrome.storage.sync.get(getCallback);
chrome.storage.sync.get("myKey", getCallback);
chrome.storage.sync.get(["myKey", "myKey2"], getCallback);
chrome.storage.sync.get({ foo: 1, bar: 2 }, getCallback);
chrome.storage.sync.get(null, getCallback);
function getBytesInUseCallback(bytesInUse: number) {
console.log(bytesInUse);
}
chrome.storage.sync.getBytesInUse(getBytesInUseCallback);
chrome.storage.sync.getBytesInUse("myKey", getBytesInUseCallback);
chrome.storage.sync.getBytesInUse(["myKey", "myKey2"], getBytesInUseCallback);
chrome.storage.sync.getBytesInUse(null, getBytesInUseCallback);
function doneCallback() {
console.log("done");
}
chrome.storage.sync.set({ foo: 1, bar: 2});
chrome.storage.sync.set({ foo: 1, bar: 2}, doneCallback);
chrome.storage.sync.remove("myKey");
chrome.storage.sync.remove("myKey", doneCallback);
chrome.storage.sync.remove(["myKey", "myKey2"]);
chrome.storage.sync.remove(["myKey", "myKey2"], doneCallback);
chrome.storage.sync.clear();
chrome.storage.sync.clear(doneCallback);
chrome.storage.onChanged.addListener(function (changes) {
var myNewValue: { x: number } = changes["myKey"].newValue;
var myOldValue: { x: number } = changes["myKey"].oldValue;
});
}
+14 -34
View File
@@ -1242,7 +1242,7 @@ declare namespace chrome.cookies {
* function( Cookie cookie) {...};
* Optional parameter cookie: Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
*/
export function set(details: SetDetails, callback?: (cookie?: Cookie) => void): void;
export function set(details: SetDetails, callback?: (cookie: Cookie | null) => void): void;
/**
* Deletes a cookie by name.
* @param details Information to identify the cookie to remove.
@@ -1257,7 +1257,7 @@ declare namespace chrome.cookies {
* function( Cookie cookie) {...};
* Parameter cookie: Contains details about the cookie. This parameter is null if no such cookie was found.
*/
export function get(details: Details, callback: (cookie?: Cookie) => void): void;
export function get(details: Details, callback: (cookie: Cookie | null) => void): void;
/** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */
var onChanged: CookieChangedEvent;
@@ -1755,7 +1755,7 @@ declare namespace chrome.devtools.panels {
* @param tooltipText Text shown as a tooltip when user hovers the mouse over the button.
* @param disabled Whether the button is disabled.
*/
update(iconPath?: string, tooltipText?: string, disabled?: boolean): void;
update(iconPath?: string | null, tooltipText?: string | null, disabled?: boolean | null): void;
/** Fired when the button is clicked. */
onClicked: ButtonClickedEvent;
}
@@ -2458,7 +2458,7 @@ declare namespace chrome.extension {
var lastError: LastError;
/** Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page. */
export function getBackgroundPage(): Window;
export function getBackgroundPage(): Window | null;
/**
* Converts a relative path within an extension install directory to a fully-qualified URL.
* @param path A path to a resource within an extension expressed relative to its install directory.
@@ -2545,7 +2545,7 @@ declare namespace chrome.fileBrowserHandler {
interface SelectionResult {
/** Optional. Selected file entry. It will be null if a file hasn't been selected. */
entry?: Object;
entry?: Object | null;
/** Whether the file has been selected. */
success: boolean;
}
@@ -4633,7 +4633,7 @@ declare namespace chrome.platformKeys {
* function(object publicKey, object privateKey) {...};
* Optional parameter privateKey: Might be null if this extension does not have access to it.
*/
export function getKeyPair(certificate: ArrayBuffer, parameters: Object, callback: (publicKey: CryptoKey, privateKey?: CryptoKey) => void): void;
export function getKeyPair(certificate: ArrayBuffer, parameters: Object, callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void): void;
/** An implementation of WebCrypto's SubtleCrypto that allows crypto operations on keys of client certificates that are available to this extension. */
export function subtleCrypto(): SubtleCrypto;
/**
@@ -5476,18 +5476,11 @@ declare namespace chrome.storage {
getBytesInUse(callback: (bytesInUse: number) => void): void;
/**
* Gets the amount of space (in bytes) being used by one or more items.
* @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage.
* @param keys A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
* @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set).
* Parameter bytesInUse: Amount of space being used in storage, in bytes.
*/
getBytesInUse(key: string, callback: (bytesInUse: number) => void): void;
/**
* Gets the amount of space (in bytes) being used by one or more items.
* @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
* @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set).
* Parameter bytesInUse: Amount of space being used in storage, in bytes.
*/
getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void;
getBytesInUse(keys: string | string[] | null, callback: (bytesInUse: number) => void): void;
/**
* Removes all items from storage.
* @param callback Optional.
@@ -5524,25 +5517,12 @@ declare namespace chrome.storage {
get(callback: (items: { [key: string]: any }) => void): void;
/**
* Gets one or more items from storage.
* @param key A single key to get. Pass in null to get the entire contents of storage.
* @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
* An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
* @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
* Parameter items: Object with items in their key-value mappings.
*/
get(key: string, callback: (items: { [key: string]: any }) => void): void;
/**
* Gets one or more items from storage.
* @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
* @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
* Parameter items: Object with items in their key-value mappings.
*/
get(keys: string[], callback: (items: { [key: string]: any }) => void): void;
/**
* Gets one or more items from storage.
* @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage.
* @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
* Parameter items: Object with items in their key-value mappings.
*/
get(keys: Object, callback: (items: { [key: string]: any }) => void): void;
get(keys: string | string[] | Object | null, callback: (items: { [key: string]: any }) => void): void;
}
interface StorageChange {
@@ -5816,7 +5796,7 @@ declare namespace chrome.tabCapture {
* @param options Configures the returned media stream.
* @param callback Callback with either the tab capture stream or null.
*/
export function capture(options: CaptureOptions, callback: (stream: MediaStream) => void): void;
export function capture(options: CaptureOptions, callback: (stream: MediaStream | null) => void): void;
/**
* Returns a list of tabs that have requested capture or are being captured, i.e. status != stopped and status != error. This allows extensions to inform the user that there is an existing tab capture that would prevent a new tab capture from succeeding (or to prevent redundant requests for the same tab).
* @param callback Callback invoked with CaptureInfo[] for captured tabs.
@@ -7107,14 +7087,14 @@ declare namespace chrome.webNavigation {
* @param callback
* Optional parameter details: Information about the requested frame, null if the specified frame ID and/or tab ID are invalid.
*/
export function getFrame(details: GetFrameDetails, callback: (details?: GetFrameResultDetails) => void): void;
export function getFrame(details: GetFrameDetails, callback: (details: GetFrameResultDetails | null) => void): void;
/**
* Retrieves information about all frames of a given tab.
* @param details Information about the tab to retrieve all frames from.
* @param callback
* Optional parameter details: A list of frames in the given tab, null if the specified tab ID is invalid.
*/
export function getAllFrames(details: GetAllFrameDetails, callback: (details?: GetAllFrameResultDetails[]) => void): void;
export function getAllFrames(details: GetAllFrameDetails, callback: (details: GetAllFrameResultDetails[] | null) => void): void;
/** Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL. */
var onReferenceFragmentUpdated: WebNavigationTransitionalEvent;
+1 -1
View File
@@ -3,7 +3,7 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
+5 -3
View File
@@ -17,6 +17,8 @@ classNames([{ foo: true, bar: false }, { baz: true }]); // => 'foo baz'
classNames(["foo", ["bar", {baz: true}]]); // => 'foo bar baz'
// other falsy values are just ignored
// NOTE: We don't really want to allow this kind of thing with Typescript (otherwise what's the point!)
//classNames(null, false, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
// falsey values are just ignored
classNames(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
// Supporting booleans is tricky since we should only support passing in false, which is ignored
//classNames(false, 'bar', 0, 1, { baz: null }, ''); // => 'bar 1'
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Dave Keen <http://www.keendevelopment.ch>, Adi Dahiya <https://github.com/adidahiya>, Jason Killian <https://github.com/JKillian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare type ClassValue = string | number | ClassDictionary | ClassArray;
declare type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null;
interface ClassDictionary {
[id: string]: boolean;
+44
View File
@@ -0,0 +1,44 @@
/// <reference types="node"/>
/// <reference types="koa"/>
import * as koa from 'koa';
import * as parse from 'co-body';
var app = new koa();
app.use(async function (ctx: koa.Context, next: Function): Promise<void> {
var body: any;
// application/json
body = await parse.json(ctx.req);
// explicit limit
body = await parse.json(ctx.req, { limit: '10kb' });
// application/x-www-form-urlencoded
body = await parse.form(ctx.req);
// text/plain
body = await parse.text(ctx.req);
// either
body = await parse(ctx.req);
// custom type
body = await parse(ctx.req, { textTypes: ['text', 'html'] });
// This lib also supports ctx.req in Koa (or other libraries), so that you may simply use this instead of this.req.
// application/json
body = await parse.json(ctx);
// application/x-www-form-urlencoded
body = await parse.form(ctx);
// text/plain
body = await parse.text(ctx);
// either
body = await parse(ctx);
});
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for co-body
// Project: https://github.com/cojs/co-body
// Definitions by: Joshua DeVinney <https://github.com/geoffreak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
/// <reference types="koa"/>
/// <reference types="qs"/>
import * as http from 'http';
import * as Koa from 'koa';
import * as qs from 'qs';
declare namespace CoBody {
type Context = http.IncomingMessage | Koa.Context;
export interface Parse {
(context: Context, options?: Options): Promise<any>;
text: (context: Context, options?: Options) => Promise<any>;
form: (context: Context, options?: Options) => Promise<any>;
json: (context: Context, options?: Options) => Promise<any>;
}
export interface Options {
limit?: number | string;
strict?: boolean;
queryString?: qs.IParseOptions;
jsonTypes?: string[];
formTypes?: string[];
textTypes?: string[];
encoding?: string;
length?: number;
}
}
declare var CoBody: CoBody.Parse;
export = CoBody;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"co-body-tests.ts"
]
}
+2
View File
@@ -5,9 +5,11 @@ colors.enabled = true;
console.log(colors.black.underline('test'));
console.log(colors.rainbow.black.blue.gray('test'));
console.log(colors.random.reset.bgWhite.dim('test'));
console.log(colors.random.reset.bgWhite.strip('test'));
console.log('test'.black.underline);
console.log('test'.rainbow.black.blue.gray);
console.log('test'.random.reset.bgWhite.dim);
console.log('test'.random.reset.bgWhite.dim.stripColors);
colors.enabled = false;
+9
View File
@@ -7,6 +7,9 @@ declare module "colors" {
interface Color {
(text: string): string;
strip: Color;
stripColors: Color;
black: Color;
red: Color;
green: Color;
@@ -49,6 +52,9 @@ declare module "colors" {
export var enabled: boolean;
export var strip: Color;
export var stripColors: Color;
export var black: Color;
export var red: Color;
export var green: Color;
@@ -90,6 +96,9 @@ declare module "colors" {
}
interface String {
strip: string;
stripColors: string;
black: string;
red: string;
green: string;
+72 -72
View File
@@ -3,12 +3,12 @@
// Definitions by: Hiraash Thawfeek <https://github.com/hiraash>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../angularjs/angular.d.ts' />
/// <reference types="angular" />
declare var commangular: commangular.ICommAngularStatic;
declare module commangular {
///////////////////////////////////////////////////////////////////////////
// Commangular Static
// see http://commangular.org/docs/#commangular-namespace
@@ -19,78 +19,78 @@ declare module commangular {
* Use this function to create and register a command with Commangular
*
* @param commandName It's the name of the command you are creating. It's useful to reference the command from the command provider.
* @param commandFunction It's the command class that will be executed when commangular runs this command.
* @param commandFunction It's the command class that will be executed when commangular runs this command.
* It has to be something that implements ICommand. Same as angular syntax
* @param commandConfig It's and object with paramaters to configure the command execution.
*/
create (commandName: string, commandFunction: Function, commandConfig?:ICommandConfig) : void;
command (commandName: string, commandFunction: Function, commandConfig?:ICommandConfig) : void;
/**
* This function allows you to hijack the execution before or after and
* execute some cross cutting functionality.
* see http://commangular.org/docs/#command-aspects
* @param aspectDescriptor The interceptor descriptor has two parts 'Where' and 'What'.
* Where do you want to intercept? you've 5 options :
* - @Before : The interceptor will be executed before the command. You will be able to
* cancel the command or modify the data that will be injected in the command or do
* - @Before : The interceptor will be executed before the command. You will be able to
* cancel the command or modify the data that will be injected in the command or do
* some other operation you need before the command execution.
* - @After : The interceptor will be executed just after the command and before any other next
* - @After : The interceptor will be executed just after the command and before any other next
* command. You can get the lastResult from the command, cancel execution etc etc.
* - @AfterExecution : This intercetor is executed just after the command execute method and
* - @AfterExecution : This intercetor is executed just after the command execute method and
* it can get the result from the command and update it before the onResult method is executed.
* - @AfterThrowing : This interceptor will be executed if the command or any interceptor of
* - @AfterThrowing : This interceptor will be executed if the command or any interceptor of
* the command throws an exception. You can get the error throwed injected to do what you need.
* - @Around : The interceptor is executed around a command.That means that a especial
* object 'processor' will be injected in the interceptor and you can invoke the command
* - @Around : The interceptor is executed around a command.That means that a especial
* object 'processor' will be injected in the interceptor and you can invoke the command
* or the next interceptor. It will be better explained below.
* @param aspectFunction It's the command class execute function that will be run for the given aspect.
* @param order You can chain any number of interceptors to the same command, so if you need to executed
* @param order You can chain any number of interceptors to the same command, so if you need to executed
* the interceptor in a specific order you can indicate it here. An order of 0 is assigned by default.
*/
aspect ( aspectDescriptor: string, aspectFunction: ICommand, order: number ) : void;
/**
* Event aspects work the same way command aspects do, but they intercept all the command groups instead,
* so you can run some function before the command group starts it's execution , after or when any
* Event aspects work the same way command aspects do, but they intercept all the command groups instead,
* so you can run some function before the command group starts it's execution , after or when any
* command or interceptor in the group throw an exception.
* see http://commangular.org/docs/#event-aspects
* @param aspectDescriptor The interceptor descriptor has two parts 'Where' and 'What'.
* Where do you want to intercept? you've 3 options :
* - @Before : The interceptor will be executed before the command. You will be able to
* cancel the command or modify the data that will be injected in the command or do
* - @Before : The interceptor will be executed before the command. You will be able to
* cancel the command or modify the data that will be injected in the command or do
* some other operation you need before the command execution.
* - @After : The interceptor will be executed just after the command and before any other next
* - @After : The interceptor will be executed just after the command and before any other next
* command. You can get the lastResult from the command, cancel execution etc etc.
* - @AfterThrowing : This interceptor will be executed if the command or any interceptor of
* - @AfterThrowing : This interceptor will be executed if the command or any interceptor of
* the command throws an exception. You can get the error throwed injected to do what you need.
* @param aspectFunction It's the command class execute function that will be run for the given aspect.
* @param order You can chain any number of interceptors to the same command, so if you need to executed
* @param order You can chain any number of interceptors to the same command, so if you need to executed
* the interceptor in a specific order you can indicate it here. An order of 0 is assigned by default.
*/
eventAspect( aspectDescriptor: string, aspectFunction: ICommand, order: number ) : void;
/**
* TBD
*/
resolver( commandName: string, resolverFunction : Function ) : void;
resolver( commandName: string, resolverFunction : Function ) : void;
/**
* Clears all commands and aspects registered with commangular.
*/
reset() : void;
/**
* Can be used to enable/disable debug
* Can be used to enable/disable debug
*/
debug( enableDebug : boolean ) : void;
/**
* TBD
*/
build() : void;
}
/**
* The command function/object
* see http://commangular.org/docs/#commangular-namespace
@@ -101,29 +101,29 @@ declare module commangular {
* It can take parameters in as injected by angular
*/
execute() : any;
}
interface IResultCommand extends ICommand{
/**
* Is executed after the execute method and the interception chain and can receive
* Is executed after the execute method and the interception chain and can receive
* the result from the execute method of the same command.
*
*
* @param result Value/object returned by the execution.
*/
onResult ( result: any ) : void;
/**
* Is executed when the executed method ends with an error. Can receive the error throw by the execute method.
* @param error The error that occured during execution
*/
onError ( error: Error ) : void;
}
/**
* The result object expected in the promise returned by the dispatch function
* This must be extended to add custom result keys
* see http://commangular.org/docs/#returning-result-from-commands
* see http://commangular.org/docs/#returning-result-from-commands
*/
interface ICommandResult {
/**
@@ -131,65 +131,65 @@ declare module commangular {
*/
lastResult : any;
}
/**
* Command creation configuration
* see http://commangular.org/docs/#the-command-config-object
*/
interface ICommandConfig {
/**
* This property instruct commangular to keep the value returned by the command in the value
* key passed in 'resultKey'. It has to be a string. It means that after the execution of this
* This property instruct commangular to keep the value returned by the command in the value
* key passed in 'resultKey'. It has to be a string. It means that after the execution of this
* commands you will be able to inject on the next command using that key and the result of the command will be injected.
*/
resultKey : string;
}
/**
* All the command configuration of your application is done in an angular config block and
* with the $commangularProvider. The provider is responsible to build the command strutures and
* map them to the desired event names. You can create multiple configs blocks in angular, so you
* All the command configuration of your application is done in an angular config block and
* with the $commangularProvider. The provider is responsible to build the command strutures and
* map them to the desired event names. You can create multiple configs blocks in angular, so you
* can have multiple command config blocks to separate functional parts of your application.
* see http://commangular.org/docs/#using-the-provider
*/
interface ICommAngularProvider {
/**
* This function lets you map a even name to a command sequence
* @param eventName An event that will be watched by commangular
*/
mapTo( eventName: string ) : ICommAngularDescriptor;
/**
* Used along with mapTo function. Creates a sequence of commands that
* Used along with mapTo function. Creates a sequence of commands that
* execute after one and other
* see http://commangular.org/docs/#building-command-sequences
*/
asSequence(): ICommAngularDescriptor;
/**
* Used along with mapTo function. Maps commands to be executed parallel
* see http://commangular.org/docs/#building-parallel-commands
*/
asParallel(): ICommAngularDescriptor;
/**
* A command flow is a decision point inside the command group.You can have any number
* A command flow is a decision point inside the command group.You can have any number
* of flows inside a command group and nesting them how you perfer.
* see http://commangular.org/docs/#building-command-flows
*/
asFlow(): ICommAngularDescriptor;
asFlow(): ICommAngularDescriptor;
findCommand( eventName: string ): ICommAngularDescriptor;
}
/**
* The service that enables the execution of commands
* see http://commangular.org/docs/#dispatching-events
*/
interface ICommAngularService {
/**
* This function executes the given command sequence.
* see http://commangular.org/docs/#dispatching-events
@@ -198,76 +198,76 @@ declare module commangular {
*/
dispatch( eventName: string, data?: any ) : ng.IPromise<any>;
}
interface ICommAngularDescriptor {
/**
* Used along with mapTo function. Creates a sequence of commands that
* Used along with mapTo function. Creates a sequence of commands that
* execute after one and other
* see http://commangular.org/docs/#building-command-sequences
*/
asSequence (): ICommAngularDescriptor;
asSequence (): ICommAngularDescriptor;
/**
* Used along with mapTo function. Maps commands to be executed parallel
* see http://commangular.org/docs/#building-parallel-commands
*/
asParallel(): ICommAngularDescriptor;
/**
* A command flow is a decision point inside the command group.You can have any number
* A command flow is a decision point inside the command group.You can have any number
* of flows inside a command group and nesting them how you perfer.
* see http://commangular.org/docs/#building-command-flows
*/
asFlow(): ICommAngularDescriptor;
asFlow(): ICommAngularDescriptor;
/**
* Add commands to a descriptor.
* @param command The name that was used to create the command.
*/
add ( command: string ): ICommAngularDescriptor;
/**
* Add descriptor to a descriptor.
* @param descriptor Another descriptor attached to a sequnce of commands.
*/
add ( descriptor: ICommAngularDescriptor ): ICommAngularDescriptor;
/**
* This is to be used with flowing commands to attach an expression that
* This is to be used with flowing commands to attach an expression that
* evaluates using Angular $parse.
* see http://commangular.org/docs/#building-command-flows
* @param expression A string form expression that can make use of services to validate conditions.
* @param services A comma seperated list of services that are used in the above expression
*/
link ( expression: string, services?: string ): ICommAngularDescriptor;
/**
* Works with the <code>link</code> function to attach a command to the flow if the
* expression becomes truthy.
* Works with the <code>link</code> function to attach a command to the flow if the
* expression becomes truthy.
* see http://commangular.org/docs/#building-command-flows
* @param command The name that was used to create the command.
*/
to ( command: string ): ICommAngularDescriptor;
to ( command: string ): ICommAngularDescriptor;
}
}
/**
* Extending the angular rootScope to include the dispatch function in all scopes.
*/
declare module angular {
interface IRootScopeService {
/**
* Commangular method to execute a command.
* @param eventName Name of the even that will trigger a command sequence
* @param data Data of any type that will be passed to the command.
*/
dispatch( eventName: string, data?: any ) : ng.IPromise<any>;
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"commangular.d.ts",
"commangular-mock.d.ts"
]
}
+5
View File
@@ -0,0 +1,5 @@
/// <reference path="./concaveman.d.ts" />
import * as concaveman from 'concaveman';
var points = [[10, 20], [30, 12.5]];
var polygon = concaveman(points);
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for concaveman 1.1.0
// Project: https://github.com/mapbox/concaveman
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "concaveman" {
/**
* A very fast 2D concave hull algorithm in JavaScript (generates a general outline of a point set).
*
* @name concaveman
* @param {Array<Array<number>>} points is an array of [x, y] points.
* @param {number} [concavity=2] is a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull. You can use values lower than 1, but they can produce pretty crazy shapes.
* @param {number} [lengthThreshold=0] when a segment length is under this threshold, it stops being considered for further detalization. Higher values result in simpler shapes.
* @return {Array<Array<number>>}
* @example
* var points = [[10, 20], [30, 12.5], ...];
* var polygon = concaveman(points);
*
* //=hull
*/
function concaveman(points: number[][], concavity?: number, lengthThreshold?: number): number[][];
namespace concaveman {}
export = concaveman;
}
+1 -1
View File
@@ -1,5 +1,5 @@
/// <reference path="./connect-redis.d.ts" />
/// <reference path="../express-session/express-session.d.ts" />
/// <reference types="express-session" />
import * as connectRedis from "connect-redis";
import * as session from "express-session";
+3 -3
View File
@@ -3,9 +3,9 @@
// Definitions by: Xavier Stouder <https://github.com/xstoudi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
/// <reference path="../express-session/express-session.d.ts" />
/// <reference path="../redis/redis.d.ts" />
/// <reference types="express" />
/// <reference types="express-session" />
/// <reference types="redis" />
declare module "connect-redis" {
import * as express from "express";
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"connect-redis.d.ts",
"connect-redis-tests.ts"
]
}
+4 -4
View File
@@ -1,8 +1,8 @@
// Type definitions for Apache Cordova Contacts plugin.
// Type definitions for Apache Cordova Contacts plugin
// Project: https://github.com/apache/cordova-plugin-contacts
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
@@ -204,7 +204,7 @@ declare var ContactName: {
* The ContactField object is a reusable component that represents contact fields generically.
* Each ContactField object contains a value, type, and pref property. A Contact object stores
* several properties in ContactField[] arrays, such as phone numbers and email addresses.
*
*
* In most instances, there are no pre-determined values for a ContactField object's type attribute.
* For example, a phone number can specify type values of home, work, mobile, iPhone,
* or any other value that is supported by a particular device platform's contact database.
+3 -1
View File
@@ -13,6 +13,8 @@
interface Device {
/** Get the version of Cordova running on the device. */
cordova: string;
/** Indicates that Cordova initialize successfully. */
available: boolean;
/**
* The device.model returns the name of the device's model or product. The value is set
* by the device manufacturer and may be different across versions of the same product.
@@ -31,4 +33,4 @@ interface Device {
/** Get the device hardware serial number. */
serial: string;}
declare var device: Device;
declare var device: Device;
+3 -3
View File
@@ -2,11 +2,11 @@
// Project: https://github.com/apache/cordova-plugin-file-transfer
// Definitions by: Microsoft Open Technologies Inc. <http://msopentech.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
//
// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license
/// <reference path="../cordova-plugin-file/index.d.ts" />
/// <reference types="cordova-plugin-file" />
/**
* The FileTransfer object provides a way to upload files using an HTTP multi-part POST request,
@@ -21,7 +21,7 @@ interface FileTransfer {
* this can also be the full path of the file on the device.
* @param server URL of the server to receive the file, as encoded by encodeURI().
* @param successCallback A callback that is passed a FileUploadResult object.
* @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
* @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
* Invoked with a FileTransferError object.
* @param options Optional parameters.
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
+8 -2
View File
@@ -2,9 +2,15 @@
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"noImplicitAny": true,
"strictNullChecks": false,
"noEmit": true
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for Apache Cordova File System plugin.
// Type definitions for Apache Cordova File System plugin
// Project: https://github.com/apache/cordova-plugin-file
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
+2 -2
View File
@@ -1889,7 +1889,7 @@ declare module "core-js/fn/number/max-safe-integer" {
var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER;
export = MAX_SAFE_INTEGER;
}
declare module "core-js/fn/number/min-safe-interger" {
declare module "core-js/fn/number/min-safe-integer" {
var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER;
export = MIN_SAFE_INTEGER;
}
@@ -2668,7 +2668,7 @@ declare module "core-js/library/fn/number/max-safe-integer" {
var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER;
export = MAX_SAFE_INTEGER;
}
declare module "core-js/library/fn/number/min-safe-interger" {
declare module "core-js/library/fn/number/min-safe-integer" {
var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER;
export = MIN_SAFE_INTEGER;
}
+24 -24
View File
@@ -3,44 +3,44 @@
// Definitions by: David Muller <https://github.com/davidm77>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference types="node" />
declare module "csv-parse/types" {
interface callbackFn {
(err: any, output: any): void
}
interface nameCallback {
(line1: any[]): boolean | string[]
}
}
interface options {
/***
* Set the field delimiter. One character only, defaults to comma.
* Set the field delimiter. One character only, defaults to comma.
*/
delimiter?: string;
/***
* String used to delimit record rows or a special value; special constants are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified).
*/
*/
rowDelimiter?: string;
/***
* Optional character surrounding a field, one character only, defaults to double quotes.
* Optional character surrounding a field, one character only, defaults to double quotes.
*/
quote?: string
/***
* Set the escape character, one character only, defaults to double quotes.
*/
* Set the escape character, one character only, defaults to double quotes.
*/
escape?: string
/***
* List of fields as an array, a user defined callback accepting the first line and returning the column names or true if autodiscovered in the first CSV line, default to null, affect the result data set in the sense that records will be objects instead of arrays.
* List of fields as an array, a user defined callback accepting the first line and returning the column names or true if autodiscovered in the first CSV line, default to null, affect the result data set in the sense that records will be objects instead of arrays.
*/
columns?: any[]|boolean|nameCallback;
/***
* Treat all the characters after this one as a comment, default to '' (disabled).
* Treat all the characters after this one as a comment, default to '' (disabled).
*/
comment?: string
@@ -88,24 +88,24 @@ declare module "csv-parse/types" {
* If true, the parser will attempt to convert read data types to native types.
*/
auto_parse?: boolean
/***
* If true, the parser will attempt to convert read data types to dates. It requires the "auto_parse" option.
*/
auto_parse_date?: boolean
}
import * as stream from "stream";
import * as stream from "stream";
interface Parser extends stream.Transform {
__push(line: any): any ;
__write(chars: any, end: any, callback: any): any;
__write(chars: any, end: any, callback: any): any;
}
interface ParserConstructor {
new (options: options): Parser;
}
interface parse {
(input: string, options?: options, callback?: callbackFn): any;
(options: options, callback: callbackFn): any;
@@ -117,16 +117,16 @@ declare module "csv-parse/types" {
declare module "csv-parse" {
import { parse as parseIntf } from "csv-parse/types";
let parse: parseIntf;
export = parse;
}
declare module "csv-parse/lib/sync" {
import { options } from "csv-parse/types";
import { options } from "csv-parse/types";
function parse (input: string, options?: options): any;
export = parse;
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"csv-parse.d.ts",
"csv-parse-tests.ts"
]
}
@@ -0,0 +1,60 @@
/**
* Typescript definition tests for d3/d3-scale-chromatic module
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
*/
import * as d3ScaleChromatic from 'd3-scale-chromatic';
// -----------------------------------------------------------------------
// Categorical
// -----------------------------------------------------------------------
let accent: string = d3ScaleChromatic.schemeAccent[0]; // #7fc97f
let dark: string = d3ScaleChromatic.schemeDark2[0]; // #1b9e77
let paired: string = d3ScaleChromatic.schemePaired[0]; // #a6cee3
let pastel1: string = d3ScaleChromatic.schemePastel1[0]; // #fbb4ae
let pastel2: string = d3ScaleChromatic.schemePastel2[0]; // #b3e2cd
let set1: string = d3ScaleChromatic.schemeSet1[0]; // #e41a1c
let set2: string = d3ScaleChromatic.schemeSet2[0]; // #66c2a5
let set3: string = d3ScaleChromatic.schemeSet3[0]; // #8dd3c7
// -----------------------------------------------------------------------
// Diverging
// -----------------------------------------------------------------------
let BrBG: string = d3ScaleChromatic.interpolateBrBG(0); // rgb(84, 48, 5)
let PRGn: string = d3ScaleChromatic.interpolatePRGn(0); // rgb(64, 0, 75)
let PiYG: string = d3ScaleChromatic.interpolatePiYG(0); // rgb(142, 1, 82)
let PuOr: string = d3ScaleChromatic.interpolatePuOr(0); // rgb(127, 59, 8)
let RdBu: string = d3ScaleChromatic.interpolateRdBu(0); // rgb(103, 0, 31)
let RdGy: string = d3ScaleChromatic.interpolateRdGy(0); // rgb(103, 0, 31)
let RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31)
let RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31)
let Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66)
// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
let Blue: string = d3ScaleChromatic.interpolateBlues(1); // rgb(8, 48, 107)
let Green: string = d3ScaleChromatic.interpolateGreens(1); // rgb(0, 68, 27)
let Grey: string = d3ScaleChromatic.interpolateGreys(1); // rgb(0, 0, 0)
let Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4)
let Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125)
let Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13)
// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
let BuGn: string = d3ScaleChromatic.interpolateBuGn(1); // rgb(0, 68, 27)
let BuPu: string = d3ScaleChromatic.interpolateBuPu(1); // rgb(77, 0, 75)
let GnBu: string = d3ScaleChromatic.interpolateGnBu(1); // rgb(8, 64, 129)
let OrRd: string = d3ScaleChromatic.interpolateOrRd(1); // rgb(127, 0, 0)
let PuBuGn: string = d3ScaleChromatic.interpolatePuBuGn(1); // rgb(1, 70, 54)
let PuBu: string = d3ScaleChromatic.interpolatePuBu(1); // rgb(2, 56, 88)
let PuRd: string = d3ScaleChromatic.interpolatePuRd(1); // rgb(103, 0, 31)
let RdPu: string = d3ScaleChromatic.interpolateRdPu(1); // rgb(73, 0, 106)
let YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88)
let YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41)
let YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6)
let YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38)
+91
View File
@@ -0,0 +1,91 @@
// Type definitions for D3JS d3-scale-chromatic module v1.0.2
// Project: https://github.com/d3/d3-scale-chromatic/
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// -----------------------------------------------------------------------
// Categorical
// -----------------------------------------------------------------------
/**An array of eight categorical colors represented as RGB hexadecimal strings. */
export const schemeAccent: Array<string>;
/**An array of eight categorical colors represented as RGB hexadecimal strings. */
export const schemeDark2: Array<string>;
/**An array of twelve categorical colors represented as RGB hexadecimal strings. */
export const schemePaired: Array<string>;
/**An array of nine categorical colors represented as RGB hexadecimal strings. */
export const schemePastel1: Array<string>;
/**An array of eight categorical colors represented as RGB hexadecimal strings. */
export const schemePastel2: Array<string>;
/**An array of nine categorical colors represented as RGB hexadecimal strings. */
export const schemeSet1: Array<string>;
/**An array of eight categorical colors represented as RGB hexadecimal strings. */
export const schemeSet2: Array<string>;
/**An array of twelve categorical colors represented as RGB hexadecimal strings. */
export const schemeSet3: Array<string>;
// -----------------------------------------------------------------------
// Diverging
// -----------------------------------------------------------------------
/**Given a number value in the range [0,1], returns the corresponding color from the “BrBG” diverging color scheme represented as an RGB string. */
export function interpolateBrBG(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string.*/
export function interpolatePRGn(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string.*/
export function interpolatePiYG(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string.*/
export function interpolatePuOr(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string.*/
export function interpolateRdBu(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string.*/
export function interpolateRdGy(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string.*/
export function interpolateRdYlBu(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string.*/
export function interpolateRdYlGn(value: number): string;
/** Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string.*/
export function interpolateSpectral(value: number): string;
// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
/**Given a number t in the range [0,1], returns the corresponding color from the “Blues” sequential color scheme represented as an RGB string. */
export function interpolateBlues(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “Greens” sequential color scheme represented as an RGB string. */
export function interpolateGreens(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “Greys” sequential color scheme represented as an RGB string. */
export function interpolateGreys(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “Oranges” sequential color scheme represented as an RGB string. */
export function interpolateOranges(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “Purples” sequential color scheme represented as an RGB string. */
export function interpolatePurples(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “Reds” sequential color scheme represented as an RGB string. */
export function interpolateReds(value: number): string;
// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
/**Given a number t in the range [0,1], returns the corresponding color from the “BuGn” sequential color scheme represented as an RGB string. */
export function interpolateBuGn(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “BuPu” sequential color scheme represented as an RGB string. */
export function interpolateBuPu(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “GnBu” sequential color scheme represented as an RGB string. */
export function interpolateGnBu(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “OrRd” sequential color scheme represented as an RGB string. */
export function interpolateOrRd(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “PuBuGn” sequential color scheme represented as an RGB string. */
export function interpolatePuBuGn(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “PuBu” sequential color scheme represented as an RGB string. */
export function interpolatePuBu(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “PuRd” sequential color scheme represented as an RGB string. */
export function interpolatePuRd(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “RdPu” sequential color scheme represented as an RGB string. */
export function interpolateRdPu(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “YlGnBu” sequential color scheme represented as an RGB string. */
export function interpolateYlGnBu(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “YlGn” sequential color scheme represented as an RGB string. */
export function interpolateYlGn(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “YlOrBr” sequential color scheme represented as an RGB string. */
export function interpolateYlOrBr(value: number): string;
/**Given a number t in the range [0,1], returns the corresponding color from the “YlOrRd” sequential color scheme represented as an RGB string. */
export function interpolateYlOrRd(value: number): string;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-scale-chromatic-tests.ts"
]
}
+3 -3
View File
@@ -1,7 +1,7 @@
/// <reference path="d3kit.d.ts" />
/// <reference path="../d3/d3.d.ts" />
/// <reference path="../mocha/mocha.d.ts" />
/// <reference path="../chai/chai.d.ts" />
/// <reference types="d3" />
/// <reference types="mocha" />
/// <reference types="chai" />
/* jshint expr: true */
+8 -8
View File
@@ -3,7 +3,7 @@
// Definitions by: Morgan Benton <https://github.com/morphatic/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../d3/d3.d.ts" />
/// <reference types="d3" />
declare namespace d3kit {
@@ -29,7 +29,7 @@ declare namespace d3kit {
export class Skeleton {
constructor(selector: string|Element, options?: ChartOptions, customEvents?: Array<string>);
// Getters
getCustomEventNames(): Array<string>;
getDispatcher(): any; // should be d3.Dispatch but this throws error for user-created events
@@ -78,9 +78,9 @@ declare namespace d3kit {
export class Chartlet {
constructor(
enterFunction?: ChartletEventFunction,
updateFunction?: ChartletEventFunction,
exitFunction?: ChartletEventFunction,
enterFunction?: ChartletEventFunction,
updateFunction?: ChartletEventFunction,
exitFunction?: ChartletEventFunction,
customEventName?: Array<string>);
// Getter functions
@@ -116,15 +116,15 @@ declare namespace d3kit {
constructor(container: d3.Selection<any>, tag?: string);
create(config: string|Array<string>|LayerConfig|Array<LayerConfig>): d3.Selection<any>|Array<d3.Selection<any>>;
create(config: string|Array<string>|LayerConfig|Array<LayerConfig>|any): d3.Selection<any>|Array<d3.Selection<any>>;
get(name: string): d3.Selection<any>;
has(name: string): boolean;
}
export namespace factory {
export function createChart(
defaultOptions: ChartOptions,
customEvents: Array<string>,
defaultOptions: ChartOptions,
customEvents: Array<string>,
constructor: (skeleton: Skeleton) => void
): (selector: string|Element, options?: ChartOptions, customEvents?: Array<string>) => Skeleton;
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"d3kit.d.ts",
"d3kit-tests.ts"
]
}
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="date-fns.d.ts" />
import {addDays, closestIndexTo, differenceInCalendarWeeks, max, isDate} from 'date-fns';
import * as addHours from 'date-fns/add_hours';
function test() {
addDays(new Date(), 5);
closestIndexTo(new Date(), [new Date(), new Date()]);
addHours(new Date(), 5);
differenceInCalendarWeeks(new Date(), new Date());
differenceInCalendarWeeks(new Date(), new Date(), {weekStartsOn: 1});
max(new Date(), new Date());
isDate({});
}
+1195
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -1,4 +1,5 @@
/// <reference path="daterangepicker.d.ts"/>
import moment = require("moment")
function tests_simple() {
$('#daterange').daterangepicker();
+7 -5
View File
@@ -3,12 +3,14 @@
// Definitions by: SirMartin <https://github.com/SirMartin/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="../moment/moment.d.ts"/>
/// <reference types="jquery"/>
import moment = require("moment");
interface JQuery {
daterangepicker(settings?: daterangepicker.Settings): JQuery;
daterangepicker(settings?: daterangepicker.Settings, callback?: (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any): JQuery;
declare global {
interface JQuery {
daterangepicker(settings?: daterangepicker.Settings): JQuery;
daterangepicker(settings?: daterangepicker.Settings, callback?: (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any): JQuery;
}
}
declare namespace daterangepicker {
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": "2.14.*"
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"daterangepicker.d.ts",
"daterangepicker-tests.ts"
]
}
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Andrey Lipatkin <https://github.com/Litee>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference types="jquery" />
type Direction = "horizontal" | "vertical" | "both";

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